var lZe=Object.defineProperty;var xwe=t=>{throw TypeError(t)};var cZe=(t,r,s)=>r in t?lZe(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s;var an=(t,r,s)=>cZe(t,typeof r!="symbol"?r+"":r,s),Hle=(t,r,s)=>r.has(t)||xwe("Cannot "+s);var ar=(t,r,s)=>(Hle(t,r,"read from private field"),s?s.call(t):r.get(t)),ka=(t,r,s)=>r.has(t)?xwe("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(t):r.set(t,s),Sn=(t,r,s,n)=>(Hle(t,r,"write to private field"),n?n.call(t,s):r.set(t,s),s),ki=(t,r,s)=>(Hle(t,r,"access private method"),s);var FL=(t,r,s,n)=>({set _(a){Sn(t,r,a,s)},get _(){return ar(t,r,n)}});function dZe(t,r){for(var s=0;sn[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(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"&&n(l)}).observe(document,{childList:!0,subtree:!0});function s(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 n(a){if(a.ep)return;a.ep=!0;const o=s(a);fetch(a.href,o)}})();var ny=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function oo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function rAe(t){if(t.__esModule)return t;var r=t.default;if(typeof r=="function"){var s=function n(){return this instanceof n?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};s.prototype=r.prototype}else s={};return Object.defineProperty(s,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var a=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(s,n,a.get?a:{enumerable:!0,get:function(){return t[n]}})}),s}var sAe={exports:{}},ine={},nAe={exports:{}},Ki={};/** * @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 rP=Symbol.for("react.element"),uZe=Symbol.for("react.portal"),hZe=Symbol.for("react.fragment"),mZe=Symbol.for("react.strict_mode"),pZe=Symbol.for("react.profiler"),fZe=Symbol.for("react.provider"),gZe=Symbol.for("react.context"),xZe=Symbol.for("react.forward_ref"),yZe=Symbol.for("react.suspense"),vZe=Symbol.for("react.memo"),_Ze=Symbol.for("react.lazy"),ywe=Symbol.iterator;function bZe(t){return t===null||typeof t!="object"?null:(t=ywe&&t[ywe]||t["@@iterator"],typeof t=="function"?t:null)}var aAe={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},iAe=Object.assign,oAe={};function N3(t,r,s){this.props=t,this.context=r,this.refs=oAe,this.updater=s||aAe}N3.prototype.isReactComponent={};N3.prototype.setState=function(t,r){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,r,"setState")};N3.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function lAe(){}lAe.prototype=N3.prototype;function hge(t,r,s){this.props=t,this.context=r,this.refs=oAe,this.updater=s||aAe}var mge=hge.prototype=new lAe;mge.constructor=hge;iAe(mge,N3.prototype);mge.isPureReactComponent=!0;var vwe=Array.isArray,cAe=Object.prototype.hasOwnProperty,pge={current:null},dAe={key:!0,ref:!0,__self:!0,__source:!0};function uAe(t,r,s){var n,a={},o=null,l=null;if(r!=null)for(n in r.ref!==void 0&&(l=r.ref),r.key!==void 0&&(o=""+r.key),r)cAe.call(r,n)&&!dAe.hasOwnProperty(n)&&(a[n]=r[n]);var i=arguments.length-2;if(i===1)a.children=s;else if(1>>1,we=ue[be];if(0>>1;bea(Ae,Te))Lea(Ue,Ae)?(ue[be]=Ue,ue[Le]=Te,be=Le):(ue[be]=Ae,ue[tt]=Te,be=tt);else if(Lea(Ue,Te))ue[be]=Ue,ue[Le]=Te,be=Le;else break e}}return xe}function a(ue,xe){var Te=ue.sortIndex-xe.sortIndex;return Te!==0?Te:ue.id-xe.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var l=Date,i=l.now();t.unstable_now=function(){return l.now()-i}}var d=[],m=[],g=1,y=null,v=3,b=!1,N=!1,j=!1,S=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,M=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(ue){for(var xe=s(m);xe!==null;){if(xe.callback===null)n(m);else if(xe.startTime<=ue)n(m),xe.sortIndex=xe.expirationTime,r(d,xe);else break;xe=s(m)}}function F(ue){if(j=!1,I(ue),!N)if(s(d)!==null)N=!0,oe(O);else{var xe=s(m);xe!==null&&de(F,xe.startTime-ue)}}function O(ue,xe){N=!1,j&&(j=!1,A(H),H=-1),b=!0;var Te=v;try{for(I(xe),y=s(d);y!==null&&(!(y.expirationTime>xe)||ue&&!se());){var be=y.callback;if(typeof be=="function"){y.callback=null,v=y.priorityLevel;var we=be(y.expirationTime<=xe);xe=t.unstable_now(),typeof we=="function"?y.callback=we:y===s(d)&&n(d),I(xe)}else n(d);y=s(d)}if(y!==null)var ve=!0;else{var tt=s(m);tt!==null&&de(F,tt.startTime-xe),ve=!1}return ve}finally{y=null,v=Te,b=!1}}var B=!1,$=null,H=-1,W=5,X=-1;function se(){return!(t.unstable_now()-Xue||125be?(ue.sortIndex=Te,r(m,ue),s(d)===null&&ue===s(m)&&(j?(A(H),H=-1):j=!0,de(F,Te-be))):(ue.sortIndex=we,r(d,ue),N||b||(N=!0,oe(O))),ue},t.unstable_shouldYield=se,t.unstable_wrapCallback=function(ue){var xe=v;return function(){var Te=v;v=xe;try{return ue.apply(this,arguments)}finally{v=Te}}}})(gAe);fAe.exports=gAe;var IZe=fAe.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 PZe=E,Tm=IZe;function Os(t){for(var r="https://reactjs.org/docs/error-decoder.html?invariant="+t,s=1;s"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Cue=Object.prototype.hasOwnProperty,LZe=/^[: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]*$/,bwe={},wwe={};function OZe(t){return Cue.call(wwe,t)?!0:Cue.call(bwe,t)?!1:LZe.test(t)?wwe[t]=!0:(bwe[t]=!0,!1)}function DZe(t,r,s,n){if(s!==null&&s.type===0)return!1;switch(typeof r){case"function":case"symbol":return!0;case"boolean":return n?!1:s!==null?!s.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function RZe(t,r,s,n){if(r===null||typeof r>"u"||DZe(t,r,s,n))return!0;if(n)return!1;if(s!==null)switch(s.type){case 3:return!r;case 4:return r===!1;case 5:return isNaN(r);case 6:return isNaN(r)||1>r}return!1}function uh(t,r,s,n,a,o,l){this.acceptsBooleans=r===2||r===3||r===4,this.attributeName=n,this.attributeNamespace=a,this.mustUseProperty=s,this.propertyName=t,this.type=r,this.sanitizeURL=o,this.removeEmptyString=l}var lu={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){lu[t]=new uh(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var r=t[0];lu[r]=new uh(r,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){lu[t]=new uh(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){lu[t]=new uh(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){lu[t]=new uh(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){lu[t]=new uh(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){lu[t]=new uh(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){lu[t]=new uh(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){lu[t]=new uh(t,5,!1,t.toLowerCase(),null,!1,!1)});var xge=/[\-:]([a-z])/g;function yge(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var r=t.replace(xge,yge);lu[r]=new uh(r,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var r=t.replace(xge,yge);lu[r]=new uh(r,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var r=t.replace(xge,yge);lu[r]=new uh(r,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){lu[t]=new uh(t,1,!1,t.toLowerCase(),null,!1,!1)});lu.xlinkHref=new uh("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){lu[t]=new uh(t,1,!1,t.toLowerCase(),null,!0,!0)});function vge(t,r,s,n){var a=lu.hasOwnProperty(r)?lu[r]:null;(a!==null?a.type!==0:n||!(2i||a[l]!==o[i]){var d=` `+a[l].replace(" at new "," at ");return t.displayName&&d.includes("")&&(d=d.replace("",t.displayName)),d}while(1<=l&&0<=i);break}}}finally{Kle=!1,Error.prepareStackTrace=s}return(t=t?t.displayName||t.name:"")?$T(t):""}function FZe(t){switch(t.tag){case 5:return $T(t.type);case 16:return $T("Lazy");case 13:return $T("Suspense");case 19:return $T("SuspenseList");case 0:case 2:case 15:return t=Zle(t.type,!1),t;case 11:return t=Zle(t.type.render,!1),t;case 1:return t=Zle(t.type,!0),t;default:return""}}function Eue(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case iS:return"Fragment";case aS:return"Portal";case Mue:return"Profiler";case _ge:return"StrictMode";case Tue:return"Suspense";case Aue:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case vAe:return(t.displayName||"Context")+".Consumer";case yAe:return(t._context.displayName||"Context")+".Provider";case bge:var r=t.render;return t=t.displayName,t||(t=r.displayName||r.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case wge:return r=t.displayName||null,r!==null?r:Eue(t.type)||"Memo";case Z0:r=t._payload,t=t._init;try{return Eue(t(r))}catch{}}return null}function zZe(t){var r=t.type;switch(t.tag){case 24:return"Cache";case 9:return(r.displayName||"Context")+".Consumer";case 10:return(r._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=r.render,t=t.displayName||t.name||"",r.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return r;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Eue(r);case 8:return r===_ge?"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 r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r}return null}function mv(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function bAe(t){var r=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function BZe(t){var r=bAe(t)?"checked":"value",s=Object.getOwnPropertyDescriptor(t.constructor.prototype,r),n=""+t[r];if(!t.hasOwnProperty(r)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var a=s.get,o=s.set;return Object.defineProperty(t,r,{configurable:!0,get:function(){return a.call(this)},set:function(l){n=""+l,o.call(this,l)}}),Object.defineProperty(t,r,{enumerable:s.enumerable}),{getValue:function(){return n},setValue:function(l){n=""+l},stopTracking:function(){t._valueTracker=null,delete t[r]}}}}function $L(t){t._valueTracker||(t._valueTracker=BZe(t))}function wAe(t){if(!t)return!1;var r=t._valueTracker;if(!r)return!0;var s=r.getValue(),n="";return t&&(n=bAe(t)?t.checked?"true":"false":t.value),t=n,t!==s?(r.setValue(t),!0):!1}function lte(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Iue(t,r){var s=r.checked;return Zl({},r,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??t._wrapperState.initialChecked})}function kwe(t,r){var s=r.defaultValue==null?"":r.defaultValue,n=r.checked!=null?r.checked:r.defaultChecked;s=mv(r.value!=null?r.value:s),t._wrapperState={initialChecked:n,initialValue:s,controlled:r.type==="checkbox"||r.type==="radio"?r.checked!=null:r.value!=null}}function jAe(t,r){r=r.checked,r!=null&&vge(t,"checked",r,!1)}function Pue(t,r){jAe(t,r);var s=mv(r.value),n=r.type;if(s!=null)n==="number"?(s===0&&t.value===""||t.value!=s)&&(t.value=""+s):t.value!==""+s&&(t.value=""+s);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}r.hasOwnProperty("value")?Lue(t,r.type,s):r.hasOwnProperty("defaultValue")&&Lue(t,r.type,mv(r.defaultValue)),r.checked==null&&r.defaultChecked!=null&&(t.defaultChecked=!!r.defaultChecked)}function Nwe(t,r,s){if(r.hasOwnProperty("value")||r.hasOwnProperty("defaultValue")){var n=r.type;if(!(n!=="submit"&&n!=="reset"||r.value!==void 0&&r.value!==null))return;r=""+t._wrapperState.initialValue,s||r===t.value||(t.value=r),t.defaultValue=r}s=t.name,s!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,s!==""&&(t.name=s)}function Lue(t,r,s){(r!=="number"||lte(t.ownerDocument)!==t)&&(s==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+s&&(t.defaultValue=""+s))}var UT=Array.isArray;function NS(t,r,s,n){if(t=t.options,r){r={};for(var a=0;a"+r.valueOf().toString()+"",r=UL.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;r.firstChild;)t.appendChild(r.firstChild)}});function wE(t,r){if(r){var s=t.firstChild;if(s&&s===t.lastChild&&s.nodeType===3){s.nodeValue=r;return}}t.textContent=r}var rA={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},$Ze=["Webkit","ms","Moz","O"];Object.keys(rA).forEach(function(t){$Ze.forEach(function(r){r=r+t.charAt(0).toUpperCase()+t.substring(1),rA[r]=rA[t]})});function CAe(t,r,s){return r==null||typeof r=="boolean"||r===""?"":s||typeof r!="number"||r===0||rA.hasOwnProperty(t)&&rA[t]?(""+r).trim():r+"px"}function MAe(t,r){t=t.style;for(var s in r)if(r.hasOwnProperty(s)){var n=s.indexOf("--")===0,a=CAe(s,r[s],n);s==="float"&&(s="cssFloat"),n?t.setProperty(s,a):t[s]=a}}var UZe=Zl({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 Rue(t,r){if(r){if(UZe[t]&&(r.children!=null||r.dangerouslySetInnerHTML!=null))throw Error(Os(137,t));if(r.dangerouslySetInnerHTML!=null){if(r.children!=null)throw Error(Os(60));if(typeof r.dangerouslySetInnerHTML!="object"||!("__html"in r.dangerouslySetInnerHTML))throw Error(Os(61))}if(r.style!=null&&typeof r.style!="object")throw Error(Os(62))}}function Fue(t,r){if(t.indexOf("-")===-1)return typeof r.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var zue=null;function jge(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Bue=null,SS=null,CS=null;function Mwe(t){if(t=aP(t)){if(typeof Bue!="function")throw Error(Os(280));var r=t.stateNode;r&&(r=une(r),Bue(t.stateNode,t.type,r))}}function TAe(t){SS?CS?CS.push(t):CS=[t]:SS=t}function AAe(){if(SS){var t=SS,r=CS;if(CS=SS=null,Mwe(t),r)for(t=0;t>>=0,t===0?32:31-(JZe(t)/eYe|0)|0}var qL=64,VL=4194304;function qT(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function hte(t,r){var s=t.pendingLanes;if(s===0)return 0;var n=0,a=t.suspendedLanes,o=t.pingedLanes,l=s&268435455;if(l!==0){var i=l&~a;i!==0?n=qT(i):(o&=l,o!==0&&(n=qT(o)))}else l=s&~a,l!==0?n=qT(l):o!==0&&(n=qT(o));if(n===0)return 0;if(r!==0&&r!==n&&!(r&a)&&(a=n&-n,o=r&-r,a>=o||a===16&&(o&4194240)!==0))return r;if(n&4&&(n|=s&16),r=t.entangledLanes,r!==0)for(t=t.entanglements,r&=n;0s;s++)r.push(t);return r}function sP(t,r,s){t.pendingLanes|=r,r!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,r=31-Pf(r),t[r]=s}function nYe(t,r){var s=t.pendingLanes&~r;t.pendingLanes=r,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=r,t.mutableReadLanes&=r,t.entangledLanes&=r,r=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0=nA),Rwe=" ",Fwe=!1;function YAe(t,r){switch(t){case"keyup":return IYe.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function XAe(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var oS=!1;function LYe(t,r){switch(t){case"compositionend":return XAe(r);case"keypress":return r.which!==32?null:(Fwe=!0,Rwe);case"textInput":return t=r.data,t===Rwe&&Fwe?null:t;default:return null}}function OYe(t,r){if(oS)return t==="compositionend"||!Ege&&YAe(t,r)?(t=KAe(),cO=Mge=C1=null,oS=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1=r)return{node:s,offset:r-t};t=n}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Uwe(s)}}function tEe(t,r){return t&&r?t===r?!0:t&&t.nodeType===3?!1:r&&r.nodeType===3?tEe(t,r.parentNode):"contains"in t?t.contains(r):t.compareDocumentPosition?!!(t.compareDocumentPosition(r)&16):!1:!1}function rEe(){for(var t=window,r=lte();r instanceof t.HTMLIFrameElement;){try{var s=typeof r.contentWindow.location.href=="string"}catch{s=!1}if(s)t=r.contentWindow;else break;r=lte(t.document)}return r}function Ige(t){var r=t&&t.nodeName&&t.nodeName.toLowerCase();return r&&(r==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||r==="textarea"||t.contentEditable==="true")}function VYe(t){var r=rEe(),s=t.focusedElem,n=t.selectionRange;if(r!==s&&s&&s.ownerDocument&&tEe(s.ownerDocument.documentElement,s)){if(n!==null&&Ige(s)){if(r=n.start,t=n.end,t===void 0&&(t=r),"selectionStart"in s)s.selectionStart=r,s.selectionEnd=Math.min(t,s.value.length);else if(t=(r=s.ownerDocument||document)&&r.defaultView||window,t.getSelection){t=t.getSelection();var a=s.textContent.length,o=Math.min(n.start,a);n=n.end===void 0?o:Math.min(n.end,a),!t.extend&&o>n&&(a=n,n=o,o=a),a=qwe(s,o);var l=qwe(s,n);a&&l&&(t.rangeCount!==1||t.anchorNode!==a.node||t.anchorOffset!==a.offset||t.focusNode!==l.node||t.focusOffset!==l.offset)&&(r=r.createRange(),r.setStart(a.node,a.offset),t.removeAllRanges(),o>n?(t.addRange(r),t.extend(l.node,l.offset)):(r.setEnd(l.node,l.offset),t.addRange(r)))}}for(r=[],t=s;t=t.parentNode;)t.nodeType===1&&r.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s=document.documentMode,lS=null,Wue=null,iA=null,Gue=!1;function Vwe(t,r,s){var n=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Gue||lS==null||lS!==lte(n)||(n=lS,"selectionStart"in n&&Ige(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),iA&&ME(iA,n)||(iA=n,n=fte(Wue,"onSelect"),0uS||(t.current=Jue[uS],Jue[uS]=null,uS--)}function ll(t,r){uS++,Jue[uS]=t.current,t.current=r}var pv={},Cu=kv(pv),Dh=kv(!1),dk=pv;function AC(t,r){var s=t.type.contextTypes;if(!s)return pv;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===r)return n.__reactInternalMemoizedMaskedChildContext;var a={},o;for(o in s)a[o]=r[o];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=r,t.__reactInternalMemoizedMaskedChildContext=a),a}function Rh(t){return t=t.childContextTypes,t!=null}function xte(){bl(Dh),bl(Cu)}function Xwe(t,r,s){if(Cu.current!==pv)throw Error(Os(168));ll(Cu,r),ll(Dh,s)}function uEe(t,r,s){var n=t.stateNode;if(r=r.childContextTypes,typeof n.getChildContext!="function")return s;n=n.getChildContext();for(var a in n)if(!(a in r))throw Error(Os(108,zZe(t)||"Unknown",a));return Zl({},s,n)}function yte(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||pv,dk=Cu.current,ll(Cu,t),ll(Dh,Dh.current),!0}function Qwe(t,r,s){var n=t.stateNode;if(!n)throw Error(Os(169));s?(t=uEe(t,r,dk),n.__reactInternalMemoizedMergedChildContext=t,bl(Dh),bl(Cu),ll(Cu,t)):bl(Dh),ll(Dh,s)}var Jx=null,hne=!1,cce=!1;function hEe(t){Jx===null?Jx=[t]:Jx.push(t)}function rXe(t){hne=!0,hEe(t)}function Nv(){if(!cce&&Jx!==null){cce=!0;var t=0,r=zo;try{var s=Jx;for(zo=1;t>=l,a-=l,ay=1<<32-Pf(r)+a|s<H?(W=$,$=null):W=$.sibling;var X=v(A,$,I[H],F);if(X===null){$===null&&($=W);break}t&&$&&X.alternate===null&&r(A,$),M=o(X,M,H),B===null?O=X:B.sibling=X,B=X,$=W}if(H===I.length)return s(A,$),Al&&F_(A,H),O;if($===null){for(;HH?(W=$,$=null):W=$.sibling;var se=v(A,$,X.value,F);if(se===null){$===null&&($=W);break}t&&$&&se.alternate===null&&r(A,$),M=o(se,M,H),B===null?O=se:B.sibling=se,B=se,$=W}if(X.done)return s(A,$),Al&&F_(A,H),O;if($===null){for(;!X.done;H++,X=I.next())X=y(A,X.value,F),X!==null&&(M=o(X,M,H),B===null?O=X:B.sibling=X,B=X);return Al&&F_(A,H),O}for($=n(A,$);!X.done;H++,X=I.next())X=b($,A,H,X.value,F),X!==null&&(t&&X.alternate!==null&&$.delete(X.key===null?H:X.key),M=o(X,M,H),B===null?O=X:B.sibling=X,B=X);return t&&$.forEach(function(ae){return r(A,ae)}),Al&&F_(A,H),O}function S(A,M,I,F){if(typeof I=="object"&&I!==null&&I.type===iS&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case BL:e:{for(var O=I.key,B=M;B!==null;){if(B.key===O){if(O=I.type,O===iS){if(B.tag===7){s(A,B.sibling),M=a(B,I.props.children),M.return=A,A=M;break e}}else if(B.elementType===O||typeof O=="object"&&O!==null&&O.$$typeof===Z0&&tje(O)===B.type){s(A,B.sibling),M=a(B,I.props),M.ref=uT(A,B,I),M.return=A,A=M;break e}s(A,B);break}else r(A,B);B=B.sibling}I.type===iS?(M=Pj(I.props.children,A.mode,F,I.key),M.return=A,A=M):(F=xO(I.type,I.key,I.props,null,A.mode,F),F.ref=uT(A,M,I),F.return=A,A=F)}return l(A);case aS:e:{for(B=I.key;M!==null;){if(M.key===B)if(M.tag===4&&M.stateNode.containerInfo===I.containerInfo&&M.stateNode.implementation===I.implementation){s(A,M.sibling),M=a(M,I.children||[]),M.return=A,A=M;break e}else{s(A,M);break}else r(A,M);M=M.sibling}M=xce(I,A.mode,F),M.return=A,A=M}return l(A);case Z0:return B=I._init,S(A,M,B(I._payload),F)}if(UT(I))return N(A,M,I,F);if(iT(I))return j(A,M,I,F);XL(A,I)}return typeof I=="string"&&I!==""||typeof I=="number"?(I=""+I,M!==null&&M.tag===6?(s(A,M.sibling),M=a(M,I),M.return=A,A=M):(s(A,M),M=gce(I,A.mode,F),M.return=A,A=M),l(A)):s(A,M)}return S}var IC=gEe(!0),xEe=gEe(!1),bte=kv(null),wte=null,pS=null,Dge=null;function Rge(){Dge=pS=wte=null}function Fge(t){var r=bte.current;bl(bte),t._currentValue=r}function rhe(t,r,s){for(;t!==null;){var n=t.alternate;if((t.childLanes&r)!==r?(t.childLanes|=r,n!==null&&(n.childLanes|=r)):n!==null&&(n.childLanes&r)!==r&&(n.childLanes|=r),t===s)break;t=t.return}}function TS(t,r){wte=t,Dge=pS=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&r&&(Ih=!0),t.firstContext=null)}function Cp(t){var r=t._currentValue;if(Dge!==t)if(t={context:t,memoizedValue:r,next:null},pS===null){if(wte===null)throw Error(Os(308));pS=t,wte.dependencies={lanes:0,firstContext:t}}else pS=pS.next=t;return r}var cj=null;function zge(t){cj===null?cj=[t]:cj.push(t)}function yEe(t,r,s,n){var a=r.interleaved;return a===null?(s.next=s,zge(r)):(s.next=a.next,a.next=s),r.interleaved=s,Ay(t,n)}function Ay(t,r){t.lanes|=r;var s=t.alternate;for(s!==null&&(s.lanes|=r),s=t,t=t.return;t!==null;)t.childLanes|=r,s=t.alternate,s!==null&&(s.childLanes|=r),s=t,t=t.return;return s.tag===3?s.stateNode:null}var Y0=!1;function Bge(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function vEe(t,r){t=t.updateQueue,r.updateQueue===t&&(r.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function hy(t,r){return{eventTime:t,lane:r,tag:0,payload:null,callback:null,next:null}}function B1(t,r,s){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,po&2){var a=n.pending;return a===null?r.next=r:(r.next=a.next,a.next=r),n.pending=r,Ay(t,s)}return a=n.interleaved,a===null?(r.next=r,zge(n)):(r.next=a.next,a.next=r),n.interleaved=r,Ay(t,s)}function uO(t,r,s){if(r=r.updateQueue,r!==null&&(r=r.shared,(s&4194240)!==0)){var n=r.lanes;n&=t.pendingLanes,s|=n,r.lanes=s,Nge(t,s)}}function rje(t,r){var s=t.updateQueue,n=t.alternate;if(n!==null&&(n=n.updateQueue,s===n)){var a=null,o=null;if(s=s.firstBaseUpdate,s!==null){do{var l={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};o===null?a=o=l:o=o.next=l,s=s.next}while(s!==null);o===null?a=o=r:o=o.next=r}else a=o=r;s={baseState:n.baseState,firstBaseUpdate:a,lastBaseUpdate:o,shared:n.shared,effects:n.effects},t.updateQueue=s;return}t=s.lastBaseUpdate,t===null?s.firstBaseUpdate=r:t.next=r,s.lastBaseUpdate=r}function jte(t,r,s,n){var a=t.updateQueue;Y0=!1;var o=a.firstBaseUpdate,l=a.lastBaseUpdate,i=a.shared.pending;if(i!==null){a.shared.pending=null;var d=i,m=d.next;d.next=null,l===null?o=m:l.next=m,l=d;var g=t.alternate;g!==null&&(g=g.updateQueue,i=g.lastBaseUpdate,i!==l&&(i===null?g.firstBaseUpdate=m:i.next=m,g.lastBaseUpdate=d))}if(o!==null){var y=a.baseState;l=0,g=m=d=null,i=o;do{var v=i.lane,b=i.eventTime;if((n&v)===v){g!==null&&(g=g.next={eventTime:b,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var N=t,j=i;switch(v=r,b=s,j.tag){case 1:if(N=j.payload,typeof N=="function"){y=N.call(b,y,v);break e}y=N;break e;case 3:N.flags=N.flags&-65537|128;case 0:if(N=j.payload,v=typeof N=="function"?N.call(b,y,v):N,v==null)break e;y=Zl({},y,v);break e;case 2:Y0=!0}}i.callback!==null&&i.lane!==0&&(t.flags|=64,v=a.effects,v===null?a.effects=[i]:v.push(i))}else b={eventTime:b,lane:v,tag:i.tag,payload:i.payload,callback:i.callback,next:null},g===null?(m=g=b,d=y):g=g.next=b,l|=v;if(i=i.next,i===null){if(i=a.shared.pending,i===null)break;v=i,i=v.next,v.next=null,a.lastBaseUpdate=v,a.shared.pending=null}}while(!0);if(g===null&&(d=y),a.baseState=d,a.firstBaseUpdate=m,a.lastBaseUpdate=g,r=a.shared.interleaved,r!==null){a=r;do l|=a.lane,a=a.next;while(a!==r)}else o===null&&(a.shared.lanes=0);mk|=l,t.lanes=l,t.memoizedState=y}}function sje(t,r,s){if(t=r.effects,r.effects=null,t!==null)for(r=0;rs?s:4,t(!0);var n=uce.transition;uce.transition={};try{t(!1),r()}finally{zo=s,uce.transition=n}}function DEe(){return Mp().memoizedState}function iXe(t,r,s){var n=U1(t);if(s={lane:n,action:s,hasEagerState:!1,eagerState:null,next:null},REe(t))FEe(r,s);else if(s=yEe(t,r,s,n),s!==null){var a=nh();Lf(s,t,n,a),zEe(s,r,n)}}function oXe(t,r,s){var n=U1(t),a={lane:n,action:s,hasEagerState:!1,eagerState:null,next:null};if(REe(t))FEe(r,a);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=r.lastRenderedReducer,o!==null))try{var l=r.lastRenderedState,i=o(l,s);if(a.hasEagerState=!0,a.eagerState=i,Wf(i,l)){var d=r.interleaved;d===null?(a.next=a,zge(r)):(a.next=d.next,d.next=a),r.interleaved=a;return}}catch{}finally{}s=yEe(t,r,a,n),s!==null&&(a=nh(),Lf(s,t,n,a),zEe(s,r,n))}}function REe(t){var r=t.alternate;return t===Hl||r!==null&&r===Hl}function FEe(t,r){oA=Nte=!0;var s=t.pending;s===null?r.next=r:(r.next=s.next,s.next=r),t.pending=r}function zEe(t,r,s){if(s&4194240){var n=r.lanes;n&=t.pendingLanes,s|=n,r.lanes=s,Nge(t,s)}}var Ste={readContext:Cp,useCallback:pu,useContext:pu,useEffect:pu,useImperativeHandle:pu,useInsertionEffect:pu,useLayoutEffect:pu,useMemo:pu,useReducer:pu,useRef:pu,useState:pu,useDebugValue:pu,useDeferredValue:pu,useTransition:pu,useMutableSource:pu,useSyncExternalStore:pu,useId:pu,unstable_isNewReconciler:!1},lXe={readContext:Cp,useCallback:function(t,r){return Ng().memoizedState=[t,r===void 0?null:r],t},useContext:Cp,useEffect:aje,useImperativeHandle:function(t,r,s){return s=s!=null?s.concat([t]):null,mO(4194308,4,EEe.bind(null,r,t),s)},useLayoutEffect:function(t,r){return mO(4194308,4,t,r)},useInsertionEffect:function(t,r){return mO(4,2,t,r)},useMemo:function(t,r){var s=Ng();return r=r===void 0?null:r,t=t(),s.memoizedState=[t,r],t},useReducer:function(t,r,s){var n=Ng();return r=s!==void 0?s(r):r,n.memoizedState=n.baseState=r,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:r},n.queue=t,t=t.dispatch=iXe.bind(null,Hl,t),[n.memoizedState,t]},useRef:function(t){var r=Ng();return t={current:t},r.memoizedState=t},useState:nje,useDebugValue:Kge,useDeferredValue:function(t){return Ng().memoizedState=t},useTransition:function(){var t=nje(!1),r=t[0];return t=aXe.bind(null,t[1]),Ng().memoizedState=t,[r,t]},useMutableSource:function(){},useSyncExternalStore:function(t,r,s){var n=Hl,a=Ng();if(Al){if(s===void 0)throw Error(Os(407));s=s()}else{if(s=r(),Bd===null)throw Error(Os(349));hk&30||jEe(n,r,s)}a.memoizedState=s;var o={value:s,getSnapshot:r};return a.queue=o,aje(NEe.bind(null,n,o,t),[t]),n.flags|=2048,DE(9,kEe.bind(null,n,o,s,r),void 0,null),s},useId:function(){var t=Ng(),r=Bd.identifierPrefix;if(Al){var s=iy,n=ay;s=(n&~(1<<32-Pf(n)-1)).toString(32)+s,r=":"+r+"R"+s,s=LE++,0<\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=l.createElement(s,{is:n.is}):(t=l.createElement(s),s==="select"&&(l=t,n.multiple?l.multiple=!0:n.size&&(l.size=n.size))):t=l.createElementNS(t,s),t[Lg]=r,t[EE]=n,ZEe(t,r,!1,!1),r.stateNode=t;e:{switch(l=Fue(s,n),s){case"dialog":gl("cancel",t),gl("close",t),a=n;break;case"iframe":case"object":case"embed":gl("load",t),a=n;break;case"video":case"audio":for(a=0;aOC&&(r.flags|=128,n=!0,hT(o,!1),r.lanes=4194304)}else{if(!n)if(t=kte(l),t!==null){if(r.flags|=128,n=!0,s=t.updateQueue,s!==null&&(r.updateQueue=s,r.flags|=4),hT(o,!0),o.tail===null&&o.tailMode==="hidden"&&!l.alternate&&!Al)return fu(r),null}else 2*kc()-o.renderingStartTime>OC&&s!==1073741824&&(r.flags|=128,n=!0,hT(o,!1),r.lanes=4194304);o.isBackwards?(l.sibling=r.child,r.child=l):(s=o.last,s!==null?s.sibling=l:r.child=l,o.last=l)}return o.tail!==null?(r=o.tail,o.rendering=r,o.tail=r.sibling,o.renderingStartTime=kc(),r.sibling=null,s=$l.current,ll($l,n?s&1|2:s&1),r):(fu(r),null);case 22:case 23:return exe(),n=r.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(r.flags|=8192),n&&r.mode&1?om&1073741824&&(fu(r),r.subtreeFlags&6&&(r.flags|=8192)):fu(r),null;case 24:return null;case 25:return null}throw Error(Os(156,r.tag))}function gXe(t,r){switch(Lge(r),r.tag){case 1:return Rh(r.type)&&xte(),t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 3:return PC(),bl(Dh),bl(Cu),qge(),t=r.flags,t&65536&&!(t&128)?(r.flags=t&-65537|128,r):null;case 5:return Uge(r),null;case 13:if(bl($l),t=r.memoizedState,t!==null&&t.dehydrated!==null){if(r.alternate===null)throw Error(Os(340));EC()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 19:return bl($l),null;case 4:return PC(),null;case 10:return Fge(r.type._context),null;case 22:case 23:return exe(),null;case 24:return null;default:return null}}var JL=!1,vu=!1,xXe=typeof WeakSet=="function"?WeakSet:Set,Pn=null;function fS(t,r){var s=t.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(n){rc(t,r,n)}else s.current=null}function uhe(t,r,s){try{s()}catch(n){rc(t,r,n)}}var gje=!1;function yXe(t,r){if(Kue=mte,t=rEe(),Ige(t)){if("selectionStart"in t)var s={start:t.selectionStart,end:t.selectionEnd};else e:{s=(s=t.ownerDocument)&&s.defaultView||window;var n=s.getSelection&&s.getSelection();if(n&&n.rangeCount!==0){s=n.anchorNode;var a=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{s.nodeType,o.nodeType}catch{s=null;break e}var l=0,i=-1,d=-1,m=0,g=0,y=t,v=null;t:for(;;){for(var b;y!==s||a!==0&&y.nodeType!==3||(i=l+a),y!==o||n!==0&&y.nodeType!==3||(d=l+n),y.nodeType===3&&(l+=y.nodeValue.length),(b=y.firstChild)!==null;)v=y,y=b;for(;;){if(y===t)break t;if(v===s&&++m===a&&(i=l),v===o&&++g===n&&(d=l),(b=y.nextSibling)!==null)break;y=v,v=y.parentNode}y=b}s=i===-1||d===-1?null:{start:i,end:d}}else s=null}s=s||{start:0,end:0}}else s=null;for(Zue={focusedElem:t,selectionRange:s},mte=!1,Pn=r;Pn!==null;)if(r=Pn,t=r.child,(r.subtreeFlags&1028)!==0&&t!==null)t.return=r,Pn=t;else for(;Pn!==null;){r=Pn;try{var N=r.alternate;if(r.flags&1024)switch(r.tag){case 0:case 11:case 15:break;case 1:if(N!==null){var j=N.memoizedProps,S=N.memoizedState,A=r.stateNode,M=A.getSnapshotBeforeUpdate(r.elementType===r.type?j:ff(r.type,j),S);A.__reactInternalSnapshotBeforeUpdate=M}break;case 3:var I=r.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(Os(163))}}catch(F){rc(r,r.return,F)}if(t=r.sibling,t!==null){t.return=r.return,Pn=t;break}Pn=r.return}return N=gje,gje=!1,N}function lA(t,r,s){var n=r.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var a=n=n.next;do{if((a.tag&t)===t){var o=a.destroy;a.destroy=void 0,o!==void 0&&uhe(r,s,o)}a=a.next}while(a!==n)}}function fne(t,r){if(r=r.updateQueue,r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&t)===t){var n=s.create;s.destroy=n()}s=s.next}while(s!==r)}}function hhe(t){var r=t.ref;if(r!==null){var s=t.stateNode;switch(t.tag){case 5:t=s;break;default:t=s}typeof r=="function"?r(t):r.current=t}}function QEe(t){var r=t.alternate;r!==null&&(t.alternate=null,QEe(r)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(r=t.stateNode,r!==null&&(delete r[Lg],delete r[EE],delete r[Que],delete r[eXe],delete r[tXe])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function JEe(t){return t.tag===5||t.tag===3||t.tag===4}function xje(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||JEe(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function mhe(t,r,s){var n=t.tag;if(n===5||n===6)t=t.stateNode,r?s.nodeType===8?s.parentNode.insertBefore(t,r):s.insertBefore(t,r):(s.nodeType===8?(r=s.parentNode,r.insertBefore(t,s)):(r=s,r.appendChild(t)),s=s._reactRootContainer,s!=null||r.onclick!==null||(r.onclick=gte));else if(n!==4&&(t=t.child,t!==null))for(mhe(t,r,s),t=t.sibling;t!==null;)mhe(t,r,s),t=t.sibling}function phe(t,r,s){var n=t.tag;if(n===5||n===6)t=t.stateNode,r?s.insertBefore(t,r):s.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(phe(t,r,s),t=t.sibling;t!==null;)phe(t,r,s),t=t.sibling}var eu=null,vf=!1;function F0(t,r,s){for(s=s.child;s!==null;)eIe(t,r,s),s=s.sibling}function eIe(t,r,s){if($g&&typeof $g.onCommitFiberUnmount=="function")try{$g.onCommitFiberUnmount(one,s)}catch{}switch(s.tag){case 5:vu||fS(s,r);case 6:var n=eu,a=vf;eu=null,F0(t,r,s),eu=n,vf=a,eu!==null&&(vf?(t=eu,s=s.stateNode,t.nodeType===8?t.parentNode.removeChild(s):t.removeChild(s)):eu.removeChild(s.stateNode));break;case 18:eu!==null&&(vf?(t=eu,s=s.stateNode,t.nodeType===8?lce(t.parentNode,s):t.nodeType===1&&lce(t,s),SE(t)):lce(eu,s.stateNode));break;case 4:n=eu,a=vf,eu=s.stateNode.containerInfo,vf=!0,F0(t,r,s),eu=n,vf=a;break;case 0:case 11:case 14:case 15:if(!vu&&(n=s.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){a=n=n.next;do{var o=a,l=o.destroy;o=o.tag,l!==void 0&&(o&2||o&4)&&uhe(s,r,l),a=a.next}while(a!==n)}F0(t,r,s);break;case 1:if(!vu&&(fS(s,r),n=s.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=s.memoizedProps,n.state=s.memoizedState,n.componentWillUnmount()}catch(i){rc(s,r,i)}F0(t,r,s);break;case 21:F0(t,r,s);break;case 22:s.mode&1?(vu=(n=vu)||s.memoizedState!==null,F0(t,r,s),vu=n):F0(t,r,s);break;default:F0(t,r,s)}}function yje(t){var r=t.updateQueue;if(r!==null){t.updateQueue=null;var s=t.stateNode;s===null&&(s=t.stateNode=new xXe),r.forEach(function(n){var a=CXe.bind(null,t,n);s.has(n)||(s.add(n),n.then(a,a))})}}function lf(t,r){var s=r.deletions;if(s!==null)for(var n=0;na&&(a=l),n&=~o}if(n=a,n=kc()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*_Xe(n/1960))-n,10t?16:t,M1===null)var n=!1;else{if(t=M1,M1=null,Tte=0,po&6)throw Error(Os(331));var a=po;for(po|=4,Pn=t.current;Pn!==null;){var o=Pn,l=o.child;if(Pn.flags&16){var i=o.deletions;if(i!==null){for(var d=0;dkc()-Qge?Ij(t,0):Xge|=s),Fh(t,r)}function lIe(t,r){r===0&&(t.mode&1?(r=VL,VL<<=1,!(VL&130023424)&&(VL=4194304)):r=1);var s=nh();t=Ay(t,r),t!==null&&(sP(t,r,s),Fh(t,s))}function SXe(t){var r=t.memoizedState,s=0;r!==null&&(s=r.retryLane),lIe(t,s)}function CXe(t,r){var s=0;switch(t.tag){case 13:var n=t.stateNode,a=t.memoizedState;a!==null&&(s=a.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(Os(314))}n!==null&&n.delete(r),lIe(t,s)}var cIe;cIe=function(t,r,s){if(t!==null)if(t.memoizedProps!==r.pendingProps||Dh.current)Ih=!0;else{if(!(t.lanes&s)&&!(r.flags&128))return Ih=!1,pXe(t,r,s);Ih=!!(t.flags&131072)}else Ih=!1,Al&&r.flags&1048576&&mEe(r,_te,r.index);switch(r.lanes=0,r.tag){case 2:var n=r.type;pO(t,r),t=r.pendingProps;var a=AC(r,Cu.current);TS(r,s),a=Hge(null,r,n,t,a,s);var o=Wge();return r.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(r.tag=1,r.memoizedState=null,r.updateQueue=null,Rh(n)?(o=!0,yte(r)):o=!1,r.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Bge(r),a.updater=pne,r.stateNode=a,a._reactInternals=r,nhe(r,n,t,s),r=ohe(null,r,n,!0,o,s)):(r.tag=0,Al&&o&&Pge(r),Zu(null,r,a,s),r=r.child),r;case 16:n=r.elementType;e:{switch(pO(t,r),t=r.pendingProps,a=n._init,n=a(n._payload),r.type=n,a=r.tag=TXe(n),t=ff(n,t),a){case 0:r=ihe(null,r,n,t,s);break e;case 1:r=mje(null,r,n,t,s);break e;case 11:r=uje(null,r,n,t,s);break e;case 14:r=hje(null,r,n,ff(n.type,t),s);break e}throw Error(Os(306,n,""))}return r;case 0:return n=r.type,a=r.pendingProps,a=r.elementType===n?a:ff(n,a),ihe(t,r,n,a,s);case 1:return n=r.type,a=r.pendingProps,a=r.elementType===n?a:ff(n,a),mje(t,r,n,a,s);case 3:e:{if(WEe(r),t===null)throw Error(Os(387));n=r.pendingProps,o=r.memoizedState,a=o.element,vEe(t,r),jte(r,n,null,s);var l=r.memoizedState;if(n=l.element,o.isDehydrated)if(o={element:n,isDehydrated:!1,cache:l.cache,pendingSuspenseBoundaries:l.pendingSuspenseBoundaries,transitions:l.transitions},r.updateQueue.baseState=o,r.memoizedState=o,r.flags&256){a=LC(Error(Os(423)),r),r=pje(t,r,n,s,a);break e}else if(n!==a){a=LC(Error(Os(424)),r),r=pje(t,r,n,s,a);break e}else for(gm=z1(r.stateNode.containerInfo.firstChild),ym=r,Al=!0,jf=null,s=xEe(r,null,n,s),r.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(EC(),n===a){r=Ey(t,r,s);break e}Zu(t,r,n,s)}r=r.child}return r;case 5:return _Ee(r),t===null&&the(r),n=r.type,a=r.pendingProps,o=t!==null?t.memoizedProps:null,l=a.children,Yue(n,a)?l=null:o!==null&&Yue(n,o)&&(r.flags|=32),HEe(t,r),Zu(t,r,l,s),r.child;case 6:return t===null&&the(r),null;case 13:return GEe(t,r,s);case 4:return $ge(r,r.stateNode.containerInfo),n=r.pendingProps,t===null?r.child=IC(r,null,n,s):Zu(t,r,n,s),r.child;case 11:return n=r.type,a=r.pendingProps,a=r.elementType===n?a:ff(n,a),uje(t,r,n,a,s);case 7:return Zu(t,r,r.pendingProps,s),r.child;case 8:return Zu(t,r,r.pendingProps.children,s),r.child;case 12:return Zu(t,r,r.pendingProps.children,s),r.child;case 10:e:{if(n=r.type._context,a=r.pendingProps,o=r.memoizedProps,l=a.value,ll(bte,n._currentValue),n._currentValue=l,o!==null)if(Wf(o.value,l)){if(o.children===a.children&&!Dh.current){r=Ey(t,r,s);break e}}else for(o=r.child,o!==null&&(o.return=r);o!==null;){var i=o.dependencies;if(i!==null){l=o.child;for(var d=i.firstContext;d!==null;){if(d.context===n){if(o.tag===1){d=hy(-1,s&-s),d.tag=2;var m=o.updateQueue;if(m!==null){m=m.shared;var g=m.pending;g===null?d.next=d:(d.next=g.next,g.next=d),m.pending=d}}o.lanes|=s,d=o.alternate,d!==null&&(d.lanes|=s),rhe(o.return,s,r),i.lanes|=s;break}d=d.next}}else if(o.tag===10)l=o.type===r.type?null:o.child;else if(o.tag===18){if(l=o.return,l===null)throw Error(Os(341));l.lanes|=s,i=l.alternate,i!==null&&(i.lanes|=s),rhe(l,s,r),l=o.sibling}else l=o.child;if(l!==null)l.return=o;else for(l=o;l!==null;){if(l===r){l=null;break}if(o=l.sibling,o!==null){o.return=l.return,l=o;break}l=l.return}o=l}Zu(t,r,a.children,s),r=r.child}return r;case 9:return a=r.type,n=r.pendingProps.children,TS(r,s),a=Cp(a),n=n(a),r.flags|=1,Zu(t,r,n,s),r.child;case 14:return n=r.type,a=ff(n,r.pendingProps),a=ff(n.type,a),hje(t,r,n,a,s);case 15:return qEe(t,r,r.type,r.pendingProps,s);case 17:return n=r.type,a=r.pendingProps,a=r.elementType===n?a:ff(n,a),pO(t,r),r.tag=1,Rh(n)?(t=!0,yte(r)):t=!1,TS(r,s),BEe(r,n,a),nhe(r,n,a,s),ohe(null,r,n,!0,t,s);case 19:return KEe(t,r,s);case 22:return VEe(t,r,s)}throw Error(Os(156,r.tag))};function dIe(t,r){return RAe(t,r)}function MXe(t,r,s,n){this.tag=t,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function hp(t,r,s,n){return new MXe(t,r,s,n)}function rxe(t){return t=t.prototype,!(!t||!t.isReactComponent)}function TXe(t){if(typeof t=="function")return rxe(t)?1:0;if(t!=null){if(t=t.$$typeof,t===bge)return 11;if(t===wge)return 14}return 2}function q1(t,r){var s=t.alternate;return s===null?(s=hp(t.tag,r,t.key,t.mode),s.elementType=t.elementType,s.type=t.type,s.stateNode=t.stateNode,s.alternate=t,t.alternate=s):(s.pendingProps=r,s.type=t.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=t.flags&14680064,s.childLanes=t.childLanes,s.lanes=t.lanes,s.child=t.child,s.memoizedProps=t.memoizedProps,s.memoizedState=t.memoizedState,s.updateQueue=t.updateQueue,r=t.dependencies,s.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},s.sibling=t.sibling,s.index=t.index,s.ref=t.ref,s}function xO(t,r,s,n,a,o){var l=2;if(n=t,typeof t=="function")rxe(t)&&(l=1);else if(typeof t=="string")l=5;else e:switch(t){case iS:return Pj(s.children,a,o,r);case _ge:l=8,a|=8;break;case Mue:return t=hp(12,s,r,a|2),t.elementType=Mue,t.lanes=o,t;case Tue:return t=hp(13,s,r,a),t.elementType=Tue,t.lanes=o,t;case Aue:return t=hp(19,s,r,a),t.elementType=Aue,t.lanes=o,t;case _Ae:return xne(s,a,o,r);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case yAe:l=10;break e;case vAe:l=9;break e;case bge:l=11;break e;case wge:l=14;break e;case Z0:l=16,n=null;break e}throw Error(Os(130,t==null?t:typeof t,""))}return r=hp(l,s,r,a),r.elementType=t,r.type=n,r.lanes=o,r}function Pj(t,r,s,n){return t=hp(7,t,n,r),t.lanes=s,t}function xne(t,r,s,n){return t=hp(22,t,n,r),t.elementType=_Ae,t.lanes=s,t.stateNode={isHidden:!1},t}function gce(t,r,s){return t=hp(6,t,null,r),t.lanes=s,t}function xce(t,r,s){return r=hp(4,t.children!==null?t.children:[],t.key,r),r.lanes=s,r.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},r}function AXe(t,r,s,n,a){this.tag=r,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Xle(0),this.expirationTimes=Xle(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xle(0),this.identifierPrefix=n,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function sxe(t,r,s,n,a,o,l,i,d){return t=new AXe(t,r,s,i,d),r===1?(r=1,o===!0&&(r|=8)):r=0,o=hp(3,null,null,r),t.current=o,o.stateNode=t,o.memoizedState={element:n,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},Bge(o),t}function EXe(t,r,s){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(pIe)}catch(t){console.error(t)}}pIe(),pAe.exports=Pm;var Ph=pAe.exports;const oxe=oo(Ph);var fIe,Sje=Ph;fIe=Sje.createRoot,Sje.hydrateRoot;const DXe=1,RXe=1e6;let yce=0;function FXe(){return yce=(yce+1)%Number.MAX_SAFE_INTEGER,yce.toString()}const vce=new Map,Cje=t=>{if(vce.has(t))return;const r=setTimeout(()=>{vce.delete(t),uA({type:"REMOVE_TOAST",toastId:t})},RXe);vce.set(t,r)},zXe=(t,r)=>{switch(r.type){case"ADD_TOAST":return{...t,toasts:[r.toast,...t.toasts].slice(0,DXe)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(s=>s.id===r.toast.id?{...s,...r.toast}:s)};case"DISMISS_TOAST":{const{toastId:s}=r;return s?Cje(s):t.toasts.forEach(n=>{Cje(n.id)}),{...t,toasts:t.toasts.map(n=>n.id===s||s===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return r.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(s=>s.id!==r.toastId)}}},yO=[];let vO={toasts:[]};function uA(t){vO=zXe(vO,t),yO.forEach(r=>{r(vO)})}function Jn({...t}){const r=FXe(),s=a=>uA({type:"UPDATE_TOAST",toast:{...a,id:r}}),n=()=>uA({type:"DISMISS_TOAST",toastId:r});return uA({type:"ADD_TOAST",toast:{...t,id:r,open:!0,onOpenChange:a=>{a||n()}}}),{id:r,dismiss:n,update:s}}function fi(){const[t,r]=E.useState(vO);return E.useEffect(()=>(yO.push(r),()=>{const s=yO.indexOf(r);s>-1&&yO.splice(s,1)}),[t]),{...t,toast:Jn,dismiss:s=>uA({type:"DISMISS_TOAST",toastId:s})}}function bs(t,r,{checkForDefaultPrevented:s=!0}={}){return function(a){if(t==null||t(a),s===!1||!a.defaultPrevented)return r==null?void 0:r(a)}}function Mje(t,r){if(typeof t=="function")return t(r);t!=null&&(t.current=r)}function Iy(...t){return r=>{let s=!1;const n=t.map(a=>{const o=Mje(a,r);return!s&&typeof o=="function"&&(s=!0),o});if(s)return()=>{for(let a=0;a{const{children:l,...i}=o,d=E.useMemo(()=>i,Object.values(i));return e.jsx(s.Provider,{value:d,children:l})};n.displayName=t+"Provider";function a(o){const l=E.useContext(s);if(l)return l;if(r!==void 0)return r;throw new Error(`\`${o}\` must be used within \`${t}\``)}return[n,a]}function fc(t,r=[]){let s=[];function n(o,l){const i=E.createContext(l),d=s.length;s=[...s,l];const m=y=>{var A;const{scope:v,children:b,...N}=y,j=((A=v==null?void 0:v[t])==null?void 0:A[d])||i,S=E.useMemo(()=>N,Object.values(N));return e.jsx(j.Provider,{value:S,children:b})};m.displayName=o+"Provider";function g(y,v){var j;const b=((j=v==null?void 0:v[t])==null?void 0:j[d])||i,N=E.useContext(b);if(N)return N;if(l!==void 0)return l;throw new Error(`\`${y}\` must be used within \`${o}\``)}return[m,g]}const a=()=>{const o=s.map(l=>E.createContext(l));return function(i){const d=(i==null?void 0:i[t])||o;return E.useMemo(()=>({[`__scope${t}`]:{...i,[t]:d}}),[i,d])}};return a.scopeName=t,[n,$Xe(a,...r)]}function $Xe(...t){const r=t[0];if(t.length===1)return r;const s=()=>{const n=t.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(o){const l=n.reduce((i,{useScope:d,scopeName:m})=>{const y=d(o)[`__scope${m}`];return{...i,...y}},{});return E.useMemo(()=>({[`__scope${r.scopeName}`]:l}),[l])}};return s.scopeName=r.scopeName,s}function fv(t){const r=UXe(t),s=E.forwardRef((n,a)=>{const{children:o,...l}=n,i=E.Children.toArray(o),d=i.find(qXe);if(d){const m=d.props.children,g=i.map(y=>y===d?E.Children.count(m)>1?E.Children.only(null):E.isValidElement(m)?m.props.children:null:y);return e.jsx(r,{...l,ref:a,children:E.isValidElement(m)?E.cloneElement(m,void 0,g):null})}return e.jsx(r,{...l,ref:a,children:o})});return s.displayName=`${t}.Slot`,s}var lxe=fv("Slot");function UXe(t){const r=E.forwardRef((s,n)=>{const{children:a,...o}=s;if(E.isValidElement(a)){const l=HXe(a),i=VXe(o,a.props);return a.type!==E.Fragment&&(i.ref=n?Iy(n,l):l),E.cloneElement(a,i)}return E.Children.count(a)>1?E.Children.only(null):null});return r.displayName=`${t}.SlotClone`,r}var gIe=Symbol("radix.slottable");function xIe(t){const r=({children:s})=>e.jsx(e.Fragment,{children:s});return r.displayName=`${t}.Slottable`,r.__radixId=gIe,r}function qXe(t){return E.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===gIe}function VXe(t,r){const s={...r};for(const n in r){const a=t[n],o=r[n];/^on[A-Z]/.test(n)?a&&o?s[n]=(...i)=>{const d=o(...i);return a(...i),d}:a&&(s[n]=a):n==="style"?s[n]={...a,...o}:n==="className"&&(s[n]=[a,o].filter(Boolean).join(" "))}return{...t,...s}}function HXe(t){var n,a;let r=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,s=r&&"isReactWarning"in r&&r.isReactWarning;return s?t.ref:(r=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,s=r&&"isReactWarning"in r&&r.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}function oP(t){const r=t+"CollectionProvider",[s,n]=fc(r),[a,o]=s(r,{collectionRef:{current:null},itemMap:new Map}),l=j=>{const{scope:S,children:A}=j,M=lt.useRef(null),I=lt.useRef(new Map).current;return e.jsx(a,{scope:S,itemMap:I,collectionRef:M,children:A})};l.displayName=r;const i=t+"CollectionSlot",d=fv(i),m=lt.forwardRef((j,S)=>{const{scope:A,children:M}=j,I=o(i,A),F=ga(S,I.collectionRef);return e.jsx(d,{ref:F,children:M})});m.displayName=i;const g=t+"CollectionItemSlot",y="data-radix-collection-item",v=fv(g),b=lt.forwardRef((j,S)=>{const{scope:A,children:M,...I}=j,F=lt.useRef(null),O=ga(S,F),B=o(g,A);return lt.useEffect(()=>(B.itemMap.set(F,{ref:F,...I}),()=>void B.itemMap.delete(F))),e.jsx(v,{[y]:"",ref:O,children:M})});b.displayName=g;function N(j){const S=o(t+"CollectionConsumer",j);return lt.useCallback(()=>{const M=S.collectionRef.current;if(!M)return[];const I=Array.from(M.querySelectorAll(`[${y}]`));return Array.from(S.itemMap.values()).sort((B,$)=>I.indexOf(B.ref.current)-I.indexOf($.ref.current))},[S.collectionRef,S.itemMap])}return[{Provider:l,Slot:m,ItemSlot:b},N,n]}var WXe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],qs=WXe.reduce((t,r)=>{const s=fv(`Primitive.${r}`),n=E.forwardRef((a,o)=>{const{asChild:l,...i}=a,d=l?s:r;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(d,{...i,ref:o})});return n.displayName=`Primitive.${r}`,{...t,[r]:n}},{});function cxe(t,r){t&&Ph.flushSync(()=>t.dispatchEvent(r))}function cc(t){const r=E.useRef(t);return E.useEffect(()=>{r.current=t}),E.useMemo(()=>(...s)=>{var n;return(n=r.current)==null?void 0:n.call(r,...s)},[])}function GXe(t,r=globalThis==null?void 0:globalThis.document){const s=cc(t);E.useEffect(()=>{const n=a=>{a.key==="Escape"&&s(a)};return r.addEventListener("keydown",n,{capture:!0}),()=>r.removeEventListener("keydown",n,{capture:!0})},[s,r])}var KXe="DismissableLayer",vhe="dismissableLayer.update",ZXe="dismissableLayer.pointerDownOutside",YXe="dismissableLayer.focusOutside",Tje,yIe=E.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Sv=E.forwardRef((t,r)=>{const{disableOutsidePointerEvents:s=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:l,onDismiss:i,...d}=t,m=E.useContext(yIe),[g,y]=E.useState(null),v=(g==null?void 0:g.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=E.useState({}),N=ga(r,$=>y($)),j=Array.from(m.layers),[S]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),A=j.indexOf(S),M=g?j.indexOf(g):-1,I=m.layersWithOutsidePointerEventsDisabled.size>0,F=M>=A,O=QXe($=>{const H=$.target,W=[...m.branches].some(X=>X.contains(H));!F||W||(a==null||a($),l==null||l($),$.defaultPrevented||i==null||i())},v),B=JXe($=>{const H=$.target;[...m.branches].some(X=>X.contains(H))||(o==null||o($),l==null||l($),$.defaultPrevented||i==null||i())},v);return GXe($=>{M===m.layers.size-1&&(n==null||n($),!$.defaultPrevented&&i&&($.preventDefault(),i()))},v),E.useEffect(()=>{if(g)return s&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(Tje=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(g)),m.layers.add(g),Aje(),()=>{s&&m.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=Tje)}},[g,v,s,m]),E.useEffect(()=>()=>{g&&(m.layers.delete(g),m.layersWithOutsidePointerEventsDisabled.delete(g),Aje())},[g,m]),E.useEffect(()=>{const $=()=>b({});return document.addEventListener(vhe,$),()=>document.removeEventListener(vhe,$)},[]),e.jsx(qs.div,{...d,ref:N,style:{pointerEvents:I?F?"auto":"none":void 0,...t.style},onFocusCapture:bs(t.onFocusCapture,B.onFocusCapture),onBlurCapture:bs(t.onBlurCapture,B.onBlurCapture),onPointerDownCapture:bs(t.onPointerDownCapture,O.onPointerDownCapture)})});Sv.displayName=KXe;var XXe="DismissableLayerBranch",vIe=E.forwardRef((t,r)=>{const s=E.useContext(yIe),n=E.useRef(null),a=ga(r,n);return E.useEffect(()=>{const o=n.current;if(o)return s.branches.add(o),()=>{s.branches.delete(o)}},[s.branches]),e.jsx(qs.div,{...t,ref:a})});vIe.displayName=XXe;function QXe(t,r=globalThis==null?void 0:globalThis.document){const s=cc(t),n=E.useRef(!1),a=E.useRef(()=>{});return E.useEffect(()=>{const o=i=>{if(i.target&&!n.current){let d=function(){_Ie(ZXe,s,m,{discrete:!0})};const m={originalEvent:i};i.pointerType==="touch"?(r.removeEventListener("click",a.current),a.current=d,r.addEventListener("click",a.current,{once:!0})):d()}else r.removeEventListener("click",a.current);n.current=!1},l=window.setTimeout(()=>{r.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(l),r.removeEventListener("pointerdown",o),r.removeEventListener("click",a.current)}},[r,s]),{onPointerDownCapture:()=>n.current=!0}}function JXe(t,r=globalThis==null?void 0:globalThis.document){const s=cc(t),n=E.useRef(!1);return E.useEffect(()=>{const a=o=>{o.target&&!n.current&&_Ie(YXe,s,{originalEvent:o},{discrete:!1})};return r.addEventListener("focusin",a),()=>r.removeEventListener("focusin",a)},[r,s]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Aje(){const t=new CustomEvent(vhe);document.dispatchEvent(t)}function _Ie(t,r,s,{discrete:n}){const a=s.originalEvent.target,o=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:s});r&&a.addEventListener(t,r,{once:!0}),n?cxe(a,o):a.dispatchEvent(o)}var eQe=Sv,tQe=vIe,mc=globalThis!=null&&globalThis.document?E.useLayoutEffect:()=>{},rQe="Portal",M3=E.forwardRef((t,r)=>{var i;const{container:s,...n}=t,[a,o]=E.useState(!1);mc(()=>o(!0),[]);const l=s||a&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return l?oxe.createPortal(e.jsx(qs.div,{...n,ref:r}),l):null});M3.displayName=rQe;function sQe(t,r){return E.useReducer((s,n)=>r[s][n]??s,t)}var zc=t=>{const{present:r,children:s}=t,n=nQe(r),a=typeof s=="function"?s({present:n.isPresent}):E.Children.only(s),o=ga(n.ref,aQe(a));return typeof s=="function"||n.isPresent?E.cloneElement(a,{ref:o}):null};zc.displayName="Presence";function nQe(t){const[r,s]=E.useState(),n=E.useRef(null),a=E.useRef(t),o=E.useRef("none"),l=t?"mounted":"unmounted",[i,d]=sQe(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const m=r8(n.current);o.current=i==="mounted"?m:"none"},[i]),mc(()=>{const m=n.current,g=a.current;if(g!==t){const v=o.current,b=r8(m);t?d("MOUNT"):b==="none"||(m==null?void 0:m.display)==="none"?d("UNMOUNT"):d(g&&v!==b?"ANIMATION_OUT":"UNMOUNT"),a.current=t}},[t,d]),mc(()=>{if(r){let m;const g=r.ownerDocument.defaultView??window,y=b=>{const j=r8(n.current).includes(b.animationName);if(b.target===r&&j&&(d("ANIMATION_END"),!a.current)){const S=r.style.animationFillMode;r.style.animationFillMode="forwards",m=g.setTimeout(()=>{r.style.animationFillMode==="forwards"&&(r.style.animationFillMode=S)})}},v=b=>{b.target===r&&(o.current=r8(n.current))};return r.addEventListener("animationstart",v),r.addEventListener("animationcancel",y),r.addEventListener("animationend",y),()=>{g.clearTimeout(m),r.removeEventListener("animationstart",v),r.removeEventListener("animationcancel",y),r.removeEventListener("animationend",y)}}else d("ANIMATION_END")},[r,d]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:E.useCallback(m=>{n.current=m?getComputedStyle(m):null,s(m)},[])}}function r8(t){return(t==null?void 0:t.animationName)||"none"}function aQe(t){var n,a;let r=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,s=r&&"isReactWarning"in r&&r.isReactWarning;return s?t.ref:(r=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,s=r&&"isReactWarning"in r&&r.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}var iQe=gge[" useInsertionEffect ".trim().toString()]||mc;function oh({prop:t,defaultProp:r,onChange:s=()=>{},caller:n}){const[a,o,l]=oQe({defaultProp:r,onChange:s}),i=t!==void 0,d=i?t:a;{const g=E.useRef(t!==void 0);E.useEffect(()=>{const y=g.current;y!==i&&console.warn(`${n} 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.`),g.current=i},[i,n])}const m=E.useCallback(g=>{var y;if(i){const v=lQe(g)?g(t):g;v!==t&&((y=l.current)==null||y.call(l,v))}else o(g)},[i,t,o,l]);return[d,m]}function oQe({defaultProp:t,onChange:r}){const[s,n]=E.useState(t),a=E.useRef(s),o=E.useRef(r);return iQe(()=>{o.current=r},[r]),E.useEffect(()=>{var l;a.current!==s&&((l=o.current)==null||l.call(o,s),a.current=s)},[s,a]),[s,n,o]}function lQe(t){return typeof t=="function"}var bIe=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"}),cQe="VisuallyHidden",wne=E.forwardRef((t,r)=>e.jsx(qs.span,{...t,ref:r,style:{...bIe,...t.style}}));wne.displayName=cQe;var dQe=wne,dxe="ToastProvider",[uxe,uQe,hQe]=oP("Toast"),[wIe]=fc("Toast",[hQe]),[mQe,jne]=wIe(dxe),jIe=t=>{const{__scopeToast:r,label:s="Notification",duration:n=5e3,swipeDirection:a="right",swipeThreshold:o=50,children:l}=t,[i,d]=E.useState(null),[m,g]=E.useState(0),y=E.useRef(!1),v=E.useRef(!1);return s.trim()||console.error(`Invalid prop \`label\` supplied to \`${dxe}\`. Expected non-empty \`string\`.`),e.jsx(uxe.Provider,{scope:r,children:e.jsx(mQe,{scope:r,label:s,duration:n,swipeDirection:a,swipeThreshold:o,toastCount:m,viewport:i,onViewportChange:d,onToastAdd:E.useCallback(()=>g(b=>b+1),[]),onToastRemove:E.useCallback(()=>g(b=>b-1),[]),isFocusedToastEscapeKeyDownRef:y,isClosePausedRef:v,children:l})})};jIe.displayName=dxe;var kIe="ToastViewport",pQe=["F8"],_he="toast.viewportPause",bhe="toast.viewportResume",NIe=E.forwardRef((t,r)=>{const{__scopeToast:s,hotkey:n=pQe,label:a="Notifications ({hotkey})",...o}=t,l=jne(kIe,s),i=uQe(s),d=E.useRef(null),m=E.useRef(null),g=E.useRef(null),y=E.useRef(null),v=ga(r,y,l.onViewportChange),b=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),N=l.toastCount>0;E.useEffect(()=>{const S=A=>{var I;n.length!==0&&n.every(F=>A[F]||A.code===F)&&((I=y.current)==null||I.focus())};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[n]),E.useEffect(()=>{const S=d.current,A=y.current;if(N&&S&&A){const M=()=>{if(!l.isClosePausedRef.current){const B=new CustomEvent(_he);A.dispatchEvent(B),l.isClosePausedRef.current=!0}},I=()=>{if(l.isClosePausedRef.current){const B=new CustomEvent(bhe);A.dispatchEvent(B),l.isClosePausedRef.current=!1}},F=B=>{!S.contains(B.relatedTarget)&&I()},O=()=>{S.contains(document.activeElement)||I()};return S.addEventListener("focusin",M),S.addEventListener("focusout",F),S.addEventListener("pointermove",M),S.addEventListener("pointerleave",O),window.addEventListener("blur",M),window.addEventListener("focus",I),()=>{S.removeEventListener("focusin",M),S.removeEventListener("focusout",F),S.removeEventListener("pointermove",M),S.removeEventListener("pointerleave",O),window.removeEventListener("blur",M),window.removeEventListener("focus",I)}}},[N,l.isClosePausedRef]);const j=E.useCallback(({tabbingDirection:S})=>{const M=i().map(I=>{const F=I.ref.current,O=[F,...CQe(F)];return S==="forwards"?O:O.reverse()});return(S==="forwards"?M.reverse():M).flat()},[i]);return E.useEffect(()=>{const S=y.current;if(S){const A=M=>{var O,B,$;const I=M.altKey||M.ctrlKey||M.metaKey;if(M.key==="Tab"&&!I){const H=document.activeElement,W=M.shiftKey;if(M.target===S&&W){(O=m.current)==null||O.focus();return}const ae=j({tabbingDirection:W?"backwards":"forwards"}),le=ae.findIndex(ne=>ne===H);_ce(ae.slice(le+1))?M.preventDefault():W?(B=m.current)==null||B.focus():($=g.current)==null||$.focus()}};return S.addEventListener("keydown",A),()=>S.removeEventListener("keydown",A)}},[i,j]),e.jsxs(tQe,{ref:d,role:"region","aria-label":a.replace("{hotkey}",b),tabIndex:-1,style:{pointerEvents:N?void 0:"none"},children:[N&&e.jsx(whe,{ref:m,onFocusFromOutsideViewport:()=>{const S=j({tabbingDirection:"forwards"});_ce(S)}}),e.jsx(uxe.Slot,{scope:s,children:e.jsx(qs.ol,{tabIndex:-1,...o,ref:v})}),N&&e.jsx(whe,{ref:g,onFocusFromOutsideViewport:()=>{const S=j({tabbingDirection:"backwards"});_ce(S)}})]})});NIe.displayName=kIe;var SIe="ToastFocusProxy",whe=E.forwardRef((t,r)=>{const{__scopeToast:s,onFocusFromOutsideViewport:n,...a}=t,o=jne(SIe,s);return e.jsx(wne,{"aria-hidden":!0,tabIndex:0,...a,ref:r,style:{position:"fixed"},onFocus:l=>{var m;const i=l.relatedTarget;!((m=o.viewport)!=null&&m.contains(i))&&n()}})});whe.displayName=SIe;var lP="Toast",fQe="toast.swipeStart",gQe="toast.swipeMove",xQe="toast.swipeCancel",yQe="toast.swipeEnd",CIe=E.forwardRef((t,r)=>{const{forceMount:s,open:n,defaultOpen:a,onOpenChange:o,...l}=t,[i,d]=oh({prop:n,defaultProp:a??!0,onChange:o,caller:lP});return e.jsx(zc,{present:s||i,children:e.jsx(bQe,{open:i,...l,ref:r,onClose:()=>d(!1),onPause:cc(t.onPause),onResume:cc(t.onResume),onSwipeStart:bs(t.onSwipeStart,m=>{m.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:bs(t.onSwipeMove,m=>{const{x:g,y}=m.detail.delta;m.currentTarget.setAttribute("data-swipe","move"),m.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${g}px`),m.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${y}px`)}),onSwipeCancel:bs(t.onSwipeCancel,m=>{m.currentTarget.setAttribute("data-swipe","cancel"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),m.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:bs(t.onSwipeEnd,m=>{const{x:g,y}=m.detail.delta;m.currentTarget.setAttribute("data-swipe","end"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),m.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${g}px`),m.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${y}px`),d(!1)})})})});CIe.displayName=lP;var[vQe,_Qe]=wIe(lP,{onClose(){}}),bQe=E.forwardRef((t,r)=>{const{__scopeToast:s,type:n="foreground",duration:a,open:o,onClose:l,onEscapeKeyDown:i,onPause:d,onResume:m,onSwipeStart:g,onSwipeMove:y,onSwipeCancel:v,onSwipeEnd:b,...N}=t,j=jne(lP,s),[S,A]=E.useState(null),M=ga(r,ne=>A(ne)),I=E.useRef(null),F=E.useRef(null),O=a||j.duration,B=E.useRef(0),$=E.useRef(O),H=E.useRef(0),{onToastAdd:W,onToastRemove:X}=j,se=cc(()=>{var fe;(S==null?void 0:S.contains(document.activeElement))&&((fe=j.viewport)==null||fe.focus()),l()}),ae=E.useCallback(ne=>{!ne||ne===1/0||(window.clearTimeout(H.current),B.current=new Date().getTime(),H.current=window.setTimeout(se,ne))},[se]);E.useEffect(()=>{const ne=j.viewport;if(ne){const fe=()=>{ae($.current),m==null||m()},oe=()=>{const de=new Date().getTime()-B.current;$.current=$.current-de,window.clearTimeout(H.current),d==null||d()};return ne.addEventListener(_he,oe),ne.addEventListener(bhe,fe),()=>{ne.removeEventListener(_he,oe),ne.removeEventListener(bhe,fe)}}},[j.viewport,O,d,m,ae]),E.useEffect(()=>{o&&!j.isClosePausedRef.current&&ae(O)},[o,O,j.isClosePausedRef,ae]),E.useEffect(()=>(W(),()=>X()),[W,X]);const le=E.useMemo(()=>S?LIe(S):null,[S]);return j.viewport?e.jsxs(e.Fragment,{children:[le&&e.jsx(wQe,{__scopeToast:s,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:le}),e.jsx(vQe,{scope:s,onClose:se,children:Ph.createPortal(e.jsx(uxe.ItemSlot,{scope:s,children:e.jsx(eQe,{asChild:!0,onEscapeKeyDown:bs(i,()=>{j.isFocusedToastEscapeKeyDownRef.current||se(),j.isFocusedToastEscapeKeyDownRef.current=!1}),children:e.jsx(qs.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":j.swipeDirection,...N,ref:M,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:bs(t.onKeyDown,ne=>{ne.key==="Escape"&&(i==null||i(ne.nativeEvent),ne.nativeEvent.defaultPrevented||(j.isFocusedToastEscapeKeyDownRef.current=!0,se()))}),onPointerDown:bs(t.onPointerDown,ne=>{ne.button===0&&(I.current={x:ne.clientX,y:ne.clientY})}),onPointerMove:bs(t.onPointerMove,ne=>{if(!I.current)return;const fe=ne.clientX-I.current.x,oe=ne.clientY-I.current.y,de=!!F.current,ue=["left","right"].includes(j.swipeDirection),xe=["left","up"].includes(j.swipeDirection)?Math.min:Math.max,Te=ue?xe(0,fe):0,be=ue?0:xe(0,oe),we=ne.pointerType==="touch"?10:2,ve={x:Te,y:be},tt={originalEvent:ne,delta:ve};de?(F.current=ve,s8(gQe,y,tt,{discrete:!1})):Eje(ve,j.swipeDirection,we)?(F.current=ve,s8(fQe,g,tt,{discrete:!1}),ne.target.setPointerCapture(ne.pointerId)):(Math.abs(fe)>we||Math.abs(oe)>we)&&(I.current=null)}),onPointerUp:bs(t.onPointerUp,ne=>{const fe=F.current,oe=ne.target;if(oe.hasPointerCapture(ne.pointerId)&&oe.releasePointerCapture(ne.pointerId),F.current=null,I.current=null,fe){const de=ne.currentTarget,ue={originalEvent:ne,delta:fe};Eje(fe,j.swipeDirection,j.swipeThreshold)?s8(yQe,b,ue,{discrete:!0}):s8(xQe,v,ue,{discrete:!0}),de.addEventListener("click",xe=>xe.preventDefault(),{once:!0})}})})})}),j.viewport)})]}):null}),wQe=t=>{const{__scopeToast:r,children:s,...n}=t,a=jne(lP,r),[o,l]=E.useState(!1),[i,d]=E.useState(!1);return NQe(()=>l(!0)),E.useEffect(()=>{const m=window.setTimeout(()=>d(!0),1e3);return()=>window.clearTimeout(m)},[]),i?null:e.jsx(M3,{asChild:!0,children:e.jsx(wne,{...n,children:o&&e.jsxs(e.Fragment,{children:[a.label," ",s]})})})},jQe="ToastTitle",MIe=E.forwardRef((t,r)=>{const{__scopeToast:s,...n}=t;return e.jsx(qs.div,{...n,ref:r})});MIe.displayName=jQe;var kQe="ToastDescription",TIe=E.forwardRef((t,r)=>{const{__scopeToast:s,...n}=t;return e.jsx(qs.div,{...n,ref:r})});TIe.displayName=kQe;var AIe="ToastAction",EIe=E.forwardRef((t,r)=>{const{altText:s,...n}=t;return s.trim()?e.jsx(PIe,{altText:s,asChild:!0,children:e.jsx(hxe,{...n,ref:r})}):(console.error(`Invalid prop \`altText\` supplied to \`${AIe}\`. Expected non-empty \`string\`.`),null)});EIe.displayName=AIe;var IIe="ToastClose",hxe=E.forwardRef((t,r)=>{const{__scopeToast:s,...n}=t,a=_Qe(IIe,s);return e.jsx(PIe,{asChild:!0,children:e.jsx(qs.button,{type:"button",...n,ref:r,onClick:bs(t.onClick,a.onClose)})})});hxe.displayName=IIe;var PIe=E.forwardRef((t,r)=>{const{__scopeToast:s,altText:n,...a}=t;return e.jsx(qs.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...a,ref:r})});function LIe(t){const r=[];return Array.from(t.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&r.push(n.textContent),SQe(n)){const a=n.ariaHidden||n.hidden||n.style.display==="none",o=n.dataset.radixToastAnnounceExclude==="";if(!a)if(o){const l=n.dataset.radixToastAnnounceAlt;l&&r.push(l)}else r.push(...LIe(n))}}),r}function s8(t,r,s,{discrete:n}){const a=s.originalEvent.currentTarget,o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:s});r&&a.addEventListener(t,r,{once:!0}),n?cxe(a,o):a.dispatchEvent(o)}var Eje=(t,r,s=0)=>{const n=Math.abs(t.x),a=Math.abs(t.y),o=n>a;return r==="left"||r==="right"?o&&n>s:!o&&a>s};function NQe(t=()=>{}){const r=cc(t);mc(()=>{let s=0,n=0;return s=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(r)),()=>{window.cancelAnimationFrame(s),window.cancelAnimationFrame(n)}},[r])}function SQe(t){return t.nodeType===t.ELEMENT_NODE}function CQe(t){const r=[],s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;s.nextNode();)r.push(s.currentNode);return r}function _ce(t){const r=document.activeElement;return t.some(s=>s===r?!0:(s.focus(),document.activeElement!==r))}var MQe=jIe,OIe=NIe,DIe=CIe,RIe=MIe,FIe=TIe,zIe=EIe,BIe=hxe;function $Ie(t){var r,s,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(r=0;rtypeof t=="boolean"?`${t}`:t===0?"0":t,Pje=vi,T3=(t,r)=>s=>{var n;if((r==null?void 0:r.variants)==null)return Pje(t,s==null?void 0:s.class,s==null?void 0:s.className);const{variants:a,defaultVariants:o}=r,l=Object.keys(a).map(m=>{const g=s==null?void 0:s[m],y=o==null?void 0:o[m];if(g===null)return null;const v=Ije(g)||Ije(y);return a[m][v]}),i=s&&Object.entries(s).reduce((m,g)=>{let[y,v]=g;return v===void 0||(m[y]=v),m},{}),d=r==null||(n=r.compoundVariants)===null||n===void 0?void 0:n.reduce((m,g)=>{let{class:y,className:v,...b}=g;return Object.entries(b).every(N=>{let[j,S]=N;return Array.isArray(S)?S.includes({...o,...i}[j]):{...o,...i}[j]===S})?[...m,y,v]:m},[]);return Pje(t,l,d,s==null?void 0:s.class,s==null?void 0:s.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 TQe=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),UIe=(...t)=>t.filter((r,s,n)=>!!r&&r.trim()!==""&&n.indexOf(r)===s).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 AQe={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 qIe=E.forwardRef(({color:t="currentColor",size:r=24,strokeWidth:s=2,absoluteStrokeWidth:n,className:a="",children:o,iconNode:l,...i},d)=>E.createElement("svg",{ref:d,...AQe,width:r,height:r,stroke:t,strokeWidth:n?Number(s)*24/Number(r):s,className:UIe("lucide",a),...i},[...l.map(([m,g])=>E.createElement(m,g)),...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 V=(t,r)=>{const s=E.forwardRef(({className:n,...a},o)=>E.createElement(qIe,{ref:o,iconNode:r,className:UIe(`lucide-${TQe(t)}`,n),...a}));return s.displayName=`${t}`,s};/** * @license lucide-react v0.462.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=V("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 bO=V("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 wO=V("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 jO=V("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 qg=V("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 kO=V("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 NO=V("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 B_=V("AlarmClockCheck",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}],["path",{d:"m9 13 2 2 4-4",key:"6343dt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $_=V("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 SO=V("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 U_=V("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 CO=V("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 MO=V("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 TO=V("Album",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["polyline",{points:"11 3 11 11 14 8 17 11 17 3",key:"1wcwz3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AO=V("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 EO=V("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 ES=V("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 IO=V("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 PO=V("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 LO=V("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 OO=V("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 DO=V("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 RO=V("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 FO=V("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 zO=V("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 BO=V("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 $O=V("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 UO=V("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 IS=V("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 PS=V("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 qO=V("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 VO=V("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 HO=V("AlignVerticalDistributeCenter",[["path",{d:"M22 17h-3",key:"1lwga1"}],["path",{d:"M22 7h-5",key:"o2endc"}],["path",{d:"M5 17H2",key:"1gx9xc"}],["path",{d:"M7 7H2",key:"6bq26l"}],["rect",{x:"5",y:"14",width:"14",height:"6",rx:"2",key:"1qrzuf"}],["rect",{x:"7",y:"4",width:"10",height:"6",rx:"2",key:"we8e9z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WO=V("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 GO=V("AlignVerticalDistributeStart",[["rect",{width:"14",height:"6",x:"5",y:"14",rx:"2",key:"jmoj9s"}],["rect",{width:"10",height:"6",x:"7",y:"4",rx:"2",key:"aza5on"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M2 4h20",key:"mda7wb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KO=V("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 ZO=V("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 YO=V("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 XO=V("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 QO=V("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 JO=V("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 eD=V("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 tD=V("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 rD=V("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 sD=V("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 nD=V("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 aD=V("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 iD=V("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 oD=V("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 lD=V("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 cD=V("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 hA=V("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 dD=V("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 uD=V("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 hD=V("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 mA=V("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 mD=V("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 pD=V("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 fD=V("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 gD=V("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 xD=V("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 yD=V("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 vD=V("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 _D=V("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 bD=V("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 wD=V("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 jD=V("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 q_=V("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 kD=V("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 ND=V("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 SD=V("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 CD=V("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 MD=V("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 TD=V("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 AD=V("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 V_=V("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 H_=V("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 my=V("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 ED=V("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 ID=V("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 PD=V("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 _i=V("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 LD=V("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 py=V("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 OD=V("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 Hi=V("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 DD=V("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 RD=V("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 W_=V("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 Of=V("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 FD=V("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 zD=V("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 BD=V("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 G_=V("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 $D=V("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 UD=V("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 qD=V("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 K_=V("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 fp=V("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 VD=V("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 HD=V("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 WD=V("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 GD=V("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 KD=V("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 ZD=V("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 ql=V("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 YD=V("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 Z_=V("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 XD=V("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 QD=V("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 JD=V("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 eR=V("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 Y_=V("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 tR=V("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 rR=V("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 sR=V("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 nR=V("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 aR=V("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 iR=V("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 oR=V("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 lR=V("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 cR=V("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 dR=V("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 uR=V("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 hR=V("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 mR=V("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 pR=V("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 fR=V("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 gR=V("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 xR=V("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 yR=V("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 vR=V("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 _R=V("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 bR=V("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 V1=V("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 wR=V("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 jR=V("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 kR=V("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 NR=V("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 SR=V("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 CR=V("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 MR=V("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 TR=V("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 AR=V("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 ER=V("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 IR=V("BedSingle",[["path",{d:"M3 20v-8a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v8",key:"1wm6mi"}],["path",{d:"M5 10V6a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v4",key:"4k93s5"}],["path",{d:"M3 18h18",key:"1h113x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H1=V("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 PR=V("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 LR=V("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 OR=V("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 DR=V("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 RR=V("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 FR=V("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 Lj=V("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 zR=V("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 BR=V("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 Df=V("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 X_=V("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 Q_=V("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 $R=V("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 UR=V("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 qR=V("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 VR=V("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 HR=V("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 WR=V("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 GR=V("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 KR=V("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 ZR=V("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 YR=V("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 XR=V("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 QR=V("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 JR=V("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 eF=V("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 tF=V("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 rF=V("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 LS=V("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 sF=V("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 nF=V("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 aF=V("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 iF=V("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 oF=V("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 lF=V("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 cF=V("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 J_=V("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 dF=V("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 uF=V("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 hF=V("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 mF=V("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 pF=V("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 fF=V("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 gF=V("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 xF=V("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 yF=V("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 vF=V("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 W1=V("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 _F=V("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 bF=V("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 wF=V("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 jF=V("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 kF=V("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 NF=V("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 SF=V("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 CF=V("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 MF=V("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 TF=V("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 pA=V("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 AF=V("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 Rf=V("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 EF=V("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 IF=V("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 PF=V("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 OS=V("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 LF=V("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 OF=V("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 eb=V("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 DF=V("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 RF=V("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 FF=V("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 fA=V("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 zF=V("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 BF=V("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 $F=V("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 UF=V("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 wu=V("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 qF=V("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 VF=V("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 HF=V("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 WF=V("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 GF=V("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 bi=V("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 Oj=V("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 KF=V("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 ZF=V("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 YF=V("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 XF=V("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 QF=V("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 vm=V("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 JF=V("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 ez=V("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 tz=V("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 rz=V("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 sz=V("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 nz=V("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 gA=V("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 az=V("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 Ff=V("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 iz=V("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 oz=V("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 lz=V("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 cz=V("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 dz=V("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 uz=V("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 Dj=V("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 hz=V("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 mz=V("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 pz=V("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 fz=V("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 gz=V("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 Mn=V("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 xz=V("CameraOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16",key:"qmtpty"}],["path",{d:"M9.5 4h5L17 7h3a2 2 0 0 1 2 2v7.5",key:"1ufyfc"}],["path",{d:"M14.121 15.121A3 3 0 1 1 9.88 10.88",key:"11zox6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vg=V("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 yz=V("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 vz=V("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 _z=V("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 bz=V("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 wz=V("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 tb=V("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 jz=V("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 kz=V("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 Nz=V("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 Sz=V("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 Cz=V("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 Mz=V("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 Tz=V("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 Az=V("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 Ez=V("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 Iz=V("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 Pz=V("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 Lz=V("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 Oz=V("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 rb=V("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 sb=V("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 Dz=V("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 Rz=V("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 Fz=V("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 nb=V("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 ab=V("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 ib=V("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 zz=V("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 ob=V("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 Bz=V("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 Nc=V("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 $z=V("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 lb=V("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 Uz=V("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 qz=V("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 cb=V("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 db=V("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 Vz=V("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 ub=V("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 hb=V("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 mb=V("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 Hz=V("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 Wz=V("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 li=V("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 Gz=V("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 Kz=V("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 Jc=V("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 Zz=V("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 Yz=V("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 uc=V("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=V("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 Hg=V("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 Xz=V("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 Qz=V("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 Jz=V("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 e7=V("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 t7=V("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 r7=V("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 s7=V("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 fy=V("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 n7=V("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 a7=V("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 i7=V("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 o7=V("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 l7=V("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 _l=V("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 pb=V("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 fb=V("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 gb=V("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 xb=V("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 yb=V("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 vb=V("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 _b=V("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 bb=V("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 ui=V("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 Li=V("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 wb=V("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 jb=V("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 kb=V("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 Nb=V("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 c7=V("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 Sb=V("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 d7=V("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 u7=V("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 h7=V("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 m7=V("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 p7=V("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 f7=V("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 g7=V("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 Cb=V("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 ey=V("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 Mb=V("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 x7=V("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 Tb=V("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 Ab=V("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 Eb=V("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 Ib=V("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 lp=V("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 Pb=V("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 Lb=V("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 Ob=V("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 y7=V("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 Db=V("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 Rb=V("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 Fb=V("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 Sc=V("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 ah=V("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 v7=V("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 _7=V("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 b7=V("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 DS=V("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 w7=V("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 xA=V("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 j7=V("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 k7=V("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 zb=V("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 Bb=V("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 N7=V("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 S7=V("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 C7=V("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 M7=V("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 T7=V("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 A7=V("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 E7=V("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 I7=V("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 P7=V("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 L7=V("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 O7=V("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 D7=V("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 R7=V("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 F7=V("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 z7=V("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 B7=V("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 $7=V("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 U7=V("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 q7=V("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 Ea=V("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 V7=V("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 H7=V("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 $b=V("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 W7=V("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 G7=V("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 K7=V("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 Z7=V("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 Y7=V("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 X7=V("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 Q7=V("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 J7=V("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 e9=V("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 t9=V("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 r9=V("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 s9=V("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 Ub=V("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 n9=V("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 a9=V("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 oy=V("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 i9=V("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 qb=V("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 Rj=V("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 o9=V("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 l9=V("Codesandbox",[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}],["polyline",{points:"7.5 4.21 12 6.81 16.5 4.21",key:"fabo96"}],["polyline",{points:"7.5 19.79 7.5 14.6 3 12",key:"z377f1"}],["polyline",{points:"21 12 16.5 14.6 16.5 19.79",key:"9nrev1"}],["polyline",{points:"3.27 6.96 12 12.01 20.73 6.96",key:"1180pa"}],["line",{x1:"12",x2:"12",y1:"22.08",y2:"12",key:"3z3uq6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fj=V("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 c9=V("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 d9=V("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 Vb=V("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 Hb=V("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 u9=V("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 h9=V("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 m9=V("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 p9=V("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 f9=V("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 g9=V("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 x9=V("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 y9=V("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 v9=V("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 Wb=V("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 zj=V("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 _9=V("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 b9=V("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 w9=V("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 j9=V("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 k9=V("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 N9=V("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 S9=V("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 C9=V("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 M9=V("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 fo=V("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 T9=V("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 A9=V("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 E9=V("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 I9=V("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 P9=V("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 L9=V("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 O9=V("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 D9=V("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 R9=V("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 F9=V("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 z9=V("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 B9=V("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 gp=V("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 $9=V("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 U9=V("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 q9=V("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 V9=V("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 ih=V("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 H9=V("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 W9=V("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 G9=V("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 K9=V("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 Z9=V("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 Y9=V("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 X9=V("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 Q9=V("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 J9=V("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 eB=V("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 tB=V("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 rB=V("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 Gb=V("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 sB=V("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 nB=V("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 aB=V("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 iB=V("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 oB=V("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 lB=V("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 cB=V("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 dB=V("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 uB=V("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 hB=V("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 mB=V("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 pB=V("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 fB=V("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 gB=V("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 xB=V("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 yB=V("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 vB=V("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 _B=V("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 bB=V("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 yd=V("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 wB=V("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 jB=V("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 Bj=V("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 kB=V("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 Oi=V("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 NB=V("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 SB=V("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 CB=V("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 MB=V("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 TB=V("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 Wg=V("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 AB=V("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 EB=V("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 IB=V("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 PB=V("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 LB=V("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 OB=V("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 Kb=V("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 DB=V("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 RB=V("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 FB=V("EggOff",[["path",{d:"M6.399 6.399C5.362 8.157 4.65 10.189 4.5 12c-.37 4.43 1.27 9.95 7.5 10 3.256-.026 5.259-1.547 6.375-3.625",key:"6et380"}],["path",{d:"M19.532 13.875A14.07 14.07 0 0 0 19.5 12c-.36-4.34-3.95-9.96-7.5-10-1.04.012-2.082.502-3.046 1.297",key:"gcdc3f"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RS=V("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 Pg=V("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 kf=V("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 zB=V("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 BB=V("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 $B=V("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 UB=V("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 qB=V("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 VB=V("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 HB=V("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 En=V("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 WB=V("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 zf=V("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 Gi=V("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 iu=V("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 GB=V("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 KB=V("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 ZB=V("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 YB=V("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 XB=V("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 QB=V("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 JB=V("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 e$=V("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 t$=V("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 r$=V("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 Zb=V("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 s$=V("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 n$=V("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 a$=V("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 Yb=V("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 Xb=V("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 Qb=V("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 Jb=V("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 i$=V("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 o$=V("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 l$=V("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 c$=V("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 d$=V("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e2=V("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 u$=V("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 h$=V("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 m$=V("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 p$=V("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 G1=V("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 f$=V("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 g$=V("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 x$=V("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 y$=V("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 v$=V("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 _$=V("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 b$=V("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 w$=V("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 j$=V("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 k$=V("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 N$=V("FileOutput",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 7V4a2 2 0 0 1 2-2 2 2 0 0 0-2 2",key:"1vk7w2"}],["path",{d:"M4.063 20.999a2 2 0 0 0 2 1L18 22a2 2 0 0 0 2-2V7l-5-5H6",key:"1jink5"}],["path",{d:"m5 11-3 3",key:"1dgrs4"}],["path",{d:"m5 17-3-3h10",key:"1mvvaf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t2=V("FilePenLine",[["path",{d:"m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2",key:"142zxg"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}],["path",{d:"M8 18h1",key:"13wk12"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r2=V("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 S$=V("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 C$=V("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$=V("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 T$=V("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 A$=V("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 E$=V("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 I$=V("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 K1=V("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 P$=V("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 L$=V("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 O$=V("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 fa=V("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 D$=V("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 R$=V("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 F$=V("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 z$=V("FileUser",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 18a3 3 0 1 0-6 0",key:"16awa0"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B$=V("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 $$=V("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 U$=V("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 q$=V("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 V$=V("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 H$=V("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 W$=V("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 FS=V("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 G$=V("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 Od=V("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 K$=V("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 Z1=V("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 Z$=V("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 Y$=V("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 X$=V("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 Q$=V("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 J$=V("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 eU=V("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 tU=V("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 rU=V("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 gy=V("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 sU=V("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 _m=V("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 nU=V("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 aU=V("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 iU=V("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 $j=V("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 oU=V("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 lU=V("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 cU=V("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 dU=V("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 uU=V("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 Tf=V("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 hU=V("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 mU=V("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 pU=V("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 fU=V("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 gU=V("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 xU=V("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 yU=V("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 vU=V("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 _U=V("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 s2=V("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 bU=V("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 wU=V("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 jU=V("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 kU=V("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 NU=V("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 SU=V("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 CU=V("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 MU=V("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 TU=V("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 AU=V("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 EU=V("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 bm=V("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 IU=V("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 n2=V("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 PU=V("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 LU=V("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 OU=V("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 DU=V("FolderSearch",[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RU=V("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 FU=V("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 zU=V("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 BU=V("FolderUp",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m9 13 3-3 3 3",key:"1pxg3c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $U=V("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 UU=V("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 qU=V("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 VU=V("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 HU=V("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 WU=V("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 GU=V("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 KU=V("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 ZU=V("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 YU=V("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 XU=V("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 QU=V("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 JU=V("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 eq=V("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 tq=V("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 rq=V("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 sq=V("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 nq=V("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 aq=V("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 iq=V("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 oq=V("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 Uj=V("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 uo=V("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 lq=V("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 cq=V("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 a2=V("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 dq=V("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 uq=V("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 hq=V("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 mq=V("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 pq=V("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 fq=V("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 gq=V("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 xq=V("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 yq=V("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 vq=V("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 _q=V("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 bq=V("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 wq=V("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 jq=V("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 kq=V("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 Nq=V("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 Sq=V("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 Gg=V("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 Cq=V("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 Mq=V("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 Y1=V("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 Tq=V("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 Aq=V("Grid2x2Check",[["path",{d:"M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",key:"11za1p"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i2=V("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 Eq=V("Grid2x2X",[["path",{d:"M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",key:"11za1p"}],["path",{d:"m16 16 5 5",key:"8tpb07"}],["path",{d:"m16 21 5-5",key:"193jll"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o2=V("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 im=V("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 Iq=V("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 xp=V("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 Pq=V("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 Lq=V("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 Oq=V("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 Dq=V("Ham",[["path",{d:"M13.144 21.144A7.274 10.445 45 1 0 2.856 10.856",key:"1k1t7q"}],["path",{d:"M13.144 21.144A7.274 4.365 45 0 0 2.856 10.856a7.274 4.365 45 0 0 10.288 10.288",key:"153t1g"}],["path",{d:"M16.565 10.435 18.6 8.4a2.501 2.501 0 1 0 1.65-4.65 2.5 2.5 0 1 0-4.66 1.66l-2.024 2.025",key:"gzrt0n"}],["path",{d:"m8.5 16.5-1-1",key:"otr954"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rq=V("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 Fq=V("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 zq=V("HandHeart",[["path",{d:"M11 14h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 16",key:"1ifwr1"}],["path",{d:"m7 20 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9",key:"17abbs"}],["path",{d:"m2 15 6 6",key:"10dquu"}],["path",{d:"M19.5 8.5c.7-.7 1.5-1.6 1.5-2.7A2.73 2.73 0 0 0 16 4a2.78 2.78 0 0 0-5 1.8c0 1.2.8 2 1.5 2.8L16 12Z",key:"1h3036"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l2=V("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 Bq=V("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 $q=V("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 yA=V("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 Uq=V("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 qq=V("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 Vq=V("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 vA=V("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 Hq=V("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 zS=V("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 Wq=V("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 Gq=V("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 _A=V("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 bA=V("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 Kq=V("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 Zq=V("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 Yq=V("Heading5",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 13v-3h4",key:"1nvgqp"}],["path",{d:"M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17",key:"2nebdn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xq=V("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 Qq=V("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 Jq=V("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 eV=V("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 tV=V("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 rV=V("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 sV=V("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 nV=V("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 aV=V("HeartPulse",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"1uw2ng"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ci=V("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 iV=V("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 oV=V("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 lV=V("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 BS=V("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 cV=V("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 dV=V("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 uV=V("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 hV=V("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 mV=V("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 pV=V("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 fV=V("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 Wn=V("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c2=V("IceCreamBowl",[["path",{d:"M12 17c5 0 8-2.69 8-6H4c0 3.31 3 6 8 6m-4 4h8m-4-3v3M5.14 11a3.5 3.5 0 1 1 6.71 0",key:"1uxfcu"}],["path",{d:"M12.14 11a3.5 3.5 0 1 1 6.71 0",key:"4k3m1s"}],["path",{d:"M15.5 6.5a3.5 3.5 0 1 0-7 0",key:"zmuahr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d2=V("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 gV=V("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 xV=V("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 yV=V("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 vV=V("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 _V=V("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 X1=V("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 bV=V("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 wV=V("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 El=V("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 jV=V("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 kV=V("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 NV=V("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u2=V("IndentDecrease",[["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 18H11",key:"4wu86t"}],["path",{d:"M21 6H11",key:"6dy1d6"}],["path",{d:"m7 8-4 4 4 4",key:"o5hrat"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h2=V("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 SV=V("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 CV=V("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 MV=V("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 TV=V("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 ju=V("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 $S=V("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 AV=V("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 EV=V("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 IV=V("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 PV=V("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 xy=V("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 qj=V("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 LV=V("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 wm=V("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 OV=V("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 DV=V("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 RV=V("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 FV=V("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 zV=V("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 BV=V("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 $V=V("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 UV=V("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 qV=V("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 VV=V("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 HV=V("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 WV=V("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 GV=V("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 m2=V("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 KV=V("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 ZV=V("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 YV=V("Lasso",[["path",{d:"M7 22a5 5 0 0 1-2-4",key:"umushi"}],["path",{d:"M3.3 14A6.8 6.8 0 0 1 2 10c0-4.4 4.5-8 10-8s10 3.6 10 8-4.5 8-10 8a12 12 0 0 1-5-1",key:"146dds"}],["path",{d:"M5 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z",key:"bq3ynw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XV=V("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 QV=V("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 JV=V("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 eH=V("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 Vj=V("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 yp=V("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 tH=V("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 rH=V("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 sH=V("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 Hj=V("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 nH=V("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 aH=V("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 iH=V("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 oH=V("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 lH=V("LibraryBig",[["rect",{width:"8",height:"18",x:"3",y:"3",rx:"1",key:"oynpb5"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z",key:"1qboyk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const US=V("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qS=V("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 cH=V("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 dH=V("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 yy=V("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 uH=V("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 jm=V("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bo=V("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 km=V("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 hH=V("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 mH=V("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 pH=V("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 fH=V("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 gH=V("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 xH=V("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 yH=V("ListMusic",[["path",{d:"M21 15V6",key:"h1cx4g"}],["path",{d:"M18.5 18a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z",key:"8saifv"}],["path",{d:"M12 12H3",key:"18klou"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M12 18H3",key:"11ftsu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VS=V("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 vH=V("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 _H=V("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 bH=V("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 wH=V("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 jH=V("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 kH=V("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 NH=V("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 vp=V("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 Hr=V("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 SH=V("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 CH=V("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 MH=V("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 TH=V("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 wA=V("Locate",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p2=V("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 AH=V("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 f2=V("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 ku=V("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HS=V("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WS=V("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 EH=V("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 IH=V("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 PH=V("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 LH=V("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 OH=V("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 DH=V("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 RH=V("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 FH=V("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 zH=V("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 BH=V("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 $H=V("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 jA=V("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 mn=V("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 UH=V("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 qH=V("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 VH=V("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 HH=V("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 WH=V("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 GH=V("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 KH=V("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 ZH=V("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 YH=V("MapPinPlusInside",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XH=V("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 QH=V("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 JH=V("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 eo=V("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 eW=V("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 tW=V("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 rW=V("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 sW=V("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 nW=V("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 vy=V("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 aW=V("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 Bf=V("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 iW=V("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 oW=V("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 kA=V("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 lW=V("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 cW=V("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 dW=V("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 GS=V("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 uW=V("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 hW=V("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 mW=V("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 NA=V("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 pW=V("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 fW=V("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 gW=V("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 Pl=V("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 xW=V("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 yW=V("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 vW=V("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 _W=V("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 SA=V("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 bW=V("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 wW=V("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 jW=V("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 CA=V("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 MA=V("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 kW=V("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 NW=V("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 SW=V("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 CW=V("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 MW=V("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 $o=V("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 TW=V("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 AW=V("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g2=V("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 TA=V("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 EW=V("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 IW=V("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 PW=V("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 LW=V("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 OW=V("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 DW=V("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 RW=V("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 FW=V("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 Q1=V("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 zW=V("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 BW=V("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 $W=V("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 UW=V("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 qW=V("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 VW=V("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 HW=V("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 WW=V("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 GW=V("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 KW=V("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 ZW=V("MonitorUp",[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YW=V("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 Wj=V("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 XW=V("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=V("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 JW=V("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 eG=V("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 tG=V("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 rG=V("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 sG=V("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 J1=V("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 nG=V("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 aG=V("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 x2=V("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 iG=V("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 oG=V("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 lG=V("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 cG=V("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 dG=V("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 uG=V("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 hG=V("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 mG=V("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 pG=V("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 fG=V("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 gG=V("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 xG=V("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 yG=V("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 vG=V("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 _G=V("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 bG=V("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 wG=V("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 jG=V("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 kG=V("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 NG=V("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 AA=V("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 SG=V("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 _y=V("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 CG=V("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 MG=V("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 TG=V("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 AG=V("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 EG=V("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 IG=V("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 PG=V("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 LG=V("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 OG=V("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 y2=V("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 DG=V("OctagonMinus",[["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v2=V("OctagonPause",[["path",{d:"M10 15V9",key:"1lckn7"}],["path",{d:"M14 15V9",key:"1muqhk"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _2=V("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 RG=V("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 FG=V("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 zG=V("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 BG=V("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 $G=V("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 UG=V("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 qG=V("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 VG=V("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 HG=V("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 WG=V("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 GG=V("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 KG=V("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 Wl=V("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 ZG=V("PaintBucket",[["path",{d:"m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z",key:"irua1i"}],["path",{d:"m5 2 5 5",key:"1lls2c"}],["path",{d:"M2 13h15",key:"1hkzvu"}],["path",{d:"M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z",key:"xk76lq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YG=V("PaintRoller",[["rect",{width:"16",height:"6",x:"2",y:"2",rx:"2",key:"jcyz7m"}],["path",{d:"M10 16v-2a2 2 0 0 1 2-2h8a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2",key:"1b9h7c"}],["rect",{width:"4",height:"6",x:"8",y:"16",rx:"1",key:"d6e7yl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b2=V("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 XG=V("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 ed=V("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=V("PanelBottomClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"m15 8-3 3-3-3",key:"1oxy1z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w2=V("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 JG=V("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 eK=V("PanelBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j2=V("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k2=V("PanelLeftDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 14v1",key:"askpd8"}],["path",{d:"M9 19v2",key:"16tejx"}],["path",{d:"M9 3v2",key:"1noubl"}],["path",{d:"M9 9v1",key:"19ebxg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N2=V("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S2=V("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 tK=V("PanelRightClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C2=V("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 rK=V("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 sK=V("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 nK=V("PanelTopClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"m9 16 3-3 3 3",key:"1idcnm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M2=V("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 aK=V("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 iK=V("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 oK=V("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 lK=V("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 X0=V("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 Gj=V("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 cK=V("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 dK=V("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 td=V("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 Nm=V("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 uK=V("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 hK=V("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 Q0=V("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 mK=V("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 Kj=V("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 J0=V("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 pK=V("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 fK=V("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 gK=V("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 ei=V("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 xK=V("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 KS=V("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 yK=V("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 vK=V("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 _K=V("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 bK=V("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 wK=V("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 jK=V("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 kK=V("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 NK=V("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 wi=V("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 SK=V("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 CK=V("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 MK=V("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 TK=V("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 AK=V("PictureInPicture",[["path",{d:"M8 4.5v5H3m-1-6 6 6m13 0v-3c0-1.16-.84-2-2-2h-7m-9 9v2c0 1.05.95 2 2 2h3",key:"bcd8fb"}],["rect",{width:"10",height:"7",x:"12",y:"13.5",ry:"2",key:"136fx3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EK=V("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 IK=V("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 PK=V("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 LK=V("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 OK=V("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 DK=V("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 EA=V("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 ev=V("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 RK=V("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 FK=V("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 zK=V("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 BK=V("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 $K=V("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 Gl=V("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UK=V("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 T2=V("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 IA=V("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 gs=V("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 qK=V("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 VK=V("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 HK=V("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 WK=V("PointerOff",[["path",{d:"M10 4.5V4a2 2 0 0 0-2.41-1.957",key:"jsi14n"}],["path",{d:"M13.9 8.4a2 2 0 0 0-1.26-1.295",key:"hirc7f"}],["path",{d:"M21.7 16.2A8 8 0 0 0 22 14v-3a2 2 0 1 0-4 0v-1a2 2 0 0 0-3.63-1.158",key:"1jxb2e"}],["path",{d:"m7 15-1.8-1.8a2 2 0 0 0-2.79 2.86L6 19.7a7.74 7.74 0 0 0 6 2.3h2a8 8 0 0 0 5.657-2.343",key:"10r7hm"}],["path",{d:"M6 6v8",key:"tv5xkp"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GK=V("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 KK=V("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 ZK=V("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 YK=V("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 XK=V("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 QK=V("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 $f=V("Presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JK=V("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 PA=V("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 eZ=V("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 tZ=V("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 rZ=V("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 sZ=V("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 Zj=V("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 LA=V("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 nZ=V("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 aZ=V("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 iZ=V("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 oZ=V("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 lZ=V("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 cZ=V("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 Yj=V("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 dZ=V("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 uZ=V("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 hZ=V("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 mZ=V("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 pZ=V("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 fZ=V("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 gZ=V("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 xZ=V("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 yZ=V("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 vZ=V("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 _Z=V("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 bZ=V("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 wZ=V("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 jZ=V("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 A2=V("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 kZ=V("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 NZ=V("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 SZ=V("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 CZ=V("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 MZ=V("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 ZS=V("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 TZ=V("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 AZ=V("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 EZ=V("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 Ko=V("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 IZ=V("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 PZ=V("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 LZ=V("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 OZ=V("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 DZ=V("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 OA=V("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 RZ=V("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 FZ=V("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 zZ=V("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 DA=V("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 BZ=V("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 $Z=V("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 Kg=V("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 UZ=V("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 qZ=V("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 E2=V("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 VZ=V("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 Xj=V("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 HZ=V("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 RA=V("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 WZ=V("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 GZ=V("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 KZ=V("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 I2=V("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 P2=V("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 ZZ=V("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 YZ=V("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 XZ=V("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 QZ=V("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 JZ=V("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 eY=V("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 tY=V("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 rY=V("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 sY=V("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 nY=V("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 aY=V("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 _p=V("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 L2=V("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 iY=V("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 oY=V("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 lY=V("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 cY=V("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 dY=V("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 uY=V("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 hY=V("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 mY=V("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 pY=V("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 fY=V("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 gY=V("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 xY=V("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 yY=V("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 vY=V("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 _Y=V("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 bY=V("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 wY=V("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 jY=V("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 kY=V("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 NY=V("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 SY=V("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 Qn=V("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 CY=V("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 O2=V("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 MY=V("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 Mi=V("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 TY=V("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 AY=V("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 EY=V("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 IY=V("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 PY=V("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 LY=V("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 OY=V("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 vd=V("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 DY=V("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 Oc=V("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 FA=V("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 RY=V("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 FY=V("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 zY=V("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 BY=V("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 zA=V("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 $Y=V("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 UY=V("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 qY=V("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 VY=V("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 HY=V("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 WY=V("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 D2=V("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 Nu=V("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 GY=V("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 KY=V("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 ZY=V("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 Zg=V("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 YY=V("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 Lh=V("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 XY=V("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 QY=V("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 JY=V("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 eX=V("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 tX=V("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 rX=V("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 sX=V("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 nX=V("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 aX=V("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 iX=V("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 oX=V("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 lX=V("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 cX=V("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 dX=V("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 uX=V("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 hX=V("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 mX=V("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 pX=V("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 fX=V("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 gX=V("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 xX=V("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 BA=V("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 R2=V("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 yX=V("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 vX=V("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 by=V("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 _X=V("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 bX=V("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 wX=V("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 T1=V("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 jX=V("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 kX=V("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 NX=V("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 SX=V("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 CX=V("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 An=V("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 MX=V("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 TX=V("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 AX=V("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 EX=V("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 IX=V("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 PX=V("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 LX=V("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 OX=V("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 F2=V("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 z2=V("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 B2=V("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 $2=V("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 U2=V("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 q2=V("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 V2=V("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 H2=V("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 W2=V("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 G2=V("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 K2=V("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 Z2=V("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 Y2=V("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 X2=V("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 Q2=V("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 kg=V("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 e1=V("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 J2=V("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 ew=V("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 tw=V("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 rw=V("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 sw=V("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 nw=V("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 DX=V("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 RX=V("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 aw=V("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 iw=V("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 ow=V("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 lw=V("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 cw=V("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 dw=V("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 uw=V("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 hw=V("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 mw=V("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 pw=V("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 fw=V("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 gw=V("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 xw=V("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 yw=V("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 vw=V("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 wc=V("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 _w=V("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 bw=V("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 ww=V("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 jw=V("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 kw=V("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 Nw=V("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 FX=V("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 Sw=V("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 Cw=V("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 Mw=V("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 Tw=V("SquareSplitHorizontal",[["path",{d:"M8 19H5c-1 0-2-1-2-2V7c0-1 1-2 2-2h3",key:"lubmu8"}],["path",{d:"M16 5h3c1 0 2 1 2 2v10c0 1-1 2-2 2h-3",key:"1ag34g"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Aw=V("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 zX=V("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 BX=V("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 Ew=V("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 Iw=V("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 Pw=V("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 Lw=V("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 Yg=V("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 $X=V("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 UX=V("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 qX=V("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 VX=V("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 HX=V("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 Ln=V("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 WX=V("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 GX=V("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 KX=V("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 ZX=V("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 YX=V("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 XX=V("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 QX=V("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 JX=V("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 eQ=V("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 tQ=V("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 rQ=V("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 sQ=V("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 nQ=V("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 aQ=V("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 tv=V("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 iQ=V("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 oQ=V("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 lQ=V("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 cQ=V("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 dQ=V("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 uQ=V("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 hQ=V("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 mQ=V("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 pQ=V("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 YS=V("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 fQ=V("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 gQ=V("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 xQ=V("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 yQ=V("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 vQ=V("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 _Q=V("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 bQ=V("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 wQ=V("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 jQ=V("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 kQ=V("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 Xg=V("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 NQ=V("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 SQ=V("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 CQ=V("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 MQ=V("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 TQ=V("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 AQ=V("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 EQ=V("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 bp=V("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 IQ=V("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 PQ=V("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 LQ=V("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 OQ=V("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 Ow=V("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 DQ=V("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 RQ=V("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 FQ=V("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 zQ=V("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 BQ=V("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 $Q=V("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 Dw=V("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 UQ=V("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 qQ=V("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 VQ=V("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 HQ=V("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 WQ=V("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 $A=V("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 _d=V("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 GQ=V("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 KQ=V("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 ZQ=V("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 YQ=V("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 XQ=V("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 QQ=V("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 UA=V("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 JQ=V("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 eJ=V("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 tJ=V("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 rJ=V("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 sJ=V("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 nJ=V("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 aJ=V("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 iJ=V("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 oJ=V("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 lJ=V("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 cJ=V("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 dJ=V("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 uJ=V("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 hJ=V("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 mJ=V("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 pJ=V("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 fJ=V("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 gJ=V("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 xJ=V("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 Rw=V("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 Rs=V("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 yJ=V("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 vJ=V("TreeDeciduous",[["path",{d:"M8 19a4 4 0 0 1-2.24-7.32A3.5 3.5 0 0 1 9 6.03V6a3 3 0 1 1 6 0v.04a3.5 3.5 0 0 1 3.24 5.65A4 4 0 0 1 16 19Z",key:"oadzkq"}],["path",{d:"M12 19v3",key:"npa21l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fw=V("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 rv=V("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 _J=V("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 bJ=V("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 Qj=V("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 wJ=V("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 ou=V("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 Qu=V("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 jJ=V("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 kJ=V("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 ho=V("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 qA=V("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 NJ=V("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 SJ=V("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 zw=V("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 CJ=V("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 MJ=V("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 TJ=V("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 AJ=V("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 EJ=V("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 IJ=V("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 PJ=V("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 LJ=V("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 OJ=V("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 DJ=V("UndoDot",[["path",{d:"M21 17a9 9 0 0 0-15-6.7L3 13",key:"8mp6z9"}],["path",{d:"M3 7v6h6",key:"1v2h90"}],["circle",{cx:"12",cy:"17",r:"1",key:"1ixnty"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XS=V("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 RJ=V("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 FJ=V("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 zJ=V("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 Bw=V("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 BJ=V("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 VA=V("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 $J=V("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 to=V("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 UJ=V("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 Jj=V("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 HA=V("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 WA=V("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 qJ=V("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 $d=V("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 $w=V("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 Uw=V("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 qw=V("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 VJ=V("UserRoundPen",[["path",{d:"M2 21a8 8 0 0 1 10.821-7.487",key:"1c8h7z"}],["path",{d:"M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1817ys"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vw=V("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 HJ=V("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 Hw=V("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 Ww=V("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 WJ=V("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 GJ=V("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 Kl=V("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 Gw=V("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 ws=V("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 Kw=V("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 Zw=V("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 KJ=V("UtilityPole",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M3 3v2",key:"9imdir"}],["path",{d:"M7 3v2",key:"n0os7"}],["path",{d:"M17 3v2",key:"1l2re6"}],["path",{d:"M21 3v2",key:"1duuac"}],["path",{d:"m19 5-7 7-7-7",key:"133zxf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GA=V("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 ZJ=V("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 YJ=V("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 XJ=V("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 QJ=V("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 JJ=V("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 eee=V("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 ya=V("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 tee=V("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 ree=V("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 see=V("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 nee=V("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 aee=V("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 iee=V("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 oee=V("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 lee=V("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 cee=V("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 dee=V("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 uee=V("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 Yw=V("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 hee=V("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 mee=V("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 Xw=V("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 pee=V("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 fee=V("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 gee=V("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 xee=V("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 yee=V("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 vee=V("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 _ee=V("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 bee=V("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 wee=V("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 jee=V("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 kee=V("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 Nee=V("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 See=V("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 Cee=V("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 Mee=V("WifiLow",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tee=V("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 Aee=V("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 Eee=V("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 Iee=V("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 Pee=V("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 Lee=V("WineOff",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M7 10h3m7 0h-1.343",key:"v48bem"}],["path",{d:"M12 15v7",key:"t2xh3l"}],["path",{d:"M7.307 7.307A12.33 12.33 0 0 0 7 10a5 5 0 0 0 7.391 4.391M8.638 2.981C8.75 2.668 8.872 2.34 9 2h6c1.5 4 2 6 2 8 0 .407-.05.809-.145 1.198",key:"1ymjlu"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oee=V("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 Dee=V("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 Ree=V("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 Fee=V("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 wy=V("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 rn=V("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 zee=V("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 Bee=V("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 Qg=V("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 QS=V("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 JS=V("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 EQe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:_O,AArrowUp:bO,ALargeSmall:wO,Accessibility:jO,Activity:qg,AirVent:kO,Airplay:NO,AlarmClock:CO,AlarmClockCheck:B_,AlarmClockMinus:$_,AlarmClockOff:SO,AlarmClockPlus:U_,AlarmSmoke:MO,Album:TO,AlignCenter:ES,AlignCenterHorizontal:AO,AlignCenterVertical:EO,AlignEndHorizontal:IO,AlignEndVertical:PO,AlignHorizontalDistributeCenter:LO,AlignHorizontalDistributeEnd:OO,AlignHorizontalDistributeStart:DO,AlignHorizontalJustifyCenter:RO,AlignHorizontalJustifyEnd:FO,AlignHorizontalJustifyStart:zO,AlignHorizontalSpaceAround:BO,AlignHorizontalSpaceBetween:$O,AlignJustify:UO,AlignLeft:IS,AlignRight:PS,AlignStartHorizontal:qO,AlignStartVertical:VO,AlignVerticalDistributeCenter:HO,AlignVerticalDistributeEnd:WO,AlignVerticalDistributeStart:GO,AlignVerticalJustifyCenter:KO,AlignVerticalJustifyEnd:ZO,AlignVerticalJustifyStart:YO,AlignVerticalSpaceAround:XO,AlignVerticalSpaceBetween:QO,Ambulance:JO,Ampersand:eD,Ampersands:tD,Amphora:rD,Anchor:sD,Angry:nD,Annoyed:aD,Antenna:iD,Anvil:oD,Aperture:lD,AppWindow:hA,AppWindowMac:cD,Apple:dD,Archive:mA,ArchiveRestore:uD,ArchiveX:hD,Armchair:mD,ArrowBigDown:fD,ArrowBigDownDash:pD,ArrowBigLeft:xD,ArrowBigLeftDash:gD,ArrowBigRight:vD,ArrowBigRightDash:yD,ArrowBigUp:bD,ArrowBigUpDash:_D,ArrowDown:my,ArrowDown01:wD,ArrowDown10:jD,ArrowDownAZ:q_,ArrowDownFromLine:kD,ArrowDownLeft:ND,ArrowDownNarrowWide:SD,ArrowDownRight:CD,ArrowDownToDot:MD,ArrowDownToLine:TD,ArrowDownUp:AD,ArrowDownWideNarrow:V_,ArrowDownZA:H_,ArrowLeft:_i,ArrowLeftFromLine:ED,ArrowLeftRight:ID,ArrowLeftToLine:PD,ArrowRight:Hi,ArrowRightFromLine:LD,ArrowRightLeft:py,ArrowRightToLine:OD,ArrowUp:fp,ArrowUp01:DD,ArrowUp10:RD,ArrowUpAZ:W_,ArrowUpDown:Of,ArrowUpFromDot:FD,ArrowUpFromLine:zD,ArrowUpLeft:BD,ArrowUpNarrowWide:G_,ArrowUpRight:$D,ArrowUpToLine:UD,ArrowUpWideNarrow:qD,ArrowUpZA:K_,ArrowsUpFromLine:VD,Asterisk:HD,AtSign:WD,Atom:GD,AudioLines:KD,AudioWaveform:ZD,Award:ql,Axe:YD,Axis3d:Z_,Baby:XD,Backpack:QD,Badge:pR,BadgeAlert:JD,BadgeCent:eR,BadgeCheck:Y_,BadgeDollarSign:tR,BadgeEuro:rR,BadgeHelp:sR,BadgeIndianRupee:nR,BadgeInfo:aR,BadgeJapaneseYen:iR,BadgeMinus:oR,BadgePercent:lR,BadgePlus:cR,BadgePoundSterling:dR,BadgeRussianRuble:uR,BadgeSwissFranc:hR,BadgeX:mR,BaggageClaim:fR,Ban:gR,Banana:xR,Bandage:yR,Banknote:vR,Barcode:_R,Baseline:bR,Bath:V1,Battery:CR,BatteryCharging:wR,BatteryFull:jR,BatteryLow:kR,BatteryMedium:NR,BatteryWarning:SR,Beaker:MR,Bean:AR,BeanOff:TR,Bed:H1,BedDouble:ER,BedSingle:IR,Beef:PR,Beer:OR,BeerOff:LR,Bell:Df,BellDot:DR,BellElectric:RR,BellMinus:FR,BellOff:Lj,BellPlus:zR,BellRing:BR,BetweenHorizontalEnd:X_,BetweenHorizontalStart:Q_,BetweenVerticalEnd:$R,BetweenVerticalStart:UR,BicepsFlexed:qR,Bike:VR,Binary:HR,Binoculars:WR,Biohazard:GR,Bird:KR,Bitcoin:ZR,Blend:YR,Blinds:XR,Blocks:QR,Bluetooth:rF,BluetoothConnected:JR,BluetoothOff:eF,BluetoothSearching:tF,Bold:LS,Bolt:sF,Bomb:nF,Bone:aF,Book:CF,BookA:iF,BookAudio:oF,BookCheck:lF,BookCopy:cF,BookDashed:J_,BookDown:dF,BookHeadphones:uF,BookHeart:hF,BookImage:mF,BookKey:pF,BookLock:fF,BookMarked:gF,BookMinus:xF,BookOpen:W1,BookOpenCheck:yF,BookOpenText:vF,BookPlus:_F,BookText:bF,BookType:wF,BookUp:kF,BookUp2:jF,BookUser:NF,BookX:SF,Bookmark:Rf,BookmarkCheck:MF,BookmarkMinus:TF,BookmarkPlus:pA,BookmarkX:AF,BoomBox:EF,Bot:OS,BotMessageSquare:IF,BotOff:PF,Box:LF,Boxes:OF,Braces:eb,Brackets:DF,Brain:fA,BrainCircuit:RF,BrainCog:FF,BrickWall:zF,Briefcase:wu,BriefcaseBusiness:BF,BriefcaseConveyorBelt:$F,BriefcaseMedical:UF,BringToFront:qF,Brush:VF,Bug:GF,BugOff:HF,BugPlay:WF,Building:Oj,Building2:bi,Bus:ZF,BusFront:KF,Cable:XF,CableCar:YF,Cake:vm,CakeSlice:QF,Calculator:JF,Calendar:Mn,Calendar1:ez,CalendarArrowDown:tz,CalendarArrowUp:rz,CalendarCheck:nz,CalendarCheck2:sz,CalendarClock:gA,CalendarCog:az,CalendarDays:Ff,CalendarFold:iz,CalendarHeart:oz,CalendarMinus:cz,CalendarMinus2:lz,CalendarOff:dz,CalendarPlus:Dj,CalendarPlus2:uz,CalendarRange:hz,CalendarSearch:mz,CalendarSync:pz,CalendarX:gz,CalendarX2:fz,Camera:Vg,CameraOff:xz,Candy:_z,CandyCane:yz,CandyOff:vz,Cannabis:bz,Captions:tb,CaptionsOff:wz,Car:Nz,CarFront:jz,CarTaxiFront:kz,Caravan:Sz,Carrot:Cz,CaseLower:Mz,CaseSensitive:Tz,CaseUpper:Az,CassetteTape:Ez,Cast:Iz,Castle:Pz,Cat:Lz,Cctv:Oz,ChartArea:rb,ChartBar:nb,ChartBarBig:sb,ChartBarDecreasing:Dz,ChartBarIncreasing:Rz,ChartBarStacked:Fz,ChartCandlestick:ab,ChartColumn:Nc,ChartColumnBig:ib,ChartColumnDecreasing:zz,ChartColumnIncreasing:ob,ChartColumnStacked:Bz,ChartGantt:$z,ChartLine:lb,ChartNetwork:Uz,ChartNoAxesColumn:db,ChartNoAxesColumnDecreasing:qz,ChartNoAxesColumnIncreasing:cb,ChartNoAxesCombined:Vz,ChartNoAxesGantt:ub,ChartPie:hb,ChartScatter:mb,ChartSpline:Hz,Check:li,CheckCheck:Wz,ChefHat:Gz,Cherry:Kz,ChevronDown:Jc,ChevronFirst:Zz,ChevronLast:Yz,ChevronLeft:uc,ChevronRight:Wi,ChevronUp:Hg,ChevronsDown:Qz,ChevronsDownUp:Xz,ChevronsLeft:t7,ChevronsLeftRight:e7,ChevronsLeftRightEllipsis:Jz,ChevronsRight:s7,ChevronsRightLeft:r7,ChevronsUp:n7,ChevronsUpDown:fy,Chrome:a7,Church:i7,Cigarette:l7,CigaretteOff:o7,Circle:ah,CircleAlert:_l,CircleArrowDown:pb,CircleArrowLeft:fb,CircleArrowOutDownLeft:gb,CircleArrowOutDownRight:xb,CircleArrowOutUpLeft:yb,CircleArrowOutUpRight:vb,CircleArrowRight:_b,CircleArrowUp:bb,CircleCheck:Li,CircleCheckBig:ui,CircleChevronDown:wb,CircleChevronLeft:jb,CircleChevronRight:kb,CircleChevronUp:Nb,CircleDashed:c7,CircleDivide:Sb,CircleDollarSign:d7,CircleDot:h7,CircleDotDashed:u7,CircleEllipsis:m7,CircleEqual:p7,CircleFadingArrowUp:f7,CircleFadingPlus:g7,CircleGauge:Cb,CircleHelp:ey,CircleMinus:Mb,CircleOff:x7,CircleParking:Ab,CircleParkingOff:Tb,CirclePause:Eb,CirclePercent:Ib,CirclePlay:lp,CirclePlus:Pb,CirclePower:Lb,CircleSlash:y7,CircleSlash2:Ob,CircleStop:Db,CircleUser:Fb,CircleUserRound:Rb,CircleX:Sc,CircuitBoard:v7,Citrus:_7,Clapperboard:b7,Clipboard:M7,ClipboardCheck:DS,ClipboardCopy:w7,ClipboardList:xA,ClipboardMinus:j7,ClipboardPaste:k7,ClipboardPen:Bb,ClipboardPenLine:zb,ClipboardPlus:N7,ClipboardType:S7,ClipboardX:C7,Clock:Ea,Clock1:T7,Clock10:A7,Clock11:E7,Clock12:I7,Clock2:P7,Clock3:L7,Clock4:O7,Clock5:D7,Clock6:R7,Clock7:F7,Clock8:z7,Clock9:B7,ClockAlert:$7,ClockArrowDown:U7,ClockArrowUp:q7,Cloud:n9,CloudAlert:V7,CloudCog:H7,CloudDownload:$b,CloudDrizzle:W7,CloudFog:G7,CloudHail:K7,CloudLightning:Z7,CloudMoon:X7,CloudMoonRain:Y7,CloudOff:Q7,CloudRain:e9,CloudRainWind:J7,CloudSnow:t9,CloudSun:s9,CloudSunRain:r9,CloudUpload:Ub,Cloudy:a9,Clover:oy,Club:i9,Code:Rj,CodeXml:qb,Codepen:o9,Codesandbox:l9,Coffee:Fj,Cog:c9,Coins:d9,Columns2:Vb,Columns3:Hb,Columns4:u9,Combine:h9,Command:m9,Compass:p9,Component:f9,Computer:g9,ConciergeBell:x9,Cone:y9,Construction:v9,Contact:zj,ContactRound:Wb,Container:_9,Contrast:b9,Cookie:w9,CookingPot:j9,Copy:fo,CopyCheck:k9,CopyMinus:N9,CopyPlus:S9,CopySlash:C9,CopyX:M9,Copyleft:T9,Copyright:A9,CornerDownLeft:E9,CornerDownRight:I9,CornerLeftDown:P9,CornerLeftUp:L9,CornerRightDown:O9,CornerRightUp:D9,CornerUpLeft:R9,CornerUpRight:F9,Cpu:z9,CreativeCommons:B9,CreditCard:gp,Croissant:$9,Crop:U9,Cross:q9,Crosshair:V9,Crown:ih,Cuboid:H9,CupSoda:W9,Currency:G9,Cylinder:K9,Dam:Z9,Database:Q9,DatabaseBackup:Y9,DatabaseZap:X9,Delete:J9,Dessert:eB,Diameter:tB,Diamond:nB,DiamondMinus:rB,DiamondPercent:Gb,DiamondPlus:sB,Dice1:aB,Dice2:iB,Dice3:oB,Dice4:lB,Dice5:cB,Dice6:dB,Dices:uB,Diff:hB,Disc:gB,Disc2:mB,Disc3:pB,DiscAlbum:fB,Divide:xB,Dna:vB,DnaOff:yB,Dock:_B,Dog:bB,DollarSign:yd,Donut:wB,DoorClosed:jB,DoorOpen:Bj,Dot:kB,Download:Oi,DraftingCompass:NB,Drama:SB,Dribbble:CB,Drill:MB,Droplet:TB,Droplets:Wg,Drum:AB,Drumstick:EB,Dumbbell:IB,Ear:LB,EarOff:PB,Earth:Kb,EarthLock:OB,Eclipse:DB,Egg:RS,EggFried:RB,EggOff:FB,Ellipsis:kf,EllipsisVertical:Pg,Equal:$B,EqualApproximately:zB,EqualNot:BB,Eraser:UB,EthernetPort:qB,Euro:VB,Expand:HB,ExternalLink:En,Eye:Gi,EyeClosed:WB,EyeOff:zf,Facebook:iu,Factory:GB,Fan:KB,FastForward:ZB,Feather:YB,Fence:XB,FerrisWheel:QB,Figma:JB,File:FS,FileArchive:e$,FileAudio:r$,FileAudio2:t$,FileAxis3d:Zb,FileBadge:n$,FileBadge2:s$,FileBox:a$,FileChartColumn:Xb,FileChartColumnIncreasing:Yb,FileChartLine:Qb,FileChartPie:Jb,FileCheck:o$,FileCheck2:i$,FileClock:l$,FileCode:d$,FileCode2:c$,FileCog:e2,FileDiff:u$,FileDigit:h$,FileDown:m$,FileHeart:p$,FileImage:G1,FileInput:f$,FileJson:x$,FileJson2:g$,FileKey:v$,FileKey2:y$,FileLock:b$,FileLock2:_$,FileMinus:j$,FileMinus2:w$,FileMusic:k$,FileOutput:N$,FilePen:r2,FilePenLine:t2,FilePlus:C$,FilePlus2:S$,FileQuestion:M$,FileScan:T$,FileSearch:E$,FileSearch2:A$,FileSliders:I$,FileSpreadsheet:K1,FileStack:P$,FileSymlink:L$,FileTerminal:O$,FileText:fa,FileType:R$,FileType2:D$,FileUp:F$,FileUser:z$,FileVideo:$$,FileVideo2:B$,FileVolume:q$,FileVolume2:U$,FileWarning:V$,FileX:W$,FileX2:H$,Files:G$,Film:Od,Filter:Z1,FilterX:K$,Fingerprint:Z$,FireExtinguisher:Y$,Fish:J$,FishOff:X$,FishSymbol:Q$,Flag:gy,FlagOff:eU,FlagTriangleLeft:tU,FlagTriangleRight:rU,Flame:_m,FlameKindling:sU,Flashlight:aU,FlashlightOff:nU,FlaskConical:$j,FlaskConicalOff:iU,FlaskRound:oU,FlipHorizontal:cU,FlipHorizontal2:lU,FlipVertical:uU,FlipVertical2:dU,Flower:hU,Flower2:Tf,Focus:mU,FoldHorizontal:pU,FoldVertical:fU,Folder:UU,FolderArchive:gU,FolderCheck:xU,FolderClock:yU,FolderClosed:vU,FolderCode:_U,FolderCog:s2,FolderDot:bU,FolderDown:wU,FolderGit:kU,FolderGit2:jU,FolderHeart:NU,FolderInput:SU,FolderKanban:CU,FolderKey:MU,FolderLock:TU,FolderMinus:AU,FolderOpen:bm,FolderOpenDot:EU,FolderOutput:IU,FolderPen:n2,FolderPlus:PU,FolderRoot:LU,FolderSearch:DU,FolderSearch2:OU,FolderSymlink:RU,FolderSync:FU,FolderTree:zU,FolderUp:BU,FolderX:$U,Folders:qU,Footprints:VU,Forklift:HU,Forward:WU,Frame:GU,Framer:KU,Frown:ZU,Fuel:YU,Fullscreen:XU,GalleryHorizontal:JU,GalleryHorizontalEnd:QU,GalleryThumbnails:eq,GalleryVertical:rq,GalleryVerticalEnd:tq,Gamepad:nq,Gamepad2:sq,Gauge:aq,Gavel:iq,Gem:oq,Ghost:Uj,Gift:uo,GitBranch:cq,GitBranchPlus:lq,GitCommitHorizontal:a2,GitCommitVertical:dq,GitCompare:hq,GitCompareArrows:uq,GitFork:mq,GitGraph:pq,GitMerge:fq,GitPullRequest:bq,GitPullRequestArrow:gq,GitPullRequestClosed:xq,GitPullRequestCreate:vq,GitPullRequestCreateArrow:yq,GitPullRequestDraft:_q,Github:wq,Gitlab:jq,GlassWater:kq,Glasses:Nq,Globe:Gg,GlobeLock:Sq,Goal:Cq,Grab:Mq,GraduationCap:Y1,Grape:Tq,Grid2x2:o2,Grid2x2Check:Aq,Grid2x2Plus:i2,Grid2x2X:Eq,Grid3x3:im,Grip:Pq,GripHorizontal:Iq,GripVertical:xp,Group:Lq,Guitar:Oq,Ham:Dq,Hammer:Rq,Hand:yA,HandCoins:Fq,HandHeart:zq,HandHelping:l2,HandMetal:Bq,HandPlatter:$q,Handshake:Uq,HardDrive:vA,HardDriveDownload:qq,HardDriveUpload:Vq,HardHat:Hq,Hash:zS,Haze:Wq,HdmiPort:Gq,Heading:Qq,Heading1:_A,Heading2:bA,Heading3:Kq,Heading4:Zq,Heading5:Yq,Heading6:Xq,HeadphoneOff:Jq,Headphones:eV,Headset:tV,Heart:Ci,HeartCrack:rV,HeartHandshake:sV,HeartOff:nV,HeartPulse:aV,Heater:iV,Hexagon:oV,Highlighter:lV,History:BS,Hop:dV,HopOff:cV,Hospital:uV,Hotel:hV,Hourglass:mV,House:Wn,HousePlug:pV,HousePlus:fV,IceCreamBowl:c2,IceCreamCone:d2,IdCard:gV,Image:El,ImageDown:xV,ImageMinus:yV,ImageOff:vV,ImagePlay:_V,ImagePlus:X1,ImageUp:bV,ImageUpscale:wV,Images:jV,Import:kV,Inbox:NV,IndentDecrease:u2,IndentIncrease:h2,IndianRupee:SV,Infinity:CV,Info:MV,InspectionPanel:TV,Instagram:ju,Italic:$S,IterationCcw:AV,IterationCw:EV,JapaneseYen:IV,Joystick:PV,Kanban:xy,Key:wm,KeyRound:qj,KeySquare:LV,Keyboard:RV,KeyboardMusic:OV,KeyboardOff:DV,Lamp:qV,LampCeiling:FV,LampDesk:zV,LampFloor:BV,LampWallDown:$V,LampWallUp:UV,LandPlot:VV,Landmark:HV,Languages:WV,Laptop:KV,LaptopMinimal:m2,LaptopMinimalCheck:GV,Lasso:YV,LassoSelect:ZV,Laugh:XV,Layers:eH,Layers2:QV,Layers3:JV,LayoutDashboard:Vj,LayoutGrid:yp,LayoutList:tH,LayoutPanelLeft:rH,LayoutPanelTop:sH,LayoutTemplate:Hj,Leaf:nH,LeafyGreen:aH,Lectern:iH,LetterText:oH,Library:US,LibraryBig:lH,LifeBuoy:qS,Ligature:cH,Lightbulb:yy,LightbulbOff:dH,Link:Bo,Link2:jm,Link2Off:uH,Linkedin:km,List:vp,ListCheck:hH,ListChecks:mH,ListCollapse:pH,ListEnd:fH,ListFilter:gH,ListMinus:xH,ListMusic:yH,ListOrdered:VS,ListPlus:vH,ListRestart:_H,ListStart:bH,ListTodo:wH,ListTree:jH,ListVideo:kH,ListX:NH,Loader:CH,LoaderCircle:Hr,LoaderPinwheel:SH,Locate:wA,LocateFixed:MH,LocateOff:TH,Lock:ku,LockKeyhole:AH,LockKeyholeOpen:p2,LockOpen:f2,LogIn:HS,LogOut:WS,Logs:EH,Lollipop:IH,Luggage:PH,Magnet:LH,Mail:mn,MailCheck:OH,MailMinus:DH,MailOpen:RH,MailPlus:FH,MailQuestion:zH,MailSearch:BH,MailWarning:$H,MailX:jA,Mailbox:UH,Mails:qH,Map:tW,MapPin:eo,MapPinCheck:HH,MapPinCheckInside:VH,MapPinHouse:WH,MapPinMinus:KH,MapPinMinusInside:GH,MapPinOff:ZH,MapPinPlus:XH,MapPinPlusInside:YH,MapPinX:JH,MapPinXInside:QH,MapPinned:eW,Martini:rW,Maximize:nW,Maximize2:sW,Medal:vy,Megaphone:Bf,MegaphoneOff:aW,Meh:iW,MemoryStick:oW,Menu:kA,Merge:lW,MessageCircle:Pl,MessageCircleCode:cW,MessageCircleDashed:dW,MessageCircleHeart:GS,MessageCircleMore:uW,MessageCircleOff:hW,MessageCirclePlus:mW,MessageCircleQuestion:NA,MessageCircleReply:pW,MessageCircleWarning:fW,MessageCircleX:gW,MessageSquare:$o,MessageSquareCode:xW,MessageSquareDashed:yW,MessageSquareDiff:vW,MessageSquareDot:_W,MessageSquareHeart:SA,MessageSquareLock:bW,MessageSquareMore:wW,MessageSquareOff:jW,MessageSquarePlus:CA,MessageSquareQuote:MA,MessageSquareReply:kW,MessageSquareShare:NW,MessageSquareText:SW,MessageSquareWarning:CW,MessageSquareX:MW,MessagesSquare:TW,Mic:TA,MicOff:AW,MicVocal:g2,Microchip:EW,Microscope:IW,Microwave:PW,Milestone:LW,Milk:DW,MilkOff:OW,Minimize:FW,Minimize2:RW,Minus:Q1,Monitor:Wj,MonitorCheck:zW,MonitorCog:BW,MonitorDot:$W,MonitorDown:UW,MonitorOff:qW,MonitorPause:VW,MonitorPlay:HW,MonitorSmartphone:WW,MonitorSpeaker:GW,MonitorStop:KW,MonitorUp:ZW,MonitorX:YW,Moon:QW,MoonStar:XW,Mountain:eG,MountainSnow:JW,Mouse:aG,MouseOff:tG,MousePointer:nG,MousePointer2:rG,MousePointerBan:sG,MousePointerClick:J1,Move:yG,Move3d:x2,MoveDiagonal:oG,MoveDiagonal2:iG,MoveDown:dG,MoveDownLeft:lG,MoveDownRight:cG,MoveHorizontal:uG,MoveLeft:hG,MoveRight:mG,MoveUp:gG,MoveUpLeft:pG,MoveUpRight:fG,MoveVertical:xG,Music:wG,Music2:vG,Music3:_G,Music4:bG,Navigation:AA,Navigation2:kG,Navigation2Off:jG,NavigationOff:NG,Network:SG,Newspaper:_y,Nfc:CG,Notebook:EG,NotebookPen:MG,NotebookTabs:TG,NotebookText:AG,NotepadText:PG,NotepadTextDashed:IG,Nut:OG,NutOff:LG,Octagon:RG,OctagonAlert:y2,OctagonMinus:DG,OctagonPause:v2,OctagonX:_2,Omega:FG,Option:zG,Orbit:BG,Origami:$G,Package:Wl,Package2:UG,PackageCheck:qG,PackageMinus:VG,PackageOpen:HG,PackagePlus:WG,PackageSearch:GG,PackageX:KG,PaintBucket:ZG,PaintRoller:YG,Paintbrush:XG,PaintbrushVertical:b2,Palette:ed,PanelBottom:eK,PanelBottomClose:QG,PanelBottomDashed:w2,PanelBottomOpen:JG,PanelLeft:S2,PanelLeftClose:j2,PanelLeftDashed:k2,PanelLeftOpen:N2,PanelRight:sK,PanelRightClose:tK,PanelRightDashed:C2,PanelRightOpen:rK,PanelTop:iK,PanelTopClose:nK,PanelTopDashed:M2,PanelTopOpen:aK,PanelsLeftBottom:oK,PanelsRightBottom:lK,PanelsTopLeft:X0,Paperclip:Gj,Parentheses:cK,ParkingMeter:dK,PartyPopper:td,Pause:Nm,PawPrint:uK,PcCase:hK,Pen:J0,PenLine:Q0,PenOff:mK,PenTool:Kj,Pencil:ei,PencilLine:pK,PencilOff:fK,PencilRuler:gK,Pentagon:xK,Percent:KS,PersonStanding:yK,PhilippinePeso:vK,Phone:wi,PhoneCall:_K,PhoneForwarded:bK,PhoneIncoming:wK,PhoneMissed:jK,PhoneOff:kK,PhoneOutgoing:NK,Pi:SK,Piano:CK,Pickaxe:MK,PictureInPicture:AK,PictureInPicture2:TK,PiggyBank:EK,Pilcrow:LK,PilcrowLeft:IK,PilcrowRight:PK,Pill:DK,PillBottle:OK,Pin:ev,PinOff:EA,Pipette:RK,Pizza:FK,Plane:$K,PlaneLanding:zK,PlaneTakeoff:BK,Play:Gl,Plug:IA,Plug2:UK,PlugZap:T2,Plus:gs,Pocket:VK,PocketKnife:qK,Podcast:HK,Pointer:GK,PointerOff:WK,Popcorn:KK,Popsicle:ZK,PoundSterling:YK,Power:QK,PowerOff:XK,Presentation:$f,Printer:PA,PrinterCheck:JK,Projector:eZ,Proportions:tZ,Puzzle:rZ,Pyramid:sZ,QrCode:Zj,Quote:LA,Rabbit:nZ,Radar:aZ,Radiation:iZ,Radical:oZ,Radio:Yj,RadioReceiver:lZ,RadioTower:cZ,Radius:dZ,RailSymbol:uZ,Rainbow:hZ,Rat:mZ,Ratio:pZ,Receipt:jZ,ReceiptCent:fZ,ReceiptEuro:gZ,ReceiptIndianRupee:xZ,ReceiptJapaneseYen:yZ,ReceiptPoundSterling:vZ,ReceiptRussianRuble:_Z,ReceiptSwissFranc:bZ,ReceiptText:wZ,RectangleEllipsis:A2,RectangleHorizontal:kZ,RectangleVertical:NZ,Recycle:SZ,Redo:ZS,Redo2:CZ,RedoDot:MZ,RefreshCcw:AZ,RefreshCcwDot:TZ,RefreshCw:Ko,RefreshCwOff:EZ,Refrigerator:IZ,Regex:PZ,RemoveFormatting:LZ,Repeat:OA,Repeat1:OZ,Repeat2:DZ,Replace:FZ,ReplaceAll:RZ,Reply:DA,ReplyAll:zZ,Rewind:BZ,Ribbon:$Z,Rocket:Kg,RockingChair:UZ,RollerCoaster:qZ,Rotate3d:E2,RotateCcw:Xj,RotateCcwSquare:VZ,RotateCw:RA,RotateCwSquare:HZ,Route:GZ,RouteOff:WZ,Router:KZ,Rows2:I2,Rows3:P2,Rows4:ZZ,Rss:YZ,Ruler:XZ,RussianRuble:QZ,Sailboat:JZ,Salad:eY,Sandwich:tY,Satellite:sY,SatelliteDish:rY,Save:_p,SaveAll:nY,SaveOff:aY,Scale:iY,Scale3d:L2,Scaling:oY,Scan:fY,ScanBarcode:lY,ScanEye:cY,ScanFace:dY,ScanLine:uY,ScanQrCode:hY,ScanSearch:mY,ScanText:pY,School:gY,Scissors:yY,ScissorsLineDashed:xY,ScreenShare:_Y,ScreenShareOff:vY,Scroll:wY,ScrollText:bY,Search:Qn,SearchCheck:jY,SearchCode:kY,SearchSlash:NY,SearchX:SY,Section:CY,Send:Mi,SendHorizontal:O2,SendToBack:MY,SeparatorHorizontal:TY,SeparatorVertical:AY,Server:LY,ServerCog:EY,ServerCrash:IY,ServerOff:PY,Settings:vd,Settings2:OY,Shapes:DY,Share:FA,Share2:Oc,Sheet:RY,Shell:FY,Shield:Nu,ShieldAlert:zY,ShieldBan:BY,ShieldCheck:zA,ShieldEllipsis:$Y,ShieldHalf:UY,ShieldMinus:qY,ShieldOff:VY,ShieldPlus:HY,ShieldQuestion:WY,ShieldX:D2,Ship:KY,ShipWheel:GY,Shirt:ZY,ShoppingBag:Zg,ShoppingBasket:YY,ShoppingCart:Lh,Shovel:XY,ShowerHead:QY,Shrink:JY,Shrub:eX,Shuffle:tX,Sigma:rX,Signal:oX,SignalHigh:sX,SignalLow:nX,SignalMedium:aX,SignalZero:iX,Signature:lX,Signpost:dX,SignpostBig:cX,Siren:uX,SkipBack:hX,SkipForward:mX,Skull:pX,Slack:fX,Slash:gX,Slice:xX,SlidersHorizontal:BA,SlidersVertical:R2,Smartphone:by,SmartphoneCharging:yX,SmartphoneNfc:vX,Smile:bX,SmilePlus:_X,Snail:wX,Snowflake:T1,Sofa:jX,Soup:kX,Space:NX,Spade:SX,Sparkle:CX,Sparkles:An,Speaker:MX,Speech:TX,SpellCheck:EX,SpellCheck2:AX,Spline:IX,Split:PX,SprayCan:LX,Sprout:OX,Square:Yg,SquareActivity:F2,SquareArrowDown:$2,SquareArrowDownLeft:z2,SquareArrowDownRight:B2,SquareArrowLeft:U2,SquareArrowOutDownLeft:q2,SquareArrowOutDownRight:V2,SquareArrowOutUpLeft:H2,SquareArrowOutUpRight:W2,SquareArrowRight:G2,SquareArrowUp:Y2,SquareArrowUpLeft:K2,SquareArrowUpRight:Z2,SquareAsterisk:X2,SquareBottomDashedScissors:Q2,SquareChartGantt:kg,SquareCheck:J2,SquareCheckBig:e1,SquareChevronDown:ew,SquareChevronLeft:tw,SquareChevronRight:rw,SquareChevronUp:sw,SquareCode:nw,SquareDashed:ow,SquareDashedBottom:RX,SquareDashedBottomCode:DX,SquareDashedKanban:aw,SquareDashedMousePointer:iw,SquareDivide:lw,SquareDot:cw,SquareEqual:dw,SquareFunction:uw,SquareKanban:hw,SquareLibrary:mw,SquareM:pw,SquareMenu:fw,SquareMinus:gw,SquareMousePointer:xw,SquareParking:vw,SquareParkingOff:yw,SquarePen:wc,SquarePercent:_w,SquarePi:bw,SquarePilcrow:ww,SquarePlay:jw,SquarePlus:kw,SquarePower:Nw,SquareRadical:FX,SquareScissors:Sw,SquareSigma:Cw,SquareSlash:Mw,SquareSplitHorizontal:Tw,SquareSplitVertical:Aw,SquareSquare:zX,SquareStack:BX,SquareTerminal:Ew,SquareUser:Pw,SquareUserRound:Iw,SquareX:Lw,Squircle:$X,Squirrel:UX,Stamp:qX,Star:Ln,StarHalf:VX,StarOff:HX,StepBack:WX,StepForward:GX,Stethoscope:KX,Sticker:ZX,StickyNote:YX,Store:XX,StretchHorizontal:QX,StretchVertical:JX,Strikethrough:eQ,Subscript:tQ,Sun:tv,SunDim:rQ,SunMedium:sQ,SunMoon:nQ,SunSnow:aQ,Sunrise:iQ,Sunset:oQ,Superscript:lQ,SwatchBook:cQ,SwissFranc:dQ,SwitchCamera:uQ,Sword:hQ,Swords:mQ,Syringe:pQ,Table:bQ,Table2:YS,TableCellsMerge:fQ,TableCellsSplit:gQ,TableColumnsSplit:xQ,TableOfContents:yQ,TableProperties:vQ,TableRowsSplit:_Q,Tablet:jQ,TabletSmartphone:wQ,Tablets:kQ,Tag:Xg,Tags:NQ,Tally1:SQ,Tally2:CQ,Tally3:MQ,Tally4:TQ,Tally5:AQ,Tangent:EQ,Target:bp,Telescope:IQ,Tent:LQ,TentTree:PQ,Terminal:OQ,TestTube:DQ,TestTubeDiagonal:Ow,TestTubes:RQ,Text:UQ,TextCursor:zQ,TextCursorInput:FQ,TextQuote:BQ,TextSearch:$Q,TextSelect:Dw,Theater:qQ,Thermometer:WQ,ThermometerSnowflake:VQ,ThermometerSun:HQ,ThumbsDown:$A,ThumbsUp:_d,Ticket:UA,TicketCheck:GQ,TicketMinus:KQ,TicketPercent:ZQ,TicketPlus:YQ,TicketSlash:XQ,TicketX:QQ,Tickets:eJ,TicketsPlane:JQ,Timer:sJ,TimerOff:tJ,TimerReset:rJ,ToggleLeft:nJ,ToggleRight:aJ,Toilet:iJ,Tornado:oJ,Torus:lJ,Touchpad:dJ,TouchpadOff:cJ,TowerControl:uJ,ToyBrick:hJ,Tractor:mJ,TrafficCone:pJ,TrainFront:gJ,TrainFrontTunnel:fJ,TrainTrack:xJ,TramFront:Rw,Trash:yJ,Trash2:Rs,TreeDeciduous:vJ,TreePalm:Fw,TreePine:rv,Trees:_J,Trello:bJ,TrendingDown:Qj,TrendingUp:ou,TrendingUpDown:wJ,Triangle:kJ,TriangleAlert:Qu,TriangleRight:jJ,Trophy:ho,Truck:qA,Turtle:NJ,Tv:CJ,TvMinimal:zw,TvMinimalPlay:SJ,Twitch:MJ,Twitter:TJ,Type:EJ,TypeOutline:AJ,Umbrella:PJ,UmbrellaOff:IJ,Underline:LJ,Undo:XS,Undo2:OJ,UndoDot:DJ,UnfoldHorizontal:RJ,UnfoldVertical:FJ,Ungroup:zJ,University:Bw,Unlink:VA,Unlink2:BJ,Unplug:$J,Upload:to,Usb:UJ,User:Kl,UserCheck:Jj,UserCog:HA,UserMinus:WA,UserPen:qJ,UserPlus:$d,UserRound:Ww,UserRoundCheck:$w,UserRoundCog:Uw,UserRoundMinus:qw,UserRoundPen:VJ,UserRoundPlus:Vw,UserRoundSearch:HJ,UserRoundX:Hw,UserSearch:WJ,UserX:GJ,Users:ws,UsersRound:Gw,Utensils:Zw,UtensilsCrossed:Kw,UtilityPole:KJ,Variable:GA,Vault:ZJ,Vegan:YJ,VenetianMask:XJ,Vibrate:JJ,VibrateOff:QJ,Video:ya,VideoOff:eee,Videotape:tee,View:ree,Voicemail:see,Volleyball:nee,Volume:cee,Volume1:aee,Volume2:iee,VolumeOff:oee,VolumeX:lee,Vote:dee,Wallet:hee,WalletCards:uee,WalletMinimal:Yw,Wallpaper:mee,Wand:pee,WandSparkles:Xw,Warehouse:fee,WashingMachine:gee,Watch:xee,Waves:yee,Waypoints:vee,Webcam:_ee,Webhook:wee,WebhookOff:bee,Weight:jee,Wheat:Nee,WheatOff:kee,WholeWord:See,Wifi:Eee,WifiHigh:Cee,WifiLow:Mee,WifiOff:Tee,WifiZero:Aee,Wind:Pee,WindArrowDown:Iee,Wine:Oee,WineOff:Lee,Workflow:Dee,Worm:Ree,WrapText:Fee,Wrench:wy,X:rn,Youtube:zee,Zap:Qg,ZapOff:Bee,ZoomIn:QS,ZoomOut:JS},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 VIe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:_O,AArrowDownIcon:_O,AArrowUp:bO,AArrowUpIcon:bO,ALargeSmall:wO,ALargeSmallIcon:wO,Accessibility:jO,AccessibilityIcon:jO,Activity:qg,ActivityIcon:qg,ActivitySquare:F2,ActivitySquareIcon:F2,AirVent:kO,AirVentIcon:kO,Airplay:NO,AirplayIcon:NO,AlarmCheck:B_,AlarmCheckIcon:B_,AlarmClock:CO,AlarmClockCheck:B_,AlarmClockCheckIcon:B_,AlarmClockIcon:CO,AlarmClockMinus:$_,AlarmClockMinusIcon:$_,AlarmClockOff:SO,AlarmClockOffIcon:SO,AlarmClockPlus:U_,AlarmClockPlusIcon:U_,AlarmMinus:$_,AlarmMinusIcon:$_,AlarmPlus:U_,AlarmPlusIcon:U_,AlarmSmoke:MO,AlarmSmokeIcon:MO,Album:TO,AlbumIcon:TO,AlertCircle:_l,AlertCircleIcon:_l,AlertOctagon:y2,AlertOctagonIcon:y2,AlertTriangle:Qu,AlertTriangleIcon:Qu,AlignCenter:ES,AlignCenterHorizontal:AO,AlignCenterHorizontalIcon:AO,AlignCenterIcon:ES,AlignCenterVertical:EO,AlignCenterVerticalIcon:EO,AlignEndHorizontal:IO,AlignEndHorizontalIcon:IO,AlignEndVertical:PO,AlignEndVerticalIcon:PO,AlignHorizontalDistributeCenter:LO,AlignHorizontalDistributeCenterIcon:LO,AlignHorizontalDistributeEnd:OO,AlignHorizontalDistributeEndIcon:OO,AlignHorizontalDistributeStart:DO,AlignHorizontalDistributeStartIcon:DO,AlignHorizontalJustifyCenter:RO,AlignHorizontalJustifyCenterIcon:RO,AlignHorizontalJustifyEnd:FO,AlignHorizontalJustifyEndIcon:FO,AlignHorizontalJustifyStart:zO,AlignHorizontalJustifyStartIcon:zO,AlignHorizontalSpaceAround:BO,AlignHorizontalSpaceAroundIcon:BO,AlignHorizontalSpaceBetween:$O,AlignHorizontalSpaceBetweenIcon:$O,AlignJustify:UO,AlignJustifyIcon:UO,AlignLeft:IS,AlignLeftIcon:IS,AlignRight:PS,AlignRightIcon:PS,AlignStartHorizontal:qO,AlignStartHorizontalIcon:qO,AlignStartVertical:VO,AlignStartVerticalIcon:VO,AlignVerticalDistributeCenter:HO,AlignVerticalDistributeCenterIcon:HO,AlignVerticalDistributeEnd:WO,AlignVerticalDistributeEndIcon:WO,AlignVerticalDistributeStart:GO,AlignVerticalDistributeStartIcon:GO,AlignVerticalJustifyCenter:KO,AlignVerticalJustifyCenterIcon:KO,AlignVerticalJustifyEnd:ZO,AlignVerticalJustifyEndIcon:ZO,AlignVerticalJustifyStart:YO,AlignVerticalJustifyStartIcon:YO,AlignVerticalSpaceAround:XO,AlignVerticalSpaceAroundIcon:XO,AlignVerticalSpaceBetween:QO,AlignVerticalSpaceBetweenIcon:QO,Ambulance:JO,AmbulanceIcon:JO,Ampersand:eD,AmpersandIcon:eD,Ampersands:tD,AmpersandsIcon:tD,Amphora:rD,AmphoraIcon:rD,Anchor:sD,AnchorIcon:sD,Angry:nD,AngryIcon:nD,Annoyed:aD,AnnoyedIcon:aD,Antenna:iD,AntennaIcon:iD,Anvil:oD,AnvilIcon:oD,Aperture:lD,ApertureIcon:lD,AppWindow:hA,AppWindowIcon:hA,AppWindowMac:cD,AppWindowMacIcon:cD,Apple:dD,AppleIcon:dD,Archive:mA,ArchiveIcon:mA,ArchiveRestore:uD,ArchiveRestoreIcon:uD,ArchiveX:hD,ArchiveXIcon:hD,AreaChart:rb,AreaChartIcon:rb,Armchair:mD,ArmchairIcon:mD,ArrowBigDown:fD,ArrowBigDownDash:pD,ArrowBigDownDashIcon:pD,ArrowBigDownIcon:fD,ArrowBigLeft:xD,ArrowBigLeftDash:gD,ArrowBigLeftDashIcon:gD,ArrowBigLeftIcon:xD,ArrowBigRight:vD,ArrowBigRightDash:yD,ArrowBigRightDashIcon:yD,ArrowBigRightIcon:vD,ArrowBigUp:bD,ArrowBigUpDash:_D,ArrowBigUpDashIcon:_D,ArrowBigUpIcon:bD,ArrowDown:my,ArrowDown01:wD,ArrowDown01Icon:wD,ArrowDown10:jD,ArrowDown10Icon:jD,ArrowDownAZ:q_,ArrowDownAZIcon:q_,ArrowDownAz:q_,ArrowDownAzIcon:q_,ArrowDownCircle:pb,ArrowDownCircleIcon:pb,ArrowDownFromLine:kD,ArrowDownFromLineIcon:kD,ArrowDownIcon:my,ArrowDownLeft:ND,ArrowDownLeftFromCircle:gb,ArrowDownLeftFromCircleIcon:gb,ArrowDownLeftFromSquare:q2,ArrowDownLeftFromSquareIcon:q2,ArrowDownLeftIcon:ND,ArrowDownLeftSquare:z2,ArrowDownLeftSquareIcon:z2,ArrowDownNarrowWide:SD,ArrowDownNarrowWideIcon:SD,ArrowDownRight:CD,ArrowDownRightFromCircle:xb,ArrowDownRightFromCircleIcon:xb,ArrowDownRightFromSquare:V2,ArrowDownRightFromSquareIcon:V2,ArrowDownRightIcon:CD,ArrowDownRightSquare:B2,ArrowDownRightSquareIcon:B2,ArrowDownSquare:$2,ArrowDownSquareIcon:$2,ArrowDownToDot:MD,ArrowDownToDotIcon:MD,ArrowDownToLine:TD,ArrowDownToLineIcon:TD,ArrowDownUp:AD,ArrowDownUpIcon:AD,ArrowDownWideNarrow:V_,ArrowDownWideNarrowIcon:V_,ArrowDownZA:H_,ArrowDownZAIcon:H_,ArrowDownZa:H_,ArrowDownZaIcon:H_,ArrowLeft:_i,ArrowLeftCircle:fb,ArrowLeftCircleIcon:fb,ArrowLeftFromLine:ED,ArrowLeftFromLineIcon:ED,ArrowLeftIcon:_i,ArrowLeftRight:ID,ArrowLeftRightIcon:ID,ArrowLeftSquare:U2,ArrowLeftSquareIcon:U2,ArrowLeftToLine:PD,ArrowLeftToLineIcon:PD,ArrowRight:Hi,ArrowRightCircle:_b,ArrowRightCircleIcon:_b,ArrowRightFromLine:LD,ArrowRightFromLineIcon:LD,ArrowRightIcon:Hi,ArrowRightLeft:py,ArrowRightLeftIcon:py,ArrowRightSquare:G2,ArrowRightSquareIcon:G2,ArrowRightToLine:OD,ArrowRightToLineIcon:OD,ArrowUp:fp,ArrowUp01:DD,ArrowUp01Icon:DD,ArrowUp10:RD,ArrowUp10Icon:RD,ArrowUpAZ:W_,ArrowUpAZIcon:W_,ArrowUpAz:W_,ArrowUpAzIcon:W_,ArrowUpCircle:bb,ArrowUpCircleIcon:bb,ArrowUpDown:Of,ArrowUpDownIcon:Of,ArrowUpFromDot:FD,ArrowUpFromDotIcon:FD,ArrowUpFromLine:zD,ArrowUpFromLineIcon:zD,ArrowUpIcon:fp,ArrowUpLeft:BD,ArrowUpLeftFromCircle:yb,ArrowUpLeftFromCircleIcon:yb,ArrowUpLeftFromSquare:H2,ArrowUpLeftFromSquareIcon:H2,ArrowUpLeftIcon:BD,ArrowUpLeftSquare:K2,ArrowUpLeftSquareIcon:K2,ArrowUpNarrowWide:G_,ArrowUpNarrowWideIcon:G_,ArrowUpRight:$D,ArrowUpRightFromCircle:vb,ArrowUpRightFromCircleIcon:vb,ArrowUpRightFromSquare:W2,ArrowUpRightFromSquareIcon:W2,ArrowUpRightIcon:$D,ArrowUpRightSquare:Z2,ArrowUpRightSquareIcon:Z2,ArrowUpSquare:Y2,ArrowUpSquareIcon:Y2,ArrowUpToLine:UD,ArrowUpToLineIcon:UD,ArrowUpWideNarrow:qD,ArrowUpWideNarrowIcon:qD,ArrowUpZA:K_,ArrowUpZAIcon:K_,ArrowUpZa:K_,ArrowUpZaIcon:K_,ArrowsUpFromLine:VD,ArrowsUpFromLineIcon:VD,Asterisk:HD,AsteriskIcon:HD,AsteriskSquare:X2,AsteriskSquareIcon:X2,AtSign:WD,AtSignIcon:WD,Atom:GD,AtomIcon:GD,AudioLines:KD,AudioLinesIcon:KD,AudioWaveform:ZD,AudioWaveformIcon:ZD,Award:ql,AwardIcon:ql,Axe:YD,AxeIcon:YD,Axis3D:Z_,Axis3DIcon:Z_,Axis3d:Z_,Axis3dIcon:Z_,Baby:XD,BabyIcon:XD,Backpack:QD,BackpackIcon:QD,Badge:pR,BadgeAlert:JD,BadgeAlertIcon:JD,BadgeCent:eR,BadgeCentIcon:eR,BadgeCheck:Y_,BadgeCheckIcon:Y_,BadgeDollarSign:tR,BadgeDollarSignIcon:tR,BadgeEuro:rR,BadgeEuroIcon:rR,BadgeHelp:sR,BadgeHelpIcon:sR,BadgeIcon:pR,BadgeIndianRupee:nR,BadgeIndianRupeeIcon:nR,BadgeInfo:aR,BadgeInfoIcon:aR,BadgeJapaneseYen:iR,BadgeJapaneseYenIcon:iR,BadgeMinus:oR,BadgeMinusIcon:oR,BadgePercent:lR,BadgePercentIcon:lR,BadgePlus:cR,BadgePlusIcon:cR,BadgePoundSterling:dR,BadgePoundSterlingIcon:dR,BadgeRussianRuble:uR,BadgeRussianRubleIcon:uR,BadgeSwissFranc:hR,BadgeSwissFrancIcon:hR,BadgeX:mR,BadgeXIcon:mR,BaggageClaim:fR,BaggageClaimIcon:fR,Ban:gR,BanIcon:gR,Banana:xR,BananaIcon:xR,Bandage:yR,BandageIcon:yR,Banknote:vR,BanknoteIcon:vR,BarChart:cb,BarChart2:db,BarChart2Icon:db,BarChart3:Nc,BarChart3Icon:Nc,BarChart4:ob,BarChart4Icon:ob,BarChartBig:ib,BarChartBigIcon:ib,BarChartHorizontal:nb,BarChartHorizontalBig:sb,BarChartHorizontalBigIcon:sb,BarChartHorizontalIcon:nb,BarChartIcon:cb,Barcode:_R,BarcodeIcon:_R,Baseline:bR,BaselineIcon:bR,Bath:V1,BathIcon:V1,Battery:CR,BatteryCharging:wR,BatteryChargingIcon:wR,BatteryFull:jR,BatteryFullIcon:jR,BatteryIcon:CR,BatteryLow:kR,BatteryLowIcon:kR,BatteryMedium:NR,BatteryMediumIcon:NR,BatteryWarning:SR,BatteryWarningIcon:SR,Beaker:MR,BeakerIcon:MR,Bean:AR,BeanIcon:AR,BeanOff:TR,BeanOffIcon:TR,Bed:H1,BedDouble:ER,BedDoubleIcon:ER,BedIcon:H1,BedSingle:IR,BedSingleIcon:IR,Beef:PR,BeefIcon:PR,Beer:OR,BeerIcon:OR,BeerOff:LR,BeerOffIcon:LR,Bell:Df,BellDot:DR,BellDotIcon:DR,BellElectric:RR,BellElectricIcon:RR,BellIcon:Df,BellMinus:FR,BellMinusIcon:FR,BellOff:Lj,BellOffIcon:Lj,BellPlus:zR,BellPlusIcon:zR,BellRing:BR,BellRingIcon:BR,BetweenHorizonalEnd:X_,BetweenHorizonalEndIcon:X_,BetweenHorizonalStart:Q_,BetweenHorizonalStartIcon:Q_,BetweenHorizontalEnd:X_,BetweenHorizontalEndIcon:X_,BetweenHorizontalStart:Q_,BetweenHorizontalStartIcon:Q_,BetweenVerticalEnd:$R,BetweenVerticalEndIcon:$R,BetweenVerticalStart:UR,BetweenVerticalStartIcon:UR,BicepsFlexed:qR,BicepsFlexedIcon:qR,Bike:VR,BikeIcon:VR,Binary:HR,BinaryIcon:HR,Binoculars:WR,BinocularsIcon:WR,Biohazard:GR,BiohazardIcon:GR,Bird:KR,BirdIcon:KR,Bitcoin:ZR,BitcoinIcon:ZR,Blend:YR,BlendIcon:YR,Blinds:XR,BlindsIcon:XR,Blocks:QR,BlocksIcon:QR,Bluetooth:rF,BluetoothConnected:JR,BluetoothConnectedIcon:JR,BluetoothIcon:rF,BluetoothOff:eF,BluetoothOffIcon:eF,BluetoothSearching:tF,BluetoothSearchingIcon:tF,Bold:LS,BoldIcon:LS,Bolt:sF,BoltIcon:sF,Bomb:nF,BombIcon:nF,Bone:aF,BoneIcon:aF,Book:CF,BookA:iF,BookAIcon:iF,BookAudio:oF,BookAudioIcon:oF,BookCheck:lF,BookCheckIcon:lF,BookCopy:cF,BookCopyIcon:cF,BookDashed:J_,BookDashedIcon:J_,BookDown:dF,BookDownIcon:dF,BookHeadphones:uF,BookHeadphonesIcon:uF,BookHeart:hF,BookHeartIcon:hF,BookIcon:CF,BookImage:mF,BookImageIcon:mF,BookKey:pF,BookKeyIcon:pF,BookLock:fF,BookLockIcon:fF,BookMarked:gF,BookMarkedIcon:gF,BookMinus:xF,BookMinusIcon:xF,BookOpen:W1,BookOpenCheck:yF,BookOpenCheckIcon:yF,BookOpenIcon:W1,BookOpenText:vF,BookOpenTextIcon:vF,BookPlus:_F,BookPlusIcon:_F,BookTemplate:J_,BookTemplateIcon:J_,BookText:bF,BookTextIcon:bF,BookType:wF,BookTypeIcon:wF,BookUp:kF,BookUp2:jF,BookUp2Icon:jF,BookUpIcon:kF,BookUser:NF,BookUserIcon:NF,BookX:SF,BookXIcon:SF,Bookmark:Rf,BookmarkCheck:MF,BookmarkCheckIcon:MF,BookmarkIcon:Rf,BookmarkMinus:TF,BookmarkMinusIcon:TF,BookmarkPlus:pA,BookmarkPlusIcon:pA,BookmarkX:AF,BookmarkXIcon:AF,BoomBox:EF,BoomBoxIcon:EF,Bot:OS,BotIcon:OS,BotMessageSquare:IF,BotMessageSquareIcon:IF,BotOff:PF,BotOffIcon:PF,Box:LF,BoxIcon:LF,BoxSelect:ow,BoxSelectIcon:ow,Boxes:OF,BoxesIcon:OF,Braces:eb,BracesIcon:eb,Brackets:DF,BracketsIcon:DF,Brain:fA,BrainCircuit:RF,BrainCircuitIcon:RF,BrainCog:FF,BrainCogIcon:FF,BrainIcon:fA,BrickWall:zF,BrickWallIcon:zF,Briefcase:wu,BriefcaseBusiness:BF,BriefcaseBusinessIcon:BF,BriefcaseConveyorBelt:$F,BriefcaseConveyorBeltIcon:$F,BriefcaseIcon:wu,BriefcaseMedical:UF,BriefcaseMedicalIcon:UF,BringToFront:qF,BringToFrontIcon:qF,Brush:VF,BrushIcon:VF,Bug:GF,BugIcon:GF,BugOff:HF,BugOffIcon:HF,BugPlay:WF,BugPlayIcon:WF,Building:Oj,Building2:bi,Building2Icon:bi,BuildingIcon:Oj,Bus:ZF,BusFront:KF,BusFrontIcon:KF,BusIcon:ZF,Cable:XF,CableCar:YF,CableCarIcon:YF,CableIcon:XF,Cake:vm,CakeIcon:vm,CakeSlice:QF,CakeSliceIcon:QF,Calculator:JF,CalculatorIcon:JF,Calendar:Mn,Calendar1:ez,Calendar1Icon:ez,CalendarArrowDown:tz,CalendarArrowDownIcon:tz,CalendarArrowUp:rz,CalendarArrowUpIcon:rz,CalendarCheck:nz,CalendarCheck2:sz,CalendarCheck2Icon:sz,CalendarCheckIcon:nz,CalendarClock:gA,CalendarClockIcon:gA,CalendarCog:az,CalendarCogIcon:az,CalendarDays:Ff,CalendarDaysIcon:Ff,CalendarFold:iz,CalendarFoldIcon:iz,CalendarHeart:oz,CalendarHeartIcon:oz,CalendarIcon:Mn,CalendarMinus:cz,CalendarMinus2:lz,CalendarMinus2Icon:lz,CalendarMinusIcon:cz,CalendarOff:dz,CalendarOffIcon:dz,CalendarPlus:Dj,CalendarPlus2:uz,CalendarPlus2Icon:uz,CalendarPlusIcon:Dj,CalendarRange:hz,CalendarRangeIcon:hz,CalendarSearch:mz,CalendarSearchIcon:mz,CalendarSync:pz,CalendarSyncIcon:pz,CalendarX:gz,CalendarX2:fz,CalendarX2Icon:fz,CalendarXIcon:gz,Camera:Vg,CameraIcon:Vg,CameraOff:xz,CameraOffIcon:xz,CandlestickChart:ab,CandlestickChartIcon:ab,Candy:_z,CandyCane:yz,CandyCaneIcon:yz,CandyIcon:_z,CandyOff:vz,CandyOffIcon:vz,Cannabis:bz,CannabisIcon:bz,Captions:tb,CaptionsIcon:tb,CaptionsOff:wz,CaptionsOffIcon:wz,Car:Nz,CarFront:jz,CarFrontIcon:jz,CarIcon:Nz,CarTaxiFront:kz,CarTaxiFrontIcon:kz,Caravan:Sz,CaravanIcon:Sz,Carrot:Cz,CarrotIcon:Cz,CaseLower:Mz,CaseLowerIcon:Mz,CaseSensitive:Tz,CaseSensitiveIcon:Tz,CaseUpper:Az,CaseUpperIcon:Az,CassetteTape:Ez,CassetteTapeIcon:Ez,Cast:Iz,CastIcon:Iz,Castle:Pz,CastleIcon:Pz,Cat:Lz,CatIcon:Lz,Cctv:Oz,CctvIcon:Oz,ChartArea:rb,ChartAreaIcon:rb,ChartBar:nb,ChartBarBig:sb,ChartBarBigIcon:sb,ChartBarDecreasing:Dz,ChartBarDecreasingIcon:Dz,ChartBarIcon:nb,ChartBarIncreasing:Rz,ChartBarIncreasingIcon:Rz,ChartBarStacked:Fz,ChartBarStackedIcon:Fz,ChartCandlestick:ab,ChartCandlestickIcon:ab,ChartColumn:Nc,ChartColumnBig:ib,ChartColumnBigIcon:ib,ChartColumnDecreasing:zz,ChartColumnDecreasingIcon:zz,ChartColumnIcon:Nc,ChartColumnIncreasing:ob,ChartColumnIncreasingIcon:ob,ChartColumnStacked:Bz,ChartColumnStackedIcon:Bz,ChartGantt:$z,ChartGanttIcon:$z,ChartLine:lb,ChartLineIcon:lb,ChartNetwork:Uz,ChartNetworkIcon:Uz,ChartNoAxesColumn:db,ChartNoAxesColumnDecreasing:qz,ChartNoAxesColumnDecreasingIcon:qz,ChartNoAxesColumnIcon:db,ChartNoAxesColumnIncreasing:cb,ChartNoAxesColumnIncreasingIcon:cb,ChartNoAxesCombined:Vz,ChartNoAxesCombinedIcon:Vz,ChartNoAxesGantt:ub,ChartNoAxesGanttIcon:ub,ChartPie:hb,ChartPieIcon:hb,ChartScatter:mb,ChartScatterIcon:mb,ChartSpline:Hz,ChartSplineIcon:Hz,Check:li,CheckCheck:Wz,CheckCheckIcon:Wz,CheckCircle:ui,CheckCircle2:Li,CheckCircle2Icon:Li,CheckCircleIcon:ui,CheckIcon:li,CheckSquare:e1,CheckSquare2:J2,CheckSquare2Icon:J2,CheckSquareIcon:e1,ChefHat:Gz,ChefHatIcon:Gz,Cherry:Kz,CherryIcon:Kz,ChevronDown:Jc,ChevronDownCircle:wb,ChevronDownCircleIcon:wb,ChevronDownIcon:Jc,ChevronDownSquare:ew,ChevronDownSquareIcon:ew,ChevronFirst:Zz,ChevronFirstIcon:Zz,ChevronLast:Yz,ChevronLastIcon:Yz,ChevronLeft:uc,ChevronLeftCircle:jb,ChevronLeftCircleIcon:jb,ChevronLeftIcon:uc,ChevronLeftSquare:tw,ChevronLeftSquareIcon:tw,ChevronRight:Wi,ChevronRightCircle:kb,ChevronRightCircleIcon:kb,ChevronRightIcon:Wi,ChevronRightSquare:rw,ChevronRightSquareIcon:rw,ChevronUp:Hg,ChevronUpCircle:Nb,ChevronUpCircleIcon:Nb,ChevronUpIcon:Hg,ChevronUpSquare:sw,ChevronUpSquareIcon:sw,ChevronsDown:Qz,ChevronsDownIcon:Qz,ChevronsDownUp:Xz,ChevronsDownUpIcon:Xz,ChevronsLeft:t7,ChevronsLeftIcon:t7,ChevronsLeftRight:e7,ChevronsLeftRightEllipsis:Jz,ChevronsLeftRightEllipsisIcon:Jz,ChevronsLeftRightIcon:e7,ChevronsRight:s7,ChevronsRightIcon:s7,ChevronsRightLeft:r7,ChevronsRightLeftIcon:r7,ChevronsUp:n7,ChevronsUpDown:fy,ChevronsUpDownIcon:fy,ChevronsUpIcon:n7,Chrome:a7,ChromeIcon:a7,Church:i7,ChurchIcon:i7,Cigarette:l7,CigaretteIcon:l7,CigaretteOff:o7,CigaretteOffIcon:o7,Circle:ah,CircleAlert:_l,CircleAlertIcon:_l,CircleArrowDown:pb,CircleArrowDownIcon:pb,CircleArrowLeft:fb,CircleArrowLeftIcon:fb,CircleArrowOutDownLeft:gb,CircleArrowOutDownLeftIcon:gb,CircleArrowOutDownRight:xb,CircleArrowOutDownRightIcon:xb,CircleArrowOutUpLeft:yb,CircleArrowOutUpLeftIcon:yb,CircleArrowOutUpRight:vb,CircleArrowOutUpRightIcon:vb,CircleArrowRight:_b,CircleArrowRightIcon:_b,CircleArrowUp:bb,CircleArrowUpIcon:bb,CircleCheck:Li,CircleCheckBig:ui,CircleCheckBigIcon:ui,CircleCheckIcon:Li,CircleChevronDown:wb,CircleChevronDownIcon:wb,CircleChevronLeft:jb,CircleChevronLeftIcon:jb,CircleChevronRight:kb,CircleChevronRightIcon:kb,CircleChevronUp:Nb,CircleChevronUpIcon:Nb,CircleDashed:c7,CircleDashedIcon:c7,CircleDivide:Sb,CircleDivideIcon:Sb,CircleDollarSign:d7,CircleDollarSignIcon:d7,CircleDot:h7,CircleDotDashed:u7,CircleDotDashedIcon:u7,CircleDotIcon:h7,CircleEllipsis:m7,CircleEllipsisIcon:m7,CircleEqual:p7,CircleEqualIcon:p7,CircleFadingArrowUp:f7,CircleFadingArrowUpIcon:f7,CircleFadingPlus:g7,CircleFadingPlusIcon:g7,CircleGauge:Cb,CircleGaugeIcon:Cb,CircleHelp:ey,CircleHelpIcon:ey,CircleIcon:ah,CircleMinus:Mb,CircleMinusIcon:Mb,CircleOff:x7,CircleOffIcon:x7,CircleParking:Ab,CircleParkingIcon:Ab,CircleParkingOff:Tb,CircleParkingOffIcon:Tb,CirclePause:Eb,CirclePauseIcon:Eb,CirclePercent:Ib,CirclePercentIcon:Ib,CirclePlay:lp,CirclePlayIcon:lp,CirclePlus:Pb,CirclePlusIcon:Pb,CirclePower:Lb,CirclePowerIcon:Lb,CircleSlash:y7,CircleSlash2:Ob,CircleSlash2Icon:Ob,CircleSlashIcon:y7,CircleSlashed:Ob,CircleSlashedIcon:Ob,CircleStop:Db,CircleStopIcon:Db,CircleUser:Fb,CircleUserIcon:Fb,CircleUserRound:Rb,CircleUserRoundIcon:Rb,CircleX:Sc,CircleXIcon:Sc,CircuitBoard:v7,CircuitBoardIcon:v7,Citrus:_7,CitrusIcon:_7,Clapperboard:b7,ClapperboardIcon:b7,Clipboard:M7,ClipboardCheck:DS,ClipboardCheckIcon:DS,ClipboardCopy:w7,ClipboardCopyIcon:w7,ClipboardEdit:Bb,ClipboardEditIcon:Bb,ClipboardIcon:M7,ClipboardList:xA,ClipboardListIcon:xA,ClipboardMinus:j7,ClipboardMinusIcon:j7,ClipboardPaste:k7,ClipboardPasteIcon:k7,ClipboardPen:Bb,ClipboardPenIcon:Bb,ClipboardPenLine:zb,ClipboardPenLineIcon:zb,ClipboardPlus:N7,ClipboardPlusIcon:N7,ClipboardSignature:zb,ClipboardSignatureIcon:zb,ClipboardType:S7,ClipboardTypeIcon:S7,ClipboardX:C7,ClipboardXIcon:C7,Clock:Ea,Clock1:T7,Clock10:A7,Clock10Icon:A7,Clock11:E7,Clock11Icon:E7,Clock12:I7,Clock12Icon:I7,Clock1Icon:T7,Clock2:P7,Clock2Icon:P7,Clock3:L7,Clock3Icon:L7,Clock4:O7,Clock4Icon:O7,Clock5:D7,Clock5Icon:D7,Clock6:R7,Clock6Icon:R7,Clock7:F7,Clock7Icon:F7,Clock8:z7,Clock8Icon:z7,Clock9:B7,Clock9Icon:B7,ClockAlert:$7,ClockAlertIcon:$7,ClockArrowDown:U7,ClockArrowDownIcon:U7,ClockArrowUp:q7,ClockArrowUpIcon:q7,ClockIcon:Ea,Cloud:n9,CloudAlert:V7,CloudAlertIcon:V7,CloudCog:H7,CloudCogIcon:H7,CloudDownload:$b,CloudDownloadIcon:$b,CloudDrizzle:W7,CloudDrizzleIcon:W7,CloudFog:G7,CloudFogIcon:G7,CloudHail:K7,CloudHailIcon:K7,CloudIcon:n9,CloudLightning:Z7,CloudLightningIcon:Z7,CloudMoon:X7,CloudMoonIcon:X7,CloudMoonRain:Y7,CloudMoonRainIcon:Y7,CloudOff:Q7,CloudOffIcon:Q7,CloudRain:e9,CloudRainIcon:e9,CloudRainWind:J7,CloudRainWindIcon:J7,CloudSnow:t9,CloudSnowIcon:t9,CloudSun:s9,CloudSunIcon:s9,CloudSunRain:r9,CloudSunRainIcon:r9,CloudUpload:Ub,CloudUploadIcon:Ub,Cloudy:a9,CloudyIcon:a9,Clover:oy,CloverIcon:oy,Club:i9,ClubIcon:i9,Code:Rj,Code2:qb,Code2Icon:qb,CodeIcon:Rj,CodeSquare:nw,CodeSquareIcon:nw,CodeXml:qb,CodeXmlIcon:qb,Codepen:o9,CodepenIcon:o9,Codesandbox:l9,CodesandboxIcon:l9,Coffee:Fj,CoffeeIcon:Fj,Cog:c9,CogIcon:c9,Coins:d9,CoinsIcon:d9,Columns:Vb,Columns2:Vb,Columns2Icon:Vb,Columns3:Hb,Columns3Icon:Hb,Columns4:u9,Columns4Icon:u9,ColumnsIcon:Vb,Combine:h9,CombineIcon:h9,Command:m9,CommandIcon:m9,Compass:p9,CompassIcon:p9,Component:f9,ComponentIcon:f9,Computer:g9,ComputerIcon:g9,ConciergeBell:x9,ConciergeBellIcon:x9,Cone:y9,ConeIcon:y9,Construction:v9,ConstructionIcon:v9,Contact:zj,Contact2:Wb,Contact2Icon:Wb,ContactIcon:zj,ContactRound:Wb,ContactRoundIcon:Wb,Container:_9,ContainerIcon:_9,Contrast:b9,ContrastIcon:b9,Cookie:w9,CookieIcon:w9,CookingPot:j9,CookingPotIcon:j9,Copy:fo,CopyCheck:k9,CopyCheckIcon:k9,CopyIcon:fo,CopyMinus:N9,CopyMinusIcon:N9,CopyPlus:S9,CopyPlusIcon:S9,CopySlash:C9,CopySlashIcon:C9,CopyX:M9,CopyXIcon:M9,Copyleft:T9,CopyleftIcon:T9,Copyright:A9,CopyrightIcon:A9,CornerDownLeft:E9,CornerDownLeftIcon:E9,CornerDownRight:I9,CornerDownRightIcon:I9,CornerLeftDown:P9,CornerLeftDownIcon:P9,CornerLeftUp:L9,CornerLeftUpIcon:L9,CornerRightDown:O9,CornerRightDownIcon:O9,CornerRightUp:D9,CornerRightUpIcon:D9,CornerUpLeft:R9,CornerUpLeftIcon:R9,CornerUpRight:F9,CornerUpRightIcon:F9,Cpu:z9,CpuIcon:z9,CreativeCommons:B9,CreativeCommonsIcon:B9,CreditCard:gp,CreditCardIcon:gp,Croissant:$9,CroissantIcon:$9,Crop:U9,CropIcon:U9,Cross:q9,CrossIcon:q9,Crosshair:V9,CrosshairIcon:V9,Crown:ih,CrownIcon:ih,Cuboid:H9,CuboidIcon:H9,CupSoda:W9,CupSodaIcon:W9,CurlyBraces:eb,CurlyBracesIcon:eb,Currency:G9,CurrencyIcon:G9,Cylinder:K9,CylinderIcon:K9,Dam:Z9,DamIcon:Z9,Database:Q9,DatabaseBackup:Y9,DatabaseBackupIcon:Y9,DatabaseIcon:Q9,DatabaseZap:X9,DatabaseZapIcon:X9,Delete:J9,DeleteIcon:J9,Dessert:eB,DessertIcon:eB,Diameter:tB,DiameterIcon:tB,Diamond:nB,DiamondIcon:nB,DiamondMinus:rB,DiamondMinusIcon:rB,DiamondPercent:Gb,DiamondPercentIcon:Gb,DiamondPlus:sB,DiamondPlusIcon:sB,Dice1:aB,Dice1Icon:aB,Dice2:iB,Dice2Icon:iB,Dice3:oB,Dice3Icon:oB,Dice4:lB,Dice4Icon:lB,Dice5:cB,Dice5Icon:cB,Dice6:dB,Dice6Icon:dB,Dices:uB,DicesIcon:uB,Diff:hB,DiffIcon:hB,Disc:gB,Disc2:mB,Disc2Icon:mB,Disc3:pB,Disc3Icon:pB,DiscAlbum:fB,DiscAlbumIcon:fB,DiscIcon:gB,Divide:xB,DivideCircle:Sb,DivideCircleIcon:Sb,DivideIcon:xB,DivideSquare:lw,DivideSquareIcon:lw,Dna:vB,DnaIcon:vB,DnaOff:yB,DnaOffIcon:yB,Dock:_B,DockIcon:_B,Dog:bB,DogIcon:bB,DollarSign:yd,DollarSignIcon:yd,Donut:wB,DonutIcon:wB,DoorClosed:jB,DoorClosedIcon:jB,DoorOpen:Bj,DoorOpenIcon:Bj,Dot:kB,DotIcon:kB,DotSquare:cw,DotSquareIcon:cw,Download:Oi,DownloadCloud:$b,DownloadCloudIcon:$b,DownloadIcon:Oi,DraftingCompass:NB,DraftingCompassIcon:NB,Drama:SB,DramaIcon:SB,Dribbble:CB,DribbbleIcon:CB,Drill:MB,DrillIcon:MB,Droplet:TB,DropletIcon:TB,Droplets:Wg,DropletsIcon:Wg,Drum:AB,DrumIcon:AB,Drumstick:EB,DrumstickIcon:EB,Dumbbell:IB,DumbbellIcon:IB,Ear:LB,EarIcon:LB,EarOff:PB,EarOffIcon:PB,Earth:Kb,EarthIcon:Kb,EarthLock:OB,EarthLockIcon:OB,Eclipse:DB,EclipseIcon:DB,Edit:wc,Edit2:J0,Edit2Icon:J0,Edit3:Q0,Edit3Icon:Q0,EditIcon:wc,Egg:RS,EggFried:RB,EggFriedIcon:RB,EggIcon:RS,EggOff:FB,EggOffIcon:FB,Ellipsis:kf,EllipsisIcon:kf,EllipsisVertical:Pg,EllipsisVerticalIcon:Pg,Equal:$B,EqualApproximately:zB,EqualApproximatelyIcon:zB,EqualIcon:$B,EqualNot:BB,EqualNotIcon:BB,EqualSquare:dw,EqualSquareIcon:dw,Eraser:UB,EraserIcon:UB,EthernetPort:qB,EthernetPortIcon:qB,Euro:VB,EuroIcon:VB,Expand:HB,ExpandIcon:HB,ExternalLink:En,ExternalLinkIcon:En,Eye:Gi,EyeClosed:WB,EyeClosedIcon:WB,EyeIcon:Gi,EyeOff:zf,EyeOffIcon:zf,Facebook:iu,FacebookIcon:iu,Factory:GB,FactoryIcon:GB,Fan:KB,FanIcon:KB,FastForward:ZB,FastForwardIcon:ZB,Feather:YB,FeatherIcon:YB,Fence:XB,FenceIcon:XB,FerrisWheel:QB,FerrisWheelIcon:QB,Figma:JB,FigmaIcon:JB,File:FS,FileArchive:e$,FileArchiveIcon:e$,FileAudio:r$,FileAudio2:t$,FileAudio2Icon:t$,FileAudioIcon:r$,FileAxis3D:Zb,FileAxis3DIcon:Zb,FileAxis3d:Zb,FileAxis3dIcon:Zb,FileBadge:n$,FileBadge2:s$,FileBadge2Icon:s$,FileBadgeIcon:n$,FileBarChart:Yb,FileBarChart2:Xb,FileBarChart2Icon:Xb,FileBarChartIcon:Yb,FileBox:a$,FileBoxIcon:a$,FileChartColumn:Xb,FileChartColumnIcon:Xb,FileChartColumnIncreasing:Yb,FileChartColumnIncreasingIcon:Yb,FileChartLine:Qb,FileChartLineIcon:Qb,FileChartPie:Jb,FileChartPieIcon:Jb,FileCheck:o$,FileCheck2:i$,FileCheck2Icon:i$,FileCheckIcon:o$,FileClock:l$,FileClockIcon:l$,FileCode:d$,FileCode2:c$,FileCode2Icon:c$,FileCodeIcon:d$,FileCog:e2,FileCog2:e2,FileCog2Icon:e2,FileCogIcon:e2,FileDiff:u$,FileDiffIcon:u$,FileDigit:h$,FileDigitIcon:h$,FileDown:m$,FileDownIcon:m$,FileEdit:r2,FileEditIcon:r2,FileHeart:p$,FileHeartIcon:p$,FileIcon:FS,FileImage:G1,FileImageIcon:G1,FileInput:f$,FileInputIcon:f$,FileJson:x$,FileJson2:g$,FileJson2Icon:g$,FileJsonIcon:x$,FileKey:v$,FileKey2:y$,FileKey2Icon:y$,FileKeyIcon:v$,FileLineChart:Qb,FileLineChartIcon:Qb,FileLock:b$,FileLock2:_$,FileLock2Icon:_$,FileLockIcon:b$,FileMinus:j$,FileMinus2:w$,FileMinus2Icon:w$,FileMinusIcon:j$,FileMusic:k$,FileMusicIcon:k$,FileOutput:N$,FileOutputIcon:N$,FilePen:r2,FilePenIcon:r2,FilePenLine:t2,FilePenLineIcon:t2,FilePieChart:Jb,FilePieChartIcon:Jb,FilePlus:C$,FilePlus2:S$,FilePlus2Icon:S$,FilePlusIcon:C$,FileQuestion:M$,FileQuestionIcon:M$,FileScan:T$,FileScanIcon:T$,FileSearch:E$,FileSearch2:A$,FileSearch2Icon:A$,FileSearchIcon:E$,FileSignature:t2,FileSignatureIcon:t2,FileSliders:I$,FileSlidersIcon:I$,FileSpreadsheet:K1,FileSpreadsheetIcon:K1,FileStack:P$,FileStackIcon:P$,FileSymlink:L$,FileSymlinkIcon:L$,FileTerminal:O$,FileTerminalIcon:O$,FileText:fa,FileTextIcon:fa,FileType:R$,FileType2:D$,FileType2Icon:D$,FileTypeIcon:R$,FileUp:F$,FileUpIcon:F$,FileUser:z$,FileUserIcon:z$,FileVideo:$$,FileVideo2:B$,FileVideo2Icon:B$,FileVideoIcon:$$,FileVolume:q$,FileVolume2:U$,FileVolume2Icon:U$,FileVolumeIcon:q$,FileWarning:V$,FileWarningIcon:V$,FileX:W$,FileX2:H$,FileX2Icon:H$,FileXIcon:W$,Files:G$,FilesIcon:G$,Film:Od,FilmIcon:Od,Filter:Z1,FilterIcon:Z1,FilterX:K$,FilterXIcon:K$,Fingerprint:Z$,FingerprintIcon:Z$,FireExtinguisher:Y$,FireExtinguisherIcon:Y$,Fish:J$,FishIcon:J$,FishOff:X$,FishOffIcon:X$,FishSymbol:Q$,FishSymbolIcon:Q$,Flag:gy,FlagIcon:gy,FlagOff:eU,FlagOffIcon:eU,FlagTriangleLeft:tU,FlagTriangleLeftIcon:tU,FlagTriangleRight:rU,FlagTriangleRightIcon:rU,Flame:_m,FlameIcon:_m,FlameKindling:sU,FlameKindlingIcon:sU,Flashlight:aU,FlashlightIcon:aU,FlashlightOff:nU,FlashlightOffIcon:nU,FlaskConical:$j,FlaskConicalIcon:$j,FlaskConicalOff:iU,FlaskConicalOffIcon:iU,FlaskRound:oU,FlaskRoundIcon:oU,FlipHorizontal:cU,FlipHorizontal2:lU,FlipHorizontal2Icon:lU,FlipHorizontalIcon:cU,FlipVertical:uU,FlipVertical2:dU,FlipVertical2Icon:dU,FlipVerticalIcon:uU,Flower:hU,Flower2:Tf,Flower2Icon:Tf,FlowerIcon:hU,Focus:mU,FocusIcon:mU,FoldHorizontal:pU,FoldHorizontalIcon:pU,FoldVertical:fU,FoldVerticalIcon:fU,Folder:UU,FolderArchive:gU,FolderArchiveIcon:gU,FolderCheck:xU,FolderCheckIcon:xU,FolderClock:yU,FolderClockIcon:yU,FolderClosed:vU,FolderClosedIcon:vU,FolderCode:_U,FolderCodeIcon:_U,FolderCog:s2,FolderCog2:s2,FolderCog2Icon:s2,FolderCogIcon:s2,FolderDot:bU,FolderDotIcon:bU,FolderDown:wU,FolderDownIcon:wU,FolderEdit:n2,FolderEditIcon:n2,FolderGit:kU,FolderGit2:jU,FolderGit2Icon:jU,FolderGitIcon:kU,FolderHeart:NU,FolderHeartIcon:NU,FolderIcon:UU,FolderInput:SU,FolderInputIcon:SU,FolderKanban:CU,FolderKanbanIcon:CU,FolderKey:MU,FolderKeyIcon:MU,FolderLock:TU,FolderLockIcon:TU,FolderMinus:AU,FolderMinusIcon:AU,FolderOpen:bm,FolderOpenDot:EU,FolderOpenDotIcon:EU,FolderOpenIcon:bm,FolderOutput:IU,FolderOutputIcon:IU,FolderPen:n2,FolderPenIcon:n2,FolderPlus:PU,FolderPlusIcon:PU,FolderRoot:LU,FolderRootIcon:LU,FolderSearch:DU,FolderSearch2:OU,FolderSearch2Icon:OU,FolderSearchIcon:DU,FolderSymlink:RU,FolderSymlinkIcon:RU,FolderSync:FU,FolderSyncIcon:FU,FolderTree:zU,FolderTreeIcon:zU,FolderUp:BU,FolderUpIcon:BU,FolderX:$U,FolderXIcon:$U,Folders:qU,FoldersIcon:qU,Footprints:VU,FootprintsIcon:VU,ForkKnife:Zw,ForkKnifeCrossed:Kw,ForkKnifeCrossedIcon:Kw,ForkKnifeIcon:Zw,Forklift:HU,ForkliftIcon:HU,FormInput:A2,FormInputIcon:A2,Forward:WU,ForwardIcon:WU,Frame:GU,FrameIcon:GU,Framer:KU,FramerIcon:KU,Frown:ZU,FrownIcon:ZU,Fuel:YU,FuelIcon:YU,Fullscreen:XU,FullscreenIcon:XU,FunctionSquare:uw,FunctionSquareIcon:uw,GalleryHorizontal:JU,GalleryHorizontalEnd:QU,GalleryHorizontalEndIcon:QU,GalleryHorizontalIcon:JU,GalleryThumbnails:eq,GalleryThumbnailsIcon:eq,GalleryVertical:rq,GalleryVerticalEnd:tq,GalleryVerticalEndIcon:tq,GalleryVerticalIcon:rq,Gamepad:nq,Gamepad2:sq,Gamepad2Icon:sq,GamepadIcon:nq,GanttChart:ub,GanttChartIcon:ub,GanttChartSquare:kg,GanttChartSquareIcon:kg,Gauge:aq,GaugeCircle:Cb,GaugeCircleIcon:Cb,GaugeIcon:aq,Gavel:iq,GavelIcon:iq,Gem:oq,GemIcon:oq,Ghost:Uj,GhostIcon:Uj,Gift:uo,GiftIcon:uo,GitBranch:cq,GitBranchIcon:cq,GitBranchPlus:lq,GitBranchPlusIcon:lq,GitCommit:a2,GitCommitHorizontal:a2,GitCommitHorizontalIcon:a2,GitCommitIcon:a2,GitCommitVertical:dq,GitCommitVerticalIcon:dq,GitCompare:hq,GitCompareArrows:uq,GitCompareArrowsIcon:uq,GitCompareIcon:hq,GitFork:mq,GitForkIcon:mq,GitGraph:pq,GitGraphIcon:pq,GitMerge:fq,GitMergeIcon:fq,GitPullRequest:bq,GitPullRequestArrow:gq,GitPullRequestArrowIcon:gq,GitPullRequestClosed:xq,GitPullRequestClosedIcon:xq,GitPullRequestCreate:vq,GitPullRequestCreateArrow:yq,GitPullRequestCreateArrowIcon:yq,GitPullRequestCreateIcon:vq,GitPullRequestDraft:_q,GitPullRequestDraftIcon:_q,GitPullRequestIcon:bq,Github:wq,GithubIcon:wq,Gitlab:jq,GitlabIcon:jq,GlassWater:kq,GlassWaterIcon:kq,Glasses:Nq,GlassesIcon:Nq,Globe:Gg,Globe2:Kb,Globe2Icon:Kb,GlobeIcon:Gg,GlobeLock:Sq,GlobeLockIcon:Sq,Goal:Cq,GoalIcon:Cq,Grab:Mq,GrabIcon:Mq,GraduationCap:Y1,GraduationCapIcon:Y1,Grape:Tq,GrapeIcon:Tq,Grid:im,Grid2X2:o2,Grid2X2Icon:o2,Grid2X2Plus:i2,Grid2X2PlusIcon:i2,Grid2x2:o2,Grid2x2Check:Aq,Grid2x2CheckIcon:Aq,Grid2x2Icon:o2,Grid2x2Plus:i2,Grid2x2PlusIcon:i2,Grid2x2X:Eq,Grid2x2XIcon:Eq,Grid3X3:im,Grid3X3Icon:im,Grid3x3:im,Grid3x3Icon:im,GridIcon:im,Grip:Pq,GripHorizontal:Iq,GripHorizontalIcon:Iq,GripIcon:Pq,GripVertical:xp,GripVerticalIcon:xp,Group:Lq,GroupIcon:Lq,Guitar:Oq,GuitarIcon:Oq,Ham:Dq,HamIcon:Dq,Hammer:Rq,HammerIcon:Rq,Hand:yA,HandCoins:Fq,HandCoinsIcon:Fq,HandHeart:zq,HandHeartIcon:zq,HandHelping:l2,HandHelpingIcon:l2,HandIcon:yA,HandMetal:Bq,HandMetalIcon:Bq,HandPlatter:$q,HandPlatterIcon:$q,Handshake:Uq,HandshakeIcon:Uq,HardDrive:vA,HardDriveDownload:qq,HardDriveDownloadIcon:qq,HardDriveIcon:vA,HardDriveUpload:Vq,HardDriveUploadIcon:Vq,HardHat:Hq,HardHatIcon:Hq,Hash:zS,HashIcon:zS,Haze:Wq,HazeIcon:Wq,HdmiPort:Gq,HdmiPortIcon:Gq,Heading:Qq,Heading1:_A,Heading1Icon:_A,Heading2:bA,Heading2Icon:bA,Heading3:Kq,Heading3Icon:Kq,Heading4:Zq,Heading4Icon:Zq,Heading5:Yq,Heading5Icon:Yq,Heading6:Xq,Heading6Icon:Xq,HeadingIcon:Qq,HeadphoneOff:Jq,HeadphoneOffIcon:Jq,Headphones:eV,HeadphonesIcon:eV,Headset:tV,HeadsetIcon:tV,Heart:Ci,HeartCrack:rV,HeartCrackIcon:rV,HeartHandshake:sV,HeartHandshakeIcon:sV,HeartIcon:Ci,HeartOff:nV,HeartOffIcon:nV,HeartPulse:aV,HeartPulseIcon:aV,Heater:iV,HeaterIcon:iV,HelpCircle:ey,HelpCircleIcon:ey,HelpingHand:l2,HelpingHandIcon:l2,Hexagon:oV,HexagonIcon:oV,Highlighter:lV,HighlighterIcon:lV,History:BS,HistoryIcon:BS,Home:Wn,HomeIcon:Wn,Hop:dV,HopIcon:dV,HopOff:cV,HopOffIcon:cV,Hospital:uV,HospitalIcon:uV,Hotel:hV,HotelIcon:hV,Hourglass:mV,HourglassIcon:mV,House:Wn,HouseIcon:Wn,HousePlug:pV,HousePlugIcon:pV,HousePlus:fV,HousePlusIcon:fV,IceCream:d2,IceCream2:c2,IceCream2Icon:c2,IceCreamBowl:c2,IceCreamBowlIcon:c2,IceCreamCone:d2,IceCreamConeIcon:d2,IceCreamIcon:d2,Icon:qIe,IdCard:gV,IdCardIcon:gV,Image:El,ImageDown:xV,ImageDownIcon:xV,ImageIcon:El,ImageMinus:yV,ImageMinusIcon:yV,ImageOff:vV,ImageOffIcon:vV,ImagePlay:_V,ImagePlayIcon:_V,ImagePlus:X1,ImagePlusIcon:X1,ImageUp:bV,ImageUpIcon:bV,ImageUpscale:wV,ImageUpscaleIcon:wV,Images:jV,ImagesIcon:jV,Import:kV,ImportIcon:kV,Inbox:NV,InboxIcon:NV,Indent:h2,IndentDecrease:u2,IndentDecreaseIcon:u2,IndentIcon:h2,IndentIncrease:h2,IndentIncreaseIcon:h2,IndianRupee:SV,IndianRupeeIcon:SV,Infinity:CV,InfinityIcon:CV,Info:MV,InfoIcon:MV,Inspect:xw,InspectIcon:xw,InspectionPanel:TV,InspectionPanelIcon:TV,Instagram:ju,InstagramIcon:ju,Italic:$S,ItalicIcon:$S,IterationCcw:AV,IterationCcwIcon:AV,IterationCw:EV,IterationCwIcon:EV,JapaneseYen:IV,JapaneseYenIcon:IV,Joystick:PV,JoystickIcon:PV,Kanban:xy,KanbanIcon:xy,KanbanSquare:hw,KanbanSquareDashed:aw,KanbanSquareDashedIcon:aw,KanbanSquareIcon:hw,Key:wm,KeyIcon:wm,KeyRound:qj,KeyRoundIcon:qj,KeySquare:LV,KeySquareIcon:LV,Keyboard:RV,KeyboardIcon:RV,KeyboardMusic:OV,KeyboardMusicIcon:OV,KeyboardOff:DV,KeyboardOffIcon:DV,Lamp:qV,LampCeiling:FV,LampCeilingIcon:FV,LampDesk:zV,LampDeskIcon:zV,LampFloor:BV,LampFloorIcon:BV,LampIcon:qV,LampWallDown:$V,LampWallDownIcon:$V,LampWallUp:UV,LampWallUpIcon:UV,LandPlot:VV,LandPlotIcon:VV,Landmark:HV,LandmarkIcon:HV,Languages:WV,LanguagesIcon:WV,Laptop:KV,Laptop2:m2,Laptop2Icon:m2,LaptopIcon:KV,LaptopMinimal:m2,LaptopMinimalCheck:GV,LaptopMinimalCheckIcon:GV,LaptopMinimalIcon:m2,Lasso:YV,LassoIcon:YV,LassoSelect:ZV,LassoSelectIcon:ZV,Laugh:XV,LaughIcon:XV,Layers:eH,Layers2:QV,Layers2Icon:QV,Layers3:JV,Layers3Icon:JV,LayersIcon:eH,Layout:X0,LayoutDashboard:Vj,LayoutDashboardIcon:Vj,LayoutGrid:yp,LayoutGridIcon:yp,LayoutIcon:X0,LayoutList:tH,LayoutListIcon:tH,LayoutPanelLeft:rH,LayoutPanelLeftIcon:rH,LayoutPanelTop:sH,LayoutPanelTopIcon:sH,LayoutTemplate:Hj,LayoutTemplateIcon:Hj,Leaf:nH,LeafIcon:nH,LeafyGreen:aH,LeafyGreenIcon:aH,Lectern:iH,LecternIcon:iH,LetterText:oH,LetterTextIcon:oH,Library:US,LibraryBig:lH,LibraryBigIcon:lH,LibraryIcon:US,LibrarySquare:mw,LibrarySquareIcon:mw,LifeBuoy:qS,LifeBuoyIcon:qS,Ligature:cH,LigatureIcon:cH,Lightbulb:yy,LightbulbIcon:yy,LightbulbOff:dH,LightbulbOffIcon:dH,LineChart:lb,LineChartIcon:lb,Link:Bo,Link2:jm,Link2Icon:jm,Link2Off:uH,Link2OffIcon:uH,LinkIcon:Bo,Linkedin:km,LinkedinIcon:km,List:vp,ListCheck:hH,ListCheckIcon:hH,ListChecks:mH,ListChecksIcon:mH,ListCollapse:pH,ListCollapseIcon:pH,ListEnd:fH,ListEndIcon:fH,ListFilter:gH,ListFilterIcon:gH,ListIcon:vp,ListMinus:xH,ListMinusIcon:xH,ListMusic:yH,ListMusicIcon:yH,ListOrdered:VS,ListOrderedIcon:VS,ListPlus:vH,ListPlusIcon:vH,ListRestart:_H,ListRestartIcon:_H,ListStart:bH,ListStartIcon:bH,ListTodo:wH,ListTodoIcon:wH,ListTree:jH,ListTreeIcon:jH,ListVideo:kH,ListVideoIcon:kH,ListX:NH,ListXIcon:NH,Loader:CH,Loader2:Hr,Loader2Icon:Hr,LoaderCircle:Hr,LoaderCircleIcon:Hr,LoaderIcon:CH,LoaderPinwheel:SH,LoaderPinwheelIcon:SH,Locate:wA,LocateFixed:MH,LocateFixedIcon:MH,LocateIcon:wA,LocateOff:TH,LocateOffIcon:TH,Lock:ku,LockIcon:ku,LockKeyhole:AH,LockKeyholeIcon:AH,LockKeyholeOpen:p2,LockKeyholeOpenIcon:p2,LockOpen:f2,LockOpenIcon:f2,LogIn:HS,LogInIcon:HS,LogOut:WS,LogOutIcon:WS,Logs:EH,LogsIcon:EH,Lollipop:IH,LollipopIcon:IH,LucideAArrowDown:_O,LucideAArrowUp:bO,LucideALargeSmall:wO,LucideAccessibility:jO,LucideActivity:qg,LucideActivitySquare:F2,LucideAirVent:kO,LucideAirplay:NO,LucideAlarmCheck:B_,LucideAlarmClock:CO,LucideAlarmClockCheck:B_,LucideAlarmClockMinus:$_,LucideAlarmClockOff:SO,LucideAlarmClockPlus:U_,LucideAlarmMinus:$_,LucideAlarmPlus:U_,LucideAlarmSmoke:MO,LucideAlbum:TO,LucideAlertCircle:_l,LucideAlertOctagon:y2,LucideAlertTriangle:Qu,LucideAlignCenter:ES,LucideAlignCenterHorizontal:AO,LucideAlignCenterVertical:EO,LucideAlignEndHorizontal:IO,LucideAlignEndVertical:PO,LucideAlignHorizontalDistributeCenter:LO,LucideAlignHorizontalDistributeEnd:OO,LucideAlignHorizontalDistributeStart:DO,LucideAlignHorizontalJustifyCenter:RO,LucideAlignHorizontalJustifyEnd:FO,LucideAlignHorizontalJustifyStart:zO,LucideAlignHorizontalSpaceAround:BO,LucideAlignHorizontalSpaceBetween:$O,LucideAlignJustify:UO,LucideAlignLeft:IS,LucideAlignRight:PS,LucideAlignStartHorizontal:qO,LucideAlignStartVertical:VO,LucideAlignVerticalDistributeCenter:HO,LucideAlignVerticalDistributeEnd:WO,LucideAlignVerticalDistributeStart:GO,LucideAlignVerticalJustifyCenter:KO,LucideAlignVerticalJustifyEnd:ZO,LucideAlignVerticalJustifyStart:YO,LucideAlignVerticalSpaceAround:XO,LucideAlignVerticalSpaceBetween:QO,LucideAmbulance:JO,LucideAmpersand:eD,LucideAmpersands:tD,LucideAmphora:rD,LucideAnchor:sD,LucideAngry:nD,LucideAnnoyed:aD,LucideAntenna:iD,LucideAnvil:oD,LucideAperture:lD,LucideAppWindow:hA,LucideAppWindowMac:cD,LucideApple:dD,LucideArchive:mA,LucideArchiveRestore:uD,LucideArchiveX:hD,LucideAreaChart:rb,LucideArmchair:mD,LucideArrowBigDown:fD,LucideArrowBigDownDash:pD,LucideArrowBigLeft:xD,LucideArrowBigLeftDash:gD,LucideArrowBigRight:vD,LucideArrowBigRightDash:yD,LucideArrowBigUp:bD,LucideArrowBigUpDash:_D,LucideArrowDown:my,LucideArrowDown01:wD,LucideArrowDown10:jD,LucideArrowDownAZ:q_,LucideArrowDownAz:q_,LucideArrowDownCircle:pb,LucideArrowDownFromLine:kD,LucideArrowDownLeft:ND,LucideArrowDownLeftFromCircle:gb,LucideArrowDownLeftFromSquare:q2,LucideArrowDownLeftSquare:z2,LucideArrowDownNarrowWide:SD,LucideArrowDownRight:CD,LucideArrowDownRightFromCircle:xb,LucideArrowDownRightFromSquare:V2,LucideArrowDownRightSquare:B2,LucideArrowDownSquare:$2,LucideArrowDownToDot:MD,LucideArrowDownToLine:TD,LucideArrowDownUp:AD,LucideArrowDownWideNarrow:V_,LucideArrowDownZA:H_,LucideArrowDownZa:H_,LucideArrowLeft:_i,LucideArrowLeftCircle:fb,LucideArrowLeftFromLine:ED,LucideArrowLeftRight:ID,LucideArrowLeftSquare:U2,LucideArrowLeftToLine:PD,LucideArrowRight:Hi,LucideArrowRightCircle:_b,LucideArrowRightFromLine:LD,LucideArrowRightLeft:py,LucideArrowRightSquare:G2,LucideArrowRightToLine:OD,LucideArrowUp:fp,LucideArrowUp01:DD,LucideArrowUp10:RD,LucideArrowUpAZ:W_,LucideArrowUpAz:W_,LucideArrowUpCircle:bb,LucideArrowUpDown:Of,LucideArrowUpFromDot:FD,LucideArrowUpFromLine:zD,LucideArrowUpLeft:BD,LucideArrowUpLeftFromCircle:yb,LucideArrowUpLeftFromSquare:H2,LucideArrowUpLeftSquare:K2,LucideArrowUpNarrowWide:G_,LucideArrowUpRight:$D,LucideArrowUpRightFromCircle:vb,LucideArrowUpRightFromSquare:W2,LucideArrowUpRightSquare:Z2,LucideArrowUpSquare:Y2,LucideArrowUpToLine:UD,LucideArrowUpWideNarrow:qD,LucideArrowUpZA:K_,LucideArrowUpZa:K_,LucideArrowsUpFromLine:VD,LucideAsterisk:HD,LucideAsteriskSquare:X2,LucideAtSign:WD,LucideAtom:GD,LucideAudioLines:KD,LucideAudioWaveform:ZD,LucideAward:ql,LucideAxe:YD,LucideAxis3D:Z_,LucideAxis3d:Z_,LucideBaby:XD,LucideBackpack:QD,LucideBadge:pR,LucideBadgeAlert:JD,LucideBadgeCent:eR,LucideBadgeCheck:Y_,LucideBadgeDollarSign:tR,LucideBadgeEuro:rR,LucideBadgeHelp:sR,LucideBadgeIndianRupee:nR,LucideBadgeInfo:aR,LucideBadgeJapaneseYen:iR,LucideBadgeMinus:oR,LucideBadgePercent:lR,LucideBadgePlus:cR,LucideBadgePoundSterling:dR,LucideBadgeRussianRuble:uR,LucideBadgeSwissFranc:hR,LucideBadgeX:mR,LucideBaggageClaim:fR,LucideBan:gR,LucideBanana:xR,LucideBandage:yR,LucideBanknote:vR,LucideBarChart:cb,LucideBarChart2:db,LucideBarChart3:Nc,LucideBarChart4:ob,LucideBarChartBig:ib,LucideBarChartHorizontal:nb,LucideBarChartHorizontalBig:sb,LucideBarcode:_R,LucideBaseline:bR,LucideBath:V1,LucideBattery:CR,LucideBatteryCharging:wR,LucideBatteryFull:jR,LucideBatteryLow:kR,LucideBatteryMedium:NR,LucideBatteryWarning:SR,LucideBeaker:MR,LucideBean:AR,LucideBeanOff:TR,LucideBed:H1,LucideBedDouble:ER,LucideBedSingle:IR,LucideBeef:PR,LucideBeer:OR,LucideBeerOff:LR,LucideBell:Df,LucideBellDot:DR,LucideBellElectric:RR,LucideBellMinus:FR,LucideBellOff:Lj,LucideBellPlus:zR,LucideBellRing:BR,LucideBetweenHorizonalEnd:X_,LucideBetweenHorizonalStart:Q_,LucideBetweenHorizontalEnd:X_,LucideBetweenHorizontalStart:Q_,LucideBetweenVerticalEnd:$R,LucideBetweenVerticalStart:UR,LucideBicepsFlexed:qR,LucideBike:VR,LucideBinary:HR,LucideBinoculars:WR,LucideBiohazard:GR,LucideBird:KR,LucideBitcoin:ZR,LucideBlend:YR,LucideBlinds:XR,LucideBlocks:QR,LucideBluetooth:rF,LucideBluetoothConnected:JR,LucideBluetoothOff:eF,LucideBluetoothSearching:tF,LucideBold:LS,LucideBolt:sF,LucideBomb:nF,LucideBone:aF,LucideBook:CF,LucideBookA:iF,LucideBookAudio:oF,LucideBookCheck:lF,LucideBookCopy:cF,LucideBookDashed:J_,LucideBookDown:dF,LucideBookHeadphones:uF,LucideBookHeart:hF,LucideBookImage:mF,LucideBookKey:pF,LucideBookLock:fF,LucideBookMarked:gF,LucideBookMinus:xF,LucideBookOpen:W1,LucideBookOpenCheck:yF,LucideBookOpenText:vF,LucideBookPlus:_F,LucideBookTemplate:J_,LucideBookText:bF,LucideBookType:wF,LucideBookUp:kF,LucideBookUp2:jF,LucideBookUser:NF,LucideBookX:SF,LucideBookmark:Rf,LucideBookmarkCheck:MF,LucideBookmarkMinus:TF,LucideBookmarkPlus:pA,LucideBookmarkX:AF,LucideBoomBox:EF,LucideBot:OS,LucideBotMessageSquare:IF,LucideBotOff:PF,LucideBox:LF,LucideBoxSelect:ow,LucideBoxes:OF,LucideBraces:eb,LucideBrackets:DF,LucideBrain:fA,LucideBrainCircuit:RF,LucideBrainCog:FF,LucideBrickWall:zF,LucideBriefcase:wu,LucideBriefcaseBusiness:BF,LucideBriefcaseConveyorBelt:$F,LucideBriefcaseMedical:UF,LucideBringToFront:qF,LucideBrush:VF,LucideBug:GF,LucideBugOff:HF,LucideBugPlay:WF,LucideBuilding:Oj,LucideBuilding2:bi,LucideBus:ZF,LucideBusFront:KF,LucideCable:XF,LucideCableCar:YF,LucideCake:vm,LucideCakeSlice:QF,LucideCalculator:JF,LucideCalendar:Mn,LucideCalendar1:ez,LucideCalendarArrowDown:tz,LucideCalendarArrowUp:rz,LucideCalendarCheck:nz,LucideCalendarCheck2:sz,LucideCalendarClock:gA,LucideCalendarCog:az,LucideCalendarDays:Ff,LucideCalendarFold:iz,LucideCalendarHeart:oz,LucideCalendarMinus:cz,LucideCalendarMinus2:lz,LucideCalendarOff:dz,LucideCalendarPlus:Dj,LucideCalendarPlus2:uz,LucideCalendarRange:hz,LucideCalendarSearch:mz,LucideCalendarSync:pz,LucideCalendarX:gz,LucideCalendarX2:fz,LucideCamera:Vg,LucideCameraOff:xz,LucideCandlestickChart:ab,LucideCandy:_z,LucideCandyCane:yz,LucideCandyOff:vz,LucideCannabis:bz,LucideCaptions:tb,LucideCaptionsOff:wz,LucideCar:Nz,LucideCarFront:jz,LucideCarTaxiFront:kz,LucideCaravan:Sz,LucideCarrot:Cz,LucideCaseLower:Mz,LucideCaseSensitive:Tz,LucideCaseUpper:Az,LucideCassetteTape:Ez,LucideCast:Iz,LucideCastle:Pz,LucideCat:Lz,LucideCctv:Oz,LucideChartArea:rb,LucideChartBar:nb,LucideChartBarBig:sb,LucideChartBarDecreasing:Dz,LucideChartBarIncreasing:Rz,LucideChartBarStacked:Fz,LucideChartCandlestick:ab,LucideChartColumn:Nc,LucideChartColumnBig:ib,LucideChartColumnDecreasing:zz,LucideChartColumnIncreasing:ob,LucideChartColumnStacked:Bz,LucideChartGantt:$z,LucideChartLine:lb,LucideChartNetwork:Uz,LucideChartNoAxesColumn:db,LucideChartNoAxesColumnDecreasing:qz,LucideChartNoAxesColumnIncreasing:cb,LucideChartNoAxesCombined:Vz,LucideChartNoAxesGantt:ub,LucideChartPie:hb,LucideChartScatter:mb,LucideChartSpline:Hz,LucideCheck:li,LucideCheckCheck:Wz,LucideCheckCircle:ui,LucideCheckCircle2:Li,LucideCheckSquare:e1,LucideCheckSquare2:J2,LucideChefHat:Gz,LucideCherry:Kz,LucideChevronDown:Jc,LucideChevronDownCircle:wb,LucideChevronDownSquare:ew,LucideChevronFirst:Zz,LucideChevronLast:Yz,LucideChevronLeft:uc,LucideChevronLeftCircle:jb,LucideChevronLeftSquare:tw,LucideChevronRight:Wi,LucideChevronRightCircle:kb,LucideChevronRightSquare:rw,LucideChevronUp:Hg,LucideChevronUpCircle:Nb,LucideChevronUpSquare:sw,LucideChevronsDown:Qz,LucideChevronsDownUp:Xz,LucideChevronsLeft:t7,LucideChevronsLeftRight:e7,LucideChevronsLeftRightEllipsis:Jz,LucideChevronsRight:s7,LucideChevronsRightLeft:r7,LucideChevronsUp:n7,LucideChevronsUpDown:fy,LucideChrome:a7,LucideChurch:i7,LucideCigarette:l7,LucideCigaretteOff:o7,LucideCircle:ah,LucideCircleAlert:_l,LucideCircleArrowDown:pb,LucideCircleArrowLeft:fb,LucideCircleArrowOutDownLeft:gb,LucideCircleArrowOutDownRight:xb,LucideCircleArrowOutUpLeft:yb,LucideCircleArrowOutUpRight:vb,LucideCircleArrowRight:_b,LucideCircleArrowUp:bb,LucideCircleCheck:Li,LucideCircleCheckBig:ui,LucideCircleChevronDown:wb,LucideCircleChevronLeft:jb,LucideCircleChevronRight:kb,LucideCircleChevronUp:Nb,LucideCircleDashed:c7,LucideCircleDivide:Sb,LucideCircleDollarSign:d7,LucideCircleDot:h7,LucideCircleDotDashed:u7,LucideCircleEllipsis:m7,LucideCircleEqual:p7,LucideCircleFadingArrowUp:f7,LucideCircleFadingPlus:g7,LucideCircleGauge:Cb,LucideCircleHelp:ey,LucideCircleMinus:Mb,LucideCircleOff:x7,LucideCircleParking:Ab,LucideCircleParkingOff:Tb,LucideCirclePause:Eb,LucideCirclePercent:Ib,LucideCirclePlay:lp,LucideCirclePlus:Pb,LucideCirclePower:Lb,LucideCircleSlash:y7,LucideCircleSlash2:Ob,LucideCircleSlashed:Ob,LucideCircleStop:Db,LucideCircleUser:Fb,LucideCircleUserRound:Rb,LucideCircleX:Sc,LucideCircuitBoard:v7,LucideCitrus:_7,LucideClapperboard:b7,LucideClipboard:M7,LucideClipboardCheck:DS,LucideClipboardCopy:w7,LucideClipboardEdit:Bb,LucideClipboardList:xA,LucideClipboardMinus:j7,LucideClipboardPaste:k7,LucideClipboardPen:Bb,LucideClipboardPenLine:zb,LucideClipboardPlus:N7,LucideClipboardSignature:zb,LucideClipboardType:S7,LucideClipboardX:C7,LucideClock:Ea,LucideClock1:T7,LucideClock10:A7,LucideClock11:E7,LucideClock12:I7,LucideClock2:P7,LucideClock3:L7,LucideClock4:O7,LucideClock5:D7,LucideClock6:R7,LucideClock7:F7,LucideClock8:z7,LucideClock9:B7,LucideClockAlert:$7,LucideClockArrowDown:U7,LucideClockArrowUp:q7,LucideCloud:n9,LucideCloudAlert:V7,LucideCloudCog:H7,LucideCloudDownload:$b,LucideCloudDrizzle:W7,LucideCloudFog:G7,LucideCloudHail:K7,LucideCloudLightning:Z7,LucideCloudMoon:X7,LucideCloudMoonRain:Y7,LucideCloudOff:Q7,LucideCloudRain:e9,LucideCloudRainWind:J7,LucideCloudSnow:t9,LucideCloudSun:s9,LucideCloudSunRain:r9,LucideCloudUpload:Ub,LucideCloudy:a9,LucideClover:oy,LucideClub:i9,LucideCode:Rj,LucideCode2:qb,LucideCodeSquare:nw,LucideCodeXml:qb,LucideCodepen:o9,LucideCodesandbox:l9,LucideCoffee:Fj,LucideCog:c9,LucideCoins:d9,LucideColumns:Vb,LucideColumns2:Vb,LucideColumns3:Hb,LucideColumns4:u9,LucideCombine:h9,LucideCommand:m9,LucideCompass:p9,LucideComponent:f9,LucideComputer:g9,LucideConciergeBell:x9,LucideCone:y9,LucideConstruction:v9,LucideContact:zj,LucideContact2:Wb,LucideContactRound:Wb,LucideContainer:_9,LucideContrast:b9,LucideCookie:w9,LucideCookingPot:j9,LucideCopy:fo,LucideCopyCheck:k9,LucideCopyMinus:N9,LucideCopyPlus:S9,LucideCopySlash:C9,LucideCopyX:M9,LucideCopyleft:T9,LucideCopyright:A9,LucideCornerDownLeft:E9,LucideCornerDownRight:I9,LucideCornerLeftDown:P9,LucideCornerLeftUp:L9,LucideCornerRightDown:O9,LucideCornerRightUp:D9,LucideCornerUpLeft:R9,LucideCornerUpRight:F9,LucideCpu:z9,LucideCreativeCommons:B9,LucideCreditCard:gp,LucideCroissant:$9,LucideCrop:U9,LucideCross:q9,LucideCrosshair:V9,LucideCrown:ih,LucideCuboid:H9,LucideCupSoda:W9,LucideCurlyBraces:eb,LucideCurrency:G9,LucideCylinder:K9,LucideDam:Z9,LucideDatabase:Q9,LucideDatabaseBackup:Y9,LucideDatabaseZap:X9,LucideDelete:J9,LucideDessert:eB,LucideDiameter:tB,LucideDiamond:nB,LucideDiamondMinus:rB,LucideDiamondPercent:Gb,LucideDiamondPlus:sB,LucideDice1:aB,LucideDice2:iB,LucideDice3:oB,LucideDice4:lB,LucideDice5:cB,LucideDice6:dB,LucideDices:uB,LucideDiff:hB,LucideDisc:gB,LucideDisc2:mB,LucideDisc3:pB,LucideDiscAlbum:fB,LucideDivide:xB,LucideDivideCircle:Sb,LucideDivideSquare:lw,LucideDna:vB,LucideDnaOff:yB,LucideDock:_B,LucideDog:bB,LucideDollarSign:yd,LucideDonut:wB,LucideDoorClosed:jB,LucideDoorOpen:Bj,LucideDot:kB,LucideDotSquare:cw,LucideDownload:Oi,LucideDownloadCloud:$b,LucideDraftingCompass:NB,LucideDrama:SB,LucideDribbble:CB,LucideDrill:MB,LucideDroplet:TB,LucideDroplets:Wg,LucideDrum:AB,LucideDrumstick:EB,LucideDumbbell:IB,LucideEar:LB,LucideEarOff:PB,LucideEarth:Kb,LucideEarthLock:OB,LucideEclipse:DB,LucideEdit:wc,LucideEdit2:J0,LucideEdit3:Q0,LucideEgg:RS,LucideEggFried:RB,LucideEggOff:FB,LucideEllipsis:kf,LucideEllipsisVertical:Pg,LucideEqual:$B,LucideEqualApproximately:zB,LucideEqualNot:BB,LucideEqualSquare:dw,LucideEraser:UB,LucideEthernetPort:qB,LucideEuro:VB,LucideExpand:HB,LucideExternalLink:En,LucideEye:Gi,LucideEyeClosed:WB,LucideEyeOff:zf,LucideFacebook:iu,LucideFactory:GB,LucideFan:KB,LucideFastForward:ZB,LucideFeather:YB,LucideFence:XB,LucideFerrisWheel:QB,LucideFigma:JB,LucideFile:FS,LucideFileArchive:e$,LucideFileAudio:r$,LucideFileAudio2:t$,LucideFileAxis3D:Zb,LucideFileAxis3d:Zb,LucideFileBadge:n$,LucideFileBadge2:s$,LucideFileBarChart:Yb,LucideFileBarChart2:Xb,LucideFileBox:a$,LucideFileChartColumn:Xb,LucideFileChartColumnIncreasing:Yb,LucideFileChartLine:Qb,LucideFileChartPie:Jb,LucideFileCheck:o$,LucideFileCheck2:i$,LucideFileClock:l$,LucideFileCode:d$,LucideFileCode2:c$,LucideFileCog:e2,LucideFileCog2:e2,LucideFileDiff:u$,LucideFileDigit:h$,LucideFileDown:m$,LucideFileEdit:r2,LucideFileHeart:p$,LucideFileImage:G1,LucideFileInput:f$,LucideFileJson:x$,LucideFileJson2:g$,LucideFileKey:v$,LucideFileKey2:y$,LucideFileLineChart:Qb,LucideFileLock:b$,LucideFileLock2:_$,LucideFileMinus:j$,LucideFileMinus2:w$,LucideFileMusic:k$,LucideFileOutput:N$,LucideFilePen:r2,LucideFilePenLine:t2,LucideFilePieChart:Jb,LucideFilePlus:C$,LucideFilePlus2:S$,LucideFileQuestion:M$,LucideFileScan:T$,LucideFileSearch:E$,LucideFileSearch2:A$,LucideFileSignature:t2,LucideFileSliders:I$,LucideFileSpreadsheet:K1,LucideFileStack:P$,LucideFileSymlink:L$,LucideFileTerminal:O$,LucideFileText:fa,LucideFileType:R$,LucideFileType2:D$,LucideFileUp:F$,LucideFileUser:z$,LucideFileVideo:$$,LucideFileVideo2:B$,LucideFileVolume:q$,LucideFileVolume2:U$,LucideFileWarning:V$,LucideFileX:W$,LucideFileX2:H$,LucideFiles:G$,LucideFilm:Od,LucideFilter:Z1,LucideFilterX:K$,LucideFingerprint:Z$,LucideFireExtinguisher:Y$,LucideFish:J$,LucideFishOff:X$,LucideFishSymbol:Q$,LucideFlag:gy,LucideFlagOff:eU,LucideFlagTriangleLeft:tU,LucideFlagTriangleRight:rU,LucideFlame:_m,LucideFlameKindling:sU,LucideFlashlight:aU,LucideFlashlightOff:nU,LucideFlaskConical:$j,LucideFlaskConicalOff:iU,LucideFlaskRound:oU,LucideFlipHorizontal:cU,LucideFlipHorizontal2:lU,LucideFlipVertical:uU,LucideFlipVertical2:dU,LucideFlower:hU,LucideFlower2:Tf,LucideFocus:mU,LucideFoldHorizontal:pU,LucideFoldVertical:fU,LucideFolder:UU,LucideFolderArchive:gU,LucideFolderCheck:xU,LucideFolderClock:yU,LucideFolderClosed:vU,LucideFolderCode:_U,LucideFolderCog:s2,LucideFolderCog2:s2,LucideFolderDot:bU,LucideFolderDown:wU,LucideFolderEdit:n2,LucideFolderGit:kU,LucideFolderGit2:jU,LucideFolderHeart:NU,LucideFolderInput:SU,LucideFolderKanban:CU,LucideFolderKey:MU,LucideFolderLock:TU,LucideFolderMinus:AU,LucideFolderOpen:bm,LucideFolderOpenDot:EU,LucideFolderOutput:IU,LucideFolderPen:n2,LucideFolderPlus:PU,LucideFolderRoot:LU,LucideFolderSearch:DU,LucideFolderSearch2:OU,LucideFolderSymlink:RU,LucideFolderSync:FU,LucideFolderTree:zU,LucideFolderUp:BU,LucideFolderX:$U,LucideFolders:qU,LucideFootprints:VU,LucideForkKnife:Zw,LucideForkKnifeCrossed:Kw,LucideForklift:HU,LucideFormInput:A2,LucideForward:WU,LucideFrame:GU,LucideFramer:KU,LucideFrown:ZU,LucideFuel:YU,LucideFullscreen:XU,LucideFunctionSquare:uw,LucideGalleryHorizontal:JU,LucideGalleryHorizontalEnd:QU,LucideGalleryThumbnails:eq,LucideGalleryVertical:rq,LucideGalleryVerticalEnd:tq,LucideGamepad:nq,LucideGamepad2:sq,LucideGanttChart:ub,LucideGanttChartSquare:kg,LucideGauge:aq,LucideGaugeCircle:Cb,LucideGavel:iq,LucideGem:oq,LucideGhost:Uj,LucideGift:uo,LucideGitBranch:cq,LucideGitBranchPlus:lq,LucideGitCommit:a2,LucideGitCommitHorizontal:a2,LucideGitCommitVertical:dq,LucideGitCompare:hq,LucideGitCompareArrows:uq,LucideGitFork:mq,LucideGitGraph:pq,LucideGitMerge:fq,LucideGitPullRequest:bq,LucideGitPullRequestArrow:gq,LucideGitPullRequestClosed:xq,LucideGitPullRequestCreate:vq,LucideGitPullRequestCreateArrow:yq,LucideGitPullRequestDraft:_q,LucideGithub:wq,LucideGitlab:jq,LucideGlassWater:kq,LucideGlasses:Nq,LucideGlobe:Gg,LucideGlobe2:Kb,LucideGlobeLock:Sq,LucideGoal:Cq,LucideGrab:Mq,LucideGraduationCap:Y1,LucideGrape:Tq,LucideGrid:im,LucideGrid2X2:o2,LucideGrid2X2Plus:i2,LucideGrid2x2:o2,LucideGrid2x2Check:Aq,LucideGrid2x2Plus:i2,LucideGrid2x2X:Eq,LucideGrid3X3:im,LucideGrid3x3:im,LucideGrip:Pq,LucideGripHorizontal:Iq,LucideGripVertical:xp,LucideGroup:Lq,LucideGuitar:Oq,LucideHam:Dq,LucideHammer:Rq,LucideHand:yA,LucideHandCoins:Fq,LucideHandHeart:zq,LucideHandHelping:l2,LucideHandMetal:Bq,LucideHandPlatter:$q,LucideHandshake:Uq,LucideHardDrive:vA,LucideHardDriveDownload:qq,LucideHardDriveUpload:Vq,LucideHardHat:Hq,LucideHash:zS,LucideHaze:Wq,LucideHdmiPort:Gq,LucideHeading:Qq,LucideHeading1:_A,LucideHeading2:bA,LucideHeading3:Kq,LucideHeading4:Zq,LucideHeading5:Yq,LucideHeading6:Xq,LucideHeadphoneOff:Jq,LucideHeadphones:eV,LucideHeadset:tV,LucideHeart:Ci,LucideHeartCrack:rV,LucideHeartHandshake:sV,LucideHeartOff:nV,LucideHeartPulse:aV,LucideHeater:iV,LucideHelpCircle:ey,LucideHelpingHand:l2,LucideHexagon:oV,LucideHighlighter:lV,LucideHistory:BS,LucideHome:Wn,LucideHop:dV,LucideHopOff:cV,LucideHospital:uV,LucideHotel:hV,LucideHourglass:mV,LucideHouse:Wn,LucideHousePlug:pV,LucideHousePlus:fV,LucideIceCream:d2,LucideIceCream2:c2,LucideIceCreamBowl:c2,LucideIceCreamCone:d2,LucideIdCard:gV,LucideImage:El,LucideImageDown:xV,LucideImageMinus:yV,LucideImageOff:vV,LucideImagePlay:_V,LucideImagePlus:X1,LucideImageUp:bV,LucideImageUpscale:wV,LucideImages:jV,LucideImport:kV,LucideInbox:NV,LucideIndent:h2,LucideIndentDecrease:u2,LucideIndentIncrease:h2,LucideIndianRupee:SV,LucideInfinity:CV,LucideInfo:MV,LucideInspect:xw,LucideInspectionPanel:TV,LucideInstagram:ju,LucideItalic:$S,LucideIterationCcw:AV,LucideIterationCw:EV,LucideJapaneseYen:IV,LucideJoystick:PV,LucideKanban:xy,LucideKanbanSquare:hw,LucideKanbanSquareDashed:aw,LucideKey:wm,LucideKeyRound:qj,LucideKeySquare:LV,LucideKeyboard:RV,LucideKeyboardMusic:OV,LucideKeyboardOff:DV,LucideLamp:qV,LucideLampCeiling:FV,LucideLampDesk:zV,LucideLampFloor:BV,LucideLampWallDown:$V,LucideLampWallUp:UV,LucideLandPlot:VV,LucideLandmark:HV,LucideLanguages:WV,LucideLaptop:KV,LucideLaptop2:m2,LucideLaptopMinimal:m2,LucideLaptopMinimalCheck:GV,LucideLasso:YV,LucideLassoSelect:ZV,LucideLaugh:XV,LucideLayers:eH,LucideLayers2:QV,LucideLayers3:JV,LucideLayout:X0,LucideLayoutDashboard:Vj,LucideLayoutGrid:yp,LucideLayoutList:tH,LucideLayoutPanelLeft:rH,LucideLayoutPanelTop:sH,LucideLayoutTemplate:Hj,LucideLeaf:nH,LucideLeafyGreen:aH,LucideLectern:iH,LucideLetterText:oH,LucideLibrary:US,LucideLibraryBig:lH,LucideLibrarySquare:mw,LucideLifeBuoy:qS,LucideLigature:cH,LucideLightbulb:yy,LucideLightbulbOff:dH,LucideLineChart:lb,LucideLink:Bo,LucideLink2:jm,LucideLink2Off:uH,LucideLinkedin:km,LucideList:vp,LucideListCheck:hH,LucideListChecks:mH,LucideListCollapse:pH,LucideListEnd:fH,LucideListFilter:gH,LucideListMinus:xH,LucideListMusic:yH,LucideListOrdered:VS,LucideListPlus:vH,LucideListRestart:_H,LucideListStart:bH,LucideListTodo:wH,LucideListTree:jH,LucideListVideo:kH,LucideListX:NH,LucideLoader:CH,LucideLoader2:Hr,LucideLoaderCircle:Hr,LucideLoaderPinwheel:SH,LucideLocate:wA,LucideLocateFixed:MH,LucideLocateOff:TH,LucideLock:ku,LucideLockKeyhole:AH,LucideLockKeyholeOpen:p2,LucideLockOpen:f2,LucideLogIn:HS,LucideLogOut:WS,LucideLogs:EH,LucideLollipop:IH,LucideLuggage:PH,LucideMSquare:pw,LucideMagnet:LH,LucideMail:mn,LucideMailCheck:OH,LucideMailMinus:DH,LucideMailOpen:RH,LucideMailPlus:FH,LucideMailQuestion:zH,LucideMailSearch:BH,LucideMailWarning:$H,LucideMailX:jA,LucideMailbox:UH,LucideMails:qH,LucideMap:tW,LucideMapPin:eo,LucideMapPinCheck:HH,LucideMapPinCheckInside:VH,LucideMapPinHouse:WH,LucideMapPinMinus:KH,LucideMapPinMinusInside:GH,LucideMapPinOff:ZH,LucideMapPinPlus:XH,LucideMapPinPlusInside:YH,LucideMapPinX:JH,LucideMapPinXInside:QH,LucideMapPinned:eW,LucideMartini:rW,LucideMaximize:nW,LucideMaximize2:sW,LucideMedal:vy,LucideMegaphone:Bf,LucideMegaphoneOff:aW,LucideMeh:iW,LucideMemoryStick:oW,LucideMenu:kA,LucideMenuSquare:fw,LucideMerge:lW,LucideMessageCircle:Pl,LucideMessageCircleCode:cW,LucideMessageCircleDashed:dW,LucideMessageCircleHeart:GS,LucideMessageCircleMore:uW,LucideMessageCircleOff:hW,LucideMessageCirclePlus:mW,LucideMessageCircleQuestion:NA,LucideMessageCircleReply:pW,LucideMessageCircleWarning:fW,LucideMessageCircleX:gW,LucideMessageSquare:$o,LucideMessageSquareCode:xW,LucideMessageSquareDashed:yW,LucideMessageSquareDiff:vW,LucideMessageSquareDot:_W,LucideMessageSquareHeart:SA,LucideMessageSquareLock:bW,LucideMessageSquareMore:wW,LucideMessageSquareOff:jW,LucideMessageSquarePlus:CA,LucideMessageSquareQuote:MA,LucideMessageSquareReply:kW,LucideMessageSquareShare:NW,LucideMessageSquareText:SW,LucideMessageSquareWarning:CW,LucideMessageSquareX:MW,LucideMessagesSquare:TW,LucideMic:TA,LucideMic2:g2,LucideMicOff:AW,LucideMicVocal:g2,LucideMicrochip:EW,LucideMicroscope:IW,LucideMicrowave:PW,LucideMilestone:LW,LucideMilk:DW,LucideMilkOff:OW,LucideMinimize:FW,LucideMinimize2:RW,LucideMinus:Q1,LucideMinusCircle:Mb,LucideMinusSquare:gw,LucideMonitor:Wj,LucideMonitorCheck:zW,LucideMonitorCog:BW,LucideMonitorDot:$W,LucideMonitorDown:UW,LucideMonitorOff:qW,LucideMonitorPause:VW,LucideMonitorPlay:HW,LucideMonitorSmartphone:WW,LucideMonitorSpeaker:GW,LucideMonitorStop:KW,LucideMonitorUp:ZW,LucideMonitorX:YW,LucideMoon:QW,LucideMoonStar:XW,LucideMoreHorizontal:kf,LucideMoreVertical:Pg,LucideMountain:eG,LucideMountainSnow:JW,LucideMouse:aG,LucideMouseOff:tG,LucideMousePointer:nG,LucideMousePointer2:rG,LucideMousePointerBan:sG,LucideMousePointerClick:J1,LucideMousePointerSquareDashed:iw,LucideMove:yG,LucideMove3D:x2,LucideMove3d:x2,LucideMoveDiagonal:oG,LucideMoveDiagonal2:iG,LucideMoveDown:dG,LucideMoveDownLeft:lG,LucideMoveDownRight:cG,LucideMoveHorizontal:uG,LucideMoveLeft:hG,LucideMoveRight:mG,LucideMoveUp:gG,LucideMoveUpLeft:pG,LucideMoveUpRight:fG,LucideMoveVertical:xG,LucideMusic:wG,LucideMusic2:vG,LucideMusic3:_G,LucideMusic4:bG,LucideNavigation:AA,LucideNavigation2:kG,LucideNavigation2Off:jG,LucideNavigationOff:NG,LucideNetwork:SG,LucideNewspaper:_y,LucideNfc:CG,LucideNotebook:EG,LucideNotebookPen:MG,LucideNotebookTabs:TG,LucideNotebookText:AG,LucideNotepadText:PG,LucideNotepadTextDashed:IG,LucideNut:OG,LucideNutOff:LG,LucideOctagon:RG,LucideOctagonAlert:y2,LucideOctagonMinus:DG,LucideOctagonPause:v2,LucideOctagonX:_2,LucideOmega:FG,LucideOption:zG,LucideOrbit:BG,LucideOrigami:$G,LucideOutdent:u2,LucidePackage:Wl,LucidePackage2:UG,LucidePackageCheck:qG,LucidePackageMinus:VG,LucidePackageOpen:HG,LucidePackagePlus:WG,LucidePackageSearch:GG,LucidePackageX:KG,LucidePaintBucket:ZG,LucidePaintRoller:YG,LucidePaintbrush:XG,LucidePaintbrush2:b2,LucidePaintbrushVertical:b2,LucidePalette:ed,LucidePalmtree:Fw,LucidePanelBottom:eK,LucidePanelBottomClose:QG,LucidePanelBottomDashed:w2,LucidePanelBottomInactive:w2,LucidePanelBottomOpen:JG,LucidePanelLeft:S2,LucidePanelLeftClose:j2,LucidePanelLeftDashed:k2,LucidePanelLeftInactive:k2,LucidePanelLeftOpen:N2,LucidePanelRight:sK,LucidePanelRightClose:tK,LucidePanelRightDashed:C2,LucidePanelRightInactive:C2,LucidePanelRightOpen:rK,LucidePanelTop:iK,LucidePanelTopClose:nK,LucidePanelTopDashed:M2,LucidePanelTopInactive:M2,LucidePanelTopOpen:aK,LucidePanelsLeftBottom:oK,LucidePanelsLeftRight:Hb,LucidePanelsRightBottom:lK,LucidePanelsTopBottom:P2,LucidePanelsTopLeft:X0,LucidePaperclip:Gj,LucideParentheses:cK,LucideParkingCircle:Ab,LucideParkingCircleOff:Tb,LucideParkingMeter:dK,LucideParkingSquare:vw,LucideParkingSquareOff:yw,LucidePartyPopper:td,LucidePause:Nm,LucidePauseCircle:Eb,LucidePauseOctagon:v2,LucidePawPrint:uK,LucidePcCase:hK,LucidePen:J0,LucidePenBox:wc,LucidePenLine:Q0,LucidePenOff:mK,LucidePenSquare:wc,LucidePenTool:Kj,LucidePencil:ei,LucidePencilLine:pK,LucidePencilOff:fK,LucidePencilRuler:gK,LucidePentagon:xK,LucidePercent:KS,LucidePercentCircle:Ib,LucidePercentDiamond:Gb,LucidePercentSquare:_w,LucidePersonStanding:yK,LucidePhilippinePeso:vK,LucidePhone:wi,LucidePhoneCall:_K,LucidePhoneForwarded:bK,LucidePhoneIncoming:wK,LucidePhoneMissed:jK,LucidePhoneOff:kK,LucidePhoneOutgoing:NK,LucidePi:SK,LucidePiSquare:bw,LucidePiano:CK,LucidePickaxe:MK,LucidePictureInPicture:AK,LucidePictureInPicture2:TK,LucidePieChart:hb,LucidePiggyBank:EK,LucidePilcrow:LK,LucidePilcrowLeft:IK,LucidePilcrowRight:PK,LucidePilcrowSquare:ww,LucidePill:DK,LucidePillBottle:OK,LucidePin:ev,LucidePinOff:EA,LucidePipette:RK,LucidePizza:FK,LucidePlane:$K,LucidePlaneLanding:zK,LucidePlaneTakeoff:BK,LucidePlay:Gl,LucidePlayCircle:lp,LucidePlaySquare:jw,LucidePlug:IA,LucidePlug2:UK,LucidePlugZap:T2,LucidePlugZap2:T2,LucidePlus:gs,LucidePlusCircle:Pb,LucidePlusSquare:kw,LucidePocket:VK,LucidePocketKnife:qK,LucidePodcast:HK,LucidePointer:GK,LucidePointerOff:WK,LucidePopcorn:KK,LucidePopsicle:ZK,LucidePoundSterling:YK,LucidePower:QK,LucidePowerCircle:Lb,LucidePowerOff:XK,LucidePowerSquare:Nw,LucidePresentation:$f,LucidePrinter:PA,LucidePrinterCheck:JK,LucideProjector:eZ,LucideProportions:tZ,LucidePuzzle:rZ,LucidePyramid:sZ,LucideQrCode:Zj,LucideQuote:LA,LucideRabbit:nZ,LucideRadar:aZ,LucideRadiation:iZ,LucideRadical:oZ,LucideRadio:Yj,LucideRadioReceiver:lZ,LucideRadioTower:cZ,LucideRadius:dZ,LucideRailSymbol:uZ,LucideRainbow:hZ,LucideRat:mZ,LucideRatio:pZ,LucideReceipt:jZ,LucideReceiptCent:fZ,LucideReceiptEuro:gZ,LucideReceiptIndianRupee:xZ,LucideReceiptJapaneseYen:yZ,LucideReceiptPoundSterling:vZ,LucideReceiptRussianRuble:_Z,LucideReceiptSwissFranc:bZ,LucideReceiptText:wZ,LucideRectangleEllipsis:A2,LucideRectangleHorizontal:kZ,LucideRectangleVertical:NZ,LucideRecycle:SZ,LucideRedo:ZS,LucideRedo2:CZ,LucideRedoDot:MZ,LucideRefreshCcw:AZ,LucideRefreshCcwDot:TZ,LucideRefreshCw:Ko,LucideRefreshCwOff:EZ,LucideRefrigerator:IZ,LucideRegex:PZ,LucideRemoveFormatting:LZ,LucideRepeat:OA,LucideRepeat1:OZ,LucideRepeat2:DZ,LucideReplace:FZ,LucideReplaceAll:RZ,LucideReply:DA,LucideReplyAll:zZ,LucideRewind:BZ,LucideRibbon:$Z,LucideRocket:Kg,LucideRockingChair:UZ,LucideRollerCoaster:qZ,LucideRotate3D:E2,LucideRotate3d:E2,LucideRotateCcw:Xj,LucideRotateCcwSquare:VZ,LucideRotateCw:RA,LucideRotateCwSquare:HZ,LucideRoute:GZ,LucideRouteOff:WZ,LucideRouter:KZ,LucideRows:I2,LucideRows2:I2,LucideRows3:P2,LucideRows4:ZZ,LucideRss:YZ,LucideRuler:XZ,LucideRussianRuble:QZ,LucideSailboat:JZ,LucideSalad:eY,LucideSandwich:tY,LucideSatellite:sY,LucideSatelliteDish:rY,LucideSave:_p,LucideSaveAll:nY,LucideSaveOff:aY,LucideScale:iY,LucideScale3D:L2,LucideScale3d:L2,LucideScaling:oY,LucideScan:fY,LucideScanBarcode:lY,LucideScanEye:cY,LucideScanFace:dY,LucideScanLine:uY,LucideScanQrCode:hY,LucideScanSearch:mY,LucideScanText:pY,LucideScatterChart:mb,LucideSchool:gY,LucideSchool2:Bw,LucideScissors:yY,LucideScissorsLineDashed:xY,LucideScissorsSquare:Sw,LucideScissorsSquareDashedBottom:Q2,LucideScreenShare:_Y,LucideScreenShareOff:vY,LucideScroll:wY,LucideScrollText:bY,LucideSearch:Qn,LucideSearchCheck:jY,LucideSearchCode:kY,LucideSearchSlash:NY,LucideSearchX:SY,LucideSection:CY,LucideSend:Mi,LucideSendHorizonal:O2,LucideSendHorizontal:O2,LucideSendToBack:MY,LucideSeparatorHorizontal:TY,LucideSeparatorVertical:AY,LucideServer:LY,LucideServerCog:EY,LucideServerCrash:IY,LucideServerOff:PY,LucideSettings:vd,LucideSettings2:OY,LucideShapes:DY,LucideShare:FA,LucideShare2:Oc,LucideSheet:RY,LucideShell:FY,LucideShield:Nu,LucideShieldAlert:zY,LucideShieldBan:BY,LucideShieldCheck:zA,LucideShieldClose:D2,LucideShieldEllipsis:$Y,LucideShieldHalf:UY,LucideShieldMinus:qY,LucideShieldOff:VY,LucideShieldPlus:HY,LucideShieldQuestion:WY,LucideShieldX:D2,LucideShip:KY,LucideShipWheel:GY,LucideShirt:ZY,LucideShoppingBag:Zg,LucideShoppingBasket:YY,LucideShoppingCart:Lh,LucideShovel:XY,LucideShowerHead:QY,LucideShrink:JY,LucideShrub:eX,LucideShuffle:tX,LucideSidebar:S2,LucideSidebarClose:j2,LucideSidebarOpen:N2,LucideSigma:rX,LucideSigmaSquare:Cw,LucideSignal:oX,LucideSignalHigh:sX,LucideSignalLow:nX,LucideSignalMedium:aX,LucideSignalZero:iX,LucideSignature:lX,LucideSignpost:dX,LucideSignpostBig:cX,LucideSiren:uX,LucideSkipBack:hX,LucideSkipForward:mX,LucideSkull:pX,LucideSlack:fX,LucideSlash:gX,LucideSlashSquare:Mw,LucideSlice:xX,LucideSliders:R2,LucideSlidersHorizontal:BA,LucideSlidersVertical:R2,LucideSmartphone:by,LucideSmartphoneCharging:yX,LucideSmartphoneNfc:vX,LucideSmile:bX,LucideSmilePlus:_X,LucideSnail:wX,LucideSnowflake:T1,LucideSofa:jX,LucideSortAsc:G_,LucideSortDesc:V_,LucideSoup:kX,LucideSpace:NX,LucideSpade:SX,LucideSparkle:CX,LucideSparkles:An,LucideSpeaker:MX,LucideSpeech:TX,LucideSpellCheck:EX,LucideSpellCheck2:AX,LucideSpline:IX,LucideSplit:PX,LucideSplitSquareHorizontal:Tw,LucideSplitSquareVertical:Aw,LucideSprayCan:LX,LucideSprout:OX,LucideSquare:Yg,LucideSquareActivity:F2,LucideSquareArrowDown:$2,LucideSquareArrowDownLeft:z2,LucideSquareArrowDownRight:B2,LucideSquareArrowLeft:U2,LucideSquareArrowOutDownLeft:q2,LucideSquareArrowOutDownRight:V2,LucideSquareArrowOutUpLeft:H2,LucideSquareArrowOutUpRight:W2,LucideSquareArrowRight:G2,LucideSquareArrowUp:Y2,LucideSquareArrowUpLeft:K2,LucideSquareArrowUpRight:Z2,LucideSquareAsterisk:X2,LucideSquareBottomDashedScissors:Q2,LucideSquareChartGantt:kg,LucideSquareCheck:J2,LucideSquareCheckBig:e1,LucideSquareChevronDown:ew,LucideSquareChevronLeft:tw,LucideSquareChevronRight:rw,LucideSquareChevronUp:sw,LucideSquareCode:nw,LucideSquareDashed:ow,LucideSquareDashedBottom:RX,LucideSquareDashedBottomCode:DX,LucideSquareDashedKanban:aw,LucideSquareDashedMousePointer:iw,LucideSquareDivide:lw,LucideSquareDot:cw,LucideSquareEqual:dw,LucideSquareFunction:uw,LucideSquareGanttChart:kg,LucideSquareKanban:hw,LucideSquareLibrary:mw,LucideSquareM:pw,LucideSquareMenu:fw,LucideSquareMinus:gw,LucideSquareMousePointer:xw,LucideSquareParking:vw,LucideSquareParkingOff:yw,LucideSquarePen:wc,LucideSquarePercent:_w,LucideSquarePi:bw,LucideSquarePilcrow:ww,LucideSquarePlay:jw,LucideSquarePlus:kw,LucideSquarePower:Nw,LucideSquareRadical:FX,LucideSquareScissors:Sw,LucideSquareSigma:Cw,LucideSquareSlash:Mw,LucideSquareSplitHorizontal:Tw,LucideSquareSplitVertical:Aw,LucideSquareSquare:zX,LucideSquareStack:BX,LucideSquareTerminal:Ew,LucideSquareUser:Pw,LucideSquareUserRound:Iw,LucideSquareX:Lw,LucideSquircle:$X,LucideSquirrel:UX,LucideStamp:qX,LucideStar:Ln,LucideStarHalf:VX,LucideStarOff:HX,LucideStars:An,LucideStepBack:WX,LucideStepForward:GX,LucideStethoscope:KX,LucideSticker:ZX,LucideStickyNote:YX,LucideStopCircle:Db,LucideStore:XX,LucideStretchHorizontal:QX,LucideStretchVertical:JX,LucideStrikethrough:eQ,LucideSubscript:tQ,LucideSubtitles:tb,LucideSun:tv,LucideSunDim:rQ,LucideSunMedium:sQ,LucideSunMoon:nQ,LucideSunSnow:aQ,LucideSunrise:iQ,LucideSunset:oQ,LucideSuperscript:lQ,LucideSwatchBook:cQ,LucideSwissFranc:dQ,LucideSwitchCamera:uQ,LucideSword:hQ,LucideSwords:mQ,LucideSyringe:pQ,LucideTable:bQ,LucideTable2:YS,LucideTableCellsMerge:fQ,LucideTableCellsSplit:gQ,LucideTableColumnsSplit:xQ,LucideTableOfContents:yQ,LucideTableProperties:vQ,LucideTableRowsSplit:_Q,LucideTablet:jQ,LucideTabletSmartphone:wQ,LucideTablets:kQ,LucideTag:Xg,LucideTags:NQ,LucideTally1:SQ,LucideTally2:CQ,LucideTally3:MQ,LucideTally4:TQ,LucideTally5:AQ,LucideTangent:EQ,LucideTarget:bp,LucideTelescope:IQ,LucideTent:LQ,LucideTentTree:PQ,LucideTerminal:OQ,LucideTerminalSquare:Ew,LucideTestTube:DQ,LucideTestTube2:Ow,LucideTestTubeDiagonal:Ow,LucideTestTubes:RQ,LucideText:UQ,LucideTextCursor:zQ,LucideTextCursorInput:FQ,LucideTextQuote:BQ,LucideTextSearch:$Q,LucideTextSelect:Dw,LucideTextSelection:Dw,LucideTheater:qQ,LucideThermometer:WQ,LucideThermometerSnowflake:VQ,LucideThermometerSun:HQ,LucideThumbsDown:$A,LucideThumbsUp:_d,LucideTicket:UA,LucideTicketCheck:GQ,LucideTicketMinus:KQ,LucideTicketPercent:ZQ,LucideTicketPlus:YQ,LucideTicketSlash:XQ,LucideTicketX:QQ,LucideTickets:eJ,LucideTicketsPlane:JQ,LucideTimer:sJ,LucideTimerOff:tJ,LucideTimerReset:rJ,LucideToggleLeft:nJ,LucideToggleRight:aJ,LucideToilet:iJ,LucideTornado:oJ,LucideTorus:lJ,LucideTouchpad:dJ,LucideTouchpadOff:cJ,LucideTowerControl:uJ,LucideToyBrick:hJ,LucideTractor:mJ,LucideTrafficCone:pJ,LucideTrain:Rw,LucideTrainFront:gJ,LucideTrainFrontTunnel:fJ,LucideTrainTrack:xJ,LucideTramFront:Rw,LucideTrash:yJ,LucideTrash2:Rs,LucideTreeDeciduous:vJ,LucideTreePalm:Fw,LucideTreePine:rv,LucideTrees:_J,LucideTrello:bJ,LucideTrendingDown:Qj,LucideTrendingUp:ou,LucideTrendingUpDown:wJ,LucideTriangle:kJ,LucideTriangleAlert:Qu,LucideTriangleRight:jJ,LucideTrophy:ho,LucideTruck:qA,LucideTurtle:NJ,LucideTv:CJ,LucideTv2:zw,LucideTvMinimal:zw,LucideTvMinimalPlay:SJ,LucideTwitch:MJ,LucideTwitter:TJ,LucideType:EJ,LucideTypeOutline:AJ,LucideUmbrella:PJ,LucideUmbrellaOff:IJ,LucideUnderline:LJ,LucideUndo:XS,LucideUndo2:OJ,LucideUndoDot:DJ,LucideUnfoldHorizontal:RJ,LucideUnfoldVertical:FJ,LucideUngroup:zJ,LucideUniversity:Bw,LucideUnlink:VA,LucideUnlink2:BJ,LucideUnlock:f2,LucideUnlockKeyhole:p2,LucideUnplug:$J,LucideUpload:to,LucideUploadCloud:Ub,LucideUsb:UJ,LucideUser:Kl,LucideUser2:Ww,LucideUserCheck:Jj,LucideUserCheck2:$w,LucideUserCircle:Fb,LucideUserCircle2:Rb,LucideUserCog:HA,LucideUserCog2:Uw,LucideUserMinus:WA,LucideUserMinus2:qw,LucideUserPen:qJ,LucideUserPlus:$d,LucideUserPlus2:Vw,LucideUserRound:Ww,LucideUserRoundCheck:$w,LucideUserRoundCog:Uw,LucideUserRoundMinus:qw,LucideUserRoundPen:VJ,LucideUserRoundPlus:Vw,LucideUserRoundSearch:HJ,LucideUserRoundX:Hw,LucideUserSearch:WJ,LucideUserSquare:Pw,LucideUserSquare2:Iw,LucideUserX:GJ,LucideUserX2:Hw,LucideUsers:ws,LucideUsers2:Gw,LucideUsersRound:Gw,LucideUtensils:Zw,LucideUtensilsCrossed:Kw,LucideUtilityPole:KJ,LucideVariable:GA,LucideVault:ZJ,LucideVegan:YJ,LucideVenetianMask:XJ,LucideVerified:Y_,LucideVibrate:JJ,LucideVibrateOff:QJ,LucideVideo:ya,LucideVideoOff:eee,LucideVideotape:tee,LucideView:ree,LucideVoicemail:see,LucideVolleyball:nee,LucideVolume:cee,LucideVolume1:aee,LucideVolume2:iee,LucideVolumeOff:oee,LucideVolumeX:lee,LucideVote:dee,LucideWallet:hee,LucideWallet2:Yw,LucideWalletCards:uee,LucideWalletMinimal:Yw,LucideWallpaper:mee,LucideWand:pee,LucideWand2:Xw,LucideWandSparkles:Xw,LucideWarehouse:fee,LucideWashingMachine:gee,LucideWatch:xee,LucideWaves:yee,LucideWaypoints:vee,LucideWebcam:_ee,LucideWebhook:wee,LucideWebhookOff:bee,LucideWeight:jee,LucideWheat:Nee,LucideWheatOff:kee,LucideWholeWord:See,LucideWifi:Eee,LucideWifiHigh:Cee,LucideWifiLow:Mee,LucideWifiOff:Tee,LucideWifiZero:Aee,LucideWind:Pee,LucideWindArrowDown:Iee,LucideWine:Oee,LucideWineOff:Lee,LucideWorkflow:Dee,LucideWorm:Ree,LucideWrapText:Fee,LucideWrench:wy,LucideX:rn,LucideXCircle:Sc,LucideXOctagon:_2,LucideXSquare:Lw,LucideYoutube:zee,LucideZap:Qg,LucideZapOff:Bee,LucideZoomIn:QS,LucideZoomOut:JS,Luggage:PH,LuggageIcon:PH,MSquare:pw,MSquareIcon:pw,Magnet:LH,MagnetIcon:LH,Mail:mn,MailCheck:OH,MailCheckIcon:OH,MailIcon:mn,MailMinus:DH,MailMinusIcon:DH,MailOpen:RH,MailOpenIcon:RH,MailPlus:FH,MailPlusIcon:FH,MailQuestion:zH,MailQuestionIcon:zH,MailSearch:BH,MailSearchIcon:BH,MailWarning:$H,MailWarningIcon:$H,MailX:jA,MailXIcon:jA,Mailbox:UH,MailboxIcon:UH,Mails:qH,MailsIcon:qH,Map:tW,MapIcon:tW,MapPin:eo,MapPinCheck:HH,MapPinCheckIcon:HH,MapPinCheckInside:VH,MapPinCheckInsideIcon:VH,MapPinHouse:WH,MapPinHouseIcon:WH,MapPinIcon:eo,MapPinMinus:KH,MapPinMinusIcon:KH,MapPinMinusInside:GH,MapPinMinusInsideIcon:GH,MapPinOff:ZH,MapPinOffIcon:ZH,MapPinPlus:XH,MapPinPlusIcon:XH,MapPinPlusInside:YH,MapPinPlusInsideIcon:YH,MapPinX:JH,MapPinXIcon:JH,MapPinXInside:QH,MapPinXInsideIcon:QH,MapPinned:eW,MapPinnedIcon:eW,Martini:rW,MartiniIcon:rW,Maximize:nW,Maximize2:sW,Maximize2Icon:sW,MaximizeIcon:nW,Medal:vy,MedalIcon:vy,Megaphone:Bf,MegaphoneIcon:Bf,MegaphoneOff:aW,MegaphoneOffIcon:aW,Meh:iW,MehIcon:iW,MemoryStick:oW,MemoryStickIcon:oW,Menu:kA,MenuIcon:kA,MenuSquare:fw,MenuSquareIcon:fw,Merge:lW,MergeIcon:lW,MessageCircle:Pl,MessageCircleCode:cW,MessageCircleCodeIcon:cW,MessageCircleDashed:dW,MessageCircleDashedIcon:dW,MessageCircleHeart:GS,MessageCircleHeartIcon:GS,MessageCircleIcon:Pl,MessageCircleMore:uW,MessageCircleMoreIcon:uW,MessageCircleOff:hW,MessageCircleOffIcon:hW,MessageCirclePlus:mW,MessageCirclePlusIcon:mW,MessageCircleQuestion:NA,MessageCircleQuestionIcon:NA,MessageCircleReply:pW,MessageCircleReplyIcon:pW,MessageCircleWarning:fW,MessageCircleWarningIcon:fW,MessageCircleX:gW,MessageCircleXIcon:gW,MessageSquare:$o,MessageSquareCode:xW,MessageSquareCodeIcon:xW,MessageSquareDashed:yW,MessageSquareDashedIcon:yW,MessageSquareDiff:vW,MessageSquareDiffIcon:vW,MessageSquareDot:_W,MessageSquareDotIcon:_W,MessageSquareHeart:SA,MessageSquareHeartIcon:SA,MessageSquareIcon:$o,MessageSquareLock:bW,MessageSquareLockIcon:bW,MessageSquareMore:wW,MessageSquareMoreIcon:wW,MessageSquareOff:jW,MessageSquareOffIcon:jW,MessageSquarePlus:CA,MessageSquarePlusIcon:CA,MessageSquareQuote:MA,MessageSquareQuoteIcon:MA,MessageSquareReply:kW,MessageSquareReplyIcon:kW,MessageSquareShare:NW,MessageSquareShareIcon:NW,MessageSquareText:SW,MessageSquareTextIcon:SW,MessageSquareWarning:CW,MessageSquareWarningIcon:CW,MessageSquareX:MW,MessageSquareXIcon:MW,MessagesSquare:TW,MessagesSquareIcon:TW,Mic:TA,Mic2:g2,Mic2Icon:g2,MicIcon:TA,MicOff:AW,MicOffIcon:AW,MicVocal:g2,MicVocalIcon:g2,Microchip:EW,MicrochipIcon:EW,Microscope:IW,MicroscopeIcon:IW,Microwave:PW,MicrowaveIcon:PW,Milestone:LW,MilestoneIcon:LW,Milk:DW,MilkIcon:DW,MilkOff:OW,MilkOffIcon:OW,Minimize:FW,Minimize2:RW,Minimize2Icon:RW,MinimizeIcon:FW,Minus:Q1,MinusCircle:Mb,MinusCircleIcon:Mb,MinusIcon:Q1,MinusSquare:gw,MinusSquareIcon:gw,Monitor:Wj,MonitorCheck:zW,MonitorCheckIcon:zW,MonitorCog:BW,MonitorCogIcon:BW,MonitorDot:$W,MonitorDotIcon:$W,MonitorDown:UW,MonitorDownIcon:UW,MonitorIcon:Wj,MonitorOff:qW,MonitorOffIcon:qW,MonitorPause:VW,MonitorPauseIcon:VW,MonitorPlay:HW,MonitorPlayIcon:HW,MonitorSmartphone:WW,MonitorSmartphoneIcon:WW,MonitorSpeaker:GW,MonitorSpeakerIcon:GW,MonitorStop:KW,MonitorStopIcon:KW,MonitorUp:ZW,MonitorUpIcon:ZW,MonitorX:YW,MonitorXIcon:YW,Moon:QW,MoonIcon:QW,MoonStar:XW,MoonStarIcon:XW,MoreHorizontal:kf,MoreHorizontalIcon:kf,MoreVertical:Pg,MoreVerticalIcon:Pg,Mountain:eG,MountainIcon:eG,MountainSnow:JW,MountainSnowIcon:JW,Mouse:aG,MouseIcon:aG,MouseOff:tG,MouseOffIcon:tG,MousePointer:nG,MousePointer2:rG,MousePointer2Icon:rG,MousePointerBan:sG,MousePointerBanIcon:sG,MousePointerClick:J1,MousePointerClickIcon:J1,MousePointerIcon:nG,MousePointerSquareDashed:iw,MousePointerSquareDashedIcon:iw,Move:yG,Move3D:x2,Move3DIcon:x2,Move3d:x2,Move3dIcon:x2,MoveDiagonal:oG,MoveDiagonal2:iG,MoveDiagonal2Icon:iG,MoveDiagonalIcon:oG,MoveDown:dG,MoveDownIcon:dG,MoveDownLeft:lG,MoveDownLeftIcon:lG,MoveDownRight:cG,MoveDownRightIcon:cG,MoveHorizontal:uG,MoveHorizontalIcon:uG,MoveIcon:yG,MoveLeft:hG,MoveLeftIcon:hG,MoveRight:mG,MoveRightIcon:mG,MoveUp:gG,MoveUpIcon:gG,MoveUpLeft:pG,MoveUpLeftIcon:pG,MoveUpRight:fG,MoveUpRightIcon:fG,MoveVertical:xG,MoveVerticalIcon:xG,Music:wG,Music2:vG,Music2Icon:vG,Music3:_G,Music3Icon:_G,Music4:bG,Music4Icon:bG,MusicIcon:wG,Navigation:AA,Navigation2:kG,Navigation2Icon:kG,Navigation2Off:jG,Navigation2OffIcon:jG,NavigationIcon:AA,NavigationOff:NG,NavigationOffIcon:NG,Network:SG,NetworkIcon:SG,Newspaper:_y,NewspaperIcon:_y,Nfc:CG,NfcIcon:CG,Notebook:EG,NotebookIcon:EG,NotebookPen:MG,NotebookPenIcon:MG,NotebookTabs:TG,NotebookTabsIcon:TG,NotebookText:AG,NotebookTextIcon:AG,NotepadText:PG,NotepadTextDashed:IG,NotepadTextDashedIcon:IG,NotepadTextIcon:PG,Nut:OG,NutIcon:OG,NutOff:LG,NutOffIcon:LG,Octagon:RG,OctagonAlert:y2,OctagonAlertIcon:y2,OctagonIcon:RG,OctagonMinus:DG,OctagonMinusIcon:DG,OctagonPause:v2,OctagonPauseIcon:v2,OctagonX:_2,OctagonXIcon:_2,Omega:FG,OmegaIcon:FG,Option:zG,OptionIcon:zG,Orbit:BG,OrbitIcon:BG,Origami:$G,OrigamiIcon:$G,Outdent:u2,OutdentIcon:u2,Package:Wl,Package2:UG,Package2Icon:UG,PackageCheck:qG,PackageCheckIcon:qG,PackageIcon:Wl,PackageMinus:VG,PackageMinusIcon:VG,PackageOpen:HG,PackageOpenIcon:HG,PackagePlus:WG,PackagePlusIcon:WG,PackageSearch:GG,PackageSearchIcon:GG,PackageX:KG,PackageXIcon:KG,PaintBucket:ZG,PaintBucketIcon:ZG,PaintRoller:YG,PaintRollerIcon:YG,Paintbrush:XG,Paintbrush2:b2,Paintbrush2Icon:b2,PaintbrushIcon:XG,PaintbrushVertical:b2,PaintbrushVerticalIcon:b2,Palette:ed,PaletteIcon:ed,Palmtree:Fw,PalmtreeIcon:Fw,PanelBottom:eK,PanelBottomClose:QG,PanelBottomCloseIcon:QG,PanelBottomDashed:w2,PanelBottomDashedIcon:w2,PanelBottomIcon:eK,PanelBottomInactive:w2,PanelBottomInactiveIcon:w2,PanelBottomOpen:JG,PanelBottomOpenIcon:JG,PanelLeft:S2,PanelLeftClose:j2,PanelLeftCloseIcon:j2,PanelLeftDashed:k2,PanelLeftDashedIcon:k2,PanelLeftIcon:S2,PanelLeftInactive:k2,PanelLeftInactiveIcon:k2,PanelLeftOpen:N2,PanelLeftOpenIcon:N2,PanelRight:sK,PanelRightClose:tK,PanelRightCloseIcon:tK,PanelRightDashed:C2,PanelRightDashedIcon:C2,PanelRightIcon:sK,PanelRightInactive:C2,PanelRightInactiveIcon:C2,PanelRightOpen:rK,PanelRightOpenIcon:rK,PanelTop:iK,PanelTopClose:nK,PanelTopCloseIcon:nK,PanelTopDashed:M2,PanelTopDashedIcon:M2,PanelTopIcon:iK,PanelTopInactive:M2,PanelTopInactiveIcon:M2,PanelTopOpen:aK,PanelTopOpenIcon:aK,PanelsLeftBottom:oK,PanelsLeftBottomIcon:oK,PanelsLeftRight:Hb,PanelsLeftRightIcon:Hb,PanelsRightBottom:lK,PanelsRightBottomIcon:lK,PanelsTopBottom:P2,PanelsTopBottomIcon:P2,PanelsTopLeft:X0,PanelsTopLeftIcon:X0,Paperclip:Gj,PaperclipIcon:Gj,Parentheses:cK,ParenthesesIcon:cK,ParkingCircle:Ab,ParkingCircleIcon:Ab,ParkingCircleOff:Tb,ParkingCircleOffIcon:Tb,ParkingMeter:dK,ParkingMeterIcon:dK,ParkingSquare:vw,ParkingSquareIcon:vw,ParkingSquareOff:yw,ParkingSquareOffIcon:yw,PartyPopper:td,PartyPopperIcon:td,Pause:Nm,PauseCircle:Eb,PauseCircleIcon:Eb,PauseIcon:Nm,PauseOctagon:v2,PauseOctagonIcon:v2,PawPrint:uK,PawPrintIcon:uK,PcCase:hK,PcCaseIcon:hK,Pen:J0,PenBox:wc,PenBoxIcon:wc,PenIcon:J0,PenLine:Q0,PenLineIcon:Q0,PenOff:mK,PenOffIcon:mK,PenSquare:wc,PenSquareIcon:wc,PenTool:Kj,PenToolIcon:Kj,Pencil:ei,PencilIcon:ei,PencilLine:pK,PencilLineIcon:pK,PencilOff:fK,PencilOffIcon:fK,PencilRuler:gK,PencilRulerIcon:gK,Pentagon:xK,PentagonIcon:xK,Percent:KS,PercentCircle:Ib,PercentCircleIcon:Ib,PercentDiamond:Gb,PercentDiamondIcon:Gb,PercentIcon:KS,PercentSquare:_w,PercentSquareIcon:_w,PersonStanding:yK,PersonStandingIcon:yK,PhilippinePeso:vK,PhilippinePesoIcon:vK,Phone:wi,PhoneCall:_K,PhoneCallIcon:_K,PhoneForwarded:bK,PhoneForwardedIcon:bK,PhoneIcon:wi,PhoneIncoming:wK,PhoneIncomingIcon:wK,PhoneMissed:jK,PhoneMissedIcon:jK,PhoneOff:kK,PhoneOffIcon:kK,PhoneOutgoing:NK,PhoneOutgoingIcon:NK,Pi:SK,PiIcon:SK,PiSquare:bw,PiSquareIcon:bw,Piano:CK,PianoIcon:CK,Pickaxe:MK,PickaxeIcon:MK,PictureInPicture:AK,PictureInPicture2:TK,PictureInPicture2Icon:TK,PictureInPictureIcon:AK,PieChart:hb,PieChartIcon:hb,PiggyBank:EK,PiggyBankIcon:EK,Pilcrow:LK,PilcrowIcon:LK,PilcrowLeft:IK,PilcrowLeftIcon:IK,PilcrowRight:PK,PilcrowRightIcon:PK,PilcrowSquare:ww,PilcrowSquareIcon:ww,Pill:DK,PillBottle:OK,PillBottleIcon:OK,PillIcon:DK,Pin:ev,PinIcon:ev,PinOff:EA,PinOffIcon:EA,Pipette:RK,PipetteIcon:RK,Pizza:FK,PizzaIcon:FK,Plane:$K,PlaneIcon:$K,PlaneLanding:zK,PlaneLandingIcon:zK,PlaneTakeoff:BK,PlaneTakeoffIcon:BK,Play:Gl,PlayCircle:lp,PlayCircleIcon:lp,PlayIcon:Gl,PlaySquare:jw,PlaySquareIcon:jw,Plug:IA,Plug2:UK,Plug2Icon:UK,PlugIcon:IA,PlugZap:T2,PlugZap2:T2,PlugZap2Icon:T2,PlugZapIcon:T2,Plus:gs,PlusCircle:Pb,PlusCircleIcon:Pb,PlusIcon:gs,PlusSquare:kw,PlusSquareIcon:kw,Pocket:VK,PocketIcon:VK,PocketKnife:qK,PocketKnifeIcon:qK,Podcast:HK,PodcastIcon:HK,Pointer:GK,PointerIcon:GK,PointerOff:WK,PointerOffIcon:WK,Popcorn:KK,PopcornIcon:KK,Popsicle:ZK,PopsicleIcon:ZK,PoundSterling:YK,PoundSterlingIcon:YK,Power:QK,PowerCircle:Lb,PowerCircleIcon:Lb,PowerIcon:QK,PowerOff:XK,PowerOffIcon:XK,PowerSquare:Nw,PowerSquareIcon:Nw,Presentation:$f,PresentationIcon:$f,Printer:PA,PrinterCheck:JK,PrinterCheckIcon:JK,PrinterIcon:PA,Projector:eZ,ProjectorIcon:eZ,Proportions:tZ,ProportionsIcon:tZ,Puzzle:rZ,PuzzleIcon:rZ,Pyramid:sZ,PyramidIcon:sZ,QrCode:Zj,QrCodeIcon:Zj,Quote:LA,QuoteIcon:LA,Rabbit:nZ,RabbitIcon:nZ,Radar:aZ,RadarIcon:aZ,Radiation:iZ,RadiationIcon:iZ,Radical:oZ,RadicalIcon:oZ,Radio:Yj,RadioIcon:Yj,RadioReceiver:lZ,RadioReceiverIcon:lZ,RadioTower:cZ,RadioTowerIcon:cZ,Radius:dZ,RadiusIcon:dZ,RailSymbol:uZ,RailSymbolIcon:uZ,Rainbow:hZ,RainbowIcon:hZ,Rat:mZ,RatIcon:mZ,Ratio:pZ,RatioIcon:pZ,Receipt:jZ,ReceiptCent:fZ,ReceiptCentIcon:fZ,ReceiptEuro:gZ,ReceiptEuroIcon:gZ,ReceiptIcon:jZ,ReceiptIndianRupee:xZ,ReceiptIndianRupeeIcon:xZ,ReceiptJapaneseYen:yZ,ReceiptJapaneseYenIcon:yZ,ReceiptPoundSterling:vZ,ReceiptPoundSterlingIcon:vZ,ReceiptRussianRuble:_Z,ReceiptRussianRubleIcon:_Z,ReceiptSwissFranc:bZ,ReceiptSwissFrancIcon:bZ,ReceiptText:wZ,ReceiptTextIcon:wZ,RectangleEllipsis:A2,RectangleEllipsisIcon:A2,RectangleHorizontal:kZ,RectangleHorizontalIcon:kZ,RectangleVertical:NZ,RectangleVerticalIcon:NZ,Recycle:SZ,RecycleIcon:SZ,Redo:ZS,Redo2:CZ,Redo2Icon:CZ,RedoDot:MZ,RedoDotIcon:MZ,RedoIcon:ZS,RefreshCcw:AZ,RefreshCcwDot:TZ,RefreshCcwDotIcon:TZ,RefreshCcwIcon:AZ,RefreshCw:Ko,RefreshCwIcon:Ko,RefreshCwOff:EZ,RefreshCwOffIcon:EZ,Refrigerator:IZ,RefrigeratorIcon:IZ,Regex:PZ,RegexIcon:PZ,RemoveFormatting:LZ,RemoveFormattingIcon:LZ,Repeat:OA,Repeat1:OZ,Repeat1Icon:OZ,Repeat2:DZ,Repeat2Icon:DZ,RepeatIcon:OA,Replace:FZ,ReplaceAll:RZ,ReplaceAllIcon:RZ,ReplaceIcon:FZ,Reply:DA,ReplyAll:zZ,ReplyAllIcon:zZ,ReplyIcon:DA,Rewind:BZ,RewindIcon:BZ,Ribbon:$Z,RibbonIcon:$Z,Rocket:Kg,RocketIcon:Kg,RockingChair:UZ,RockingChairIcon:UZ,RollerCoaster:qZ,RollerCoasterIcon:qZ,Rotate3D:E2,Rotate3DIcon:E2,Rotate3d:E2,Rotate3dIcon:E2,RotateCcw:Xj,RotateCcwIcon:Xj,RotateCcwSquare:VZ,RotateCcwSquareIcon:VZ,RotateCw:RA,RotateCwIcon:RA,RotateCwSquare:HZ,RotateCwSquareIcon:HZ,Route:GZ,RouteIcon:GZ,RouteOff:WZ,RouteOffIcon:WZ,Router:KZ,RouterIcon:KZ,Rows:I2,Rows2:I2,Rows2Icon:I2,Rows3:P2,Rows3Icon:P2,Rows4:ZZ,Rows4Icon:ZZ,RowsIcon:I2,Rss:YZ,RssIcon:YZ,Ruler:XZ,RulerIcon:XZ,RussianRuble:QZ,RussianRubleIcon:QZ,Sailboat:JZ,SailboatIcon:JZ,Salad:eY,SaladIcon:eY,Sandwich:tY,SandwichIcon:tY,Satellite:sY,SatelliteDish:rY,SatelliteDishIcon:rY,SatelliteIcon:sY,Save:_p,SaveAll:nY,SaveAllIcon:nY,SaveIcon:_p,SaveOff:aY,SaveOffIcon:aY,Scale:iY,Scale3D:L2,Scale3DIcon:L2,Scale3d:L2,Scale3dIcon:L2,ScaleIcon:iY,Scaling:oY,ScalingIcon:oY,Scan:fY,ScanBarcode:lY,ScanBarcodeIcon:lY,ScanEye:cY,ScanEyeIcon:cY,ScanFace:dY,ScanFaceIcon:dY,ScanIcon:fY,ScanLine:uY,ScanLineIcon:uY,ScanQrCode:hY,ScanQrCodeIcon:hY,ScanSearch:mY,ScanSearchIcon:mY,ScanText:pY,ScanTextIcon:pY,ScatterChart:mb,ScatterChartIcon:mb,School:gY,School2:Bw,School2Icon:Bw,SchoolIcon:gY,Scissors:yY,ScissorsIcon:yY,ScissorsLineDashed:xY,ScissorsLineDashedIcon:xY,ScissorsSquare:Sw,ScissorsSquareDashedBottom:Q2,ScissorsSquareDashedBottomIcon:Q2,ScissorsSquareIcon:Sw,ScreenShare:_Y,ScreenShareIcon:_Y,ScreenShareOff:vY,ScreenShareOffIcon:vY,Scroll:wY,ScrollIcon:wY,ScrollText:bY,ScrollTextIcon:bY,Search:Qn,SearchCheck:jY,SearchCheckIcon:jY,SearchCode:kY,SearchCodeIcon:kY,SearchIcon:Qn,SearchSlash:NY,SearchSlashIcon:NY,SearchX:SY,SearchXIcon:SY,Section:CY,SectionIcon:CY,Send:Mi,SendHorizonal:O2,SendHorizonalIcon:O2,SendHorizontal:O2,SendHorizontalIcon:O2,SendIcon:Mi,SendToBack:MY,SendToBackIcon:MY,SeparatorHorizontal:TY,SeparatorHorizontalIcon:TY,SeparatorVertical:AY,SeparatorVerticalIcon:AY,Server:LY,ServerCog:EY,ServerCogIcon:EY,ServerCrash:IY,ServerCrashIcon:IY,ServerIcon:LY,ServerOff:PY,ServerOffIcon:PY,Settings:vd,Settings2:OY,Settings2Icon:OY,SettingsIcon:vd,Shapes:DY,ShapesIcon:DY,Share:FA,Share2:Oc,Share2Icon:Oc,ShareIcon:FA,Sheet:RY,SheetIcon:RY,Shell:FY,ShellIcon:FY,Shield:Nu,ShieldAlert:zY,ShieldAlertIcon:zY,ShieldBan:BY,ShieldBanIcon:BY,ShieldCheck:zA,ShieldCheckIcon:zA,ShieldClose:D2,ShieldCloseIcon:D2,ShieldEllipsis:$Y,ShieldEllipsisIcon:$Y,ShieldHalf:UY,ShieldHalfIcon:UY,ShieldIcon:Nu,ShieldMinus:qY,ShieldMinusIcon:qY,ShieldOff:VY,ShieldOffIcon:VY,ShieldPlus:HY,ShieldPlusIcon:HY,ShieldQuestion:WY,ShieldQuestionIcon:WY,ShieldX:D2,ShieldXIcon:D2,Ship:KY,ShipIcon:KY,ShipWheel:GY,ShipWheelIcon:GY,Shirt:ZY,ShirtIcon:ZY,ShoppingBag:Zg,ShoppingBagIcon:Zg,ShoppingBasket:YY,ShoppingBasketIcon:YY,ShoppingCart:Lh,ShoppingCartIcon:Lh,Shovel:XY,ShovelIcon:XY,ShowerHead:QY,ShowerHeadIcon:QY,Shrink:JY,ShrinkIcon:JY,Shrub:eX,ShrubIcon:eX,Shuffle:tX,ShuffleIcon:tX,Sidebar:S2,SidebarClose:j2,SidebarCloseIcon:j2,SidebarIcon:S2,SidebarOpen:N2,SidebarOpenIcon:N2,Sigma:rX,SigmaIcon:rX,SigmaSquare:Cw,SigmaSquareIcon:Cw,Signal:oX,SignalHigh:sX,SignalHighIcon:sX,SignalIcon:oX,SignalLow:nX,SignalLowIcon:nX,SignalMedium:aX,SignalMediumIcon:aX,SignalZero:iX,SignalZeroIcon:iX,Signature:lX,SignatureIcon:lX,Signpost:dX,SignpostBig:cX,SignpostBigIcon:cX,SignpostIcon:dX,Siren:uX,SirenIcon:uX,SkipBack:hX,SkipBackIcon:hX,SkipForward:mX,SkipForwardIcon:mX,Skull:pX,SkullIcon:pX,Slack:fX,SlackIcon:fX,Slash:gX,SlashIcon:gX,SlashSquare:Mw,SlashSquareIcon:Mw,Slice:xX,SliceIcon:xX,Sliders:R2,SlidersHorizontal:BA,SlidersHorizontalIcon:BA,SlidersIcon:R2,SlidersVertical:R2,SlidersVerticalIcon:R2,Smartphone:by,SmartphoneCharging:yX,SmartphoneChargingIcon:yX,SmartphoneIcon:by,SmartphoneNfc:vX,SmartphoneNfcIcon:vX,Smile:bX,SmileIcon:bX,SmilePlus:_X,SmilePlusIcon:_X,Snail:wX,SnailIcon:wX,Snowflake:T1,SnowflakeIcon:T1,Sofa:jX,SofaIcon:jX,SortAsc:G_,SortAscIcon:G_,SortDesc:V_,SortDescIcon:V_,Soup:kX,SoupIcon:kX,Space:NX,SpaceIcon:NX,Spade:SX,SpadeIcon:SX,Sparkle:CX,SparkleIcon:CX,Sparkles:An,SparklesIcon:An,Speaker:MX,SpeakerIcon:MX,Speech:TX,SpeechIcon:TX,SpellCheck:EX,SpellCheck2:AX,SpellCheck2Icon:AX,SpellCheckIcon:EX,Spline:IX,SplineIcon:IX,Split:PX,SplitIcon:PX,SplitSquareHorizontal:Tw,SplitSquareHorizontalIcon:Tw,SplitSquareVertical:Aw,SplitSquareVerticalIcon:Aw,SprayCan:LX,SprayCanIcon:LX,Sprout:OX,SproutIcon:OX,Square:Yg,SquareActivity:F2,SquareActivityIcon:F2,SquareArrowDown:$2,SquareArrowDownIcon:$2,SquareArrowDownLeft:z2,SquareArrowDownLeftIcon:z2,SquareArrowDownRight:B2,SquareArrowDownRightIcon:B2,SquareArrowLeft:U2,SquareArrowLeftIcon:U2,SquareArrowOutDownLeft:q2,SquareArrowOutDownLeftIcon:q2,SquareArrowOutDownRight:V2,SquareArrowOutDownRightIcon:V2,SquareArrowOutUpLeft:H2,SquareArrowOutUpLeftIcon:H2,SquareArrowOutUpRight:W2,SquareArrowOutUpRightIcon:W2,SquareArrowRight:G2,SquareArrowRightIcon:G2,SquareArrowUp:Y2,SquareArrowUpIcon:Y2,SquareArrowUpLeft:K2,SquareArrowUpLeftIcon:K2,SquareArrowUpRight:Z2,SquareArrowUpRightIcon:Z2,SquareAsterisk:X2,SquareAsteriskIcon:X2,SquareBottomDashedScissors:Q2,SquareBottomDashedScissorsIcon:Q2,SquareChartGantt:kg,SquareChartGanttIcon:kg,SquareCheck:J2,SquareCheckBig:e1,SquareCheckBigIcon:e1,SquareCheckIcon:J2,SquareChevronDown:ew,SquareChevronDownIcon:ew,SquareChevronLeft:tw,SquareChevronLeftIcon:tw,SquareChevronRight:rw,SquareChevronRightIcon:rw,SquareChevronUp:sw,SquareChevronUpIcon:sw,SquareCode:nw,SquareCodeIcon:nw,SquareDashed:ow,SquareDashedBottom:RX,SquareDashedBottomCode:DX,SquareDashedBottomCodeIcon:DX,SquareDashedBottomIcon:RX,SquareDashedIcon:ow,SquareDashedKanban:aw,SquareDashedKanbanIcon:aw,SquareDashedMousePointer:iw,SquareDashedMousePointerIcon:iw,SquareDivide:lw,SquareDivideIcon:lw,SquareDot:cw,SquareDotIcon:cw,SquareEqual:dw,SquareEqualIcon:dw,SquareFunction:uw,SquareFunctionIcon:uw,SquareGanttChart:kg,SquareGanttChartIcon:kg,SquareIcon:Yg,SquareKanban:hw,SquareKanbanIcon:hw,SquareLibrary:mw,SquareLibraryIcon:mw,SquareM:pw,SquareMIcon:pw,SquareMenu:fw,SquareMenuIcon:fw,SquareMinus:gw,SquareMinusIcon:gw,SquareMousePointer:xw,SquareMousePointerIcon:xw,SquareParking:vw,SquareParkingIcon:vw,SquareParkingOff:yw,SquareParkingOffIcon:yw,SquarePen:wc,SquarePenIcon:wc,SquarePercent:_w,SquarePercentIcon:_w,SquarePi:bw,SquarePiIcon:bw,SquarePilcrow:ww,SquarePilcrowIcon:ww,SquarePlay:jw,SquarePlayIcon:jw,SquarePlus:kw,SquarePlusIcon:kw,SquarePower:Nw,SquarePowerIcon:Nw,SquareRadical:FX,SquareRadicalIcon:FX,SquareScissors:Sw,SquareScissorsIcon:Sw,SquareSigma:Cw,SquareSigmaIcon:Cw,SquareSlash:Mw,SquareSlashIcon:Mw,SquareSplitHorizontal:Tw,SquareSplitHorizontalIcon:Tw,SquareSplitVertical:Aw,SquareSplitVerticalIcon:Aw,SquareSquare:zX,SquareSquareIcon:zX,SquareStack:BX,SquareStackIcon:BX,SquareTerminal:Ew,SquareTerminalIcon:Ew,SquareUser:Pw,SquareUserIcon:Pw,SquareUserRound:Iw,SquareUserRoundIcon:Iw,SquareX:Lw,SquareXIcon:Lw,Squircle:$X,SquircleIcon:$X,Squirrel:UX,SquirrelIcon:UX,Stamp:qX,StampIcon:qX,Star:Ln,StarHalf:VX,StarHalfIcon:VX,StarIcon:Ln,StarOff:HX,StarOffIcon:HX,Stars:An,StarsIcon:An,StepBack:WX,StepBackIcon:WX,StepForward:GX,StepForwardIcon:GX,Stethoscope:KX,StethoscopeIcon:KX,Sticker:ZX,StickerIcon:ZX,StickyNote:YX,StickyNoteIcon:YX,StopCircle:Db,StopCircleIcon:Db,Store:XX,StoreIcon:XX,StretchHorizontal:QX,StretchHorizontalIcon:QX,StretchVertical:JX,StretchVerticalIcon:JX,Strikethrough:eQ,StrikethroughIcon:eQ,Subscript:tQ,SubscriptIcon:tQ,Subtitles:tb,SubtitlesIcon:tb,Sun:tv,SunDim:rQ,SunDimIcon:rQ,SunIcon:tv,SunMedium:sQ,SunMediumIcon:sQ,SunMoon:nQ,SunMoonIcon:nQ,SunSnow:aQ,SunSnowIcon:aQ,Sunrise:iQ,SunriseIcon:iQ,Sunset:oQ,SunsetIcon:oQ,Superscript:lQ,SuperscriptIcon:lQ,SwatchBook:cQ,SwatchBookIcon:cQ,SwissFranc:dQ,SwissFrancIcon:dQ,SwitchCamera:uQ,SwitchCameraIcon:uQ,Sword:hQ,SwordIcon:hQ,Swords:mQ,SwordsIcon:mQ,Syringe:pQ,SyringeIcon:pQ,Table:bQ,Table2:YS,Table2Icon:YS,TableCellsMerge:fQ,TableCellsMergeIcon:fQ,TableCellsSplit:gQ,TableCellsSplitIcon:gQ,TableColumnsSplit:xQ,TableColumnsSplitIcon:xQ,TableIcon:bQ,TableOfContents:yQ,TableOfContentsIcon:yQ,TableProperties:vQ,TablePropertiesIcon:vQ,TableRowsSplit:_Q,TableRowsSplitIcon:_Q,Tablet:jQ,TabletIcon:jQ,TabletSmartphone:wQ,TabletSmartphoneIcon:wQ,Tablets:kQ,TabletsIcon:kQ,Tag:Xg,TagIcon:Xg,Tags:NQ,TagsIcon:NQ,Tally1:SQ,Tally1Icon:SQ,Tally2:CQ,Tally2Icon:CQ,Tally3:MQ,Tally3Icon:MQ,Tally4:TQ,Tally4Icon:TQ,Tally5:AQ,Tally5Icon:AQ,Tangent:EQ,TangentIcon:EQ,Target:bp,TargetIcon:bp,Telescope:IQ,TelescopeIcon:IQ,Tent:LQ,TentIcon:LQ,TentTree:PQ,TentTreeIcon:PQ,Terminal:OQ,TerminalIcon:OQ,TerminalSquare:Ew,TerminalSquareIcon:Ew,TestTube:DQ,TestTube2:Ow,TestTube2Icon:Ow,TestTubeDiagonal:Ow,TestTubeDiagonalIcon:Ow,TestTubeIcon:DQ,TestTubes:RQ,TestTubesIcon:RQ,Text:UQ,TextCursor:zQ,TextCursorIcon:zQ,TextCursorInput:FQ,TextCursorInputIcon:FQ,TextIcon:UQ,TextQuote:BQ,TextQuoteIcon:BQ,TextSearch:$Q,TextSearchIcon:$Q,TextSelect:Dw,TextSelectIcon:Dw,TextSelection:Dw,TextSelectionIcon:Dw,Theater:qQ,TheaterIcon:qQ,Thermometer:WQ,ThermometerIcon:WQ,ThermometerSnowflake:VQ,ThermometerSnowflakeIcon:VQ,ThermometerSun:HQ,ThermometerSunIcon:HQ,ThumbsDown:$A,ThumbsDownIcon:$A,ThumbsUp:_d,ThumbsUpIcon:_d,Ticket:UA,TicketCheck:GQ,TicketCheckIcon:GQ,TicketIcon:UA,TicketMinus:KQ,TicketMinusIcon:KQ,TicketPercent:ZQ,TicketPercentIcon:ZQ,TicketPlus:YQ,TicketPlusIcon:YQ,TicketSlash:XQ,TicketSlashIcon:XQ,TicketX:QQ,TicketXIcon:QQ,Tickets:eJ,TicketsIcon:eJ,TicketsPlane:JQ,TicketsPlaneIcon:JQ,Timer:sJ,TimerIcon:sJ,TimerOff:tJ,TimerOffIcon:tJ,TimerReset:rJ,TimerResetIcon:rJ,ToggleLeft:nJ,ToggleLeftIcon:nJ,ToggleRight:aJ,ToggleRightIcon:aJ,Toilet:iJ,ToiletIcon:iJ,Tornado:oJ,TornadoIcon:oJ,Torus:lJ,TorusIcon:lJ,Touchpad:dJ,TouchpadIcon:dJ,TouchpadOff:cJ,TouchpadOffIcon:cJ,TowerControl:uJ,TowerControlIcon:uJ,ToyBrick:hJ,ToyBrickIcon:hJ,Tractor:mJ,TractorIcon:mJ,TrafficCone:pJ,TrafficConeIcon:pJ,Train:Rw,TrainFront:gJ,TrainFrontIcon:gJ,TrainFrontTunnel:fJ,TrainFrontTunnelIcon:fJ,TrainIcon:Rw,TrainTrack:xJ,TrainTrackIcon:xJ,TramFront:Rw,TramFrontIcon:Rw,Trash:yJ,Trash2:Rs,Trash2Icon:Rs,TrashIcon:yJ,TreeDeciduous:vJ,TreeDeciduousIcon:vJ,TreePalm:Fw,TreePalmIcon:Fw,TreePine:rv,TreePineIcon:rv,Trees:_J,TreesIcon:_J,Trello:bJ,TrelloIcon:bJ,TrendingDown:Qj,TrendingDownIcon:Qj,TrendingUp:ou,TrendingUpDown:wJ,TrendingUpDownIcon:wJ,TrendingUpIcon:ou,Triangle:kJ,TriangleAlert:Qu,TriangleAlertIcon:Qu,TriangleIcon:kJ,TriangleRight:jJ,TriangleRightIcon:jJ,Trophy:ho,TrophyIcon:ho,Truck:qA,TruckIcon:qA,Turtle:NJ,TurtleIcon:NJ,Tv:CJ,Tv2:zw,Tv2Icon:zw,TvIcon:CJ,TvMinimal:zw,TvMinimalIcon:zw,TvMinimalPlay:SJ,TvMinimalPlayIcon:SJ,Twitch:MJ,TwitchIcon:MJ,Twitter:TJ,TwitterIcon:TJ,Type:EJ,TypeIcon:EJ,TypeOutline:AJ,TypeOutlineIcon:AJ,Umbrella:PJ,UmbrellaIcon:PJ,UmbrellaOff:IJ,UmbrellaOffIcon:IJ,Underline:LJ,UnderlineIcon:LJ,Undo:XS,Undo2:OJ,Undo2Icon:OJ,UndoDot:DJ,UndoDotIcon:DJ,UndoIcon:XS,UnfoldHorizontal:RJ,UnfoldHorizontalIcon:RJ,UnfoldVertical:FJ,UnfoldVerticalIcon:FJ,Ungroup:zJ,UngroupIcon:zJ,University:Bw,UniversityIcon:Bw,Unlink:VA,Unlink2:BJ,Unlink2Icon:BJ,UnlinkIcon:VA,Unlock:f2,UnlockIcon:f2,UnlockKeyhole:p2,UnlockKeyholeIcon:p2,Unplug:$J,UnplugIcon:$J,Upload:to,UploadCloud:Ub,UploadCloudIcon:Ub,UploadIcon:to,Usb:UJ,UsbIcon:UJ,User:Kl,User2:Ww,User2Icon:Ww,UserCheck:Jj,UserCheck2:$w,UserCheck2Icon:$w,UserCheckIcon:Jj,UserCircle:Fb,UserCircle2:Rb,UserCircle2Icon:Rb,UserCircleIcon:Fb,UserCog:HA,UserCog2:Uw,UserCog2Icon:Uw,UserCogIcon:HA,UserIcon:Kl,UserMinus:WA,UserMinus2:qw,UserMinus2Icon:qw,UserMinusIcon:WA,UserPen:qJ,UserPenIcon:qJ,UserPlus:$d,UserPlus2:Vw,UserPlus2Icon:Vw,UserPlusIcon:$d,UserRound:Ww,UserRoundCheck:$w,UserRoundCheckIcon:$w,UserRoundCog:Uw,UserRoundCogIcon:Uw,UserRoundIcon:Ww,UserRoundMinus:qw,UserRoundMinusIcon:qw,UserRoundPen:VJ,UserRoundPenIcon:VJ,UserRoundPlus:Vw,UserRoundPlusIcon:Vw,UserRoundSearch:HJ,UserRoundSearchIcon:HJ,UserRoundX:Hw,UserRoundXIcon:Hw,UserSearch:WJ,UserSearchIcon:WJ,UserSquare:Pw,UserSquare2:Iw,UserSquare2Icon:Iw,UserSquareIcon:Pw,UserX:GJ,UserX2:Hw,UserX2Icon:Hw,UserXIcon:GJ,Users:ws,Users2:Gw,Users2Icon:Gw,UsersIcon:ws,UsersRound:Gw,UsersRoundIcon:Gw,Utensils:Zw,UtensilsCrossed:Kw,UtensilsCrossedIcon:Kw,UtensilsIcon:Zw,UtilityPole:KJ,UtilityPoleIcon:KJ,Variable:GA,VariableIcon:GA,Vault:ZJ,VaultIcon:ZJ,Vegan:YJ,VeganIcon:YJ,VenetianMask:XJ,VenetianMaskIcon:XJ,Verified:Y_,VerifiedIcon:Y_,Vibrate:JJ,VibrateIcon:JJ,VibrateOff:QJ,VibrateOffIcon:QJ,Video:ya,VideoIcon:ya,VideoOff:eee,VideoOffIcon:eee,Videotape:tee,VideotapeIcon:tee,View:ree,ViewIcon:ree,Voicemail:see,VoicemailIcon:see,Volleyball:nee,VolleyballIcon:nee,Volume:cee,Volume1:aee,Volume1Icon:aee,Volume2:iee,Volume2Icon:iee,VolumeIcon:cee,VolumeOff:oee,VolumeOffIcon:oee,VolumeX:lee,VolumeXIcon:lee,Vote:dee,VoteIcon:dee,Wallet:hee,Wallet2:Yw,Wallet2Icon:Yw,WalletCards:uee,WalletCardsIcon:uee,WalletIcon:hee,WalletMinimal:Yw,WalletMinimalIcon:Yw,Wallpaper:mee,WallpaperIcon:mee,Wand:pee,Wand2:Xw,Wand2Icon:Xw,WandIcon:pee,WandSparkles:Xw,WandSparklesIcon:Xw,Warehouse:fee,WarehouseIcon:fee,WashingMachine:gee,WashingMachineIcon:gee,Watch:xee,WatchIcon:xee,Waves:yee,WavesIcon:yee,Waypoints:vee,WaypointsIcon:vee,Webcam:_ee,WebcamIcon:_ee,Webhook:wee,WebhookIcon:wee,WebhookOff:bee,WebhookOffIcon:bee,Weight:jee,WeightIcon:jee,Wheat:Nee,WheatIcon:Nee,WheatOff:kee,WheatOffIcon:kee,WholeWord:See,WholeWordIcon:See,Wifi:Eee,WifiHigh:Cee,WifiHighIcon:Cee,WifiIcon:Eee,WifiLow:Mee,WifiLowIcon:Mee,WifiOff:Tee,WifiOffIcon:Tee,WifiZero:Aee,WifiZeroIcon:Aee,Wind:Pee,WindArrowDown:Iee,WindArrowDownIcon:Iee,WindIcon:Pee,Wine:Oee,WineIcon:Oee,WineOff:Lee,WineOffIcon:Lee,Workflow:Dee,WorkflowIcon:Dee,Worm:Ree,WormIcon:Ree,WrapText:Fee,WrapTextIcon:Fee,Wrench:wy,WrenchIcon:wy,X:rn,XCircle:Sc,XCircleIcon:Sc,XIcon:rn,XOctagon:_2,XOctagonIcon:_2,XSquare:Lw,XSquareIcon:Lw,Youtube:zee,YoutubeIcon:zee,Zap:Qg,ZapIcon:Qg,ZapOff:Bee,ZapOffIcon:Bee,ZoomIn:QS,ZoomInIcon:QS,ZoomOut:JS,ZoomOutIcon:JS,createLucideIcon:V,icons:EQe},Symbol.toStringTag,{value:"Module"})),mxe="-",IQe=t=>{const r=LQe(t),{conflictingClassGroups:s,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:l=>{const i=l.split(mxe);return i[0]===""&&i.length!==1&&i.shift(),HIe(i,r)||PQe(l)},getConflictingClassGroupIds:(l,i)=>{const d=s[l]||[];return i&&n[l]?[...d,...n[l]]:d}}},HIe=(t,r)=>{var l;if(t.length===0)return r.classGroupId;const s=t[0],n=r.nextPart.get(s),a=n?HIe(t.slice(1),n):void 0;if(a)return a;if(r.validators.length===0)return;const o=t.join(mxe);return(l=r.validators.find(({validator:i})=>i(o)))==null?void 0:l.classGroupId},Lje=/^\[(.+)\]$/,PQe=t=>{if(Lje.test(t)){const r=Lje.exec(t)[1],s=r==null?void 0:r.substring(0,r.indexOf(":"));if(s)return"arbitrary.."+s}},LQe=t=>{const{theme:r,prefix:s}=t,n={nextPart:new Map,validators:[]};return DQe(Object.entries(t.classGroups),s).forEach(([o,l])=>{jhe(l,n,o,r)}),n},jhe=(t,r,s,n)=>{t.forEach(a=>{if(typeof a=="string"){const o=a===""?r:Oje(r,a);o.classGroupId=s;return}if(typeof a=="function"){if(OQe(a)){jhe(a(n),r,s,n);return}r.validators.push({validator:a,classGroupId:s});return}Object.entries(a).forEach(([o,l])=>{jhe(l,Oje(r,o),s,n)})})},Oje=(t,r)=>{let s=t;return r.split(mxe).forEach(n=>{s.nextPart.has(n)||s.nextPart.set(n,{nextPart:new Map,validators:[]}),s=s.nextPart.get(n)}),s},OQe=t=>t.isThemeGetter,DQe=(t,r)=>r?t.map(([s,n])=>{const a=n.map(o=>typeof o=="string"?r+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([l,i])=>[r+l,i])):o);return[s,a]}):t,RQe=t=>{if(t<1)return{get:()=>{},set:()=>{}};let r=0,s=new Map,n=new Map;const a=(o,l)=>{s.set(o,l),r++,r>t&&(r=0,n=s,s=new Map)};return{get(o){let l=s.get(o);if(l!==void 0)return l;if((l=n.get(o))!==void 0)return a(o,l),l},set(o,l){s.has(o)?s.set(o,l):a(o,l)}}},WIe="!",FQe=t=>{const{separator:r,experimentalParseClassName:s}=t,n=r.length===1,a=r[0],o=r.length,l=i=>{const d=[];let m=0,g=0,y;for(let S=0;Sg?y-g:void 0;return{modifiers:d,hasImportantModifier:b,baseClassName:N,maybePostfixModifierPosition:j}};return s?i=>s({className:i,parseClassName:l}):l},zQe=t=>{if(t.length<=1)return t;const r=[];let s=[];return t.forEach(n=>{n[0]==="["?(r.push(...s.sort(),n),s=[]):s.push(n)}),r.push(...s.sort()),r},BQe=t=>({cache:RQe(t.cacheSize),parseClassName:FQe(t),...IQe(t)}),$Qe=/\s+/,UQe=(t,r)=>{const{parseClassName:s,getClassGroupId:n,getConflictingClassGroupIds:a}=r,o=[],l=t.trim().split($Qe);let i="";for(let d=l.length-1;d>=0;d-=1){const m=l[d],{modifiers:g,hasImportantModifier:y,baseClassName:v,maybePostfixModifierPosition:b}=s(m);let N=!!b,j=n(N?v.substring(0,b):v);if(!j){if(!N){i=m+(i.length>0?" "+i:i);continue}if(j=n(v),!j){i=m+(i.length>0?" "+i:i);continue}N=!1}const S=zQe(g).join(":"),A=y?S+WIe:S,M=A+j;if(o.includes(M))continue;o.push(M);const I=a(j,N);for(let F=0;F0?" "+i:i)}return i};function qQe(){let t=0,r,s,n="";for(;t{if(typeof t=="string")return t;let r,s="";for(let n=0;ny(g),t());return s=BQe(m),n=s.cache.get,a=s.cache.set,o=i,i(d)}function i(d){const m=n(d);if(m)return m;const g=UQe(d,s);return a(d,g),g}return function(){return o(qQe.apply(null,arguments))}}const fl=t=>{const r=s=>s[t]||[];return r.isThemeGetter=!0,r},KIe=/^\[(?:([a-z-]+):)?(.+)\]$/i,HQe=/^\d+\/\d+$/,WQe=new Set(["px","full","screen"]),GQe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,KQe=/\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$/,ZQe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,YQe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,XQe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,zx=t=>eC(t)||WQe.has(t)||HQe.test(t),z0=t=>A3(t,"length",aJe),eC=t=>!!t&&!Number.isNaN(Number(t)),bce=t=>A3(t,"number",eC),pT=t=>!!t&&Number.isInteger(Number(t)),QQe=t=>t.endsWith("%")&&eC(t.slice(0,-1)),yi=t=>KIe.test(t),B0=t=>GQe.test(t),JQe=new Set(["length","size","percentage"]),eJe=t=>A3(t,JQe,ZIe),tJe=t=>A3(t,"position",ZIe),rJe=new Set(["image","url"]),sJe=t=>A3(t,rJe,oJe),nJe=t=>A3(t,"",iJe),fT=()=>!0,A3=(t,r,s)=>{const n=KIe.exec(t);return n?n[1]?typeof r=="string"?n[1]===r:r.has(n[1]):s(n[2]):!1},aJe=t=>KQe.test(t)&&!ZQe.test(t),ZIe=()=>!1,iJe=t=>YQe.test(t),oJe=t=>XQe.test(t),lJe=()=>{const t=fl("colors"),r=fl("spacing"),s=fl("blur"),n=fl("brightness"),a=fl("borderColor"),o=fl("borderRadius"),l=fl("borderSpacing"),i=fl("borderWidth"),d=fl("contrast"),m=fl("grayscale"),g=fl("hueRotate"),y=fl("invert"),v=fl("gap"),b=fl("gradientColorStops"),N=fl("gradientColorStopPositions"),j=fl("inset"),S=fl("margin"),A=fl("opacity"),M=fl("padding"),I=fl("saturate"),F=fl("scale"),O=fl("sepia"),B=fl("skew"),$=fl("space"),H=fl("translate"),W=()=>["auto","contain","none"],X=()=>["auto","hidden","clip","visible","scroll"],se=()=>["auto",yi,r],ae=()=>[yi,r],le=()=>["",zx,z0],ne=()=>["auto",eC,yi],fe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],oe=()=>["solid","dashed","dotted","double","none"],de=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ue=()=>["start","end","center","between","around","evenly","stretch"],xe=()=>["","0",yi],Te=()=>["auto","avoid","all","avoid-page","page","left","right","column"],be=()=>[eC,yi];return{cacheSize:500,separator:":",theme:{colors:[fT],spacing:[zx,z0],blur:["none","",B0,yi],brightness:be(),borderColor:[t],borderRadius:["none","","full",B0,yi],borderSpacing:ae(),borderWidth:le(),contrast:be(),grayscale:xe(),hueRotate:be(),invert:xe(),gap:ae(),gradientColorStops:[t],gradientColorStopPositions:[QQe,z0],inset:se(),margin:se(),opacity:be(),padding:ae(),saturate:be(),scale:be(),sepia:xe(),skew:be(),space:ae(),translate:ae()},classGroups:{aspect:[{aspect:["auto","square","video",yi]}],container:["container"],columns:[{columns:[B0]}],"break-after":[{"break-after":Te()}],"break-before":[{"break-before":Te()}],"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:[...fe(),yi]}],overflow:[{overflow:X()}],"overflow-x":[{"overflow-x":X()}],"overflow-y":[{"overflow-y":X()}],overscroll:[{overscroll:W()}],"overscroll-x":[{"overscroll-x":W()}],"overscroll-y":[{"overscroll-y":W()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[j]}],"inset-x":[{"inset-x":[j]}],"inset-y":[{"inset-y":[j]}],start:[{start:[j]}],end:[{end:[j]}],top:[{top:[j]}],right:[{right:[j]}],bottom:[{bottom:[j]}],left:[{left:[j]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",pT,yi]}],basis:[{basis:se()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",yi]}],grow:[{grow:xe()}],shrink:[{shrink:xe()}],order:[{order:["first","last","none",pT,yi]}],"grid-cols":[{"grid-cols":[fT]}],"col-start-end":[{col:["auto",{span:["full",pT,yi]},yi]}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":[fT]}],"row-start-end":[{row:["auto",{span:[pT,yi]},yi]}],"row-start":[{"row-start":ne()}],"row-end":[{"row-end":ne()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",yi]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",yi]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",...ue()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ue(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ue(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[M]}],px:[{px:[M]}],py:[{py:[M]}],ps:[{ps:[M]}],pe:[{pe:[M]}],pt:[{pt:[M]}],pr:[{pr:[M]}],pb:[{pb:[M]}],pl:[{pl:[M]}],m:[{m:[S]}],mx:[{mx:[S]}],my:[{my:[S]}],ms:[{ms:[S]}],me:[{me:[S]}],mt:[{mt:[S]}],mr:[{mr:[S]}],mb:[{mb:[S]}],ml:[{ml:[S]}],"space-x":[{"space-x":[$]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[$]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",yi,r]}],"min-w":[{"min-w":[yi,r,"min","max","fit"]}],"max-w":[{"max-w":[yi,r,"none","full","min","max","fit","prose",{screen:[B0]},B0]}],h:[{h:[yi,r,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[yi,r,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[yi,r,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[yi,r,"auto","min","max","fit"]}],"font-size":[{text:["base",B0,z0]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",bce]}],"font-family":[{font:[fT]}],"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",yi]}],"line-clamp":[{"line-clamp":["none",eC,bce]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",zx,yi]}],"list-image":[{"list-image":["none",yi]}],"list-style-type":[{list:["none","disc","decimal",yi]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[A]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[A]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",zx,z0]}],"underline-offset":[{"underline-offset":["auto",zx,yi]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:ae()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",yi]}],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",yi]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[A]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...fe(),tJe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",eJe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},sJe]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[N]}],"gradient-via-pos":[{via:[N]}],"gradient-to-pos":[{to:[N]}],"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":[A]}],"border-style":[{border:[...oe(),"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":[A]}],"divide-style":[{divide:oe()}],"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:["",...oe()]}],"outline-offset":[{"outline-offset":[zx,yi]}],"outline-w":[{outline:[zx,z0]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:le()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[A]}],"ring-offset-w":[{"ring-offset":[zx,z0]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",B0,nJe]}],"shadow-color":[{shadow:[fT]}],opacity:[{opacity:[A]}],"mix-blend":[{"mix-blend":[...de(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":de()}],filter:[{filter:["","none"]}],blur:[{blur:[s]}],brightness:[{brightness:[n]}],contrast:[{contrast:[d]}],"drop-shadow":[{"drop-shadow":["","none",B0,yi]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[g]}],invert:[{invert:[y]}],saturate:[{saturate:[I]}],sepia:[{sepia:[O]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[s]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[d]}],"backdrop-grayscale":[{"backdrop-grayscale":[m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[g]}],"backdrop-invert":[{"backdrop-invert":[y]}],"backdrop-opacity":[{"backdrop-opacity":[A]}],"backdrop-saturate":[{"backdrop-saturate":[I]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"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",yi]}],duration:[{duration:be()}],ease:[{ease:["linear","in","out","in-out",yi]}],delay:[{delay:be()}],animate:[{animate:["none","spin","ping","pulse","bounce",yi]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[F]}],"scale-x":[{"scale-x":[F]}],"scale-y":[{"scale-y":[F]}],rotate:[{rotate:[pT,yi]}],"translate-x":[{"translate-x":[H]}],"translate-y":[{"translate-y":[H]}],"skew-x":[{"skew-x":[B]}],"skew-y":[{"skew-y":[B]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",yi]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",yi]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ae()}],"scroll-mx":[{"scroll-mx":ae()}],"scroll-my":[{"scroll-my":ae()}],"scroll-ms":[{"scroll-ms":ae()}],"scroll-me":[{"scroll-me":ae()}],"scroll-mt":[{"scroll-mt":ae()}],"scroll-mr":[{"scroll-mr":ae()}],"scroll-mb":[{"scroll-mb":ae()}],"scroll-ml":[{"scroll-ml":ae()}],"scroll-p":[{"scroll-p":ae()}],"scroll-px":[{"scroll-px":ae()}],"scroll-py":[{"scroll-py":ae()}],"scroll-ps":[{"scroll-ps":ae()}],"scroll-pe":[{"scroll-pe":ae()}],"scroll-pt":[{"scroll-pt":ae()}],"scroll-pr":[{"scroll-pr":ae()}],"scroll-pb":[{"scroll-pb":ae()}],"scroll-pl":[{"scroll-pl":ae()}],"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",yi]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[zx,z0,bce]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},cJe=VQe(lJe);function qt(...t){return cJe(vi(t))}function ru(t,r=!1){return r&&t>=1e6?`$${(t/1e6).toFixed(1)}M`:r&&t>=1e3?`$${(t/1e3).toFixed(0)}K`:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(t)}function Dje(t){const r=new Date(t);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(r)}function kne(t){return t?t.replace(/<[^>]*>/g,""):""}const dJe=MQe,YIe=E.forwardRef(({className:t,...r},s)=>e.jsx(OIe,{ref:s,className:qt("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...r}));YIe.displayName=OIe.displayName;const uJe=T3("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"}}),XIe=E.forwardRef(({className:t,variant:r,...s},n)=>e.jsx(DIe,{ref:n,className:qt(uJe({variant:r}),t),...s}));XIe.displayName=DIe.displayName;const hJe=E.forwardRef(({className:t,...r},s)=>e.jsx(zIe,{ref:s,className:qt("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",t),...r}));hJe.displayName=zIe.displayName;const QIe=E.forwardRef(({className:t,...r},s)=>e.jsx(BIe,{ref:s,className:qt("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...r,children:e.jsx(rn,{className:"h-4 w-4"})}));QIe.displayName=BIe.displayName;const JIe=E.forwardRef(({className:t,...r},s)=>e.jsx(RIe,{ref:s,className:qt("text-sm font-semibold",t),...r}));JIe.displayName=RIe.displayName;const ePe=E.forwardRef(({className:t,...r},s)=>e.jsx(FIe,{ref:s,className:qt("text-sm opacity-90",t),...r}));ePe.displayName=FIe.displayName;function mJe(){const{toasts:t}=fi();return e.jsxs(dJe,{children:[t.map(function({id:r,title:s,description:n,action:a,...o}){return e.jsxs(XIe,{...o,children:[e.jsxs("div",{className:"grid gap-1",children:[s&&e.jsx(JIe,{children:s}),n&&e.jsx(ePe,{children:n})]}),a,e.jsx(QIe,{})]},r)}),e.jsx(YIe,{})]})}var Rje=["light","dark"],pJe="(prefers-color-scheme: dark)",fJe=E.createContext(void 0),gJe={setTheme:t=>{},themes:[]},xJe=()=>{var t;return(t=E.useContext(fJe))!=null?t:gJe};E.memo(({forcedTheme:t,storageKey:r,attribute:s,enableSystem:n,enableColorScheme:a,defaultTheme:o,value:l,attrs:i,nonce:d})=>{let m=o==="system",g=s==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${i.map(N=>`'${N}'`).join(",")})`};`:`var d=document.documentElement,n='${s}',s='setAttribute';`,y=a?Rje.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",v=(N,j=!1,S=!0)=>{let A=l?l[N]:N,M=j?N+"|| ''":`'${A}'`,I="";return a&&S&&!j&&Rje.includes(N)&&(I+=`d.style.colorScheme = '${N}';`),s==="class"?j||A?I+=`c.add(${M})`:I+="null":A&&(I+=`d[s](n,${M})`),I},b=t?`!function(){${g}${v(t)}}()`:n?`!function(){try{${g}var e=localStorage.getItem('${r}');if('system'===e||(!e&&${m})){var t='${pJe}',m=window.matchMedia(t);if(m.media!==t||m.matches){${v("dark")}}else{${v("light")}}}else if(e){${l?`var x=${JSON.stringify(l)};`:""}${v(l?"x[e]":"e",!0)}}${m?"":"else{"+v(o,!1,!1)+"}"}${y}}catch(e){}}()`:`!function(){try{${g}var e=localStorage.getItem('${r}');if(e){${l?`var x=${JSON.stringify(l)};`:""}${v(l?"x[e]":"e",!0)}}else{${v(o,!1,!1)};}${y}}catch(t){}}();`;return E.createElement("script",{nonce:d,dangerouslySetInnerHTML:{__html:b}})});var yJe=t=>{switch(t){case"success":return bJe;case"info":return jJe;case"warning":return wJe;case"error":return kJe;default:return null}},vJe=Array(12).fill(0),_Je=({visible:t,className:r})=>lt.createElement("div",{className:["sonner-loading-wrapper",r].filter(Boolean).join(" "),"data-visible":t},lt.createElement("div",{className:"sonner-spinner"},vJe.map((s,n)=>lt.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),bJe=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"})),wJe=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"})),jJe=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"})),kJe=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"})),NJe=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"})),SJe=()=>{let[t,r]=lt.useState(document.hidden);return lt.useEffect(()=>{let s=()=>{r(document.hidden)};return document.addEventListener("visibilitychange",s),()=>window.removeEventListener("visibilitychange",s)},[]),t},khe=1,CJe=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;let{message:s,...n}=t,a=typeof(t==null?void 0:t.id)=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:khe++,o=this.toasts.find(i=>i.id===a),l=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),o?this.toasts=this.toasts.map(i=>i.id===a?(this.publish({...i,...t,id:a,title:s}),{...i,...t,id:a,dismissible:l,title:s}):i):this.addToast({title:s,...n,dismissible:l,id:a}),a},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(r=>{this.subscribers.forEach(s=>s({id:r.id,dismiss:!0}))}),this.subscribers.forEach(r=>r({id:t,dismiss:!0})),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let s;r.loading!==void 0&&(s=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));let n=t instanceof Promise?t:t(),a=s!==void 0,o,l=n.then(async d=>{if(o=["resolve",d],lt.isValidElement(d))a=!1,this.create({id:s,type:"default",message:d});else if(TJe(d)&&!d.ok){a=!1;let m=typeof r.error=="function"?await r.error(`HTTP error! status: ${d.status}`):r.error,g=typeof r.description=="function"?await r.description(`HTTP error! status: ${d.status}`):r.description;this.create({id:s,type:"error",message:m,description:g})}else if(r.success!==void 0){a=!1;let m=typeof r.success=="function"?await r.success(d):r.success,g=typeof r.description=="function"?await r.description(d):r.description;this.create({id:s,type:"success",message:m,description:g})}}).catch(async d=>{if(o=["reject",d],r.error!==void 0){a=!1;let m=typeof r.error=="function"?await r.error(d):r.error,g=typeof r.description=="function"?await r.description(d):r.description;this.create({id:s,type:"error",message:m,description:g})}}).finally(()=>{var d;a&&(this.dismiss(s),s=void 0),(d=r.finally)==null||d.call(r)}),i=()=>new Promise((d,m)=>l.then(()=>o[0]==="reject"?m(o[1]):d(o[1])).catch(m));return typeof s!="string"&&typeof s!="number"?{unwrap:i}:Object.assign(s,{unwrap:i})},this.custom=(t,r)=>{let s=(r==null?void 0:r.id)||khe++;return this.create({jsx:t(s),id:s,...r}),s},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Mh=new CJe,MJe=(t,r)=>{let s=(r==null?void 0:r.id)||khe++;return Mh.addToast({title:t,...r,id:s}),s},TJe=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",AJe=MJe,EJe=()=>Mh.toasts,IJe=()=>Mh.getActiveToasts(),Se=Object.assign(AJe,{success:Mh.success,info:Mh.info,warning:Mh.warning,error:Mh.error,custom:Mh.custom,message:Mh.message,promise:Mh.promise,dismiss:Mh.dismiss,loading:Mh.loading},{getHistory:EJe,getToasts:IJe});function PJe(t,{insertAt:r}={}){if(typeof document>"u")return;let s=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",r==="top"&&s.firstChild?s.insertBefore(n,s.firstChild):s.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}PJe(`: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 n8(t){return t.label!==void 0}var LJe=3,OJe="32px",DJe="16px",Fje=4e3,RJe=356,FJe=14,zJe=20,BJe=200;function cf(...t){return t.filter(Boolean).join(" ")}function $Je(t){let[r,s]=t.split("-"),n=[];return r&&n.push(r),s&&n.push(s),n}var UJe=t=>{var r,s,n,a,o,l,i,d,m,g,y;let{invert:v,toast:b,unstyled:N,interacting:j,setHeights:S,visibleToasts:A,heights:M,index:I,toasts:F,expanded:O,removeToast:B,defaultRichColors:$,closeButton:H,style:W,cancelButtonStyle:X,actionButtonStyle:se,className:ae="",descriptionClassName:le="",duration:ne,position:fe,gap:oe,loadingIcon:de,expandByDefault:ue,classNames:xe,icons:Te,closeButtonAriaLabel:be="Close toast",pauseWhenPageIsHidden:we}=t,[ve,tt]=lt.useState(null),[Ae,Le]=lt.useState(null),[Ue,Ye]=lt.useState(!1),[Ie,et]=lt.useState(!1),[It,Pe]=lt.useState(!1),[at,ce]=lt.useState(!1),[$e,Ge]=lt.useState(!1),[rt,je]=lt.useState(0),[it,Me]=lt.useState(0),Je=lt.useRef(b.duration||ne||Fje),Xe=lt.useRef(null),Ve=lt.useRef(null),ot=I===0,mt=I+1<=A,ft=b.type,ct=b.dismissible!==!1,Mt=b.className||"",Ot=b.descriptionClassName||"",rr=lt.useMemo(()=>M.findIndex(en=>en.toastId===b.id)||0,[M,b.id]),Ir=lt.useMemo(()=>{var en;return(en=b.closeButton)!=null?en:H},[b.closeButton,H]),cr=lt.useMemo(()=>b.duration||ne||Fje,[b.duration,ne]),Mr=lt.useRef(0),As=lt.useRef(0),At=lt.useRef(0),Rt=lt.useRef(null),[Cr,fs]=fe.split("-"),Vs=lt.useMemo(()=>M.reduce((en,Un,Gn)=>Gn>=rr?en:en+Un.height,0),[M,rr]),Js=SJe(),hi=b.invert||v,Ia=ft==="loading";As.current=lt.useMemo(()=>rr*oe+Vs,[rr,Vs]),lt.useEffect(()=>{Je.current=cr},[cr]),lt.useEffect(()=>{Ye(!0)},[]),lt.useEffect(()=>{let en=Ve.current;if(en){let Un=en.getBoundingClientRect().height;return Me(Un),S(Gn=>[{toastId:b.id,height:Un,position:b.position},...Gn]),()=>S(Gn=>Gn.filter(Ai=>Ai.toastId!==b.id))}},[S,b.id]),lt.useLayoutEffect(()=>{if(!Ue)return;let en=Ve.current,Un=en.style.height;en.style.height="auto";let Gn=en.getBoundingClientRect().height;en.style.height=Un,Me(Gn),S(Ai=>Ai.find(dr=>dr.toastId===b.id)?Ai.map(dr=>dr.toastId===b.id?{...dr,height:Gn}:dr):[{toastId:b.id,height:Gn,position:b.position},...Ai])},[Ue,b.title,b.description,S,b.id]);let dn=lt.useCallback(()=>{et(!0),je(As.current),S(en=>en.filter(Un=>Un.toastId!==b.id)),setTimeout(()=>{B(b)},BJe)},[b,B,S,As]);lt.useEffect(()=>{if(b.promise&&ft==="loading"||b.duration===1/0||b.type==="loading")return;let en;return O||j||we&&Js?(()=>{if(At.current{var Un;(Un=b.onAutoClose)==null||Un.call(b,b),dn()},Je.current)),()=>clearTimeout(en)},[O,j,b,ft,we,Js,dn]),lt.useEffect(()=>{b.delete&&dn()},[dn,b.delete]);function na(){var en,Un,Gn;return Te!=null&&Te.loading?lt.createElement("div",{className:cf(xe==null?void 0:xe.loader,(en=b==null?void 0:b.classNames)==null?void 0:en.loader,"sonner-loader"),"data-visible":ft==="loading"},Te.loading):de?lt.createElement("div",{className:cf(xe==null?void 0:xe.loader,(Un=b==null?void 0:b.classNames)==null?void 0:Un.loader,"sonner-loader"),"data-visible":ft==="loading"},de):lt.createElement(_Je,{className:cf(xe==null?void 0:xe.loader,(Gn=b==null?void 0:b.classNames)==null?void 0:Gn.loader),visible:ft==="loading"})}return lt.createElement("li",{tabIndex:0,ref:Ve,className:cf(ae,Mt,xe==null?void 0:xe.toast,(r=b==null?void 0:b.classNames)==null?void 0:r.toast,xe==null?void 0:xe.default,xe==null?void 0:xe[ft],(s=b==null?void 0:b.classNames)==null?void 0:s[ft]),"data-sonner-toast":"","data-rich-colors":(n=b.richColors)!=null?n:$,"data-styled":!(b.jsx||b.unstyled||N),"data-mounted":Ue,"data-promise":!!b.promise,"data-swiped":$e,"data-removed":Ie,"data-visible":mt,"data-y-position":Cr,"data-x-position":fs,"data-index":I,"data-front":ot,"data-swiping":It,"data-dismissible":ct,"data-type":ft,"data-invert":hi,"data-swipe-out":at,"data-swipe-direction":Ae,"data-expanded":!!(O||ue&&Ue),style:{"--index":I,"--toasts-before":I,"--z-index":F.length-I,"--offset":`${Ie?rt:As.current}px`,"--initial-height":ue?"auto":`${it}px`,...W,...b.style},onDragEnd:()=>{Pe(!1),tt(null),Rt.current=null},onPointerDown:en=>{Ia||!ct||(Xe.current=new Date,je(As.current),en.target.setPointerCapture(en.pointerId),en.target.tagName!=="BUTTON"&&(Pe(!0),Rt.current={x:en.clientX,y:en.clientY}))},onPointerUp:()=>{var en,Un,Gn,Ai;if(at||!ct)return;Rt.current=null;let dr=Number(((en=Ve.current)==null?void 0:en.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Fa=Number(((Un=Ve.current)==null?void 0:Un.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),mo=new Date().getTime()-((Gn=Xe.current)==null?void 0:Gn.getTime()),Ti=ve==="x"?dr:Fa,Ys=Math.abs(Ti)/mo;if(Math.abs(Ti)>=zJe||Ys>.11){je(As.current),(Ai=b.onDismiss)==null||Ai.call(b,b),Le(ve==="x"?dr>0?"right":"left":Fa>0?"down":"up"),dn(),ce(!0),Ge(!1);return}Pe(!1),tt(null)},onPointerMove:en=>{var Un,Gn,Ai,dr;if(!Rt.current||!ct||((Un=window.getSelection())==null?void 0:Un.toString().length)>0)return;let Fa=en.clientY-Rt.current.y,mo=en.clientX-Rt.current.x,Ti=(Gn=t.swipeDirections)!=null?Gn:$Je(fe);!ve&&(Math.abs(mo)>1||Math.abs(Fa)>1)&&tt(Math.abs(mo)>Math.abs(Fa)?"x":"y");let Ys={x:0,y:0};ve==="y"?(Ti.includes("top")||Ti.includes("bottom"))&&(Ti.includes("top")&&Fa<0||Ti.includes("bottom")&&Fa>0)&&(Ys.y=Fa):ve==="x"&&(Ti.includes("left")||Ti.includes("right"))&&(Ti.includes("left")&&mo<0||Ti.includes("right")&&mo>0)&&(Ys.x=mo),(Math.abs(Ys.x)>0||Math.abs(Ys.y)>0)&&Ge(!0),(Ai=Ve.current)==null||Ai.style.setProperty("--swipe-amount-x",`${Ys.x}px`),(dr=Ve.current)==null||dr.style.setProperty("--swipe-amount-y",`${Ys.y}px`)}},Ir&&!b.jsx?lt.createElement("button",{"aria-label":be,"data-disabled":Ia,"data-close-button":!0,onClick:Ia||!ct?()=>{}:()=>{var en;dn(),(en=b.onDismiss)==null||en.call(b,b)},className:cf(xe==null?void 0:xe.closeButton,(a=b==null?void 0:b.classNames)==null?void 0:a.closeButton)},(o=Te==null?void 0:Te.close)!=null?o:NJe):null,b.jsx||E.isValidElement(b.title)?b.jsx?b.jsx:typeof b.title=="function"?b.title():b.title:lt.createElement(lt.Fragment,null,ft||b.icon||b.promise?lt.createElement("div",{"data-icon":"",className:cf(xe==null?void 0:xe.icon,(l=b==null?void 0:b.classNames)==null?void 0:l.icon)},b.promise||b.type==="loading"&&!b.icon?b.icon||na():null,b.type!=="loading"?b.icon||(Te==null?void 0:Te[ft])||yJe(ft):null):null,lt.createElement("div",{"data-content":"",className:cf(xe==null?void 0:xe.content,(i=b==null?void 0:b.classNames)==null?void 0:i.content)},lt.createElement("div",{"data-title":"",className:cf(xe==null?void 0:xe.title,(d=b==null?void 0:b.classNames)==null?void 0:d.title)},typeof b.title=="function"?b.title():b.title),b.description?lt.createElement("div",{"data-description":"",className:cf(le,Ot,xe==null?void 0:xe.description,(m=b==null?void 0:b.classNames)==null?void 0:m.description)},typeof b.description=="function"?b.description():b.description):null),E.isValidElement(b.cancel)?b.cancel:b.cancel&&n8(b.cancel)?lt.createElement("button",{"data-button":!0,"data-cancel":!0,style:b.cancelButtonStyle||X,onClick:en=>{var Un,Gn;n8(b.cancel)&&ct&&((Gn=(Un=b.cancel).onClick)==null||Gn.call(Un,en),dn())},className:cf(xe==null?void 0:xe.cancelButton,(g=b==null?void 0:b.classNames)==null?void 0:g.cancelButton)},b.cancel.label):null,E.isValidElement(b.action)?b.action:b.action&&n8(b.action)?lt.createElement("button",{"data-button":!0,"data-action":!0,style:b.actionButtonStyle||se,onClick:en=>{var Un,Gn;n8(b.action)&&((Gn=(Un=b.action).onClick)==null||Gn.call(Un,en),!en.defaultPrevented&&dn())},className:cf(xe==null?void 0:xe.actionButton,(y=b==null?void 0:b.classNames)==null?void 0:y.actionButton)},b.action.label):null))};function zje(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function qJe(t,r){let s={};return[t,r].forEach((n,a)=>{let o=a===1,l=o?"--mobile-offset":"--offset",i=o?DJe:OJe;function d(m){["top","right","bottom","left"].forEach(g=>{s[`${l}-${g}`]=typeof m=="number"?`${m}px`:m})}typeof n=="number"||typeof n=="string"?d(n):typeof n=="object"?["top","right","bottom","left"].forEach(m=>{n[m]===void 0?s[`${l}-${m}`]=i:s[`${l}-${m}`]=typeof n[m]=="number"?`${n[m]}px`:n[m]}):d(i)}),s}var VJe=E.forwardRef(function(t,r){let{invert:s,position:n="bottom-right",hotkey:a=["altKey","KeyT"],expand:o,closeButton:l,className:i,offset:d,mobileOffset:m,theme:g="light",richColors:y,duration:v,style:b,visibleToasts:N=LJe,toastOptions:j,dir:S=zje(),gap:A=FJe,loadingIcon:M,icons:I,containerAriaLabel:F="Notifications",pauseWhenPageIsHidden:O}=t,[B,$]=lt.useState([]),H=lt.useMemo(()=>Array.from(new Set([n].concat(B.filter(we=>we.position).map(we=>we.position)))),[B,n]),[W,X]=lt.useState([]),[se,ae]=lt.useState(!1),[le,ne]=lt.useState(!1),[fe,oe]=lt.useState(g!=="system"?g:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),de=lt.useRef(null),ue=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),xe=lt.useRef(null),Te=lt.useRef(!1),be=lt.useCallback(we=>{$(ve=>{var tt;return(tt=ve.find(Ae=>Ae.id===we.id))!=null&&tt.delete||Mh.dismiss(we.id),ve.filter(({id:Ae})=>Ae!==we.id)})},[]);return lt.useEffect(()=>Mh.subscribe(we=>{if(we.dismiss){$(ve=>ve.map(tt=>tt.id===we.id?{...tt,delete:!0}:tt));return}setTimeout(()=>{oxe.flushSync(()=>{$(ve=>{let tt=ve.findIndex(Ae=>Ae.id===we.id);return tt!==-1?[...ve.slice(0,tt),{...ve[tt],...we},...ve.slice(tt+1)]:[we,...ve]})})})}),[]),lt.useEffect(()=>{if(g!=="system"){oe(g);return}if(g==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?oe("dark"):oe("light")),typeof window>"u")return;let we=window.matchMedia("(prefers-color-scheme: dark)");try{we.addEventListener("change",({matches:ve})=>{oe(ve?"dark":"light")})}catch{we.addListener(({matches:tt})=>{try{oe(tt?"dark":"light")}catch(Ae){console.error(Ae)}})}},[g]),lt.useEffect(()=>{B.length<=1&&ae(!1)},[B]),lt.useEffect(()=>{let we=ve=>{var tt,Ae;a.every(Le=>ve[Le]||ve.code===Le)&&(ae(!0),(tt=de.current)==null||tt.focus()),ve.code==="Escape"&&(document.activeElement===de.current||(Ae=de.current)!=null&&Ae.contains(document.activeElement))&&ae(!1)};return document.addEventListener("keydown",we),()=>document.removeEventListener("keydown",we)},[a]),lt.useEffect(()=>{if(de.current)return()=>{xe.current&&(xe.current.focus({preventScroll:!0}),xe.current=null,Te.current=!1)}},[de.current]),lt.createElement("section",{ref:r,"aria-label":`${F} ${ue}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},H.map((we,ve)=>{var tt;let[Ae,Le]=we.split("-");return B.length?lt.createElement("ol",{key:we,dir:S==="auto"?zje():S,tabIndex:-1,ref:de,className:i,"data-sonner-toaster":!0,"data-theme":fe,"data-y-position":Ae,"data-lifted":se&&B.length>1&&!o,"data-x-position":Le,style:{"--front-toast-height":`${((tt=W[0])==null?void 0:tt.height)||0}px`,"--width":`${RJe}px`,"--gap":`${A}px`,...b,...qJe(d,m)},onBlur:Ue=>{Te.current&&!Ue.currentTarget.contains(Ue.relatedTarget)&&(Te.current=!1,xe.current&&(xe.current.focus({preventScroll:!0}),xe.current=null))},onFocus:Ue=>{Ue.target instanceof HTMLElement&&Ue.target.dataset.dismissible==="false"||Te.current||(Te.current=!0,xe.current=Ue.relatedTarget)},onMouseEnter:()=>ae(!0),onMouseMove:()=>ae(!0),onMouseLeave:()=>{le||ae(!1)},onDragEnd:()=>ae(!1),onPointerDown:Ue=>{Ue.target instanceof HTMLElement&&Ue.target.dataset.dismissible==="false"||ne(!0)},onPointerUp:()=>ne(!1)},B.filter(Ue=>!Ue.position&&ve===0||Ue.position===we).map((Ue,Ye)=>{var Ie,et;return lt.createElement(UJe,{key:Ue.id,icons:I,index:Ye,toast:Ue,defaultRichColors:y,duration:(Ie=j==null?void 0:j.duration)!=null?Ie:v,className:j==null?void 0:j.className,descriptionClassName:j==null?void 0:j.descriptionClassName,invert:s,visibleToasts:N,closeButton:(et=j==null?void 0:j.closeButton)!=null?et:l,interacting:le,position:we,style:j==null?void 0:j.style,unstyled:j==null?void 0:j.unstyled,classNames:j==null?void 0:j.classNames,cancelButtonStyle:j==null?void 0:j.cancelButtonStyle,actionButtonStyle:j==null?void 0:j.actionButtonStyle,removeToast:be,toasts:B.filter(It=>It.position==Ue.position),heights:W.filter(It=>It.position==Ue.position),setHeights:X,expandByDefault:o,gap:A,loadingIcon:M,expanded:se,pauseWhenPageIsHidden:O,swipeDirections:t.swipeDirections})})):null}))});const HJe=({...t})=>{const{theme:r="system"}=xJe();return e.jsx(VJe,{theme:r,position:"top-center",className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...t})};var WJe=gge[" useId ".trim().toString()]||(()=>{}),GJe=0;function bd(t){const[r,s]=E.useState(WJe());return mc(()=>{s(n=>n??String(GJe++))},[t]),r?`radix-${r}`:""}const KJe=["top","right","bottom","left"],gv=Math.min,dm=Math.max,Ite=Math.round,a8=Math.floor,Jg=t=>({x:t,y:t}),ZJe={left:"right",right:"left",bottom:"top",top:"bottom"},YJe={start:"end",end:"start"};function Nhe(t,r,s){return dm(t,gv(r,s))}function Py(t,r){return typeof t=="function"?t(r):t}function Ly(t){return t.split("-")[0]}function E3(t){return t.split("-")[1]}function pxe(t){return t==="x"?"y":"x"}function fxe(t){return t==="y"?"height":"width"}const XJe=new Set(["top","bottom"]);function Rg(t){return XJe.has(Ly(t))?"y":"x"}function gxe(t){return pxe(Rg(t))}function QJe(t,r,s){s===void 0&&(s=!1);const n=E3(t),a=gxe(t),o=fxe(a);let l=a==="x"?n===(s?"end":"start")?"right":"left":n==="start"?"bottom":"top";return r.reference[o]>r.floating[o]&&(l=Pte(l)),[l,Pte(l)]}function JJe(t){const r=Pte(t);return[She(t),r,She(r)]}function She(t){return t.replace(/start|end/g,r=>YJe[r])}const Bje=["left","right"],$je=["right","left"],eet=["top","bottom"],tet=["bottom","top"];function ret(t,r,s){switch(t){case"top":case"bottom":return s?r?$je:Bje:r?Bje:$je;case"left":case"right":return r?eet:tet;default:return[]}}function set(t,r,s,n){const a=E3(t);let o=ret(Ly(t),s==="start",n);return a&&(o=o.map(l=>l+"-"+a),r&&(o=o.concat(o.map(She)))),o}function Pte(t){return t.replace(/left|right|bottom|top/g,r=>ZJe[r])}function net(t){return{top:0,right:0,bottom:0,left:0,...t}}function tPe(t){return typeof t!="number"?net(t):{top:t,right:t,bottom:t,left:t}}function Lte(t){const{x:r,y:s,width:n,height:a}=t;return{width:n,height:a,top:s,left:r,right:r+n,bottom:s+a,x:r,y:s}}function Uje(t,r,s){let{reference:n,floating:a}=t;const o=Rg(r),l=gxe(r),i=fxe(l),d=Ly(r),m=o==="y",g=n.x+n.width/2-a.width/2,y=n.y+n.height/2-a.height/2,v=n[i]/2-a[i]/2;let b;switch(d){case"top":b={x:g,y:n.y-a.height};break;case"bottom":b={x:g,y:n.y+n.height};break;case"right":b={x:n.x+n.width,y};break;case"left":b={x:n.x-a.width,y};break;default:b={x:n.x,y:n.y}}switch(E3(r)){case"start":b[l]-=v*(s&&m?-1:1);break;case"end":b[l]+=v*(s&&m?-1:1);break}return b}const aet=async(t,r,s)=>{const{placement:n="bottom",strategy:a="absolute",middleware:o=[],platform:l}=s,i=o.filter(Boolean),d=await(l.isRTL==null?void 0:l.isRTL(r));let m=await l.getElementRects({reference:t,floating:r,strategy:a}),{x:g,y}=Uje(m,n,d),v=n,b={},N=0;for(let j=0;j({name:"arrow",options:t,async fn(r){const{x:s,y:n,placement:a,rects:o,platform:l,elements:i,middlewareData:d}=r,{element:m,padding:g=0}=Py(t,r)||{};if(m==null)return{};const y=tPe(g),v={x:s,y:n},b=gxe(a),N=fxe(b),j=await l.getDimensions(m),S=b==="y",A=S?"top":"left",M=S?"bottom":"right",I=S?"clientHeight":"clientWidth",F=o.reference[N]+o.reference[b]-v[b]-o.floating[N],O=v[b]-o.reference[b],B=await(l.getOffsetParent==null?void 0:l.getOffsetParent(m));let $=B?B[I]:0;(!$||!await(l.isElement==null?void 0:l.isElement(B)))&&($=i.floating[I]||o.floating[N]);const H=F/2-O/2,W=$/2-j[N]/2-1,X=gv(y[A],W),se=gv(y[M],W),ae=X,le=$-j[N]-se,ne=$/2-j[N]/2+H,fe=Nhe(ae,ne,le),oe=!d.arrow&&E3(a)!=null&&ne!==fe&&o.reference[N]/2-(nene<=0)){var se,ae;const ne=(((se=o.flip)==null?void 0:se.index)||0)+1,fe=$[ne];if(fe&&(!(y==="alignment"?M!==Rg(fe):!1)||X.every(ue=>ue.overflows[0]>0&&Rg(ue.placement)===M)))return{data:{index:ne,overflows:X},reset:{placement:fe}};let oe=(ae=X.filter(de=>de.overflows[0]<=0).sort((de,ue)=>de.overflows[1]-ue.overflows[1])[0])==null?void 0:ae.placement;if(!oe)switch(b){case"bestFit":{var le;const de=(le=X.filter(ue=>{if(B){const xe=Rg(ue.placement);return xe===M||xe==="y"}return!0}).map(ue=>[ue.placement,ue.overflows.filter(xe=>xe>0).reduce((xe,Te)=>xe+Te,0)]).sort((ue,xe)=>ue[1]-xe[1])[0])==null?void 0:le[0];de&&(oe=de);break}case"initialPlacement":oe=i;break}if(a!==oe)return{reset:{placement:oe}}}return{}}}};function qje(t,r){return{top:t.top-r.height,right:t.right-r.width,bottom:t.bottom-r.height,left:t.left-r.width}}function Vje(t){return KJe.some(r=>t[r]>=0)}const cet=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(r){const{rects:s}=r,{strategy:n="referenceHidden",...a}=Py(t,r);switch(n){case"referenceHidden":{const o=await FE(r,{...a,elementContext:"reference"}),l=qje(o,s.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Vje(l)}}}case"escaped":{const o=await FE(r,{...a,altBoundary:!0}),l=qje(o,s.floating);return{data:{escapedOffsets:l,escaped:Vje(l)}}}default:return{}}}}},rPe=new Set(["left","top"]);async function det(t,r){const{placement:s,platform:n,elements:a}=t,o=await(n.isRTL==null?void 0:n.isRTL(a.floating)),l=Ly(s),i=E3(s),d=Rg(s)==="y",m=rPe.has(l)?-1:1,g=o&&d?-1:1,y=Py(r,t);let{mainAxis:v,crossAxis:b,alignmentAxis:N}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return i&&typeof N=="number"&&(b=i==="end"?N*-1:N),d?{x:b*g,y:v*m}:{x:v*m,y:b*g}}const uet=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(r){var s,n;const{x:a,y:o,placement:l,middlewareData:i}=r,d=await det(r,t);return l===((s=i.offset)==null?void 0:s.placement)&&(n=i.arrow)!=null&&n.alignmentOffset?{}:{x:a+d.x,y:o+d.y,data:{...d,placement:l}}}}},het=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(r){const{x:s,y:n,placement:a}=r,{mainAxis:o=!0,crossAxis:l=!1,limiter:i={fn:S=>{let{x:A,y:M}=S;return{x:A,y:M}}},...d}=Py(t,r),m={x:s,y:n},g=await FE(r,d),y=Rg(Ly(a)),v=pxe(y);let b=m[v],N=m[y];if(o){const S=v==="y"?"top":"left",A=v==="y"?"bottom":"right",M=b+g[S],I=b-g[A];b=Nhe(M,b,I)}if(l){const S=y==="y"?"top":"left",A=y==="y"?"bottom":"right",M=N+g[S],I=N-g[A];N=Nhe(M,N,I)}const j=i.fn({...r,[v]:b,[y]:N});return{...j,data:{x:j.x-s,y:j.y-n,enabled:{[v]:o,[y]:l}}}}}},met=function(t){return t===void 0&&(t={}),{options:t,fn(r){const{x:s,y:n,placement:a,rects:o,middlewareData:l}=r,{offset:i=0,mainAxis:d=!0,crossAxis:m=!0}=Py(t,r),g={x:s,y:n},y=Rg(a),v=pxe(y);let b=g[v],N=g[y];const j=Py(i,r),S=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(d){const I=v==="y"?"height":"width",F=o.reference[v]-o.floating[I]+S.mainAxis,O=o.reference[v]+o.reference[I]-S.mainAxis;bO&&(b=O)}if(m){var A,M;const I=v==="y"?"width":"height",F=rPe.has(Ly(a)),O=o.reference[y]-o.floating[I]+(F&&((A=l.offset)==null?void 0:A[y])||0)+(F?0:S.crossAxis),B=o.reference[y]+o.reference[I]+(F?0:((M=l.offset)==null?void 0:M[y])||0)-(F?S.crossAxis:0);NB&&(N=B)}return{[v]:b,[y]:N}}}},pet=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(r){var s,n;const{placement:a,rects:o,platform:l,elements:i}=r,{apply:d=()=>{},...m}=Py(t,r),g=await FE(r,m),y=Ly(a),v=E3(a),b=Rg(a)==="y",{width:N,height:j}=o.floating;let S,A;y==="top"||y==="bottom"?(S=y,A=v===(await(l.isRTL==null?void 0:l.isRTL(i.floating))?"start":"end")?"left":"right"):(A=y,S=v==="end"?"top":"bottom");const M=j-g.top-g.bottom,I=N-g.left-g.right,F=gv(j-g[S],M),O=gv(N-g[A],I),B=!r.middlewareData.shift;let $=F,H=O;if((s=r.middlewareData.shift)!=null&&s.enabled.x&&(H=I),(n=r.middlewareData.shift)!=null&&n.enabled.y&&($=M),B&&!v){const X=dm(g.left,0),se=dm(g.right,0),ae=dm(g.top,0),le=dm(g.bottom,0);b?H=N-2*(X!==0||se!==0?X+se:dm(g.left,g.right)):$=j-2*(ae!==0||le!==0?ae+le:dm(g.top,g.bottom))}await d({...r,availableWidth:H,availableHeight:$});const W=await l.getDimensions(i.floating);return N!==W.width||j!==W.height?{reset:{rects:!0}}:{}}}};function Nne(){return typeof window<"u"}function I3(t){return sPe(t)?(t.nodeName||"").toLowerCase():"#document"}function Sm(t){var r;return(t==null||(r=t.ownerDocument)==null?void 0:r.defaultView)||window}function dx(t){var r;return(r=(sPe(t)?t.ownerDocument:t.document)||window.document)==null?void 0:r.documentElement}function sPe(t){return Nne()?t instanceof Node||t instanceof Sm(t).Node:!1}function Gf(t){return Nne()?t instanceof Element||t instanceof Sm(t).Element:!1}function sx(t){return Nne()?t instanceof HTMLElement||t instanceof Sm(t).HTMLElement:!1}function Hje(t){return!Nne()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Sm(t).ShadowRoot}const fet=new Set(["inline","contents"]);function cP(t){const{overflow:r,overflowX:s,overflowY:n,display:a}=Kf(t);return/auto|scroll|overlay|hidden|clip/.test(r+n+s)&&!fet.has(a)}const get=new Set(["table","td","th"]);function xet(t){return get.has(I3(t))}const yet=[":popover-open",":modal"];function Sne(t){return yet.some(r=>{try{return t.matches(r)}catch{return!1}})}const vet=["transform","translate","scale","rotate","perspective"],_et=["transform","translate","scale","rotate","perspective","filter"],bet=["paint","layout","strict","content"];function xxe(t){const r=yxe(),s=Gf(t)?Kf(t):t;return vet.some(n=>s[n]?s[n]!=="none":!1)||(s.containerType?s.containerType!=="normal":!1)||!r&&(s.backdropFilter?s.backdropFilter!=="none":!1)||!r&&(s.filter?s.filter!=="none":!1)||_et.some(n=>(s.willChange||"").includes(n))||bet.some(n=>(s.contain||"").includes(n))}function wet(t){let r=xv(t);for(;sx(r)&&!DC(r);){if(xxe(r))return r;if(Sne(r))return null;r=xv(r)}return null}function yxe(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const jet=new Set(["html","body","#document"]);function DC(t){return jet.has(I3(t))}function Kf(t){return Sm(t).getComputedStyle(t)}function Cne(t){return Gf(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function xv(t){if(I3(t)==="html")return t;const r=t.assignedSlot||t.parentNode||Hje(t)&&t.host||dx(t);return Hje(r)?r.host:r}function nPe(t){const r=xv(t);return DC(r)?t.ownerDocument?t.ownerDocument.body:t.body:sx(r)&&cP(r)?r:nPe(r)}function zE(t,r,s){var n;r===void 0&&(r=[]),s===void 0&&(s=!0);const a=nPe(t),o=a===((n=t.ownerDocument)==null?void 0:n.body),l=Sm(a);if(o){const i=Che(l);return r.concat(l,l.visualViewport||[],cP(a)?a:[],i&&s?zE(i):[])}return r.concat(a,zE(a,[],s))}function Che(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function aPe(t){const r=Kf(t);let s=parseFloat(r.width)||0,n=parseFloat(r.height)||0;const a=sx(t),o=a?t.offsetWidth:s,l=a?t.offsetHeight:n,i=Ite(s)!==o||Ite(n)!==l;return i&&(s=o,n=l),{width:s,height:n,$:i}}function vxe(t){return Gf(t)?t:t.contextElement}function tC(t){const r=vxe(t);if(!sx(r))return Jg(1);const s=r.getBoundingClientRect(),{width:n,height:a,$:o}=aPe(r);let l=(o?Ite(s.width):s.width)/n,i=(o?Ite(s.height):s.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!i||!Number.isFinite(i))&&(i=1),{x:l,y:i}}const ket=Jg(0);function iPe(t){const r=Sm(t);return!yxe()||!r.visualViewport?ket:{x:r.visualViewport.offsetLeft,y:r.visualViewport.offsetTop}}function Net(t,r,s){return r===void 0&&(r=!1),!s||r&&s!==Sm(t)?!1:r}function fk(t,r,s,n){r===void 0&&(r=!1),s===void 0&&(s=!1);const a=t.getBoundingClientRect(),o=vxe(t);let l=Jg(1);r&&(n?Gf(n)&&(l=tC(n)):l=tC(t));const i=Net(o,s,n)?iPe(o):Jg(0);let d=(a.left+i.x)/l.x,m=(a.top+i.y)/l.y,g=a.width/l.x,y=a.height/l.y;if(o){const v=Sm(o),b=n&&Gf(n)?Sm(n):n;let N=v,j=Che(N);for(;j&&n&&b!==N;){const S=tC(j),A=j.getBoundingClientRect(),M=Kf(j),I=A.left+(j.clientLeft+parseFloat(M.paddingLeft))*S.x,F=A.top+(j.clientTop+parseFloat(M.paddingTop))*S.y;d*=S.x,m*=S.y,g*=S.x,y*=S.y,d+=I,m+=F,N=Sm(j),j=Che(N)}}return Lte({width:g,height:y,x:d,y:m})}function _xe(t,r){const s=Cne(t).scrollLeft;return r?r.left+s:fk(dx(t)).left+s}function oPe(t,r,s){s===void 0&&(s=!1);const n=t.getBoundingClientRect(),a=n.left+r.scrollLeft-(s?0:_xe(t,n)),o=n.top+r.scrollTop;return{x:a,y:o}}function Cet(t){let{elements:r,rect:s,offsetParent:n,strategy:a}=t;const o=a==="fixed",l=dx(n),i=r?Sne(r.floating):!1;if(n===l||i&&o)return s;let d={scrollLeft:0,scrollTop:0},m=Jg(1);const g=Jg(0),y=sx(n);if((y||!y&&!o)&&((I3(n)!=="body"||cP(l))&&(d=Cne(n)),sx(n))){const b=fk(n);m=tC(n),g.x=b.x+n.clientLeft,g.y=b.y+n.clientTop}const v=l&&!y&&!o?oPe(l,d,!0):Jg(0);return{width:s.width*m.x,height:s.height*m.y,x:s.x*m.x-d.scrollLeft*m.x+g.x+v.x,y:s.y*m.y-d.scrollTop*m.y+g.y+v.y}}function Met(t){return Array.from(t.getClientRects())}function Tet(t){const r=dx(t),s=Cne(t),n=t.ownerDocument.body,a=dm(r.scrollWidth,r.clientWidth,n.scrollWidth,n.clientWidth),o=dm(r.scrollHeight,r.clientHeight,n.scrollHeight,n.clientHeight);let l=-s.scrollLeft+_xe(t);const i=-s.scrollTop;return Kf(n).direction==="rtl"&&(l+=dm(r.clientWidth,n.clientWidth)-a),{width:a,height:o,x:l,y:i}}function Aet(t,r){const s=Sm(t),n=dx(t),a=s.visualViewport;let o=n.clientWidth,l=n.clientHeight,i=0,d=0;if(a){o=a.width,l=a.height;const m=yxe();(!m||m&&r==="fixed")&&(i=a.offsetLeft,d=a.offsetTop)}return{width:o,height:l,x:i,y:d}}const Eet=new Set(["absolute","fixed"]);function Iet(t,r){const s=fk(t,!0,r==="fixed"),n=s.top+t.clientTop,a=s.left+t.clientLeft,o=sx(t)?tC(t):Jg(1),l=t.clientWidth*o.x,i=t.clientHeight*o.y,d=a*o.x,m=n*o.y;return{width:l,height:i,x:d,y:m}}function Wje(t,r,s){let n;if(r==="viewport")n=Aet(t,s);else if(r==="document")n=Tet(dx(t));else if(Gf(r))n=Iet(r,s);else{const a=iPe(t);n={x:r.x-a.x,y:r.y-a.y,width:r.width,height:r.height}}return Lte(n)}function lPe(t,r){const s=xv(t);return s===r||!Gf(s)||DC(s)?!1:Kf(s).position==="fixed"||lPe(s,r)}function Pet(t,r){const s=r.get(t);if(s)return s;let n=zE(t,[],!1).filter(i=>Gf(i)&&I3(i)!=="body"),a=null;const o=Kf(t).position==="fixed";let l=o?xv(t):t;for(;Gf(l)&&!DC(l);){const i=Kf(l),d=xxe(l);!d&&i.position==="fixed"&&(a=null),(o?!d&&!a:!d&&i.position==="static"&&!!a&&Eet.has(a.position)||cP(l)&&!d&&lPe(t,l))?n=n.filter(g=>g!==l):a=i,l=xv(l)}return r.set(t,n),n}function Let(t){let{element:r,boundary:s,rootBoundary:n,strategy:a}=t;const l=[...s==="clippingAncestors"?Sne(r)?[]:Pet(r,this._c):[].concat(s),n],i=l[0],d=l.reduce((m,g)=>{const y=Wje(r,g,a);return m.top=dm(y.top,m.top),m.right=gv(y.right,m.right),m.bottom=gv(y.bottom,m.bottom),m.left=dm(y.left,m.left),m},Wje(r,i,a));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function Oet(t){const{width:r,height:s}=aPe(t);return{width:r,height:s}}function Det(t,r,s){const n=sx(r),a=dx(r),o=s==="fixed",l=fk(t,!0,o,r);let i={scrollLeft:0,scrollTop:0};const d=Jg(0);function m(){d.x=_xe(a)}if(n||!n&&!o)if((I3(r)!=="body"||cP(a))&&(i=Cne(r)),n){const b=fk(r,!0,o,r);d.x=b.x+r.clientLeft,d.y=b.y+r.clientTop}else a&&m();o&&!n&&a&&m();const g=a&&!n&&!o?oPe(a,i):Jg(0),y=l.left+i.scrollLeft-d.x-g.x,v=l.top+i.scrollTop-d.y-g.y;return{x:y,y:v,width:l.width,height:l.height}}function wce(t){return Kf(t).position==="static"}function Gje(t,r){if(!sx(t)||Kf(t).position==="fixed")return null;if(r)return r(t);let s=t.offsetParent;return dx(t)===s&&(s=s.ownerDocument.body),s}function cPe(t,r){const s=Sm(t);if(Sne(t))return s;if(!sx(t)){let a=xv(t);for(;a&&!DC(a);){if(Gf(a)&&!wce(a))return a;a=xv(a)}return s}let n=Gje(t,r);for(;n&&xet(n)&&wce(n);)n=Gje(n,r);return n&&DC(n)&&wce(n)&&!xxe(n)?s:n||wet(t)||s}const Ret=async function(t){const r=this.getOffsetParent||cPe,s=this.getDimensions,n=await s(t.floating);return{reference:Det(t.reference,await r(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Fet(t){return Kf(t).direction==="rtl"}const zet={convertOffsetParentRelativeRectToViewportRelativeRect:Cet,getDocumentElement:dx,getClippingRect:Let,getOffsetParent:cPe,getElementRects:Ret,getClientRects:Met,getDimensions:Oet,getScale:tC,isElement:Gf,isRTL:Fet};function dPe(t,r){return t.x===r.x&&t.y===r.y&&t.width===r.width&&t.height===r.height}function Bet(t,r){let s=null,n;const a=dx(t);function o(){var i;clearTimeout(n),(i=s)==null||i.disconnect(),s=null}function l(i,d){i===void 0&&(i=!1),d===void 0&&(d=1),o();const m=t.getBoundingClientRect(),{left:g,top:y,width:v,height:b}=m;if(i||r(),!v||!b)return;const N=a8(y),j=a8(a.clientWidth-(g+v)),S=a8(a.clientHeight-(y+b)),A=a8(g),I={rootMargin:-N+"px "+-j+"px "+-S+"px "+-A+"px",threshold:dm(0,gv(1,d))||1};let F=!0;function O(B){const $=B[0].intersectionRatio;if($!==d){if(!F)return l();$?l(!1,$):n=setTimeout(()=>{l(!1,1e-7)},1e3)}$===1&&!dPe(m,t.getBoundingClientRect())&&l(),F=!1}try{s=new IntersectionObserver(O,{...I,root:a.ownerDocument})}catch{s=new IntersectionObserver(O,I)}s.observe(t)}return l(!0),o}function $et(t,r,s,n){n===void 0&&(n={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:d=!1}=n,m=vxe(t),g=a||o?[...m?zE(m):[],...zE(r)]:[];g.forEach(A=>{a&&A.addEventListener("scroll",s,{passive:!0}),o&&A.addEventListener("resize",s)});const y=m&&i?Bet(m,s):null;let v=-1,b=null;l&&(b=new ResizeObserver(A=>{let[M]=A;M&&M.target===m&&b&&(b.unobserve(r),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var I;(I=b)==null||I.observe(r)})),s()}),m&&!d&&b.observe(m),b.observe(r));let N,j=d?fk(t):null;d&&S();function S(){const A=fk(t);j&&!dPe(j,A)&&s(),j=A,N=requestAnimationFrame(S)}return s(),()=>{var A;g.forEach(M=>{a&&M.removeEventListener("scroll",s),o&&M.removeEventListener("resize",s)}),y==null||y(),(A=b)==null||A.disconnect(),b=null,d&&cancelAnimationFrame(N)}}const Uet=uet,qet=het,Vet=oet,Het=pet,Wet=cet,Kje=iet,Get=met,Ket=(t,r,s)=>{const n=new Map,a={platform:zet,...s},o={...a.platform,_c:n};return aet(t,r,{...a,platform:o})};var Zet=typeof document<"u",Yet=function(){},$ee=Zet?E.useLayoutEffect:Yet;function Ote(t,r){if(t===r)return!0;if(typeof t!=typeof r)return!1;if(typeof t=="function"&&t.toString()===r.toString())return!0;let s,n,a;if(t&&r&&typeof t=="object"){if(Array.isArray(t)){if(s=t.length,s!==r.length)return!1;for(n=s;n--!==0;)if(!Ote(t[n],r[n]))return!1;return!0}if(a=Object.keys(t),s=a.length,s!==Object.keys(r).length)return!1;for(n=s;n--!==0;)if(!{}.hasOwnProperty.call(r,a[n]))return!1;for(n=s;n--!==0;){const o=a[n];if(!(o==="_owner"&&t.$$typeof)&&!Ote(t[o],r[o]))return!1}return!0}return t!==t&&r!==r}function uPe(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Zje(t,r){const s=uPe(t);return Math.round(r*s)/s}function jce(t){const r=E.useRef(t);return $ee(()=>{r.current=t}),r}function Xet(t){t===void 0&&(t={});const{placement:r="bottom",strategy:s="absolute",middleware:n=[],platform:a,elements:{reference:o,floating:l}={},transform:i=!0,whileElementsMounted:d,open:m}=t,[g,y]=E.useState({x:0,y:0,strategy:s,placement:r,middlewareData:{},isPositioned:!1}),[v,b]=E.useState(n);Ote(v,n)||b(n);const[N,j]=E.useState(null),[S,A]=E.useState(null),M=E.useCallback(ue=>{ue!==B.current&&(B.current=ue,j(ue))},[]),I=E.useCallback(ue=>{ue!==$.current&&($.current=ue,A(ue))},[]),F=o||N,O=l||S,B=E.useRef(null),$=E.useRef(null),H=E.useRef(g),W=d!=null,X=jce(d),se=jce(a),ae=jce(m),le=E.useCallback(()=>{if(!B.current||!$.current)return;const ue={placement:r,strategy:s,middleware:v};se.current&&(ue.platform=se.current),Ket(B.current,$.current,ue).then(xe=>{const Te={...xe,isPositioned:ae.current!==!1};ne.current&&!Ote(H.current,Te)&&(H.current=Te,Ph.flushSync(()=>{y(Te)}))})},[v,r,s,se,ae]);$ee(()=>{m===!1&&H.current.isPositioned&&(H.current.isPositioned=!1,y(ue=>({...ue,isPositioned:!1})))},[m]);const ne=E.useRef(!1);$ee(()=>(ne.current=!0,()=>{ne.current=!1}),[]),$ee(()=>{if(F&&(B.current=F),O&&($.current=O),F&&O){if(X.current)return X.current(F,O,le);le()}},[F,O,le,X,W]);const fe=E.useMemo(()=>({reference:B,floating:$,setReference:M,setFloating:I}),[M,I]),oe=E.useMemo(()=>({reference:F,floating:O}),[F,O]),de=E.useMemo(()=>{const ue={position:s,left:0,top:0};if(!oe.floating)return ue;const xe=Zje(oe.floating,g.x),Te=Zje(oe.floating,g.y);return i?{...ue,transform:"translate("+xe+"px, "+Te+"px)",...uPe(oe.floating)>=1.5&&{willChange:"transform"}}:{position:s,left:xe,top:Te}},[s,i,oe.floating,g.x,g.y]);return E.useMemo(()=>({...g,update:le,refs:fe,elements:oe,floatingStyles:de}),[g,le,fe,oe,de])}const Qet=t=>{function r(s){return{}.hasOwnProperty.call(s,"current")}return{name:"arrow",options:t,fn(s){const{element:n,padding:a}=typeof t=="function"?t(s):t;return n&&r(n)?n.current!=null?Kje({element:n.current,padding:a}).fn(s):{}:n?Kje({element:n,padding:a}).fn(s):{}}}},Jet=(t,r)=>({...Uet(t),options:[t,r]}),ett=(t,r)=>({...qet(t),options:[t,r]}),ttt=(t,r)=>({...Get(t),options:[t,r]}),rtt=(t,r)=>({...Vet(t),options:[t,r]}),stt=(t,r)=>({...Het(t),options:[t,r]}),ntt=(t,r)=>({...Wet(t),options:[t,r]}),att=(t,r)=>({...Qet(t),options:[t,r]});var itt="Arrow",hPe=E.forwardRef((t,r)=>{const{children:s,width:n=10,height:a=5,...o}=t;return e.jsx(qs.svg,{...o,ref:r,width:n,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?s:e.jsx("polygon",{points:"0,0 30,0 15,10"})})});hPe.displayName=itt;var ott=hPe;function dP(t){const[r,s]=E.useState(void 0);return mc(()=>{if(t){s({width:t.offsetWidth,height:t.offsetHeight});const n=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const o=a[0];let l,i;if("borderBoxSize"in o){const d=o.borderBoxSize,m=Array.isArray(d)?d[0]:d;l=m.inlineSize,i=m.blockSize}else l=t.offsetWidth,i=t.offsetHeight;s({width:l,height:i})});return n.observe(t,{box:"border-box"}),()=>n.unobserve(t)}else s(void 0)},[t]),r}var bxe="Popper",[mPe,ux]=fc(bxe),[ltt,pPe]=mPe(bxe),fPe=t=>{const{__scopePopper:r,children:s}=t,[n,a]=E.useState(null);return e.jsx(ltt,{scope:r,anchor:n,onAnchorChange:a,children:s})};fPe.displayName=bxe;var gPe="PopperAnchor",xPe=E.forwardRef((t,r)=>{const{__scopePopper:s,virtualRef:n,...a}=t,o=pPe(gPe,s),l=E.useRef(null),i=ga(r,l);return E.useEffect(()=>{o.onAnchorChange((n==null?void 0:n.current)||l.current)}),n?null:e.jsx(qs.div,{...a,ref:i})});xPe.displayName=gPe;var wxe="PopperContent",[ctt,dtt]=mPe(wxe),yPe=E.forwardRef((t,r)=>{var Ue,Ye,Ie,et,It,Pe;const{__scopePopper:s,side:n="bottom",sideOffset:a=0,align:o="center",alignOffset:l=0,arrowPadding:i=0,avoidCollisions:d=!0,collisionBoundary:m=[],collisionPadding:g=0,sticky:y="partial",hideWhenDetached:v=!1,updatePositionStrategy:b="optimized",onPlaced:N,...j}=t,S=pPe(wxe,s),[A,M]=E.useState(null),I=ga(r,at=>M(at)),[F,O]=E.useState(null),B=dP(F),$=(B==null?void 0:B.width)??0,H=(B==null?void 0:B.height)??0,W=n+(o!=="center"?"-"+o:""),X=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},se=Array.isArray(m)?m:[m],ae=se.length>0,le={padding:X,boundary:se.filter(htt),altBoundary:ae},{refs:ne,floatingStyles:fe,placement:oe,isPositioned:de,middlewareData:ue}=Xet({strategy:"fixed",placement:W,whileElementsMounted:(...at)=>$et(...at,{animationFrame:b==="always"}),elements:{reference:S.anchor},middleware:[Jet({mainAxis:a+H,alignmentAxis:l}),d&&ett({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?ttt():void 0,...le}),d&&rtt({...le}),stt({...le,apply:({elements:at,rects:ce,availableWidth:$e,availableHeight:Ge})=>{const{width:rt,height:je}=ce.reference,it=at.floating.style;it.setProperty("--radix-popper-available-width",`${$e}px`),it.setProperty("--radix-popper-available-height",`${Ge}px`),it.setProperty("--radix-popper-anchor-width",`${rt}px`),it.setProperty("--radix-popper-anchor-height",`${je}px`)}}),F&&att({element:F,padding:i}),mtt({arrowWidth:$,arrowHeight:H}),v&&ntt({strategy:"referenceHidden",...le})]}),[xe,Te]=bPe(oe),be=cc(N);mc(()=>{de&&(be==null||be())},[de,be]);const we=(Ue=ue.arrow)==null?void 0:Ue.x,ve=(Ye=ue.arrow)==null?void 0:Ye.y,tt=((Ie=ue.arrow)==null?void 0:Ie.centerOffset)!==0,[Ae,Le]=E.useState();return mc(()=>{A&&Le(window.getComputedStyle(A).zIndex)},[A]),e.jsx("div",{ref:ne.setFloating,"data-radix-popper-content-wrapper":"",style:{...fe,transform:de?fe.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ae,"--radix-popper-transform-origin":[(et=ue.transformOrigin)==null?void 0:et.x,(It=ue.transformOrigin)==null?void 0:It.y].join(" "),...((Pe=ue.hide)==null?void 0:Pe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:e.jsx(ctt,{scope:s,placedSide:xe,onArrowChange:O,arrowX:we,arrowY:ve,shouldHideArrow:tt,children:e.jsx(qs.div,{"data-side":xe,"data-align":Te,...j,ref:I,style:{...j.style,animation:de?void 0:"none"}})})})});yPe.displayName=wxe;var vPe="PopperArrow",utt={top:"bottom",right:"left",bottom:"top",left:"right"},_Pe=E.forwardRef(function(r,s){const{__scopePopper:n,...a}=r,o=dtt(vPe,n),l=utt[o.placedSide];return e.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:e.jsx(ott,{...a,ref:s,style:{...a.style,display:"block"}})})});_Pe.displayName=vPe;function htt(t){return t!==null}var mtt=t=>({name:"transformOrigin",options:t,fn(r){var S,A,M;const{placement:s,rects:n,middlewareData:a}=r,l=((S=a.arrow)==null?void 0:S.centerOffset)!==0,i=l?0:t.arrowWidth,d=l?0:t.arrowHeight,[m,g]=bPe(s),y={start:"0%",center:"50%",end:"100%"}[g],v=(((A=a.arrow)==null?void 0:A.x)??0)+i/2,b=(((M=a.arrow)==null?void 0:M.y)??0)+d/2;let N="",j="";return m==="bottom"?(N=l?y:`${v}px`,j=`${-d}px`):m==="top"?(N=l?y:`${v}px`,j=`${n.floating.height+d}px`):m==="right"?(N=`${-d}px`,j=l?y:`${b}px`):m==="left"&&(N=`${n.floating.width+d}px`,j=l?y:`${b}px`),{data:{x:N,y:j}}}});function bPe(t){const[r,s="center"]=t.split("-");return[r,s]}var uP=fPe,P3=xPe,hP=yPe,mP=_Pe,[Mne]=fc("Tooltip",[ux]),Tne=ux(),wPe="TooltipProvider",ptt=700,Mhe="tooltip.open",[ftt,jxe]=Mne(wPe),jPe=t=>{const{__scopeTooltip:r,delayDuration:s=ptt,skipDelayDuration:n=300,disableHoverableContent:a=!1,children:o}=t,l=E.useRef(!0),i=E.useRef(!1),d=E.useRef(0);return E.useEffect(()=>{const m=d.current;return()=>window.clearTimeout(m)},[]),e.jsx(ftt,{scope:r,isOpenDelayedRef:l,delayDuration:s,onOpen:E.useCallback(()=>{window.clearTimeout(d.current),l.current=!1},[]),onClose:E.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.current=!0,n)},[n]),isPointerInTransitRef:i,onPointerInTransitChange:E.useCallback(m=>{i.current=m},[]),disableHoverableContent:a,children:o})};jPe.displayName=wPe;var BE="Tooltip",[gtt,Ane]=Mne(BE),kPe=t=>{const{__scopeTooltip:r,children:s,open:n,defaultOpen:a,onOpenChange:o,disableHoverableContent:l,delayDuration:i}=t,d=jxe(BE,t.__scopeTooltip),m=Tne(r),[g,y]=E.useState(null),v=bd(),b=E.useRef(0),N=l??d.disableHoverableContent,j=i??d.delayDuration,S=E.useRef(!1),[A,M]=oh({prop:n,defaultProp:a??!1,onChange:$=>{$?(d.onOpen(),document.dispatchEvent(new CustomEvent(Mhe))):d.onClose(),o==null||o($)},caller:BE}),I=E.useMemo(()=>A?S.current?"delayed-open":"instant-open":"closed",[A]),F=E.useCallback(()=>{window.clearTimeout(b.current),b.current=0,S.current=!1,M(!0)},[M]),O=E.useCallback(()=>{window.clearTimeout(b.current),b.current=0,M(!1)},[M]),B=E.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{S.current=!0,M(!0),b.current=0},j)},[j,M]);return E.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),e.jsx(uP,{...m,children:e.jsx(gtt,{scope:r,contentId:v,open:A,stateAttribute:I,trigger:g,onTriggerChange:y,onTriggerEnter:E.useCallback(()=>{d.isOpenDelayedRef.current?B():F()},[d.isOpenDelayedRef,B,F]),onTriggerLeave:E.useCallback(()=>{N?O():(window.clearTimeout(b.current),b.current=0)},[O,N]),onOpen:F,onClose:O,disableHoverableContent:N,children:s})})};kPe.displayName=BE;var The="TooltipTrigger",NPe=E.forwardRef((t,r)=>{const{__scopeTooltip:s,...n}=t,a=Ane(The,s),o=jxe(The,s),l=Tne(s),i=E.useRef(null),d=ga(r,i,a.onTriggerChange),m=E.useRef(!1),g=E.useRef(!1),y=E.useCallback(()=>m.current=!1,[]);return E.useEffect(()=>()=>document.removeEventListener("pointerup",y),[y]),e.jsx(P3,{asChild:!0,...l,children:e.jsx(qs.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:d,onPointerMove:bs(t.onPointerMove,v=>{v.pointerType!=="touch"&&!g.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),g.current=!0)}),onPointerLeave:bs(t.onPointerLeave,()=>{a.onTriggerLeave(),g.current=!1}),onPointerDown:bs(t.onPointerDown,()=>{a.open&&a.onClose(),m.current=!0,document.addEventListener("pointerup",y,{once:!0})}),onFocus:bs(t.onFocus,()=>{m.current||a.onOpen()}),onBlur:bs(t.onBlur,a.onClose),onClick:bs(t.onClick,a.onClose)})})});NPe.displayName=The;var xtt="TooltipPortal",[Prr,ytt]=Mne(xtt,{forceMount:void 0}),RC="TooltipContent",SPe=E.forwardRef((t,r)=>{const s=ytt(RC,t.__scopeTooltip),{forceMount:n=s.forceMount,side:a="top",...o}=t,l=Ane(RC,t.__scopeTooltip);return e.jsx(zc,{present:n||l.open,children:l.disableHoverableContent?e.jsx(CPe,{side:a,...o,ref:r}):e.jsx(vtt,{side:a,...o,ref:r})})}),vtt=E.forwardRef((t,r)=>{const s=Ane(RC,t.__scopeTooltip),n=jxe(RC,t.__scopeTooltip),a=E.useRef(null),o=ga(r,a),[l,i]=E.useState(null),{trigger:d,onClose:m}=s,g=a.current,{onPointerInTransitChange:y}=n,v=E.useCallback(()=>{i(null),y(!1)},[y]),b=E.useCallback((N,j)=>{const S=N.currentTarget,A={x:N.clientX,y:N.clientY},M=ktt(A,S.getBoundingClientRect()),I=Ntt(A,M),F=Stt(j.getBoundingClientRect()),O=Mtt([...I,...F]);i(O),y(!0)},[y]);return E.useEffect(()=>()=>v(),[v]),E.useEffect(()=>{if(d&&g){const N=S=>b(S,g),j=S=>b(S,d);return d.addEventListener("pointerleave",N),g.addEventListener("pointerleave",j),()=>{d.removeEventListener("pointerleave",N),g.removeEventListener("pointerleave",j)}}},[d,g,b,v]),E.useEffect(()=>{if(l){const N=j=>{const S=j.target,A={x:j.clientX,y:j.clientY},M=(d==null?void 0:d.contains(S))||(g==null?void 0:g.contains(S)),I=!Ctt(A,l);M?v():I&&(v(),m())};return document.addEventListener("pointermove",N),()=>document.removeEventListener("pointermove",N)}},[d,g,l,m,v]),e.jsx(CPe,{...t,ref:o})}),[_tt,btt]=Mne(BE,{isInside:!1}),wtt=xIe("TooltipContent"),CPe=E.forwardRef((t,r)=>{const{__scopeTooltip:s,children:n,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:l,...i}=t,d=Ane(RC,s),m=Tne(s),{onClose:g}=d;return E.useEffect(()=>(document.addEventListener(Mhe,g),()=>document.removeEventListener(Mhe,g)),[g]),E.useEffect(()=>{if(d.trigger){const y=v=>{const b=v.target;b!=null&&b.contains(d.trigger)&&g()};return window.addEventListener("scroll",y,{capture:!0}),()=>window.removeEventListener("scroll",y,{capture:!0})}},[d.trigger,g]),e.jsx(Sv,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:y=>y.preventDefault(),onDismiss:g,children:e.jsxs(hP,{"data-state":d.stateAttribute,...m,...i,ref:r,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:[e.jsx(wtt,{children:n}),e.jsx(_tt,{scope:s,isInside:!0,children:e.jsx(dQe,{id:d.contentId,role:"tooltip",children:a||n})})]})})});SPe.displayName=RC;var MPe="TooltipArrow",jtt=E.forwardRef((t,r)=>{const{__scopeTooltip:s,...n}=t,a=Tne(s);return btt(MPe,s).isInside?null:e.jsx(mP,{...a,...n,ref:r})});jtt.displayName=MPe;function ktt(t,r){const s=Math.abs(r.top-t.y),n=Math.abs(r.bottom-t.y),a=Math.abs(r.right-t.x),o=Math.abs(r.left-t.x);switch(Math.min(s,n,a,o)){case o:return"left";case a:return"right";case s:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function Ntt(t,r,s=5){const n=[];switch(r){case"top":n.push({x:t.x-s,y:t.y+s},{x:t.x+s,y:t.y+s});break;case"bottom":n.push({x:t.x-s,y:t.y-s},{x:t.x+s,y:t.y-s});break;case"left":n.push({x:t.x+s,y:t.y-s},{x:t.x+s,y:t.y+s});break;case"right":n.push({x:t.x-s,y:t.y-s},{x:t.x-s,y:t.y+s});break}return n}function Stt(t){const{top:r,right:s,bottom:n,left:a}=t;return[{x:a,y:r},{x:s,y:r},{x:s,y:n},{x:a,y:n}]}function Ctt(t,r){const{x:s,y:n}=t;let a=!1;for(let o=0,l=r.length-1;on!=v>n&&s<(y-m)*(n-g)/(v-g)+m&&(a=!a)}return a}function Mtt(t){const r=t.slice();return r.sort((s,n)=>s.xn.x?1:s.yn.y?1:0),Ttt(r)}function Ttt(t){if(t.length<=1)return t.slice();const r=[];for(let n=0;n=2;){const o=r[r.length-1],l=r[r.length-2];if((o.x-l.x)*(a.y-l.y)>=(o.y-l.y)*(a.x-l.x))r.pop();else break}r.push(a)}r.pop();const s=[];for(let n=t.length-1;n>=0;n--){const a=t[n];for(;s.length>=2;){const o=s[s.length-1],l=s[s.length-2];if((o.x-l.x)*(a.y-l.y)>=(o.y-l.y)*(a.x-l.x))s.pop();else break}s.push(a)}return s.pop(),r.length===1&&s.length===1&&r[0].x===s[0].x&&r[0].y===s[0].y?r:r.concat(s)}var Att=jPe,Ett=kPe,Itt=NPe,TPe=SPe;const L3=Att,Uf=Ett,qf=Itt,wp=E.forwardRef(({className:t,sideOffset:r=4,...s},n)=>e.jsx(TPe,{ref:n,sideOffset:r,className:qt("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s}));wp.displayName=TPe.displayName;var O3=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},gk=typeof window>"u"||"Deno"in globalThis;function Yu(){}function Ptt(t,r){return typeof t=="function"?t(r):t}function Ahe(t){return typeof t=="number"&&t>=0&&t!==1/0}function APe(t,r){return Math.max(t+(r||0)-Date.now(),0)}function sv(t,r){return typeof t=="function"?t(r):t}function sp(t,r){return typeof t=="function"?t(r):t}function Yje(t,r){const{type:s="all",exact:n,fetchStatus:a,predicate:o,queryKey:l,stale:i}=t;if(l){if(n){if(r.queryHash!==kxe(l,r.options))return!1}else if(!$E(r.queryKey,l))return!1}if(s!=="all"){const d=r.isActive();if(s==="active"&&!d||s==="inactive"&&d)return!1}return!(typeof i=="boolean"&&r.isStale()!==i||a&&a!==r.state.fetchStatus||o&&!o(r))}function Xje(t,r){const{exact:s,status:n,predicate:a,mutationKey:o}=t;if(o){if(!r.options.mutationKey)return!1;if(s){if(xk(r.options.mutationKey)!==xk(o))return!1}else if(!$E(r.options.mutationKey,o))return!1}return!(n&&r.state.status!==n||a&&!a(r))}function kxe(t,r){return((r==null?void 0:r.queryKeyHashFn)||xk)(t)}function xk(t){return JSON.stringify(t,(r,s)=>Ehe(s)?Object.keys(s).sort().reduce((n,a)=>(n[a]=s[a],n),{}):s)}function $E(t,r){return t===r?!0:typeof t!=typeof r?!1:t&&r&&typeof t=="object"&&typeof r=="object"?Object.keys(r).every(s=>$E(t[s],r[s])):!1}function EPe(t,r){if(t===r)return t;const s=Qje(t)&&Qje(r);if(s||Ehe(t)&&Ehe(r)){const n=s?t:Object.keys(t),a=n.length,o=s?r:Object.keys(r),l=o.length,i=s?[]:{},d=new Set(n);let m=0;for(let g=0;g{setTimeout(r,t)})}function Ihe(t,r,s){return typeof s.structuralSharing=="function"?s.structuralSharing(t,r):s.structuralSharing!==!1?EPe(t,r):r}function Ott(t,r,s=0){const n=[...t,r];return s&&n.length>s?n.slice(1):n}function Dtt(t,r,s=0){const n=[r,...t];return s&&n.length>s?n.slice(0,-1):n}var Nxe=Symbol();function IPe(t,r){return!t.queryFn&&(r!=null&&r.initialPromise)?()=>r.initialPromise:!t.queryFn||t.queryFn===Nxe?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function PPe(t,r){return typeof t=="function"?t(...r):!!t}var wj,x1,xC,WTe,Rtt=(WTe=class extends O3{constructor(){super();ka(this,wj);ka(this,x1);ka(this,xC);Sn(this,xC,r=>{if(!gk&&window.addEventListener){const s=()=>r();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){ar(this,x1)||this.setEventListener(ar(this,xC))}onUnsubscribe(){var r;this.hasListeners()||((r=ar(this,x1))==null||r.call(this),Sn(this,x1,void 0))}setEventListener(r){var s;Sn(this,xC,r),(s=ar(this,x1))==null||s.call(this),Sn(this,x1,r(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(r){ar(this,wj)!==r&&(Sn(this,wj,r),this.onFocus())}onFocus(){const r=this.isFocused();this.listeners.forEach(s=>{s(r)})}isFocused(){var r;return typeof ar(this,wj)=="boolean"?ar(this,wj):((r=globalThis.document)==null?void 0:r.visibilityState)!=="hidden"}},wj=new WeakMap,x1=new WeakMap,xC=new WeakMap,WTe),Sxe=new Rtt,yC,y1,vC,GTe,Ftt=(GTe=class extends O3{constructor(){super();ka(this,yC,!0);ka(this,y1);ka(this,vC);Sn(this,vC,r=>{if(!gk&&window.addEventListener){const s=()=>r(!0),n=()=>r(!1);return window.addEventListener("online",s,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",n)}}})}onSubscribe(){ar(this,y1)||this.setEventListener(ar(this,vC))}onUnsubscribe(){var r;this.hasListeners()||((r=ar(this,y1))==null||r.call(this),Sn(this,y1,void 0))}setEventListener(r){var s;Sn(this,vC,r),(s=ar(this,y1))==null||s.call(this),Sn(this,y1,r(this.setOnline.bind(this)))}setOnline(r){ar(this,yC)!==r&&(Sn(this,yC,r),this.listeners.forEach(n=>{n(r)}))}isOnline(){return ar(this,yC)}},yC=new WeakMap,y1=new WeakMap,vC=new WeakMap,GTe),Rte=new Ftt;function Phe(){let t,r;const s=new Promise((a,o)=>{t=a,r=o});s.status="pending",s.catch(()=>{});function n(a){Object.assign(s,a),delete s.resolve,delete s.reject}return s.resolve=a=>{n({status:"fulfilled",value:a}),t(a)},s.reject=a=>{n({status:"rejected",reason:a}),r(a)},s}function ztt(t){return Math.min(1e3*2**t,3e4)}function LPe(t){return(t??"online")==="online"?Rte.isOnline():!0}var OPe=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function kce(t){return t instanceof OPe}function DPe(t){let r=!1,s=0,n=!1,a;const o=Phe(),l=j=>{var S;n||(v(new OPe(j)),(S=t.abort)==null||S.call(t))},i=()=>{r=!0},d=()=>{r=!1},m=()=>Sxe.isFocused()&&(t.networkMode==="always"||Rte.isOnline())&&t.canRun(),g=()=>LPe(t.networkMode)&&t.canRun(),y=j=>{var S;n||(n=!0,(S=t.onSuccess)==null||S.call(t,j),a==null||a(),o.resolve(j))},v=j=>{var S;n||(n=!0,(S=t.onError)==null||S.call(t,j),a==null||a(),o.reject(j))},b=()=>new Promise(j=>{var S;a=A=>{(n||m())&&j(A)},(S=t.onPause)==null||S.call(t)}).then(()=>{var j;a=void 0,n||(j=t.onContinue)==null||j.call(t)}),N=()=>{if(n)return;let j;const S=s===0?t.initialPromise:void 0;try{j=S??t.fn()}catch(A){j=Promise.reject(A)}Promise.resolve(j).then(y).catch(A=>{var B;if(n)return;const M=t.retry??(gk?0:3),I=t.retryDelay??ztt,F=typeof I=="function"?I(s,A):I,O=M===!0||typeof M=="number"&&sm()?void 0:b()).then(()=>{r?v(A):N()})})};return{promise:o,cancel:l,continue:()=>(a==null||a(),o),cancelRetry:i,continueRetry:d,canStart:g,start:()=>(g()?N():b().then(N),o)}}var Btt=t=>setTimeout(t,0);function $tt(){let t=[],r=0,s=i=>{i()},n=i=>{i()},a=Btt;const o=i=>{r?t.push(i):a(()=>{s(i)})},l=()=>{const i=t;t=[],i.length&&a(()=>{n(()=>{i.forEach(d=>{s(d)})})})};return{batch:i=>{let d;r++;try{d=i()}finally{r--,r||l()}return d},batchCalls:i=>(...d)=>{o(()=>{i(...d)})},schedule:o,setNotifyFunction:i=>{s=i},setBatchNotifyFunction:i=>{n=i},setScheduler:i=>{a=i}}}var pd=$tt(),jj,KTe,RPe=(KTe=class{constructor(){ka(this,jj)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ahe(this.gcTime)&&Sn(this,jj,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(gk?1/0:5*60*1e3))}clearGcTimeout(){ar(this,jj)&&(clearTimeout(ar(this,jj)),Sn(this,jj,void 0))}},jj=new WeakMap,KTe),_C,kj,rp,Nj,gu,QI,Sj,xf,Wx,ZTe,Utt=(ZTe=class extends RPe{constructor(r){super();ka(this,xf);ka(this,_C);ka(this,kj);ka(this,rp);ka(this,Nj);ka(this,gu);ka(this,QI);ka(this,Sj);Sn(this,Sj,!1),Sn(this,QI,r.defaultOptions),this.setOptions(r.options),this.observers=[],Sn(this,Nj,r.client),Sn(this,rp,ar(this,Nj).getQueryCache()),this.queryKey=r.queryKey,this.queryHash=r.queryHash,Sn(this,_C,qtt(this.options)),this.state=r.state??ar(this,_C),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var r;return(r=ar(this,gu))==null?void 0:r.promise}setOptions(r){this.options={...ar(this,QI),...r},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ar(this,rp).remove(this)}setData(r,s){const n=Ihe(this.state.data,r,this.options);return ki(this,xf,Wx).call(this,{data:n,type:"success",dataUpdatedAt:s==null?void 0:s.updatedAt,manual:s==null?void 0:s.manual}),n}setState(r,s){ki(this,xf,Wx).call(this,{type:"setState",state:r,setStateOptions:s})}cancel(r){var n,a;const s=(n=ar(this,gu))==null?void 0:n.promise;return(a=ar(this,gu))==null||a.cancel(r),s?s.then(Yu).catch(Yu):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(ar(this,_C))}isActive(){return this.observers.some(r=>sp(r.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Nxe||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(r=>sv(r.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(r=>r.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(r=0){return this.state.data===void 0?!0:r==="static"?!1:this.state.isInvalidated?!0:!APe(this.state.dataUpdatedAt,r)}onFocus(){var s;const r=this.observers.find(n=>n.shouldFetchOnWindowFocus());r==null||r.refetch({cancelRefetch:!1}),(s=ar(this,gu))==null||s.continue()}onOnline(){var s;const r=this.observers.find(n=>n.shouldFetchOnReconnect());r==null||r.refetch({cancelRefetch:!1}),(s=ar(this,gu))==null||s.continue()}addObserver(r){this.observers.includes(r)||(this.observers.push(r),this.clearGcTimeout(),ar(this,rp).notify({type:"observerAdded",query:this,observer:r}))}removeObserver(r){this.observers.includes(r)&&(this.observers=this.observers.filter(s=>s!==r),this.observers.length||(ar(this,gu)&&(ar(this,Sj)?ar(this,gu).cancel({revert:!0}):ar(this,gu).cancelRetry()),this.scheduleGc()),ar(this,rp).notify({type:"observerRemoved",query:this,observer:r}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ki(this,xf,Wx).call(this,{type:"invalidate"})}fetch(r,s){var m,g,y;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(ar(this,gu))return ar(this,gu).continueRetry(),ar(this,gu).promise}if(r&&this.setOptions(r),!this.options.queryFn){const v=this.observers.find(b=>b.options.queryFn);v&&this.setOptions(v.options)}const n=new AbortController,a=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(Sn(this,Sj,!0),n.signal)})},o=()=>{const v=IPe(this.options,s),N=(()=>{const j={client:ar(this,Nj),queryKey:this.queryKey,meta:this.meta};return a(j),j})();return Sn(this,Sj,!1),this.options.persister?this.options.persister(v,N,this):v(N)},i=(()=>{const v={fetchOptions:s,options:this.options,queryKey:this.queryKey,client:ar(this,Nj),state:this.state,fetchFn:o};return a(v),v})();(m=this.options.behavior)==null||m.onFetch(i,this),Sn(this,kj,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((g=i.fetchOptions)==null?void 0:g.meta))&&ki(this,xf,Wx).call(this,{type:"fetch",meta:(y=i.fetchOptions)==null?void 0:y.meta});const d=v=>{var b,N,j,S;kce(v)&&v.silent||ki(this,xf,Wx).call(this,{type:"error",error:v}),kce(v)||((N=(b=ar(this,rp).config).onError)==null||N.call(b,v,this),(S=(j=ar(this,rp).config).onSettled)==null||S.call(j,this.state.data,v,this)),this.scheduleGc()};return Sn(this,gu,DPe({initialPromise:s==null?void 0:s.initialPromise,fn:i.fetchFn,abort:n.abort.bind(n),onSuccess:v=>{var b,N,j,S;if(v===void 0){d(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(v)}catch(A){d(A);return}(N=(b=ar(this,rp).config).onSuccess)==null||N.call(b,v,this),(S=(j=ar(this,rp).config).onSettled)==null||S.call(j,v,this.state.error,this),this.scheduleGc()},onError:d,onFail:(v,b)=>{ki(this,xf,Wx).call(this,{type:"failed",failureCount:v,error:b})},onPause:()=>{ki(this,xf,Wx).call(this,{type:"pause"})},onContinue:()=>{ki(this,xf,Wx).call(this,{type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0})),ar(this,gu).start()}},_C=new WeakMap,kj=new WeakMap,rp=new WeakMap,Nj=new WeakMap,gu=new WeakMap,QI=new WeakMap,Sj=new WeakMap,xf=new WeakSet,Wx=function(r){const s=n=>{switch(r.type){case"failed":return{...n,fetchFailureCount:r.failureCount,fetchFailureReason:r.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...FPe(n.data,this.options),fetchMeta:r.meta??null};case"success":return Sn(this,kj,void 0),{...n,data:r.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:r.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!r.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const a=r.error;return kce(a)&&a.revert&&ar(this,kj)?{...ar(this,kj),fetchStatus:"idle"}:{...n,error:a,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...r.state}}};this.state=s(this.state),pd.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),ar(this,rp).notify({query:this,type:"updated",action:r})})},ZTe);function FPe(t,r){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:LPe(r.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function qtt(t){const r=typeof t.initialData=="function"?t.initialData():t.initialData,s=r!==void 0,n=s?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:r,dataUpdateCount:0,dataUpdatedAt:s?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var Ag,YTe,Vtt=(YTe=class extends O3{constructor(r={}){super();ka(this,Ag);this.config=r,Sn(this,Ag,new Map)}build(r,s,n){const a=s.queryKey,o=s.queryHash??kxe(a,s);let l=this.get(o);return l||(l=new Utt({client:r,queryKey:a,queryHash:o,options:r.defaultQueryOptions(s),state:n,defaultOptions:r.getQueryDefaults(a)}),this.add(l)),l}add(r){ar(this,Ag).has(r.queryHash)||(ar(this,Ag).set(r.queryHash,r),this.notify({type:"added",query:r}))}remove(r){const s=ar(this,Ag).get(r.queryHash);s&&(r.destroy(),s===r&&ar(this,Ag).delete(r.queryHash),this.notify({type:"removed",query:r}))}clear(){pd.batch(()=>{this.getAll().forEach(r=>{this.remove(r)})})}get(r){return ar(this,Ag).get(r)}getAll(){return[...ar(this,Ag).values()]}find(r){const s={exact:!0,...r};return this.getAll().find(n=>Yje(s,n))}findAll(r={}){const s=this.getAll();return Object.keys(r).length>0?s.filter(n=>Yje(r,n)):s}notify(r){pd.batch(()=>{this.listeners.forEach(s=>{s(r)})})}onFocus(){pd.batch(()=>{this.getAll().forEach(r=>{r.onFocus()})})}onOnline(){pd.batch(()=>{this.getAll().forEach(r=>{r.onOnline()})})}},Ag=new WeakMap,YTe),Eg,Gu,Cj,Ig,H0,XTe,Htt=(XTe=class extends RPe{constructor(r){super();ka(this,Ig);ka(this,Eg);ka(this,Gu);ka(this,Cj);this.mutationId=r.mutationId,Sn(this,Gu,r.mutationCache),Sn(this,Eg,[]),this.state=r.state||zPe(),this.setOptions(r.options),this.scheduleGc()}setOptions(r){this.options=r,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(r){ar(this,Eg).includes(r)||(ar(this,Eg).push(r),this.clearGcTimeout(),ar(this,Gu).notify({type:"observerAdded",mutation:this,observer:r}))}removeObserver(r){Sn(this,Eg,ar(this,Eg).filter(s=>s!==r)),this.scheduleGc(),ar(this,Gu).notify({type:"observerRemoved",mutation:this,observer:r})}optionalRemove(){ar(this,Eg).length||(this.state.status==="pending"?this.scheduleGc():ar(this,Gu).remove(this))}continue(){var r;return((r=ar(this,Cj))==null?void 0:r.continue())??this.execute(this.state.variables)}async execute(r){var o,l,i,d,m,g,y,v,b,N,j,S,A,M,I,F,O,B,$,H;const s=()=>{ki(this,Ig,H0).call(this,{type:"continue"})};Sn(this,Cj,DPe({fn:()=>this.options.mutationFn?this.options.mutationFn(r):Promise.reject(new Error("No mutationFn found")),onFail:(W,X)=>{ki(this,Ig,H0).call(this,{type:"failed",failureCount:W,error:X})},onPause:()=>{ki(this,Ig,H0).call(this,{type:"pause"})},onContinue:s,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ar(this,Gu).canRun(this)}));const n=this.state.status==="pending",a=!ar(this,Cj).canStart();try{if(n)s();else{ki(this,Ig,H0).call(this,{type:"pending",variables:r,isPaused:a}),await((l=(o=ar(this,Gu).config).onMutate)==null?void 0:l.call(o,r,this));const X=await((d=(i=this.options).onMutate)==null?void 0:d.call(i,r));X!==this.state.context&&ki(this,Ig,H0).call(this,{type:"pending",context:X,variables:r,isPaused:a})}const W=await ar(this,Cj).start();return await((g=(m=ar(this,Gu).config).onSuccess)==null?void 0:g.call(m,W,r,this.state.context,this)),await((v=(y=this.options).onSuccess)==null?void 0:v.call(y,W,r,this.state.context)),await((N=(b=ar(this,Gu).config).onSettled)==null?void 0:N.call(b,W,null,this.state.variables,this.state.context,this)),await((S=(j=this.options).onSettled)==null?void 0:S.call(j,W,null,r,this.state.context)),ki(this,Ig,H0).call(this,{type:"success",data:W}),W}catch(W){try{throw await((M=(A=ar(this,Gu).config).onError)==null?void 0:M.call(A,W,r,this.state.context,this)),await((F=(I=this.options).onError)==null?void 0:F.call(I,W,r,this.state.context)),await((B=(O=ar(this,Gu).config).onSettled)==null?void 0:B.call(O,void 0,W,this.state.variables,this.state.context,this)),await((H=($=this.options).onSettled)==null?void 0:H.call($,void 0,W,r,this.state.context)),W}finally{ki(this,Ig,H0).call(this,{type:"error",error:W})}}finally{ar(this,Gu).runNext(this)}}},Eg=new WeakMap,Gu=new WeakMap,Cj=new WeakMap,Ig=new WeakSet,H0=function(r){const s=n=>{switch(r.type){case"failed":return{...n,failureCount:r.failureCount,failureReason:r.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:r.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:r.isPaused,status:"pending",variables:r.variables,submittedAt:Date.now()};case"success":return{...n,data:r.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:r.error,failureCount:n.failureCount+1,failureReason:r.error,isPaused:!1,status:"error"}}};this.state=s(this.state),pd.batch(()=>{ar(this,Eg).forEach(n=>{n.onMutationUpdate(r)}),ar(this,Gu).notify({mutation:this,type:"updated",action:r})})},XTe);function zPe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ty,yf,JI,QTe,Wtt=(QTe=class extends O3{constructor(r={}){super();ka(this,ty);ka(this,yf);ka(this,JI);this.config=r,Sn(this,ty,new Set),Sn(this,yf,new Map),Sn(this,JI,0)}build(r,s,n){const a=new Htt({mutationCache:this,mutationId:++FL(this,JI)._,options:r.defaultMutationOptions(s),state:n});return this.add(a),a}add(r){ar(this,ty).add(r);const s=i8(r);if(typeof s=="string"){const n=ar(this,yf).get(s);n?n.push(r):ar(this,yf).set(s,[r])}this.notify({type:"added",mutation:r})}remove(r){if(ar(this,ty).delete(r)){const s=i8(r);if(typeof s=="string"){const n=ar(this,yf).get(s);if(n)if(n.length>1){const a=n.indexOf(r);a!==-1&&n.splice(a,1)}else n[0]===r&&ar(this,yf).delete(s)}}this.notify({type:"removed",mutation:r})}canRun(r){const s=i8(r);if(typeof s=="string"){const n=ar(this,yf).get(s),a=n==null?void 0:n.find(o=>o.state.status==="pending");return!a||a===r}else return!0}runNext(r){var n;const s=i8(r);if(typeof s=="string"){const a=(n=ar(this,yf).get(s))==null?void 0:n.find(o=>o!==r&&o.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){pd.batch(()=>{ar(this,ty).forEach(r=>{this.notify({type:"removed",mutation:r})}),ar(this,ty).clear(),ar(this,yf).clear()})}getAll(){return Array.from(ar(this,ty))}find(r){const s={exact:!0,...r};return this.getAll().find(n=>Xje(s,n))}findAll(r={}){return this.getAll().filter(s=>Xje(r,s))}notify(r){pd.batch(()=>{this.listeners.forEach(s=>{s(r)})})}resumePausedMutations(){const r=this.getAll().filter(s=>s.state.isPaused);return pd.batch(()=>Promise.all(r.map(s=>s.continue().catch(Yu))))}},ty=new WeakMap,yf=new WeakMap,JI=new WeakMap,QTe);function i8(t){var r;return(r=t.options.scope)==null?void 0:r.id}function Fte(t){return{onFetch:(r,s)=>{var g,y,v,b,N;const n=r.options,a=(v=(y=(g=r.fetchOptions)==null?void 0:g.meta)==null?void 0:y.fetchMore)==null?void 0:v.direction,o=((b=r.state.data)==null?void 0:b.pages)||[],l=((N=r.state.data)==null?void 0:N.pageParams)||[];let i={pages:[],pageParams:[]},d=0;const m=async()=>{let j=!1;const S=I=>{Object.defineProperty(I,"signal",{enumerable:!0,get:()=>(r.signal.aborted?j=!0:r.signal.addEventListener("abort",()=>{j=!0}),r.signal)})},A=IPe(r.options,r.fetchOptions),M=async(I,F,O)=>{if(j)return Promise.reject();if(F==null&&I.pages.length)return Promise.resolve(I);const $=(()=>{const se={client:r.client,queryKey:r.queryKey,pageParam:F,direction:O?"backward":"forward",meta:r.options.meta};return S(se),se})(),H=await A($),{maxPages:W}=r.options,X=O?Dtt:Ott;return{pages:X(I.pages,H,W),pageParams:X(I.pageParams,F,W)}};if(a&&o.length){const I=a==="backward",F=I?BPe:Lhe,O={pages:o,pageParams:l},B=F(n,O);i=await M(O,B,I)}else{const I=t??o.length;do{const F=d===0?l[0]??n.initialPageParam:Lhe(n,i);if(d>0&&F==null)break;i=await M(i,F),d++}while(d{var j,S;return(S=(j=r.options).persister)==null?void 0:S.call(j,m,{client:r.client,queryKey:r.queryKey,meta:r.options.meta,signal:r.signal},s)}:r.fetchFn=m}}}function Lhe(t,{pages:r,pageParams:s}){const n=r.length-1;return r.length>0?t.getNextPageParam(r[n],r,s[n],s):void 0}function BPe(t,{pages:r,pageParams:s}){var n;return r.length>0?(n=t.getPreviousPageParam)==null?void 0:n.call(t,r[0],r,s[0],s):void 0}function Gtt(t,r){return r?Lhe(t,r)!=null:!1}function Ktt(t,r){return!r||!t.getPreviousPageParam?!1:BPe(t,r)!=null}var tc,v1,_1,bC,wC,b1,jC,kC,JTe,Ztt=(JTe=class{constructor(t={}){ka(this,tc);ka(this,v1);ka(this,_1);ka(this,bC);ka(this,wC);ka(this,b1);ka(this,jC);ka(this,kC);Sn(this,tc,t.queryCache||new Vtt),Sn(this,v1,t.mutationCache||new Wtt),Sn(this,_1,t.defaultOptions||{}),Sn(this,bC,new Map),Sn(this,wC,new Map),Sn(this,b1,0)}mount(){FL(this,b1)._++,ar(this,b1)===1&&(Sn(this,jC,Sxe.subscribe(async t=>{t&&(await this.resumePausedMutations(),ar(this,tc).onFocus())})),Sn(this,kC,Rte.subscribe(async t=>{t&&(await this.resumePausedMutations(),ar(this,tc).onOnline())})))}unmount(){var t,r;FL(this,b1)._--,ar(this,b1)===0&&((t=ar(this,jC))==null||t.call(this),Sn(this,jC,void 0),(r=ar(this,kC))==null||r.call(this),Sn(this,kC,void 0))}isFetching(t){return ar(this,tc).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return ar(this,v1).findAll({...t,status:"pending"}).length}getQueryData(t){var s;const r=this.defaultQueryOptions({queryKey:t});return(s=ar(this,tc).get(r.queryHash))==null?void 0:s.state.data}ensureQueryData(t){const r=this.defaultQueryOptions(t),s=ar(this,tc).build(this,r),n=s.state.data;return n===void 0?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(sv(r.staleTime,s))&&this.prefetchQuery(r),Promise.resolve(n))}getQueriesData(t){return ar(this,tc).findAll(t).map(({queryKey:r,state:s})=>{const n=s.data;return[r,n]})}setQueryData(t,r,s){const n=this.defaultQueryOptions({queryKey:t}),a=ar(this,tc).get(n.queryHash),o=a==null?void 0:a.state.data,l=Ptt(r,o);if(l!==void 0)return ar(this,tc).build(this,n).setData(l,{...s,manual:!0})}setQueriesData(t,r,s){return pd.batch(()=>ar(this,tc).findAll(t).map(({queryKey:n})=>[n,this.setQueryData(n,r,s)]))}getQueryState(t){var s;const r=this.defaultQueryOptions({queryKey:t});return(s=ar(this,tc).get(r.queryHash))==null?void 0:s.state}removeQueries(t){const r=ar(this,tc);pd.batch(()=>{r.findAll(t).forEach(s=>{r.remove(s)})})}resetQueries(t,r){const s=ar(this,tc);return pd.batch(()=>(s.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...t},r)))}cancelQueries(t,r={}){const s={revert:!0,...r},n=pd.batch(()=>ar(this,tc).findAll(t).map(a=>a.cancel(s)));return Promise.all(n).then(Yu).catch(Yu)}invalidateQueries(t,r={}){return pd.batch(()=>(ar(this,tc).findAll(t).forEach(s=>{s.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},r)))}refetchQueries(t,r={}){const s={...r,cancelRefetch:r.cancelRefetch??!0},n=pd.batch(()=>ar(this,tc).findAll(t).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let o=a.fetch(void 0,s);return s.throwOnError||(o=o.catch(Yu)),a.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(n).then(Yu)}fetchQuery(t){const r=this.defaultQueryOptions(t);r.retry===void 0&&(r.retry=!1);const s=ar(this,tc).build(this,r);return s.isStaleByTime(sv(r.staleTime,s))?s.fetch(r):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Yu).catch(Yu)}fetchInfiniteQuery(t){return t.behavior=Fte(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Yu).catch(Yu)}ensureInfiniteQueryData(t){return t.behavior=Fte(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Rte.isOnline()?ar(this,v1).resumePausedMutations():Promise.resolve()}getQueryCache(){return ar(this,tc)}getMutationCache(){return ar(this,v1)}getDefaultOptions(){return ar(this,_1)}setDefaultOptions(t){Sn(this,_1,t)}setQueryDefaults(t,r){ar(this,bC).set(xk(t),{queryKey:t,defaultOptions:r})}getQueryDefaults(t){const r=[...ar(this,bC).values()],s={};return r.forEach(n=>{$E(t,n.queryKey)&&Object.assign(s,n.defaultOptions)}),s}setMutationDefaults(t,r){ar(this,wC).set(xk(t),{mutationKey:t,defaultOptions:r})}getMutationDefaults(t){const r=[...ar(this,wC).values()],s={};return r.forEach(n=>{$E(t,n.mutationKey)&&Object.assign(s,n.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;const r={...ar(this,_1).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return r.queryHash||(r.queryHash=kxe(r.queryKey,r)),r.refetchOnReconnect===void 0&&(r.refetchOnReconnect=r.networkMode!=="always"),r.throwOnError===void 0&&(r.throwOnError=!!r.suspense),!r.networkMode&&r.persister&&(r.networkMode="offlineFirst"),r.queryFn===Nxe&&(r.enabled=!1),r}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...ar(this,_1).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){ar(this,tc).clear(),ar(this,v1).clear()}},tc=new WeakMap,v1=new WeakMap,_1=new WeakMap,bC=new WeakMap,wC=new WeakMap,b1=new WeakMap,jC=new WeakMap,kC=new WeakMap,JTe),Nh,ao,eP,Ku,Mj,NC,w1,j1,tP,SC,CC,Tj,Aj,k1,MC,Ao,HT,Ohe,Dhe,Rhe,Fhe,zhe,Bhe,$he,UPe,eAe,$Pe=(eAe=class extends O3{constructor(r,s){super();ka(this,Ao);ka(this,Nh);ka(this,ao);ka(this,eP);ka(this,Ku);ka(this,Mj);ka(this,NC);ka(this,w1);ka(this,j1);ka(this,tP);ka(this,SC);ka(this,CC);ka(this,Tj);ka(this,Aj);ka(this,k1);ka(this,MC,new Set);this.options=s,Sn(this,Nh,r),Sn(this,j1,null),Sn(this,w1,Phe()),this.options.experimental_prefetchInRender||ar(this,w1).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(ar(this,ao).addObserver(this),eke(ar(this,ao),this.options)?ki(this,Ao,HT).call(this):this.updateResult(),ki(this,Ao,Fhe).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Uhe(ar(this,ao),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Uhe(ar(this,ao),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ki(this,Ao,zhe).call(this),ki(this,Ao,Bhe).call(this),ar(this,ao).removeObserver(this)}setOptions(r){const s=this.options,n=ar(this,ao);if(this.options=ar(this,Nh).defaultQueryOptions(r),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof sp(this.options.enabled,ar(this,ao))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ki(this,Ao,$he).call(this),ar(this,ao).setOptions(this.options),s._defaulted&&!Dte(this.options,s)&&ar(this,Nh).getQueryCache().notify({type:"observerOptionsUpdated",query:ar(this,ao),observer:this});const a=this.hasListeners();a&&tke(ar(this,ao),n,this.options,s)&&ki(this,Ao,HT).call(this),this.updateResult(),a&&(ar(this,ao)!==n||sp(this.options.enabled,ar(this,ao))!==sp(s.enabled,ar(this,ao))||sv(this.options.staleTime,ar(this,ao))!==sv(s.staleTime,ar(this,ao)))&&ki(this,Ao,Ohe).call(this);const o=ki(this,Ao,Dhe).call(this);a&&(ar(this,ao)!==n||sp(this.options.enabled,ar(this,ao))!==sp(s.enabled,ar(this,ao))||o!==ar(this,k1))&&ki(this,Ao,Rhe).call(this,o)}getOptimisticResult(r){const s=ar(this,Nh).getQueryCache().build(ar(this,Nh),r),n=this.createResult(s,r);return Xtt(this,n)&&(Sn(this,Ku,n),Sn(this,NC,this.options),Sn(this,Mj,ar(this,ao).state)),n}getCurrentResult(){return ar(this,Ku)}trackResult(r,s){return new Proxy(r,{get:(n,a)=>(this.trackProp(a),s==null||s(a),Reflect.get(n,a))})}trackProp(r){ar(this,MC).add(r)}getCurrentQuery(){return ar(this,ao)}refetch({...r}={}){return this.fetch({...r})}fetchOptimistic(r){const s=ar(this,Nh).defaultQueryOptions(r),n=ar(this,Nh).getQueryCache().build(ar(this,Nh),s);return n.fetch().then(()=>this.createResult(n,s))}fetch(r){return ki(this,Ao,HT).call(this,{...r,cancelRefetch:r.cancelRefetch??!0}).then(()=>(this.updateResult(),ar(this,Ku)))}createResult(r,s){var W;const n=ar(this,ao),a=this.options,o=ar(this,Ku),l=ar(this,Mj),i=ar(this,NC),m=r!==n?r.state:ar(this,eP),{state:g}=r;let y={...g},v=!1,b;if(s._optimisticResults){const X=this.hasListeners(),se=!X&&eke(r,s),ae=X&&tke(r,n,s,a);(se||ae)&&(y={...y,...FPe(g.data,r.options)}),s._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:N,errorUpdatedAt:j,status:S}=y;b=y.data;let A=!1;if(s.placeholderData!==void 0&&b===void 0&&S==="pending"){let X;o!=null&&o.isPlaceholderData&&s.placeholderData===(i==null?void 0:i.placeholderData)?(X=o.data,A=!0):X=typeof s.placeholderData=="function"?s.placeholderData((W=ar(this,CC))==null?void 0:W.state.data,ar(this,CC)):s.placeholderData,X!==void 0&&(S="success",b=Ihe(o==null?void 0:o.data,X,s),v=!0)}if(s.select&&b!==void 0&&!A)if(o&&b===(l==null?void 0:l.data)&&s.select===ar(this,tP))b=ar(this,SC);else try{Sn(this,tP,s.select),b=s.select(b),b=Ihe(o==null?void 0:o.data,b,s),Sn(this,SC,b),Sn(this,j1,null)}catch(X){Sn(this,j1,X)}ar(this,j1)&&(N=ar(this,j1),b=ar(this,SC),j=Date.now(),S="error");const M=y.fetchStatus==="fetching",I=S==="pending",F=S==="error",O=I&&M,B=b!==void 0,H={status:S,fetchStatus:y.fetchStatus,isPending:I,isSuccess:S==="success",isError:F,isInitialLoading:O,isLoading:O,data:b,dataUpdatedAt:y.dataUpdatedAt,error:N,errorUpdatedAt:j,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:y.dataUpdateCount>0||y.errorUpdateCount>0,isFetchedAfterMount:y.dataUpdateCount>m.dataUpdateCount||y.errorUpdateCount>m.errorUpdateCount,isFetching:M,isRefetching:M&&!I,isLoadingError:F&&!B,isPaused:y.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:F&&B,isStale:Cxe(r,s),refetch:this.refetch,promise:ar(this,w1),isEnabled:sp(s.enabled,r)!==!1};if(this.options.experimental_prefetchInRender){const X=le=>{H.status==="error"?le.reject(H.error):H.data!==void 0&&le.resolve(H.data)},se=()=>{const le=Sn(this,w1,H.promise=Phe());X(le)},ae=ar(this,w1);switch(ae.status){case"pending":r.queryHash===n.queryHash&&X(ae);break;case"fulfilled":(H.status==="error"||H.data!==ae.value)&&se();break;case"rejected":(H.status!=="error"||H.error!==ae.reason)&&se();break}}return H}updateResult(){const r=ar(this,Ku),s=this.createResult(ar(this,ao),this.options);if(Sn(this,Mj,ar(this,ao).state),Sn(this,NC,this.options),ar(this,Mj).data!==void 0&&Sn(this,CC,ar(this,ao)),Dte(s,r))return;Sn(this,Ku,s);const n=()=>{if(!r)return!0;const{notifyOnChangeProps:a}=this.options,o=typeof a=="function"?a():a;if(o==="all"||!o&&!ar(this,MC).size)return!0;const l=new Set(o??ar(this,MC));return this.options.throwOnError&&l.add("error"),Object.keys(ar(this,Ku)).some(i=>{const d=i;return ar(this,Ku)[d]!==r[d]&&l.has(d)})};ki(this,Ao,UPe).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ki(this,Ao,Fhe).call(this)}},Nh=new WeakMap,ao=new WeakMap,eP=new WeakMap,Ku=new WeakMap,Mj=new WeakMap,NC=new WeakMap,w1=new WeakMap,j1=new WeakMap,tP=new WeakMap,SC=new WeakMap,CC=new WeakMap,Tj=new WeakMap,Aj=new WeakMap,k1=new WeakMap,MC=new WeakMap,Ao=new WeakSet,HT=function(r){ki(this,Ao,$he).call(this);let s=ar(this,ao).fetch(this.options,r);return r!=null&&r.throwOnError||(s=s.catch(Yu)),s},Ohe=function(){ki(this,Ao,zhe).call(this);const r=sv(this.options.staleTime,ar(this,ao));if(gk||ar(this,Ku).isStale||!Ahe(r))return;const n=APe(ar(this,Ku).dataUpdatedAt,r)+1;Sn(this,Tj,setTimeout(()=>{ar(this,Ku).isStale||this.updateResult()},n))},Dhe=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(ar(this,ao)):this.options.refetchInterval)??!1},Rhe=function(r){ki(this,Ao,Bhe).call(this),Sn(this,k1,r),!(gk||sp(this.options.enabled,ar(this,ao))===!1||!Ahe(ar(this,k1))||ar(this,k1)===0)&&Sn(this,Aj,setInterval(()=>{(this.options.refetchIntervalInBackground||Sxe.isFocused())&&ki(this,Ao,HT).call(this)},ar(this,k1)))},Fhe=function(){ki(this,Ao,Ohe).call(this),ki(this,Ao,Rhe).call(this,ki(this,Ao,Dhe).call(this))},zhe=function(){ar(this,Tj)&&(clearTimeout(ar(this,Tj)),Sn(this,Tj,void 0))},Bhe=function(){ar(this,Aj)&&(clearInterval(ar(this,Aj)),Sn(this,Aj,void 0))},$he=function(){const r=ar(this,Nh).getQueryCache().build(ar(this,Nh),this.options);if(r===ar(this,ao))return;const s=ar(this,ao);Sn(this,ao,r),Sn(this,eP,r.state),this.hasListeners()&&(s==null||s.removeObserver(this),r.addObserver(this))},UPe=function(r){pd.batch(()=>{r.listeners&&this.listeners.forEach(s=>{s(ar(this,Ku))}),ar(this,Nh).getQueryCache().notify({query:ar(this,ao),type:"observerResultsUpdated"})})},eAe);function Ytt(t,r){return sp(r.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&r.retryOnMount===!1)}function eke(t,r){return Ytt(t,r)||t.state.data!==void 0&&Uhe(t,r,r.refetchOnMount)}function Uhe(t,r,s){if(sp(r.enabled,t)!==!1&&sv(r.staleTime,t)!=="static"){const n=typeof s=="function"?s(t):s;return n==="always"||n!==!1&&Cxe(t,r)}return!1}function tke(t,r,s,n){return(t!==r||sp(n.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&Cxe(t,s)}function Cxe(t,r){return sp(r.enabled,t)!==!1&&t.isStaleByTime(sv(r.staleTime,t))}function Xtt(t,r){return!Dte(t.getCurrentResult(),r)}var Qtt=class extends $Pe{constructor(t,r){super(t,r)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:Fte()})}getOptimisticResult(t){return t.behavior=Fte(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,r){var N,j;const{state:s}=t,n=super.createResult(t,r),{isFetching:a,isRefetching:o,isError:l,isRefetchError:i}=n,d=(j=(N=s.fetchMeta)==null?void 0:N.fetchMore)==null?void 0:j.direction,m=l&&d==="forward",g=a&&d==="forward",y=l&&d==="backward",v=a&&d==="backward";return{...n,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Gtt(r,s.data),hasPreviousPage:Ktt(r,s.data),isFetchNextPageError:m,isFetchingNextPage:g,isFetchPreviousPageError:y,isFetchingPreviousPage:v,isRefetchError:i&&!m&&!y,isRefetching:o&&!g&&!v}}},N1,S1,Sh,ry,Cy,Uee,qhe,tAe,Jtt=(tAe=class extends O3{constructor(s,n){super();ka(this,Cy);ka(this,N1);ka(this,S1);ka(this,Sh);ka(this,ry);Sn(this,N1,s),this.setOptions(n),this.bindMethods(),ki(this,Cy,Uee).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(s){var a;const n=this.options;this.options=ar(this,N1).defaultMutationOptions(s),Dte(this.options,n)||ar(this,N1).getMutationCache().notify({type:"observerOptionsUpdated",mutation:ar(this,Sh),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&xk(n.mutationKey)!==xk(this.options.mutationKey)?this.reset():((a=ar(this,Sh))==null?void 0:a.state.status)==="pending"&&ar(this,Sh).setOptions(this.options)}onUnsubscribe(){var s;this.hasListeners()||(s=ar(this,Sh))==null||s.removeObserver(this)}onMutationUpdate(s){ki(this,Cy,Uee).call(this),ki(this,Cy,qhe).call(this,s)}getCurrentResult(){return ar(this,S1)}reset(){var s;(s=ar(this,Sh))==null||s.removeObserver(this),Sn(this,Sh,void 0),ki(this,Cy,Uee).call(this),ki(this,Cy,qhe).call(this)}mutate(s,n){var a;return Sn(this,ry,n),(a=ar(this,Sh))==null||a.removeObserver(this),Sn(this,Sh,ar(this,N1).getMutationCache().build(ar(this,N1),this.options)),ar(this,Sh).addObserver(this),ar(this,Sh).execute(s)}},N1=new WeakMap,S1=new WeakMap,Sh=new WeakMap,ry=new WeakMap,Cy=new WeakSet,Uee=function(){var n;const s=((n=ar(this,Sh))==null?void 0:n.state)??zPe();Sn(this,S1,{...s,isPending:s.status==="pending",isSuccess:s.status==="success",isError:s.status==="error",isIdle:s.status==="idle",mutate:this.mutate,reset:this.reset})},qhe=function(s){pd.batch(()=>{var n,a,o,l,i,d,m,g;if(ar(this,ry)&&this.hasListeners()){const y=ar(this,S1).variables,v=ar(this,S1).context;(s==null?void 0:s.type)==="success"?((a=(n=ar(this,ry)).onSuccess)==null||a.call(n,s.data,y,v),(l=(o=ar(this,ry)).onSettled)==null||l.call(o,s.data,null,y,v)):(s==null?void 0:s.type)==="error"&&((d=(i=ar(this,ry)).onError)==null||d.call(i,s.error,y,v),(g=(m=ar(this,ry)).onSettled)==null||g.call(m,void 0,s.error,y,v))}this.listeners.forEach(y=>{y(ar(this,S1))})})},tAe),qPe=E.createContext(void 0),qr=t=>{const r=E.useContext(qPe);if(!r)throw new Error("No QueryClient set, use QueryClientProvider to set one");return r},ert=({client:t,children:r})=>(E.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),e.jsx(qPe.Provider,{value:t,children:r})),VPe=E.createContext(!1),trt=()=>E.useContext(VPe);VPe.Provider;function rrt(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var srt=E.createContext(rrt()),nrt=()=>E.useContext(srt),art=(t,r)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(r.isReset()||(t.retryOnMount=!1))},irt=t=>{E.useEffect(()=>{t.clearReset()},[t])},ort=({result:t,errorResetBoundary:r,throwOnError:s,query:n,suspense:a})=>t.isError&&!r.isReset()&&!t.isFetching&&n&&(a&&t.data===void 0||PPe(s,[t.error,n])),lrt=t=>{if(t.suspense){const r=n=>n==="static"?n:Math.max(n??1e3,1e3),s=t.staleTime;t.staleTime=typeof s=="function"?(...n)=>r(s(...n)):r(s),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},crt=(t,r)=>t.isLoading&&t.isFetching&&!r,drt=(t,r)=>(t==null?void 0:t.suspense)&&r.isPending,rke=(t,r,s)=>r.fetchOptimistic(t).catch(()=>{s.clearReset()});function HPe(t,r,s){var y,v,b,N,j;const n=trt(),a=nrt(),o=qr(),l=o.defaultQueryOptions(t);(v=(y=o.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||v.call(y,l),l._optimisticResults=n?"isRestoring":"optimistic",lrt(l),art(l,a),irt(a);const i=!o.getQueryCache().get(l.queryHash),[d]=E.useState(()=>new r(o,l)),m=d.getOptimisticResult(l),g=!n&&t.subscribed!==!1;if(E.useSyncExternalStore(E.useCallback(S=>{const A=g?d.subscribe(pd.batchCalls(S)):Yu;return d.updateResult(),A},[d,g]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),E.useEffect(()=>{d.setOptions(l)},[l,d]),drt(l,m))throw rke(l,d,a);if(ort({result:m,errorResetBoundary:a,throwOnError:l.throwOnError,query:o.getQueryCache().get(l.queryHash),suspense:l.suspense}))throw m.error;if((N=(b=o.getDefaultOptions().queries)==null?void 0:b._experimental_afterQuery)==null||N.call(b,l,m),l.experimental_prefetchInRender&&!gk&&crt(m,n)){const S=i?rke(l,d,a):(j=o.getQueryCache().get(l.queryHash))==null?void 0:j.promise;S==null||S.catch(Yu).finally(()=>{d.updateResult()})}return l.notifyOnChangeProps?m:d.trackResult(m)}function Ht(t,r){return HPe(t,$Pe)}function Jt(t,r){const s=qr(),[n]=E.useState(()=>new Jtt(s,t));E.useEffect(()=>{n.setOptions(t)},[n,t]);const a=E.useSyncExternalStore(E.useCallback(l=>n.subscribe(pd.batchCalls(l)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),o=E.useCallback((l,i)=>{n.mutate(l,i).catch(Yu)},[n]);if(a.error&&PPe(n.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:o,mutateAsync:a.mutate}}function urt(t,r){return HPe(t,Qtt)}/** * @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 UE(){return UE=Object.assign?Object.assign.bind():function(t){for(var r=1;r"u")throw new Error(r)}function WPe(t,r){if(!t){typeof console<"u"&&console.warn(r);try{throw new Error(r)}catch{}}}function mrt(){return Math.random().toString(36).substr(2,8)}function nke(t,r){return{usr:t.state,key:t.key,idx:r}}function Vhe(t,r,s,n){return s===void 0&&(s=null),UE({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof r=="string"?D3(r):r,{state:s,key:r&&r.key||n||mrt()})}function zte(t){let{pathname:r="/",search:s="",hash:n=""}=t;return s&&s!=="?"&&(r+=s.charAt(0)==="?"?s:"?"+s),n&&n!=="#"&&(r+=n.charAt(0)==="#"?n:"#"+n),r}function D3(t){let r={};if(t){let s=t.indexOf("#");s>=0&&(r.hash=t.substr(s),t=t.substr(0,s));let n=t.indexOf("?");n>=0&&(r.search=t.substr(n),t=t.substr(0,n)),t&&(r.pathname=t)}return r}function prt(t,r,s,n){n===void 0&&(n={});let{window:a=document.defaultView,v5Compat:o=!1}=n,l=a.history,i=A1.Pop,d=null,m=g();m==null&&(m=0,l.replaceState(UE({},l.state,{idx:m}),""));function g(){return(l.state||{idx:null}).idx}function y(){i=A1.Pop;let S=g(),A=S==null?null:S-m;m=S,d&&d({action:i,location:j.location,delta:A})}function v(S,A){i=A1.Push;let M=Vhe(j.location,S,A);m=g()+1;let I=nke(M,m),F=j.createHref(M);try{l.pushState(I,"",F)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;a.location.assign(F)}o&&d&&d({action:i,location:j.location,delta:1})}function b(S,A){i=A1.Replace;let M=Vhe(j.location,S,A);m=g();let I=nke(M,m),F=j.createHref(M);l.replaceState(I,"",F),o&&d&&d({action:i,location:j.location,delta:0})}function N(S){let A=a.location.origin!=="null"?a.location.origin:a.location.href,M=typeof S=="string"?S:zte(S);return M=M.replace(/ $/,"%20"),Dc(A,"No window.location.(origin|href) available to create URL for href: "+M),new URL(M,A)}let j={get action(){return i},get location(){return t(a,l)},listen(S){if(d)throw new Error("A history only accepts one active listener");return a.addEventListener(ske,y),d=S,()=>{a.removeEventListener(ske,y),d=null}},createHref(S){return r(a,S)},createURL:N,encodeLocation(S){let A=N(S);return{pathname:A.pathname,search:A.search,hash:A.hash}},push:v,replace:b,go(S){return l.go(S)}};return j}var ake;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(ake||(ake={}));function frt(t,r,s){return s===void 0&&(s="/"),grt(t,r,s)}function grt(t,r,s,n){let a=typeof r=="string"?D3(r):r,o=Mxe(a.pathname||"/",s);if(o==null)return null;let l=GPe(t);xrt(l);let i=null;for(let d=0;i==null&&d{let d={relativePath:i===void 0?o.path||"":i,caseSensitive:o.caseSensitive===!0,childrenIndex:l,route:o};d.relativePath.startsWith("/")&&(Dc(d.relativePath.startsWith(n),'Absolute route path "'+d.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),d.relativePath=d.relativePath.slice(n.length));let m=nv([n,d.relativePath]),g=s.concat(d);o.children&&o.children.length>0&&(Dc(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+m+'".')),GPe(o.children,r,g,m)),!(o.path==null&&!o.index)&&r.push({path:m,score:krt(m,o.index),routesMeta:g})};return t.forEach((o,l)=>{var i;if(o.path===""||!((i=o.path)!=null&&i.includes("?")))a(o,l);else for(let d of KPe(o.path))a(o,l,d)}),r}function KPe(t){let r=t.split("/");if(r.length===0)return[];let[s,...n]=r,a=s.endsWith("?"),o=s.replace(/\?$/,"");if(n.length===0)return a?[o,""]:[o];let l=KPe(n.join("/")),i=[];return i.push(...l.map(d=>d===""?o:[o,d].join("/"))),a&&i.push(...l),i.map(d=>t.startsWith("/")&&d===""?"/":d)}function xrt(t){t.sort((r,s)=>r.score!==s.score?s.score-r.score:Nrt(r.routesMeta.map(n=>n.childrenIndex),s.routesMeta.map(n=>n.childrenIndex)))}const yrt=/^:[\w-]+$/,vrt=3,_rt=2,brt=1,wrt=10,jrt=-2,ike=t=>t==="*";function krt(t,r){let s=t.split("/"),n=s.length;return s.some(ike)&&(n+=jrt),r&&(n+=_rt),s.filter(a=>!ike(a)).reduce((a,o)=>a+(yrt.test(o)?vrt:o===""?brt:wrt),n)}function Nrt(t,r){return t.length===r.length&&t.slice(0,-1).every((n,a)=>n===r[a])?t[t.length-1]-r[r.length-1]:0}function Srt(t,r,s){let{routesMeta:n}=t,a={},o="/",l=[];for(let i=0;i{let{paramName:v,isOptional:b}=g;if(v==="*"){let j=i[y]||"";l=o.slice(0,o.length-j.length).replace(/(.)\/+$/,"$1")}const N=i[y];return b&&!N?m[v]=void 0:m[v]=(N||"").replace(/%2F/g,"/"),m},{}),pathname:o,pathnameBase:l,pattern:t}}function Mrt(t,r,s){r===void 0&&(r=!1),s===void 0&&(s=!0),WPe(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],a="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,i,d)=>(n.push({paramName:i,isOptional:d!=null}),d?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,r?void 0:"i"),n]}function Trt(t){try{return t.split("/").map(r=>decodeURIComponent(r).replace(/\//g,"%2F")).join("/")}catch(r){return WPe(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+r+").")),t}}function Mxe(t,r){if(r==="/")return t;if(!t.toLowerCase().startsWith(r.toLowerCase()))return null;let s=r.endsWith("/")?r.length-1:r.length,n=t.charAt(s);return n&&n!=="/"?null:t.slice(s)||"/"}function Art(t,r){r===void 0&&(r="/");let{pathname:s,search:n="",hash:a=""}=typeof t=="string"?D3(t):t;return{pathname:s?s.startsWith("/")?s:Ert(s,r):r,search:Lrt(n),hash:Ort(a)}}function Ert(t,r){let s=r.replace(/\/+$/,"").split("/");return t.split("/").forEach(a=>{a===".."?s.length>1&&s.pop():a!=="."&&s.push(a)}),s.length>1?s.join("/"):"/"}function Nce(t,r,s,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+r+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+s+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Irt(t){return t.filter((r,s)=>s===0||r.route.path&&r.route.path.length>0)}function Txe(t,r){let s=Irt(t);return r?s.map((n,a)=>a===s.length-1?n.pathname:n.pathnameBase):s.map(n=>n.pathnameBase)}function Axe(t,r,s,n){n===void 0&&(n=!1);let a;typeof t=="string"?a=D3(t):(a=UE({},t),Dc(!a.pathname||!a.pathname.includes("?"),Nce("?","pathname","search",a)),Dc(!a.pathname||!a.pathname.includes("#"),Nce("#","pathname","hash",a)),Dc(!a.search||!a.search.includes("#"),Nce("#","search","hash",a)));let o=t===""||a.pathname==="",l=o?"/":a.pathname,i;if(l==null)i=s;else{let y=r.length-1;if(!n&&l.startsWith("..")){let v=l.split("/");for(;v[0]==="..";)v.shift(),y-=1;a.pathname=v.join("/")}i=y>=0?r[y]:"/"}let d=Art(a,i),m=l&&l!=="/"&&l.endsWith("/"),g=(o||l===".")&&s.endsWith("/");return!d.pathname.endsWith("/")&&(m||g)&&(d.pathname+="/"),d}const nv=t=>t.join("/").replace(/\/\/+/g,"/"),Prt=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Lrt=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Ort=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function Drt(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const ZPe=["post","put","patch","delete"];new Set(ZPe);const Rrt=["get",...ZPe];new Set(Rrt);/** * 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 qE(){return qE=Object.assign?Object.assign.bind():function(t){for(var r=1;r{i.current=!0}),E.useCallback(function(m,g){if(g===void 0&&(g={}),!i.current)return;if(typeof m=="number"){n.go(m);return}let y=Axe(m,JSON.parse(l),o,g.relative==="path");t==null&&r!=="/"&&(y.pathname=y.pathname==="/"?r:nv([r,y.pathname])),(g.replace?n.replace:n.push)(y,g.state,g)},[r,n,l,o,t])}const $rt=E.createContext(null);function Urt(t){let r=E.useContext(hx).outlet;return r&&E.createElement($rt.Provider,{value:t},r)}function Xl(){let{matches:t}=E.useContext(hx),r=t[t.length-1];return r?r.params:{}}function QPe(t,r){let{relative:s}=r===void 0?{}:r,{future:n}=E.useContext(Cv),{matches:a}=E.useContext(hx),{pathname:o}=Uh(),l=JSON.stringify(Txe(a,n.v7_relativeSplatPath));return E.useMemo(()=>Axe(t,JSON.parse(l),o,s==="path"),[t,l,o,s])}function qrt(t,r){return Vrt(t,r)}function Vrt(t,r,s,n){R3()||Dc(!1);let{navigator:a}=E.useContext(Cv),{matches:o}=E.useContext(hx),l=o[o.length-1],i=l?l.params:{};l&&l.pathname;let d=l?l.pathnameBase:"/";l&&l.route;let m=Uh(),g;if(r){var y;let S=typeof r=="string"?D3(r):r;d==="/"||(y=S.pathname)!=null&&y.startsWith(d)||Dc(!1),g=S}else g=m;let v=g.pathname||"/",b=v;if(d!=="/"){let S=d.replace(/^\//,"").split("/");b="/"+v.replace(/^\//,"").split("/").slice(S.length).join("/")}let N=frt(t,{pathname:b}),j=Zrt(N&&N.map(S=>Object.assign({},S,{params:Object.assign({},i,S.params),pathname:nv([d,a.encodeLocation?a.encodeLocation(S.pathname).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?d:nv([d,a.encodeLocation?a.encodeLocation(S.pathnameBase).pathname:S.pathnameBase])})),o,s,n);return r&&j?E.createElement(Ene.Provider,{value:{location:qE({pathname:"/",search:"",hash:"",state:null,key:"default"},g),navigationType:A1.Pop}},j):j}function Hrt(){let t=Jrt(),r=Drt(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),s=t instanceof Error?t.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"}},r),s?E.createElement("pre",{style:a},s):null,null)}const Wrt=E.createElement(Hrt,null);class Grt extends E.Component{constructor(r){super(r),this.state={location:r.location,revalidation:r.revalidation,error:r.error}}static getDerivedStateFromError(r){return{error:r}}static getDerivedStateFromProps(r,s){return s.location!==r.location||s.revalidation!=="idle"&&r.revalidation==="idle"?{error:r.error,location:r.location,revalidation:r.revalidation}:{error:r.error!==void 0?r.error:s.error,location:s.location,revalidation:r.revalidation||s.revalidation}}componentDidCatch(r,s){console.error("React Router caught the following error during render",r,s)}render(){return this.state.error!==void 0?E.createElement(hx.Provider,{value:this.props.routeContext},E.createElement(YPe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Krt(t){let{routeContext:r,match:s,children:n}=t,a=E.useContext(Exe);return a&&a.static&&a.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=s.route.id),E.createElement(hx.Provider,{value:r},n)}function Zrt(t,r,s,n){var a;if(r===void 0&&(r=[]),s===void 0&&(s=null),n===void 0&&(n=null),t==null){var o;if(!s)return null;if(s.errors)t=s.matches;else if((o=n)!=null&&o.v7_partialHydration&&r.length===0&&!s.initialized&&s.matches.length>0)t=s.matches;else return null}let l=t,i=(a=s)==null?void 0:a.errors;if(i!=null){let g=l.findIndex(y=>y.route.id&&(i==null?void 0:i[y.route.id])!==void 0);g>=0||Dc(!1),l=l.slice(0,Math.min(l.length,g+1))}let d=!1,m=-1;if(s&&n&&n.v7_partialHydration)for(let g=0;g=0?l=l.slice(0,m+1):l=[l[0]];break}}}return l.reduceRight((g,y,v)=>{let b,N=!1,j=null,S=null;s&&(b=i&&y.route.id?i[y.route.id]:void 0,j=y.route.errorElement||Wrt,d&&(m<0&&v===0?(tst("route-fallback"),N=!0,S=null):m===v&&(N=!0,S=y.route.hydrateFallbackElement||null)));let A=r.concat(l.slice(0,v+1)),M=()=>{let I;return b?I=j:N?I=S:y.route.Component?I=E.createElement(y.route.Component,null):y.route.element?I=y.route.element:I=g,E.createElement(Krt,{match:y,routeContext:{outlet:g,matches:A,isDataRoute:s!=null},children:I})};return s&&(y.route.ErrorBoundary||y.route.errorElement||v===0)?E.createElement(Grt,{location:s.location,revalidation:s.revalidation,component:j,error:b,children:M(),routeContext:{outlet:null,matches:A,isDataRoute:!0}}):M()},null)}var JPe=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(JPe||{}),e6e=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(e6e||{});function Yrt(t){let r=E.useContext(Exe);return r||Dc(!1),r}function Xrt(t){let r=E.useContext(Frt);return r||Dc(!1),r}function Qrt(t){let r=E.useContext(hx);return r||Dc(!1),r}function t6e(t){let r=Qrt(),s=r.matches[r.matches.length-1];return s.route.id||Dc(!1),s.route.id}function Jrt(){var t;let r=E.useContext(YPe),s=Xrt(),n=t6e();return r!==void 0?r:(t=s.errors)==null?void 0:t[n]}function est(){let{router:t}=Yrt(JPe.UseNavigateStable),r=t6e(e6e.UseNavigateStable),s=E.useRef(!1);return XPe(()=>{s.current=!0}),E.useCallback(function(a,o){o===void 0&&(o={}),s.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,qE({fromRouteId:r},o)))},[t,r])}const oke={};function tst(t,r,s){oke[t]||(oke[t]=!0)}function rst(t,r){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Sce(t){let{to:r,replace:s,state:n,relative:a}=t;R3()||Dc(!1);let{future:o,static:l}=E.useContext(Cv),{matches:i}=E.useContext(hx),{pathname:d}=Uh(),m=Ws(),g=Axe(r,Txe(i,o.v7_relativeSplatPath),d,a==="path"),y=JSON.stringify(g);return E.useEffect(()=>m(JSON.parse(y),{replace:s,state:n,relative:a}),[m,y,a,s,n]),null}function sst(t){return Urt(t.context)}function ts(t){Dc(!1)}function nst(t){let{basename:r="/",children:s=null,location:n,navigationType:a=A1.Pop,navigator:o,static:l=!1,future:i}=t;R3()&&Dc(!1);let d=r.replace(/^\/*/,"/"),m=E.useMemo(()=>({basename:d,navigator:o,static:l,future:qE({v7_relativeSplatPath:!1},i)}),[d,i,o,l]);typeof n=="string"&&(n=D3(n));let{pathname:g="/",search:y="",hash:v="",state:b=null,key:N="default"}=n,j=E.useMemo(()=>{let S=Mxe(g,d);return S==null?null:{location:{pathname:S,search:y,hash:v,state:b,key:N},navigationType:a}},[d,g,y,v,b,N,a]);return j==null?null:E.createElement(Cv.Provider,{value:m},E.createElement(Ene.Provider,{children:s,value:j}))}function ast(t){let{children:r,location:s}=t;return qrt(Hhe(r),s)}new Promise(()=>{});function Hhe(t,r){r===void 0&&(r=[]);let s=[];return E.Children.forEach(t,(n,a)=>{if(!E.isValidElement(n))return;let o=[...r,a];if(n.type===E.Fragment){s.push.apply(s,Hhe(n.props.children,o));return}n.type!==ts&&Dc(!1),!n.props.index||!n.props.children||Dc(!1);let l={id:n.props.id||o.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(l.children=Hhe(n.props.children,o)),s.push(l)}),s}/** * 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 Whe(){return Whe=Object.assign?Object.assign.bind():function(t){for(var r=1;r=0)&&(s[a]=t[a]);return s}function ost(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function lst(t,r){return t.button===0&&(!r||r==="_self")&&!ost(t)}function Ghe(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((r,s)=>{let n=t[s];return r.concat(Array.isArray(n)?n.map(a=>[s,a]):[[s,n]])},[]))}function cst(t,r){let s=Ghe(t);return r&&r.forEach((n,a)=>{s.has(a)||r.getAll(a).forEach(o=>{s.append(a,o)})}),s}const dst=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],ust="6";try{window.__reactRouterVersion=ust}catch{}const hst="startTransition",lke=gge[hst];function mst(t){let{basename:r,children:s,future:n,window:a}=t,o=E.useRef();o.current==null&&(o.current=hrt({window:a,v5Compat:!0}));let l=o.current,[i,d]=E.useState({action:l.action,location:l.location}),{v7_startTransition:m}=n||{},g=E.useCallback(y=>{m&&lke?lke(()=>d(y)):d(y)},[d,m]);return E.useLayoutEffect(()=>l.listen(g),[l,g]),E.useEffect(()=>rst(n),[n]),E.createElement(nst,{basename:r,children:s,location:i.location,navigationType:i.action,navigator:l,future:n})}const pst=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",fst=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,go=E.forwardRef(function(r,s){let{onClick:n,relative:a,reloadDocument:o,replace:l,state:i,target:d,to:m,preventScrollReset:g,viewTransition:y}=r,v=ist(r,dst),{basename:b}=E.useContext(Cv),N,j=!1;if(typeof m=="string"&&fst.test(m)&&(N=m,pst))try{let I=new URL(window.location.href),F=m.startsWith("//")?new URL(I.protocol+m):new URL(m),O=Mxe(F.pathname,b);F.origin===I.origin&&O!=null?m=O+F.search+F.hash:j=!0}catch{}let S=zrt(m,{relative:a}),A=gst(m,{replace:l,state:i,target:d,preventScrollReset:g,relative:a,viewTransition:y});function M(I){n&&n(I),I.defaultPrevented||A(I)}return E.createElement("a",Whe({},v,{href:N||S,onClick:j||o?n:M,ref:s,target:d}))});var cke;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(cke||(cke={}));var dke;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(dke||(dke={}));function gst(t,r){let{target:s,replace:n,state:a,preventScrollReset:o,relative:l,viewTransition:i}=r===void 0?{}:r,d=Ws(),m=Uh(),g=QPe(t,{relative:l});return E.useCallback(y=>{if(lst(y,s)){y.preventDefault();let v=n!==void 0?n:zte(m)===zte(g);d(t,{replace:v,state:a,preventScrollReset:o,relative:l,viewTransition:i})}},[m,d,g,n,a,s,t,o,l,i])}function Bc(t){let r=E.useRef(Ghe(t)),s=E.useRef(!1),n=Uh(),a=E.useMemo(()=>cst(n.search,s.current?null:r.current),[n.search]),o=Ws(),l=E.useCallback((i,d)=>{const m=Ghe(typeof i=="function"?i(a):i);s.current=!0,o("?"+m,d)},[o,a]);return[a,l]}var xst=typeof Element<"u",yst=typeof Map=="function",vst=typeof Set=="function",_st=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function qee(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var s,n,a;if(Array.isArray(t)){if(s=t.length,s!=r.length)return!1;for(n=s;n--!==0;)if(!qee(t[n],r[n]))return!1;return!0}var o;if(yst&&t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(o=t.entries();!(n=o.next()).done;)if(!r.has(n.value[0]))return!1;for(o=t.entries();!(n=o.next()).done;)if(!qee(n.value[1],r.get(n.value[0])))return!1;return!0}if(vst&&t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(o=t.entries();!(n=o.next()).done;)if(!r.has(n.value[0]))return!1;return!0}if(_st&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(r)){if(s=t.length,s!=r.length)return!1;for(n=s;n--!==0;)if(t[n]!==r[n])return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf&&typeof t.valueOf=="function"&&typeof r.valueOf=="function")return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString&&typeof t.toString=="function"&&typeof r.toString=="function")return t.toString()===r.toString();if(a=Object.keys(t),s=a.length,s!==Object.keys(r).length)return!1;for(n=s;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,a[n]))return!1;if(xst&&t instanceof Element)return!1;for(n=s;n--!==0;)if(!((a[n]==="_owner"||a[n]==="__v"||a[n]==="__o")&&t.$$typeof)&&!qee(t[a[n]],r[a[n]]))return!1;return!0}return t!==t&&r!==r}var bst=function(r,s){try{return qee(r,s)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}};const wst=oo(bst);var jst=function(t,r,s,n,a,o,l,i){if(!t){var d;if(r===void 0)d=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var m=[s,n,a,o,l,i],g=0;d=new Error(r.replace(/%s/g,function(){return m[g++]})),d.name="Invariant Violation"}throw d.framesToPop=1,d}},kst=jst;const uke=oo(kst);var Nst=function(r,s,n,a){var o=n?n.call(a,r,s):void 0;if(o!==void 0)return!!o;if(r===s)return!0;if(typeof r!="object"||!r||typeof s!="object"||!s)return!1;var l=Object.keys(r),i=Object.keys(s);if(l.length!==i.length)return!1;for(var d=Object.prototype.hasOwnProperty.bind(s),m=0;m(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(r6e||{}),Cce={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"]}},hke=Object.values(r6e),Ixe={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},Cst=Object.entries(Ixe).reduce((t,[r,s])=>(t[s]=r,t),{}),Af="data-rh",rC={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},sC=(t,r)=>{for(let s=t.length-1;s>=0;s-=1){const n=t[s];if(Object.prototype.hasOwnProperty.call(n,r))return n[r]}return null},Mst=t=>{let r=sC(t,"title");const s=sC(t,rC.TITLE_TEMPLATE);if(Array.isArray(r)&&(r=r.join("")),s&&r)return s.replace(/%s/g,()=>r);const n=sC(t,rC.DEFAULT_TITLE);return r||n||void 0},Tst=t=>sC(t,rC.ON_CHANGE_CLIENT_STATE)||(()=>{}),Mce=(t,r)=>r.filter(s=>typeof s[t]<"u").map(s=>s[t]).reduce((s,n)=>({...s,...n}),{}),Ast=(t,r)=>r.filter(s=>typeof s.base<"u").map(s=>s.base).reverse().reduce((s,n)=>{if(!s.length){const a=Object.keys(n);for(let o=0;oconsole&&typeof console.warn=="function"&&console.warn(t),gT=(t,r,s)=>{const n={};return s.filter(a=>Array.isArray(a[t])?!0:(typeof a[t]<"u"&&Est(`Helmet: ${t} should be of type "Array". Instead found type "${typeof a[t]}"`),!1)).map(a=>a[t]).reverse().reduce((a,o)=>{const l={};o.filter(d=>{let m;const g=Object.keys(d);for(let v=0;va.push(d));const i=Object.keys(l);for(let d=0;d{if(Array.isArray(t)&&t.length){for(let s=0;s({baseTag:Ast(["href"],t),bodyAttributes:Mce("bodyAttributes",t),defer:sC(t,rC.DEFER),encode:sC(t,rC.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:Mce("htmlAttributes",t),linkTags:gT("link",["rel","href"],t),metaTags:gT("meta",["name","charset","http-equiv","property","itemprop"],t),noscriptTags:gT("noscript",["innerHTML"],t),onChangeClientState:Tst(t),scriptTags:gT("script",["src","innerHTML"],t),styleTags:gT("style",["cssText"],t),title:Mst(t),titleAttributes:Mce("titleAttributes",t),prioritizeSeoTags:Ist(t,rC.PRIORITIZE_SEO_TAGS)}),s6e=t=>Array.isArray(t)?t.join(""):t,Lst=(t,r)=>{const s=Object.keys(t);for(let n=0;nArray.isArray(t)?t.reduce((s,n)=>(Lst(n,r)?s.priority.push(n):s.default.push(n),s),{priority:[],default:[]}):{default:t,priority:[]},mke=(t,r)=>({...t,[r]:void 0}),Ost=["noscript","script","style"],Khe=(t,r=!0)=>r===!1?String(t):String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),n6e=t=>Object.keys(t).reduce((r,s)=>{const n=typeof t[s]<"u"?`${s}="${t[s]}"`:`${s}`;return r?`${r} ${n}`:n},""),Dst=(t,r,s,n)=>{const a=n6e(s),o=s6e(r);return a?`<${t} ${Af}="true" ${a}>${Khe(o,n)}`:`<${t} ${Af}="true">${Khe(o,n)}`},Rst=(t,r,s=!0)=>r.reduce((n,a)=>{const o=a,l=Object.keys(o).filter(m=>!(m==="innerHTML"||m==="cssText")).reduce((m,g)=>{const y=typeof o[g]>"u"?g:`${g}="${Khe(o[g],s)}"`;return m?`${m} ${y}`:y},""),i=o.innerHTML||o.cssText||"",d=Ost.indexOf(t)===-1;return`${n}<${t} ${Af}="true" ${l}${d?"/>":`>${i}`}`},""),a6e=(t,r={})=>Object.keys(t).reduce((s,n)=>{const a=Ixe[n];return s[a||n]=t[n],s},r),Fst=(t,r,s)=>{const n={key:r,[Af]:!0},a=a6e(s,n);return[lt.createElement("title",a,r)]},Vee=(t,r)=>r.map((s,n)=>{const a={key:n,[Af]:!0};return Object.keys(s).forEach(o=>{const i=Ixe[o]||o;if(i==="innerHTML"||i==="cssText"){const d=s.innerHTML||s.cssText;a.dangerouslySetInnerHTML={__html:d}}else a[i]=s[o]}),lt.createElement(t,a)}),tp=(t,r,s=!0)=>{switch(t){case"title":return{toComponent:()=>Fst(t,r.title,r.titleAttributes),toString:()=>Dst(t,r.title,r.titleAttributes,s)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>a6e(r),toString:()=>n6e(r)};default:return{toComponent:()=>Vee(t,r),toString:()=>Rst(t,r,s)}}},zst=({metaTags:t,linkTags:r,scriptTags:s,encode:n})=>{const a=Tce(t,Cce.meta),o=Tce(r,Cce.link),l=Tce(s,Cce.script);return{priorityMethods:{toComponent:()=>[...Vee("meta",a.priority),...Vee("link",o.priority),...Vee("script",l.priority)],toString:()=>`${tp("meta",a.priority,n)} ${tp("link",o.priority,n)} ${tp("script",l.priority,n)}`},metaTags:a.default,linkTags:o.default,scriptTags:l.default}},Bst=t=>{const{baseTag:r,bodyAttributes:s,encode:n=!0,htmlAttributes:a,noscriptTags:o,styleTags:l,title:i="",titleAttributes:d,prioritizeSeoTags:m}=t;let{linkTags:g,metaTags:y,scriptTags:v}=t,b={toComponent:()=>{},toString:()=>""};return m&&({priorityMethods:b,linkTags:g,metaTags:y,scriptTags:v}=zst(t)),{priority:b,base:tp("base",r,n),bodyAttributes:tp("bodyAttributes",s,n),htmlAttributes:tp("htmlAttributes",a,n),link:tp("link",g,n),meta:tp("meta",y,n),noscript:tp("noscript",o,n),script:tp("script",v,n),style:tp("style",l,n),title:tp("title",{title:i,titleAttributes:d},n)}},Zhe=Bst,o8=[],i6e=!!(typeof window<"u"&&window.document&&window.document.createElement),Yhe=class{constructor(t,r){an(this,"instances",[]);an(this,"canUseDOM",i6e);an(this,"context");an(this,"value",{setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?o8:this.instances,add:t=>{(this.canUseDOM?o8:this.instances).push(t)},remove:t=>{const r=(this.canUseDOM?o8:this.instances).indexOf(t);(this.canUseDOM?o8:this.instances).splice(r,1)}}});this.context=t,this.canUseDOM=r||!1,r||(t.helmet=Zhe({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},$st={},o6e=lt.createContext($st),Ej,l6e=(Ej=class extends E.Component{constructor(s){super(s);an(this,"helmetData");this.helmetData=new Yhe(this.props.context||{},Ej.canUseDOM)}render(){return lt.createElement(o6e.Provider,{value:this.helmetData.value},this.props.children)}},an(Ej,"canUseDOM",i6e),Ej),E4=(t,r)=>{const s=document.head||document.querySelector("head"),n=s.querySelectorAll(`${t}[${Af}]`),a=[].slice.call(n),o=[];let l;return r&&r.length&&r.forEach(i=>{const d=document.createElement(t);for(const m in i)if(Object.prototype.hasOwnProperty.call(i,m))if(m==="innerHTML")d.innerHTML=i.innerHTML;else if(m==="cssText")d.styleSheet?d.styleSheet.cssText=i.cssText:d.appendChild(document.createTextNode(i.cssText));else{const g=m,y=typeof i[g]>"u"?"":i[g];d.setAttribute(m,y)}d.setAttribute(Af,"true"),a.some((m,g)=>(l=g,d.isEqualNode(m)))?a.splice(l,1):o.push(d)}),a.forEach(i=>{var d;return(d=i.parentNode)==null?void 0:d.removeChild(i)}),o.forEach(i=>s.appendChild(i)),{oldTags:a,newTags:o}},Xhe=(t,r)=>{const s=document.getElementsByTagName(t)[0];if(!s)return;const n=s.getAttribute(Af),a=n?n.split(","):[],o=[...a],l=Object.keys(r);for(const i of l){const d=r[i]||"";s.getAttribute(i)!==d&&s.setAttribute(i,d),a.indexOf(i)===-1&&a.push(i);const m=o.indexOf(i);m!==-1&&o.splice(m,1)}for(let i=o.length-1;i>=0;i-=1)s.removeAttribute(o[i]);a.length===o.length?s.removeAttribute(Af):s.getAttribute(Af)!==l.join(",")&&s.setAttribute(Af,l.join(","))},Ust=(t,r)=>{typeof t<"u"&&document.title!==t&&(document.title=s6e(t)),Xhe("title",r)},pke=(t,r)=>{const{baseTag:s,bodyAttributes:n,htmlAttributes:a,linkTags:o,metaTags:l,noscriptTags:i,onChangeClientState:d,scriptTags:m,styleTags:g,title:y,titleAttributes:v}=t;Xhe("body",n),Xhe("html",a),Ust(y,v);const b={baseTag:E4("base",s),linkTags:E4("link",o),metaTags:E4("meta",l),noscriptTags:E4("noscript",i),scriptTags:E4("script",m),styleTags:E4("style",g)},N={},j={};Object.keys(b).forEach(S=>{const{newTags:A,oldTags:M}=b[S];A.length&&(N[S]=A),M.length&&(j[S]=b[S].oldTags)}),r&&r(),d(t,N,j)},xT=null,qst=t=>{xT&&cancelAnimationFrame(xT),t.defer?xT=requestAnimationFrame(()=>{pke(t,()=>{xT=null})}):(pke(t),xT=null)},Vst=qst,fke=class extends E.Component{constructor(){super(...arguments);an(this,"rendered",!1)}shouldComponentUpdate(r){return!Sst(r,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:r}=this.props.context;r.remove(this),this.emitChange()}emitChange(){const{helmetInstances:r,setHelmet:s}=this.props.context;let n=null;const a=Pst(r.get().map(o=>{const l={...o.props};return delete l.context,l}));l6e.canUseDOM?Vst(a):Zhe&&(n=Zhe(a)),s(n)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:r}=this.props.context;r.add(this),this.emitChange()}render(){return this.init(),null}},Sue,qh=(Sue=class extends E.Component{shouldComponentUpdate(t){return!wst(mke(this.props,"helmetData"),mke(t,"helmetData"))}mapNestedChildrenToProps(t,r){if(!r)return null;switch(t.type){case"script":case"noscript":return{innerHTML:r};case"style":return{cssText:r};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,r,s,n){return{...r,[t.type]:[...r[t.type]||[],{...s,...this.mapNestedChildrenToProps(t,n)}]}}mapObjectTypeChildren(t,r,s,n){switch(t.type){case"title":return{...r,[t.type]:n,titleAttributes:{...s}};case"body":return{...r,bodyAttributes:{...s}};case"html":return{...r,htmlAttributes:{...s}};default:return{...r,[t.type]:{...s}}}}mapArrayTypeChildrenToProps(t,r){let s={...r};return Object.keys(t).forEach(n=>{s={...s,[n]:t[n]}}),s}warnOnInvalidChildren(t,r){return uke(hke.some(s=>t.type===s),typeof t.type=="function"?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${hke.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`),uke(!r||typeof r=="string"||Array.isArray(r)&&!r.some(s=>typeof s!="string"),`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`} ) Refer to our API for more information.`),!0}mapChildrenToProps(t,r){let s={};return lt.Children.forEach(t,n=>{if(!n||!n.props)return;const{children:a,...o}=n.props,l=Object.keys(o).reduce((d,m)=>(d[Cst[m]||m]=o[m],d),{});let{type:i}=n;switch(typeof i=="symbol"?i=i.toString():this.warnOnInvalidChildren(n,a),i){case"Symbol(react.fragment)":r=this.mapChildrenToProps(a,r);break;case"link":case"meta":case"noscript":case"script":case"style":s=this.flattenArrayTypeChildren(n,s,l,a);break;default:r=this.mapObjectTypeChildren(n,r,l,a);break}}),this.mapArrayTypeChildrenToProps(s,r)}render(){const{children:t,...r}=this.props;let s={...r},{helmetData:n}=r;if(t&&(s=this.mapChildrenToProps(t,s)),n&&!(n instanceof Yhe)){const a=n;n=new Yhe(a.context,!0),delete s.helmetData}return n?lt.createElement(fke,{...s,context:n.value}):lt.createElement(o6e.Consumer,null,a=>lt.createElement(fke,{...s,context:a}))}},an(Sue,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),Sue),Qhe=function(t,r){return Qhe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,n){s.__proto__=n}||function(s,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(s[a]=n[a])},Qhe(t,r)};function c6e(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");Qhe(t,r);function s(){this.constructor=t}t.prototype=r===null?Object.create(r):(s.prototype=r.prototype,new s)}var cp=function(){return cp=Object.assign||function(r){for(var s,n=1,a=arguments.length;n=0;i--)(l=t[i])&&(o=(a<3?l(o):a>3?l(r,s,o):l(r,s))||o);return a>3&&o&&Object.defineProperty(r,s,o),o}function u6e(t,r){return function(s,n){r(s,n,t)}}function h6e(t,r,s,n,a,o){function l(A){if(A!==void 0&&typeof A!="function")throw new TypeError("Function expected");return A}for(var i=n.kind,d=i==="getter"?"get":i==="setter"?"set":"value",m=!r&&t?n.static?t:t.prototype:null,g=r||(m?Object.getOwnPropertyDescriptor(m,n.name):{}),y,v=!1,b=s.length-1;b>=0;b--){var N={};for(var j in n)N[j]=j==="access"?{}:n[j];for(var j in n.access)N.access[j]=n.access[j];N.addInitializer=function(A){if(v)throw new TypeError("Cannot add initializers after decoration has completed");o.push(l(A||null))};var S=(0,s[b])(i==="accessor"?{get:g.get,set:g.set}:g[d],N);if(i==="accessor"){if(S===void 0)continue;if(S===null||typeof S!="object")throw new TypeError("Object expected");(y=l(S.get))&&(g.get=y),(y=l(S.set))&&(g.set=y),(y=l(S.init))&&a.unshift(y)}else(y=l(S))&&(i==="field"?a.unshift(y):g[d]=y)}m&&Object.defineProperty(m,n.name,g),v=!0}function m6e(t,r,s){for(var n=arguments.length>2,a=0;a0&&o[o.length-1])&&(m[0]===6||m[0]===2)){s=0;continue}if(m[0]===3&&(!o||m[1]>o[0]&&m[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function Pxe(t,r){var s=typeof Symbol=="function"&&t[Symbol.iterator];if(!s)return t;var n=s.call(t),a,o=[],l;try{for(;(r===void 0||r-- >0)&&!(a=n.next()).done;)o.push(a.value)}catch(i){l={error:i}}finally{try{a&&!a.done&&(s=n.return)&&s.call(n)}finally{if(l)throw l.error}}return o}function v6e(){for(var t=[],r=0;r1||d(b,j)})},N&&(a[b]=N(a[b])))}function d(b,N){try{m(n[b](N))}catch(j){v(o[0][3],j)}}function m(b){b.value instanceof FC?Promise.resolve(b.value.v).then(g,y):v(o[0][2],b)}function g(b){d("next",b)}function y(b){d("throw",b)}function v(b,N){b(N),o.shift(),o.length&&d(o[0][0],o[0][1])}}function w6e(t){var r,s;return r={},n("next"),n("throw",function(a){throw a}),n("return"),r[Symbol.iterator]=function(){return this},r;function n(a,o){r[a]=t[a]?function(l){return(s=!s)?{value:FC(t[a](l)),done:!1}:o?o(l):l}:o}}function j6e(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t[Symbol.asyncIterator],s;return r?r.call(t):(t=typeof Bte=="function"?Bte(t):t[Symbol.iterator](),s={},n("next"),n("throw"),n("return"),s[Symbol.asyncIterator]=function(){return this},s);function n(o){s[o]=t[o]&&function(l){return new Promise(function(i,d){l=t[o](l),a(i,d,l.done,l.value)})}}function a(o,l,i,d){Promise.resolve(d).then(function(m){o({value:m,done:i})},l)}}function k6e(t,r){return Object.defineProperty?Object.defineProperty(t,"raw",{value:r}):t.raw=r,t}var Hst=Object.create?function(t,r){Object.defineProperty(t,"default",{enumerable:!0,value:r})}:function(t,r){t.default=r},Jhe=function(t){return Jhe=Object.getOwnPropertyNames||function(r){var s=[];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(s[s.length]=n);return s},Jhe(t)};function N6e(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var s=Jhe(t),n=0;n0){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(s.map(d=>{if(d=Yst(d),d in gke)return;gke[d]=!0;const m=d.endsWith(".css"),g=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${g}`))return;const y=document.createElement("link");if(y.rel=m?"stylesheet":Zst,m||(y.as="script"),y.crossOrigin="",y.href=d,i&&y.setAttribute("nonce",i),document.head.appendChild(y),m)return new Promise((v,b)=>{y.addEventListener("load",v),y.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${d}`)))})}))}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 r().catch(o)})},Xst=t=>{let r;return t?r=t:typeof fetch>"u"?r=(...s)=>F3(async()=>{const{default:n}=await Promise.resolve().then(()=>zk);return{default:n}},void 0).then(({default:n})=>n(...s)):r=fetch,(...s)=>r(...s)};class Oxe extends Error{constructor(r,s="FunctionsError",n){super(r),this.name=s,this.context=n}}class xke extends Oxe{constructor(r){super("Failed to send a request to the Edge Function","FunctionsFetchError",r)}}class yke extends Oxe{constructor(r){super("Relay Error invoking the Edge Function","FunctionsRelayError",r)}}class vke extends Oxe{constructor(r){super("Edge Function returned a non-2xx status code","FunctionsHttpError",r)}}var eme;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(eme||(eme={}));class Qst{constructor(r,{headers:s={},customFetch:n,region:a=eme.Any}={}){this.url=r,this.headers=s,this.region=a,this.fetch=Xst(n)}setAuth(r){this.headers.Authorization=`Bearer ${r}`}invoke(r){return Xn(this,arguments,void 0,function*(s,n={}){var a;try{const{headers:o,method:l,body:i,signal:d}=n;let m={},{region:g}=n;g||(g=this.region);const y=new URL(`${this.url}/${s}`);g&&g!=="any"&&(m["x-region"]=g,y.searchParams.set("forceFunctionRegion",g));let v;i&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)?typeof Blob<"u"&&i instanceof Blob||i instanceof ArrayBuffer?(m["Content-Type"]="application/octet-stream",v=i):typeof i=="string"?(m["Content-Type"]="text/plain",v=i):typeof FormData<"u"&&i instanceof FormData?v=i:(m["Content-Type"]="application/json",v=JSON.stringify(i)):v=i;const b=yield this.fetch(y.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},m),this.headers),o),body:v,signal:d}).catch(A=>{throw A.name==="AbortError"?A:new xke(A)}),N=b.headers.get("x-relay-error");if(N&&N==="true")throw new yke(b);if(!b.ok)throw new vke(b);let j=((a=b.headers.get("Content-Type"))!==null&&a!==void 0?a:"text/plain").split(";")[0].trim(),S;return j==="application/json"?S=yield b.json():j==="application/octet-stream"||j==="application/pdf"?S=yield b.blob():j==="text/event-stream"?S=b:j==="multipart/form-data"?S=yield b.formData():S=yield b.text(),{data:S,error:null,response:b}}catch(o){return o instanceof Error&&o.name==="AbortError"?{data:null,error:new xke(o)}:{data:null,error:o,response:o instanceof vke||o instanceof yke?o.context:void 0}}})}}var Ah={};const z3=rAe(Kst);var l8={},c8={},d8={},u8={},h8={},Jst=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")},zC=Jst();const ent=zC.fetch,P6e=zC.fetch.bind(zC),L6e=zC.Headers,tnt=zC.Request,rnt=zC.Response,zk=Object.freeze(Object.defineProperty({__proto__:null,Headers:L6e,Request:tnt,Response:rnt,default:P6e,fetch:ent},Symbol.toStringTag,{value:"Module"})),snt=rAe(zk);var m8={},_ke;function O6e(){if(_ke)return m8;_ke=1,Object.defineProperty(m8,"__esModule",{value:!0});class t extends Error{constructor(s){super(s.message),this.name="PostgrestError",this.details=s.details,this.hint=s.hint,this.code=s.code}}return m8.default=t,m8}var bke;function D6e(){if(bke)return h8;bke=1,Object.defineProperty(h8,"__esModule",{value:!0});const t=z3,r=t.__importDefault(snt),s=t.__importDefault(O6e());class n{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=r.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 d=i(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async m=>{var g,y,v,b;let N=null,j=null,S=null,A=m.status,M=m.statusText;if(m.ok){if(this.method!=="HEAD"){const B=await m.text();B===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((g=this.headers.get("Accept"))===null||g===void 0)&&g.includes("application/vnd.pgrst.plan+text"))?j=B:j=JSON.parse(B))}const F=(y=this.headers.get("Prefer"))===null||y===void 0?void 0:y.match(/count=(exact|planned|estimated)/),O=(v=m.headers.get("content-range"))===null||v===void 0?void 0:v.split("/");F&&O&&O.length>1&&(S=parseInt(O[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(j)&&(j.length>1?(N={code:"PGRST116",details:`Results contain ${j.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},j=null,S=null,A=406,M="Not Acceptable"):j.length===1?j=j[0]:j=null)}else{const F=await m.text();try{N=JSON.parse(F),Array.isArray(N)&&m.status===404&&(j=[],N=null,A=200,M="OK")}catch{m.status===404&&F===""?(A=204,M="No Content"):N={message:F}}if(N&&this.isMaybeSingle&&(!((b=N==null?void 0:N.details)===null||b===void 0)&&b.includes("0 rows"))&&(N=null,A=200,M="OK"),N&&this.shouldThrowOnError)throw new s.default(N)}return{error:N,data:j,count:S,status:A,statusText:M}});return this.shouldThrowOnError||(d=d.catch(m=>{var g,y,v;return{error:{message:`${(g=m==null?void 0:m.name)!==null&&g!==void 0?g:"FetchError"}: ${m==null?void 0:m.message}`,details:`${(y=m==null?void 0:m.stack)!==null&&y!==void 0?y:""}`,hint:"",code:`${(v=m==null?void 0:m.code)!==null&&v!==void 0?v:""}`},data:null,count:null,status:0,statusText:""}})),d.then(o,l)}returns(){return this}overrideTypes(){return this}}return h8.default=n,h8}var wke;function R6e(){if(wke)return u8;wke=1,Object.defineProperty(u8,"__esModule",{value:!0});const r=z3.__importDefault(D6e());class s extends r.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:d=i}={}){const m=d?`${d}.order`:"order",g=this.url.searchParams.get(m);return this.url.searchParams.set(m,`${g?`${g},`:""}${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 d=typeof i>"u"?"offset":`${i}.offset`,m=typeof i>"u"?"limit":`${i}.limit`;return this.url.searchParams.set(d,`${a}`),this.url.searchParams.set(m,`${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:d=!1,format:m="text"}={}){var g;const y=[a?"analyze":null,o?"verbose":null,l?"settings":null,i?"buffers":null,d?"wal":null].filter(Boolean).join("|"),v=(g=this.headers.get("Accept"))!==null&&g!==void 0?g:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${m}; for="${v}"; options=${y};`),m==="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 u8.default=s,u8}var jke;function Dxe(){if(jke)return d8;jke=1,Object.defineProperty(d8,"__esModule",{value:!0});const r=z3.__importDefault(R6e()),s=new RegExp("[,()]");class n extends r.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(d=>typeof d=="string"&&s.test(d)?`"${d}"`:`${d}`).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:d}={}){let m="";d==="plain"?m="pl":d==="phrase"?m="ph":d==="websearch"&&(m="w");const g=i===void 0?"":`(${i})`;return this.url.searchParams.append(o,`${m}fts${g}.${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 d=i?`${i}.or`:"or";return this.url.searchParams.append(d,`(${o})`),this}filter(o,l,i){return this.url.searchParams.append(o,`${l}.${i}`),this}}return d8.default=n,d8}var kke;function F6e(){if(kke)return c8;kke=1,Object.defineProperty(c8,"__esModule",{value:!0});const r=z3.__importDefault(Dxe());class s{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??{},d=l?"HEAD":"GET";let m=!1;const g=(a??"*").split("").map(y=>/\s/.test(y)&&!m?"":(y==='"'&&(m=!m),y)).join("");return this.url.searchParams.set("select",g),i&&this.headers.append("Prefer",`count=${i}`),new r.default({method:d,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(a,{count:o,defaultToNull:l=!0}={}){var i;const d="POST";if(o&&this.headers.append("Prefer",`count=${o}`),l||this.headers.append("Prefer","missing=default"),Array.isArray(a)){const m=a.reduce((g,y)=>g.concat(Object.keys(y)),[]);if(m.length>0){const g=[...new Set(m)].map(y=>`"${y}"`);this.url.searchParams.set("columns",g.join(","))}}return new r.default({method:d,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:d=!0}={}){var m;const g="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}`),d||this.headers.append("Prefer","missing=default"),Array.isArray(a)){const y=a.reduce((v,b)=>v.concat(Object.keys(b)),[]);if(y.length>0){const v=[...new Set(y)].map(b=>`"${b}"`);this.url.searchParams.set("columns",v.join(","))}}return new r.default({method:g,url:this.url,headers:this.headers,schema:this.schema,body:a,fetch:(m=this.fetch)!==null&&m!==void 0?m:fetch})}update(a,{count:o}={}){var l;const i="PATCH";return o&&this.headers.append("Prefer",`count=${o}`),new r.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 r.default({method:l,url:this.url,headers:this.headers,schema:this.schema,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}}return c8.default=s,c8}var Nke;function nnt(){if(Nke)return l8;Nke=1,Object.defineProperty(l8,"__esModule",{value:!0});const t=z3,r=t.__importDefault(F6e()),s=t.__importDefault(Dxe());class n{constructor(o,{headers:l={},schema:i,fetch:d}={}){this.url=o,this.headers=new Headers(l),this.schemaName=i,this.fetch=d}from(o){const l=new URL(`${this.url}/${o}`);return new r.default(l,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(o){return new n(this.url,{headers:this.headers,schema:o,fetch:this.fetch})}rpc(o,l={},{head:i=!1,get:d=!1,count:m}={}){var g;let y;const v=new URL(`${this.url}/rpc/${o}`);let b;i||d?(y=i?"HEAD":"GET",Object.entries(l).filter(([j,S])=>S!==void 0).map(([j,S])=>[j,Array.isArray(S)?`{${S.join(",")}}`:`${S}`]).forEach(([j,S])=>{v.searchParams.append(j,S)})):(y="POST",b=l);const N=new Headers(this.headers);return m&&N.set("Prefer",`count=${m}`),new s.default({method:y,url:v,headers:N,schema:this.schemaName,body:b,fetch:(g=this.fetch)!==null&&g!==void 0?g:fetch})}}return l8.default=n,l8}Object.defineProperty(Ah,"__esModule",{value:!0});var z6e=Ah.PostgrestError=Z6e=Ah.PostgrestBuilder=G6e=Ah.PostgrestTransformBuilder=H6e=Ah.PostgrestFilterBuilder=q6e=Ah.PostgrestQueryBuilder=$6e=Ah.PostgrestClient=void 0;const B3=z3,B6e=B3.__importDefault(nnt());var $6e=Ah.PostgrestClient=B6e.default;const U6e=B3.__importDefault(F6e());var q6e=Ah.PostgrestQueryBuilder=U6e.default;const V6e=B3.__importDefault(Dxe());var H6e=Ah.PostgrestFilterBuilder=V6e.default;const W6e=B3.__importDefault(R6e());var G6e=Ah.PostgrestTransformBuilder=W6e.default;const K6e=B3.__importDefault(D6e());var Z6e=Ah.PostgrestBuilder=K6e.default;const Y6e=B3.__importDefault(O6e());z6e=Ah.PostgrestError=Y6e.default;var X6e=Ah.default={PostgrestClient:B6e.default,PostgrestQueryBuilder:U6e.default,PostgrestFilterBuilder:V6e.default,PostgrestTransformBuilder:W6e.default,PostgrestBuilder:K6e.default,PostgrestError:Y6e.default};const ant=Object.freeze(Object.defineProperty({__proto__:null,get PostgrestBuilder(){return Z6e},get PostgrestClient(){return $6e},get PostgrestError(){return z6e},get PostgrestFilterBuilder(){return H6e},get PostgrestQueryBuilder(){return q6e},get PostgrestTransformBuilder(){return G6e},default:X6e},Symbol.toStringTag,{value:"Module"})),{PostgrestClient:int,PostgrestQueryBuilder:Orr,PostgrestFilterBuilder:Drr,PostgrestTransformBuilder:Rrr,PostgrestBuilder:Frr,PostgrestError:zrr}=X6e||ant;class ont{static detectEnvironment(){var r;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"&&(!((r=navigator.userAgent)===null||r===void 0)&&r.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 s=process.versions;if(s&&s.node){const n=s.node,a=parseInt(n.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 r=this.detectEnvironment();if(r.constructor)return r.constructor;let s=r.error||"WebSocket not supported in this environment.";throw r.workaround&&(s+=` Suggested solution: ${r.workaround}`),new Error(s)}static createWebSocket(r,s){const n=this.getWebSocketConstructor();return new n(r,s)}static isWebSocketSupported(){try{const r=this.detectEnvironment();return r.type==="native"||r.type==="ws"}catch{return!1}}}const lnt="2.78.0",cnt=`realtime-js/${lnt}`,dnt="1.0.0",tme=1e4,unt=1e3,hnt=100;var KA;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(KA||(KA={}));var dd;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(dd||(dd={}));var _f;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(_f||(_f={}));var rme;(function(t){t.websocket="websocket"})(rme||(rme={}));var sj;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(sj||(sj={}));class mnt{constructor(){this.HEADER_LENGTH=1}decode(r,s){return r.constructor===ArrayBuffer?s(this._binaryDecode(r)):s(typeof r=="string"?JSON.parse(r):{})}_binaryDecode(r){const s=new DataView(r),n=new TextDecoder;return this._decodeBroadcast(r,s,n)}_decodeBroadcast(r,s,n){const a=s.getUint8(1),o=s.getUint8(2);let l=this.HEADER_LENGTH+2;const i=n.decode(r.slice(l,l+a));l=l+a;const d=n.decode(r.slice(l,l+o));l=l+o;const m=JSON.parse(n.decode(r.slice(l,r.byteLength)));return{ref:null,topic:i,event:d,payload:m}}}class Q6e{constructor(r,s){this.callback=r,this.timerCalc=s,this.timer=void 0,this.tries=0,this.callback=r,this.timerCalc=s}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 al;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(al||(al={}));const Ske=(t,r,s={})=>{var n;const a=(n=s.skipTypes)!==null&&n!==void 0?n:[];return r?Object.keys(r).reduce((o,l)=>(o[l]=pnt(l,t,r,a),o),{}):{}},pnt=(t,r,s,n)=>{const a=r.find(i=>i.name===t),o=a==null?void 0:a.type,l=s[t];return o&&!n.includes(o)?J6e(o,l):sme(l)},J6e=(t,r)=>{if(t.charAt(0)==="_"){const s=t.slice(1,t.length);return ynt(r,s)}switch(t){case al.bool:return fnt(r);case al.float4:case al.float8:case al.int2:case al.int4:case al.int8:case al.numeric:case al.oid:return gnt(r);case al.json:case al.jsonb:return xnt(r);case al.timestamp:return vnt(r);case al.abstime:case al.date:case al.daterange:case al.int4range:case al.int8range:case al.money:case al.reltime:case al.text:case al.time:case al.timestamptz:case al.timetz:case al.tsrange:case al.tstzrange:return sme(r);default:return sme(r)}},sme=t=>t,fnt=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},gnt=t=>{if(typeof t=="string"){const r=parseFloat(t);if(!Number.isNaN(r))return r}return t},xnt=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(r){return console.log(`JSON parse error: ${r}`),t}return t},ynt=(t,r)=>{if(typeof t!="string")return t;const s=t.length-1,n=t[s];if(t[0]==="{"&&n==="}"){let o;const l=t.slice(1,s);try{o=JSON.parse("["+l+"]")}catch{o=l?l.split(","):[]}return o.map(i=>J6e(r,i))}return t},vnt=t=>typeof t=="string"?t.replace(" ","T"):t,eLe=t=>{const r=new URL(t);return r.protocol=r.protocol.replace(/^ws/i,"http"),r.pathname=r.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),r.pathname===""||r.pathname==="/"?r.pathname="/api/broadcast":r.pathname=r.pathname+"/api/broadcast",r.href};class Ace{constructor(r,s,n={},a=tme){this.channel=r,this.event=s,this.payload=n,this.timeout=a,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(r){this.timeout=r,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(r){this.payload=Object.assign(Object.assign({},this.payload),r)}receive(r,s){var n;return this._hasReceived(r)&&s((n=this.receivedResp)===null||n===void 0?void 0:n.response),this.recHooks.push({status:r,callback:s}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const r=s=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=s,this._matchReceive(s)};this.channel._on(this.refEvent,{},r),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(r,s){this.refEvent&&this.channel._trigger(this.refEvent,{status:r,response:s})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:r,response:s}){this.recHooks.filter(n=>n.status===r).forEach(n=>n.callback(s))}_hasReceived(r){return this.receivedResp&&this.receivedResp.status===r}}var Cke;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(Cke||(Cke={}));class ZA{constructor(r,s){this.channel=r,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const n=(s==null?void 0:s.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(n.state,{},a=>{const{onJoin:o,onLeave:l,onSync:i}=this.caller;this.joinRef=this.channel._joinRef(),this.state=ZA.syncState(this.state,a,o,l),this.pendingDiffs.forEach(d=>{this.state=ZA.syncDiff(this.state,d,o,l)}),this.pendingDiffs=[],i()}),this.channel._on(n.diff,{},a=>{const{onJoin:o,onLeave:l,onSync:i}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(a):(this.state=ZA.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(r,s,n,a){const o=this.cloneDeep(r),l=this.transformState(s),i={},d={};return this.map(o,(m,g)=>{l[m]||(d[m]=g)}),this.map(l,(m,g)=>{const y=o[m];if(y){const v=g.map(S=>S.presence_ref),b=y.map(S=>S.presence_ref),N=g.filter(S=>b.indexOf(S.presence_ref)<0),j=y.filter(S=>v.indexOf(S.presence_ref)<0);N.length>0&&(i[m]=N),j.length>0&&(d[m]=j)}else i[m]=g}),this.syncDiff(o,{joins:i,leaves:d},n,a)}static syncDiff(r,s,n,a){const{joins:o,leaves:l}={joins:this.transformState(s.joins),leaves:this.transformState(s.leaves)};return n||(n=()=>{}),a||(a=()=>{}),this.map(o,(i,d)=>{var m;const g=(m=r[i])!==null&&m!==void 0?m:[];if(r[i]=this.cloneDeep(d),g.length>0){const y=r[i].map(b=>b.presence_ref),v=g.filter(b=>y.indexOf(b.presence_ref)<0);r[i].unshift(...v)}n(i,g,d)}),this.map(l,(i,d)=>{let m=r[i];if(!m)return;const g=d.map(y=>y.presence_ref);m=m.filter(y=>g.indexOf(y.presence_ref)<0),r[i]=m,a(i,m,d),m.length===0&&delete r[i]}),r}static map(r,s){return Object.getOwnPropertyNames(r).map(n=>s(n,r[n]))}static transformState(r){return r=this.cloneDeep(r),Object.getOwnPropertyNames(r).reduce((s,n)=>{const a=r[n];return"metas"in a?s[n]=a.metas.map(o=>(o.presence_ref=o.phx_ref,delete o.phx_ref,delete o.phx_ref_prev,o)):s[n]=a,s},{})}static cloneDeep(r){return JSON.parse(JSON.stringify(r))}onJoin(r){this.caller.onJoin=r}onLeave(r){this.caller.onLeave=r}onSync(r){this.caller.onSync=r}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var Mke;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(Mke||(Mke={}));var YA;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(YA||(YA={}));var Yx;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Yx||(Yx={}));class Rxe{constructor(r,s={config:{}},n){var a,o;if(this.topic=r,this.params=s,this.socket=n,this.bindings={},this.state=dd.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=r.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},s.config),this.timeout=this.socket.timeout,this.joinPush=new Ace(this,_f.join,this.params,this.timeout),this.rejoinTimer=new Q6e(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=dd.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=dd.closed,this.socket._remove(this)}),this._onError(l=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,l),this.state=dd.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=dd.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",l=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,l),this.state=dd.errored,this.rejoinTimer.scheduleTimeout())}),this._on(_f.reply,{},(l,i)=>{this._trigger(this._replyEventName(i),l)}),this.presence=new ZA(this),this.broadcastEndpointURL=eLe(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(r,s=this.timeout){var n,a,o;if(this.socket.isConnected()||this.socket.connect(),this.state==dd.closed){const{config:{broadcast:l,presence:i,private:d}}=this.params,m=(a=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(b=>b.filter))!==null&&a!==void 0?a:[],g=!!this.bindings[YA.PRESENCE]&&this.bindings[YA.PRESENCE].length>0||((o=this.params.config.presence)===null||o===void 0?void 0:o.enabled)===!0,y={},v={broadcast:l,presence:Object.assign(Object.assign({},i),{enabled:g}),postgres_changes:m,private:d};this.socket.accessTokenValue&&(y.access_token=this.socket.accessTokenValue),this._onError(b=>r==null?void 0:r(Yx.CHANNEL_ERROR,b)),this._onClose(()=>r==null?void 0:r(Yx.CLOSED)),this.updateJoinPayload(Object.assign({config:v},y)),this.joinedOnce=!0,this._rejoin(s),this.joinPush.receive("ok",async({postgres_changes:b})=>{var N;if(this.socket.setAuth(),b===void 0){r==null||r(Yx.SUBSCRIBED);return}else{const j=this.bindings.postgres_changes,S=(N=j==null?void 0:j.length)!==null&&N!==void 0?N:0,A=[];for(let M=0;M{this.state=dd.errored,r==null||r(Yx.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(b).join(", ")||"error")))}).receive("timeout",()=>{r==null||r(Yx.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(r,s={}){return await this.send({type:"presence",event:"track",payload:r},s.timeout||this.timeout)}async untrack(r={}){return await this.send({type:"presence",event:"untrack"},r)}on(r,s,n){return this.state===dd.joined&&r===YA.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(r,s,n)}async httpSend(r,s,n={}){var a;const o=this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"";if(s==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:r,payload:s,private:this.private}]})},i=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(a=n.timeout)!==null&&a!==void 0?a:this.timeout);if(i.status===202)return{success:!0};let d=i.statusText;try{const m=await i.json();d=m.error||m.message||d}catch{}return Promise.reject(new Error(d))}async send(r,s={}){var n,a;if(!this._canPush()&&r.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}=r,d={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 m=await this._fetchWithTimeout(this.broadcastEndpointURL,d,(n=s.timeout)!==null&&n!==void 0?n:this.timeout);return await((a=m.body)===null||a===void 0?void 0:a.cancel()),m.ok?"ok":"error"}catch(m){return m.name==="AbortError"?"timed out":"error"}}else return new Promise(o=>{var l,i,d;const m=this._push(r.type,r,s.timeout||this.timeout);r.type==="broadcast"&&!(!((d=(i=(l=this.params)===null||l===void 0?void 0:l.config)===null||i===void 0?void 0:i.broadcast)===null||d===void 0)&&d.ack)&&o("ok"),m.receive("ok",()=>o("ok")),m.receive("error",()=>o("error")),m.receive("timeout",()=>o("timed out"))})}updateJoinPayload(r){this.joinPush.updatePayload(r)}unsubscribe(r=this.timeout){this.state=dd.leaving;const s=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(_f.close,"leave",this._joinRef())};this.joinPush.destroy();let n=null;return new Promise(a=>{n=new Ace(this,_f.leave,{},r),n.receive("ok",()=>{s(),a("ok")}).receive("timeout",()=>{s(),a("timed out")}).receive("error",()=>{a("error")}),n.send(),this._canPush()||n.trigger("ok",{})}).finally(()=>{n==null||n.destroy()})}teardown(){this.pushBuffer.forEach(r=>r.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=dd.closed,this.bindings={}}async _fetchWithTimeout(r,s,n){const a=new AbortController,o=setTimeout(()=>a.abort(),n),l=await this.socket.fetch(r,Object.assign(Object.assign({},s),{signal:a.signal}));return clearTimeout(o),l}_push(r,s,n=this.timeout){if(!this.joinedOnce)throw`tried to push '${r}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let a=new Ace(this,r,s,n);return this._canPush()?a.send():this._addToPushBuffer(a),a}_addToPushBuffer(r){if(r.startTimeout(),this.pushBuffer.push(r),this.pushBuffer.length>hnt){const s=this.pushBuffer.shift();s&&(s.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${s.event}`,s.payload))}}_onMessage(r,s,n){return s}_isMember(r){return this.topic===r}_joinRef(){return this.joinPush.ref}_trigger(r,s,n){var a,o;const l=r.toLocaleLowerCase(),{close:i,error:d,leave:m,join:g}=_f;if(n&&[i,d,m,g].indexOf(l)>=0&&n!==this._joinRef())return;let v=this._onMessage(l,s,n);if(s&&!v)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 N,j,S;return((N=b.filter)===null||N===void 0?void 0:N.event)==="*"||((S=(j=b.filter)===null||j===void 0?void 0:j.event)===null||S===void 0?void 0:S.toLocaleLowerCase())===l}).map(b=>b.callback(v,n)):(o=this.bindings[l])===null||o===void 0||o.filter(b=>{var N,j,S,A,M,I;if(["broadcast","presence","postgres_changes"].includes(l))if("id"in b){const F=b.id,O=(N=b.filter)===null||N===void 0?void 0:N.event;return F&&((j=s.ids)===null||j===void 0?void 0:j.includes(F))&&(O==="*"||(O==null?void 0:O.toLocaleLowerCase())===((S=s.data)===null||S===void 0?void 0:S.type.toLocaleLowerCase()))}else{const F=(M=(A=b==null?void 0:b.filter)===null||A===void 0?void 0:A.event)===null||M===void 0?void 0:M.toLocaleLowerCase();return F==="*"||F===((I=s==null?void 0:s.event)===null||I===void 0?void 0:I.toLocaleLowerCase())}else return b.type.toLocaleLowerCase()===l}).map(b=>{if(typeof v=="object"&&"ids"in v){const N=v.data,{schema:j,table:S,commit_timestamp:A,type:M,errors:I}=N;v=Object.assign(Object.assign({},{schema:j,table:S,commit_timestamp:A,eventType:M,new:{},old:{},errors:I}),this._getPayloadRecords(N))}b.callback(v,n)})}_isClosed(){return this.state===dd.closed}_isJoined(){return this.state===dd.joined}_isJoining(){return this.state===dd.joining}_isLeaving(){return this.state===dd.leaving}_replyEventName(r){return`chan_reply_${r}`}_on(r,s,n){const a=r.toLocaleLowerCase(),o={type:a,filter:s,callback:n};return this.bindings[a]?this.bindings[a].push(o):this.bindings[a]=[o],this}_off(r,s){const n=r.toLocaleLowerCase();return this.bindings[n]&&(this.bindings[n]=this.bindings[n].filter(a=>{var o;return!(((o=a.type)===null||o===void 0?void 0:o.toLocaleLowerCase())===n&&Rxe.isEqual(a.filter,s))})),this}static isEqual(r,s){if(Object.keys(r).length!==Object.keys(s).length)return!1;for(const n in r)if(r[n]!==s[n])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(r){this._on(_f.close,{},r)}_onError(r){this._on(_f.error,{},s=>r(s))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(r=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=dd.joining,this.joinPush.resend(r))}_getPayloadRecords(r){const s={new:{},old:{}};return(r.type==="INSERT"||r.type==="UPDATE")&&(s.new=Ske(r.columns,r.record)),(r.type==="UPDATE"||r.type==="DELETE")&&(s.old=Ske(r.columns,r.old_record)),s}}const Ece=()=>{},p8={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},_nt=[1e3,2e3,5e3,1e4],bnt=1e4,wnt=` addEventListener("message", (e) => { if (e.data.event === "start") { setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); } });`;class jnt{constructor(r,s){var n;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=tme,this.transport=null,this.heartbeatIntervalMs=p8.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=Ece,this.ref=0,this.reconnectTimer=null,this.logger=Ece,this.conn=null,this.sendBuffer=[],this.serializer=new mnt,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)=>F3(async()=>{const{default:i}=await Promise.resolve().then(()=>zk);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)},!(!((n=s==null?void 0:s.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=s.params.apikey,this.endPoint=`${r}/${rme.websocket}`,this.httpEndpoint=eLe(r),this._initializeOptions(s),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(s==null?void 0:s.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=ont.createWebSocket(this.endpointURL())}catch(r){this._setConnectionState("disconnected");const s=r.message;throw s.includes("Node.js")?new Error(`${s} 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: ${s}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:dnt}))}disconnect(r,s){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const n=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(n),this._setConnectionState("disconnected")},r?this.conn.close(r,s??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(r){const s=await r.unsubscribe();return this.channels.length===0&&this.disconnect(),s}async removeAllChannels(){const r=await Promise.all(this.channels.map(s=>s.unsubscribe()));return this.channels=[],this.disconnect(),r}log(r,s,n){this.logger(r,s,n)}connectionState(){switch(this.conn&&this.conn.readyState){case KA.connecting:return sj.Connecting;case KA.open:return sj.Open;case KA.closing:return sj.Closing;default:return sj.Closed}}isConnected(){return this.connectionState()===sj.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(r,s={config:{}}){const n=`realtime:${r}`,a=this.getChannels().find(o=>o.topic===n);if(a)return a;{const o=new Rxe(`realtime:${r}`,s,this);return this.channels.push(o),o}}push(r){const{topic:s,event:n,payload:a,ref:o}=r,l=()=>{this.encode(r,i=>{var d;(d=this.conn)===null||d===void 0||d.send(i)})};this.log("push",`${s} ${n} (${o})`,a),this.isConnected()?l():this.sendBuffer.push(l)}async setAuth(r=null){this._authPromise=this._performAuth(r);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var r;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(s){this.log("error","error in heartbeat callback",s)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(s){this.log("error","error in heartbeat callback",s)}this._wasManualDisconnect=!1,(r=this.conn)===null||r===void 0||r.close(unt,"heartbeat timeout"),setTimeout(()=>{var s;this.isConnected()||(s=this.reconnectTimer)===null||s===void 0||s.scheduleTimeout()},p8.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(s){this.log("error","error in heartbeat callback",s)}this._setAuthSafely("heartbeat")}onHeartbeat(r){this.heartbeatCallback=r}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(r=>r()),this.sendBuffer=[])}_makeRef(){let r=this.ref+1;return r===this.ref?this.ref=0:this.ref=r,this.ref.toString()}_leaveOpenTopic(r){let s=this.channels.find(n=>n.topic===r&&(n._isJoined()||n._isJoining()));s&&(this.log("transport",`leaving duplicate topic "${r}"`),s.unsubscribe())}_remove(r){this.channels=this.channels.filter(s=>s.topic!==r.topic)}_onConnMessage(r){this.decode(r.data,s=>{if(s.topic==="phoenix"&&s.event==="phx_reply")try{this.heartbeatCallback(s.payload.status==="ok"?"ok":"error")}catch(m){this.log("error","error in heartbeat callback",m)}s.ref&&s.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:n,event:a,payload:o,ref:l}=s,i=l?`(${l})`:"",d=o.status||"";this.log("receive",`${d} ${n} ${a} ${i}`.trim(),o),this.channels.filter(m=>m._isMember(n)).forEach(m=>m._trigger(a,o,l)),this._triggerStateCallbacks("message",s)})}_clearTimer(r){var s;r==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):r==="reconnect"&&((s=this.reconnectTimer)===null||s===void 0||s.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=r=>this._onConnError(r),this.conn.onmessage=r=>this._onConnMessage(r),this.conn.onclose=r=>this._onConnClose(r))}_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(r=>r.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 r=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(r),this.workerRef.onerror=s=>{this.log("worker","worker error",s.message),this.workerRef.terminate()},this.workerRef.onmessage=s=>{s.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(r){var s;this._setConnectionState("disconnected"),this.log("transport","close",r),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(s=this.reconnectTimer)===null||s===void 0||s.scheduleTimeout(),this._triggerStateCallbacks("close",r)}_onConnError(r){this._setConnectionState("disconnected"),this.log("transport",`${r}`),this._triggerChanError(),this._triggerStateCallbacks("error",r)}_triggerChanError(){this.channels.forEach(r=>r._trigger(_f.error))}_appendParams(r,s){if(Object.keys(s).length===0)return r;const n=r.match(/\?/)?"&":"?",a=new URLSearchParams(s);return`${r}${n}${a}`}_workerObjectUrl(r){let s;if(r)s=r;else{const n=new Blob([wnt],{type:"application/javascript"});s=URL.createObjectURL(n)}return s}_setConnectionState(r,s=!1){this._connectionState=r,r==="connecting"?this._wasManualDisconnect=!1:r==="disconnecting"&&(this._wasManualDisconnect=s)}async _performAuth(r=null){let s;r?s=r:this.accessToken?s=await this.accessToken():s=this.accessTokenValue,this.accessTokenValue!=s&&(this.accessTokenValue=s,this.channels.forEach(n=>{const a={access_token:s,version:cnt};s&&n.updateJoinPayload(a),n.joinedOnce&&n._isJoined()&&n._push(_f.access_token,{access_token:s})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(r="general"){this.setAuth().catch(s=>{this.log("error",`error setting auth in ${r}`,s)})}_triggerStateCallbacks(r,s){try{this.stateChangeCallbacks[r].forEach(n=>{try{n(s)}catch(a){this.log("error",`error in ${r} callback`,a)}})}catch(n){this.log("error",`error triggering ${r} callbacks`,n)}}_setupReconnectionTimer(){this.reconnectTimer=new Q6e(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},p8.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(r){var s,n,a,o,l,i,d,m,g;if(this.transport=(s=r==null?void 0:r.transport)!==null&&s!==void 0?s:null,this.timeout=(n=r==null?void 0:r.timeout)!==null&&n!==void 0?n:tme,this.heartbeatIntervalMs=(a=r==null?void 0:r.heartbeatIntervalMs)!==null&&a!==void 0?a:p8.HEARTBEAT_INTERVAL,this.worker=(o=r==null?void 0:r.worker)!==null&&o!==void 0?o:!1,this.accessToken=(l=r==null?void 0:r.accessToken)!==null&&l!==void 0?l:null,this.heartbeatCallback=(i=r==null?void 0:r.heartbeatCallback)!==null&&i!==void 0?i:Ece,r!=null&&r.params&&(this.params=r.params),r!=null&&r.logger&&(this.logger=r.logger),(r!=null&&r.logLevel||r!=null&&r.log_level)&&(this.logLevel=r.logLevel||r.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(d=r==null?void 0:r.reconnectAfterMs)!==null&&d!==void 0?d:y=>_nt[y-1]||bnt,this.encode=(m=r==null?void 0:r.encode)!==null&&m!==void 0?m:(y,v)=>v(JSON.stringify(y)),this.decode=(g=r==null?void 0:r.decode)!==null&&g!==void 0?g:this.serializer.decode.bind(this.serializer),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=r==null?void 0:r.workerUrl}}}class Fxe extends Error{constructor(r){super(r),this.__isStorageError=!0,this.name="StorageError"}}function Bl(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}class knt extends Fxe{constructor(r,s,n){super(r),this.name="StorageApiError",this.status=s,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class nme extends Fxe{constructor(r,s){super(r),this.name="StorageUnknownError",this.originalError=s}}const zxe=t=>{let r;return t?r=t:typeof fetch>"u"?r=(...s)=>F3(async()=>{const{default:n}=await Promise.resolve().then(()=>zk);return{default:n}},void 0).then(({default:n})=>n(...s)):r=fetch,(...s)=>r(...s)},Nnt=()=>Xn(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield F3(()=>Promise.resolve().then(()=>zk),void 0)).Response:Response}),ame=t=>{if(Array.isArray(t))return t.map(s=>ame(s));if(typeof t=="function"||t!==Object(t))return t;const r={};return Object.entries(t).forEach(([s,n])=>{const a=s.replace(/([-_][a-z])/gi,o=>o.toUpperCase().replace(/[-_]/g,""));r[a]=ame(n)}),r},Snt=t=>{if(typeof t!="object"||t===null)return!1;const r=Object.getPrototypeOf(t);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Ice=t=>{var r;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(r=t.error)===null||r===void 0?void 0:r.message)||JSON.stringify(t)},Cnt=(t,r,s)=>Xn(void 0,void 0,void 0,function*(){const n=yield Nnt();t instanceof n&&!(s!=null&&s.noResolveJson)?t.json().then(a=>{const o=t.status||500,l=(a==null?void 0:a.statusCode)||o+"";r(new knt(Ice(a),o,l))}).catch(a=>{r(new nme(Ice(a),a))}):r(new nme(Ice(t),t))}),Mnt=(t,r,s,n)=>{const a={method:t,headers:(r==null?void 0:r.headers)||{}};return t==="GET"||!n?a:(Snt(n)?(a.headers=Object.assign({"Content-Type":"application/json"},r==null?void 0:r.headers),a.body=JSON.stringify(n)):a.body=n,r!=null&&r.duplex&&(a.duplex=r.duplex),Object.assign(Object.assign({},a),s))};function pP(t,r,s,n,a,o){return Xn(this,void 0,void 0,function*(){return new Promise((l,i)=>{t(s,Mnt(r,n,a,o)).then(d=>{if(!d.ok)throw d;return n!=null&&n.noResolveJson?d:d.json()}).then(d=>l(d)).catch(d=>Cnt(d,i,n))})})}function VE(t,r,s,n){return Xn(this,void 0,void 0,function*(){return pP(t,"GET",r,s,n)})}function gf(t,r,s,n,a){return Xn(this,void 0,void 0,function*(){return pP(t,"POST",r,n,a,s)})}function ime(t,r,s,n,a){return Xn(this,void 0,void 0,function*(){return pP(t,"PUT",r,n,a,s)})}function Tnt(t,r,s,n){return Xn(this,void 0,void 0,function*(){return pP(t,"HEAD",r,Object.assign(Object.assign({},s),{noResolveJson:!0}),n)})}function Bxe(t,r,s,n,a){return Xn(this,void 0,void 0,function*(){return pP(t,"DELETE",r,n,a,s)})}class Ant{constructor(r,s){this.downloadFn=r,this.shouldThrowOnError=s}then(r,s){return this.execute().then(r,s)}execute(){return Xn(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Bl(r))return{data:null,error:r};throw r}})}}var tLe;class Ent{constructor(r,s){this.downloadFn=r,this.shouldThrowOnError=s,this[tLe]="BlobDownloadBuilder",this.promise=null}asStream(){return new Ant(this.downloadFn,this.shouldThrowOnError)}then(r,s){return this.getPromise().then(r,s)}catch(r){return this.getPromise().catch(r)}finally(r){return this.getPromise().finally(r)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}execute(){return Xn(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if(Bl(r))return{data:null,error:r};throw r}})}}tLe=Symbol.toStringTag;const Int={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Tke={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class Pnt{constructor(r,s={},n,a){this.shouldThrowOnError=!1,this.url=r,this.headers=s,this.bucketId=n,this.fetch=zxe(a)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(r,s,n,a){return Xn(this,void 0,void 0,function*(){try{let o;const l=Object.assign(Object.assign({},Tke),a);let i=Object.assign(Object.assign({},this.headers),r==="POST"&&{"x-upsert":String(l.upsert)});const d=l.metadata;typeof Blob<"u"&&n instanceof Blob?(o=new FormData,o.append("cacheControl",l.cacheControl),d&&o.append("metadata",this.encodeMetadata(d)),o.append("",n)):typeof FormData<"u"&&n instanceof FormData?(o=n,o.append("cacheControl",l.cacheControl),d&&o.append("metadata",this.encodeMetadata(d))):(o=n,i["cache-control"]=`max-age=${l.cacheControl}`,i["content-type"]=l.contentType,d&&(i["x-metadata"]=this.toBase64(this.encodeMetadata(d)))),a!=null&&a.headers&&(i=Object.assign(Object.assign({},i),a.headers));const m=this._removeEmptyFolders(s),g=this._getFinalPath(m),y=yield(r=="PUT"?ime:gf)(this.fetch,`${this.url}/object/${g}`,o,Object.assign({headers:i},l!=null&&l.duplex?{duplex:l.duplex}:{}));return{data:{path:m,id:y.Id,fullPath:y.Key},error:null}}catch(o){if(this.shouldThrowOnError)throw o;if(Bl(o))return{data:null,error:o};throw o}})}upload(r,s,n){return Xn(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",r,s,n)})}uploadToSignedUrl(r,s,n,a){return Xn(this,void 0,void 0,function*(){const o=this._removeEmptyFolders(r),l=this._getFinalPath(o),i=new URL(this.url+`/object/upload/sign/${l}`);i.searchParams.set("token",s);try{let d;const m=Object.assign({upsert:Tke.upsert},a),g=Object.assign(Object.assign({},this.headers),{"x-upsert":String(m.upsert)});typeof Blob<"u"&&n instanceof Blob?(d=new FormData,d.append("cacheControl",m.cacheControl),d.append("",n)):typeof FormData<"u"&&n instanceof FormData?(d=n,d.append("cacheControl",m.cacheControl)):(d=n,g["cache-control"]=`max-age=${m.cacheControl}`,g["content-type"]=m.contentType);const y=yield ime(this.fetch,i.toString(),d,{headers:g});return{data:{path:o,fullPath:y.Key},error:null}}catch(d){if(this.shouldThrowOnError)throw d;if(Bl(d))return{data:null,error:d};throw d}})}createSignedUploadUrl(r,s){return Xn(this,void 0,void 0,function*(){try{let n=this._getFinalPath(r);const a=Object.assign({},this.headers);s!=null&&s.upsert&&(a["x-upsert"]="true");const o=yield gf(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:a}),l=new URL(this.url+o.url),i=l.searchParams.get("token");if(!i)throw new Fxe("No token returned by API");return{data:{signedUrl:l.toString(),path:r,token:i},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Bl(n))return{data:null,error:n};throw n}})}update(r,s,n){return Xn(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",r,s,n)})}move(r,s,n){return Xn(this,void 0,void 0,function*(){try{return{data:yield gf(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:r,destinationKey:s,destinationBucket:n==null?void 0:n.destinationBucket},{headers:this.headers}),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Bl(a))return{data:null,error:a};throw a}})}copy(r,s,n){return Xn(this,void 0,void 0,function*(){try{return{data:{path:(yield gf(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:r,destinationKey:s,destinationBucket:n==null?void 0:n.destinationBucket},{headers:this.headers})).Key},error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Bl(a))return{data:null,error:a};throw a}})}createSignedUrl(r,s,n){return Xn(this,void 0,void 0,function*(){try{let a=this._getFinalPath(r),o=yield gf(this.fetch,`${this.url}/object/sign/${a}`,Object.assign({expiresIn:s},n!=null&&n.transform?{transform:n.transform}:{}),{headers:this.headers});const l=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return o={signedUrl:encodeURI(`${this.url}${o.signedURL}${l}`)},{data:o,error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Bl(a))return{data:null,error:a};throw a}})}createSignedUrls(r,s,n){return Xn(this,void 0,void 0,function*(){try{const a=yield gf(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:s,paths:r},{headers:this.headers}),o=n!=null&&n.download?`&download=${n.download===!0?"":n.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(Bl(a))return{data:null,error:a};throw a}})}download(r,s){const a=typeof(s==null?void 0:s.transform)<"u"?"render/image/authenticated":"object",o=this.transformOptsToQueryString((s==null?void 0:s.transform)||{}),l=o?`?${o}`:"",i=this._getFinalPath(r),d=()=>VE(this.fetch,`${this.url}/${a}/${i}${l}`,{headers:this.headers,noResolveJson:!0});return new Ent(d,this.shouldThrowOnError)}info(r){return Xn(this,void 0,void 0,function*(){const s=this._getFinalPath(r);try{const n=yield VE(this.fetch,`${this.url}/object/info/${s}`,{headers:this.headers});return{data:ame(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Bl(n))return{data:null,error:n};throw n}})}exists(r){return Xn(this,void 0,void 0,function*(){const s=this._getFinalPath(r);try{return yield Tnt(this.fetch,`${this.url}/object/${s}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Bl(n)&&n instanceof nme){const a=n.originalError;if([400,404].includes(a==null?void 0:a.status))return{data:!1,error:n}}throw n}})}getPublicUrl(r,s){const n=this._getFinalPath(r),a=[],o=s!=null&&s.download?`download=${s.download===!0?"":s.download}`:"";o!==""&&a.push(o);const i=typeof(s==null?void 0:s.transform)<"u"?"render/image":"object",d=this.transformOptsToQueryString((s==null?void 0:s.transform)||{});d!==""&&a.push(d);let m=a.join("&");return m!==""&&(m=`?${m}`),{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${n}${m}`)}}}remove(r){return Xn(this,void 0,void 0,function*(){try{return{data:yield Bxe(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:r},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Bl(s))return{data:null,error:s};throw s}})}list(r,s,n){return Xn(this,void 0,void 0,function*(){try{const a=Object.assign(Object.assign(Object.assign({},Int),s),{prefix:r||""});return{data:yield gf(this.fetch,`${this.url}/object/list/${this.bucketId}`,a,{headers:this.headers},n),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Bl(a))return{data:null,error:a};throw a}})}listV2(r,s){return Xn(this,void 0,void 0,function*(){try{const n=Object.assign({},r);return{data:yield gf(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,n,{headers:this.headers},s),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Bl(n))return{data:null,error:n};throw n}})}encodeMetadata(r){return JSON.stringify(r)}toBase64(r){return typeof Buffer<"u"?Buffer.from(r).toString("base64"):btoa(r)}_getFinalPath(r){return`${this.bucketId}/${r.replace(/^\/+/,"")}`}_removeEmptyFolders(r){return r.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(r){const s=[];return r.width&&s.push(`width=${r.width}`),r.height&&s.push(`height=${r.height}`),r.resize&&s.push(`resize=${r.resize}`),r.format&&s.push(`format=${r.format}`),r.quality&&s.push(`quality=${r.quality}`),s.join("&")}}const rLe="2.78.0",sLe={"X-Client-Info":`storage-js/${rLe}`};class Lnt{constructor(r,s={},n,a){this.shouldThrowOnError=!1;const o=new URL(r);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({},sLe),s),this.fetch=zxe(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(r){return Xn(this,void 0,void 0,function*(){try{const s=this.listBucketOptionsToQueryString(r);return{data:yield VE(this.fetch,`${this.url}/bucket${s}`,{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Bl(s))return{data:null,error:s};throw s}})}getBucket(r){return Xn(this,void 0,void 0,function*(){try{return{data:yield VE(this.fetch,`${this.url}/bucket/${r}`,{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Bl(s))return{data:null,error:s};throw s}})}createBucket(r){return Xn(this,arguments,void 0,function*(s,n={public:!1}){try{return{data:yield gf(this.fetch,`${this.url}/bucket`,{id:s,name:s,type:n.type,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Bl(a))return{data:null,error:a};throw a}})}updateBucket(r,s){return Xn(this,void 0,void 0,function*(){try{return{data:yield ime(this.fetch,`${this.url}/bucket/${r}`,{id:r,name:r,public:s.public,file_size_limit:s.fileSizeLimit,allowed_mime_types:s.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Bl(n))return{data:null,error:n};throw n}})}emptyBucket(r){return Xn(this,void 0,void 0,function*(){try{return{data:yield gf(this.fetch,`${this.url}/bucket/${r}/empty`,{},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Bl(s))return{data:null,error:s};throw s}})}deleteBucket(r){return Xn(this,void 0,void 0,function*(){try{return{data:yield Bxe(this.fetch,`${this.url}/bucket/${r}`,{},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Bl(s))return{data:null,error:s};throw s}})}listBucketOptionsToQueryString(r){const s={};return r&&("limit"in r&&(s.limit=String(r.limit)),"offset"in r&&(s.offset=String(r.offset)),r.search&&(s.search=r.search),r.sortColumn&&(s.sortColumn=r.sortColumn),r.sortOrder&&(s.sortOrder=r.sortOrder)),Object.keys(s).length>0?"?"+new URLSearchParams(s).toString():""}}class Ont{constructor(r,s={},n){this.shouldThrowOnError=!1,this.url=r.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},sLe),s),this.fetch=zxe(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(r){return Xn(this,void 0,void 0,function*(){try{return{data:yield gf(this.fetch,`${this.url}/bucket`,{name:r},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Bl(s))return{data:null,error:s};throw s}})}listBuckets(r){return Xn(this,void 0,void 0,function*(){try{const s=new URLSearchParams;(r==null?void 0:r.limit)!==void 0&&s.set("limit",r.limit.toString()),(r==null?void 0:r.offset)!==void 0&&s.set("offset",r.offset.toString()),r!=null&&r.sortColumn&&s.set("sortColumn",r.sortColumn),r!=null&&r.sortOrder&&s.set("sortOrder",r.sortOrder),r!=null&&r.search&&s.set("search",r.search);const n=s.toString(),a=n?`${this.url}/bucket?${n}`:`${this.url}/bucket`;return{data:yield VE(this.fetch,a,{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Bl(s))return{data:null,error:s};throw s}})}deleteBucket(r){return Xn(this,void 0,void 0,function*(){try{return{data:yield Bxe(this.fetch,`${this.url}/bucket/${r}`,{},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Bl(s))return{data:null,error:s};throw s}})}}const $xe={"X-Client-Info":`storage-js/${rLe}`,"Content-Type":"application/json"};class nLe extends Error{constructor(r){super(r),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}}function um(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}class Pce extends nLe{constructor(r,s,n){super(r),this.name="StorageVectorsApiError",this.status=s,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class Dnt extends nLe{constructor(r,s){super(r),this.name="StorageVectorsUnknownError",this.originalError=s}}var Ake;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(Ake||(Ake={}));const Uxe=t=>{let r;return t?r=t:typeof fetch>"u"?r=(...s)=>F3(async()=>{const{default:n}=await Promise.resolve().then(()=>zk);return{default:n}},void 0).then(({default:n})=>n(...s)):r=fetch,(...s)=>r(...s)},Rnt=t=>{if(typeof t!="object"||t===null)return!1;const r=Object.getPrototypeOf(t);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Eke=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),Fnt=(t,r,s)=>Xn(void 0,void 0,void 0,function*(){if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!(s!=null&&s.noResolveJson)){const a=t.status||500,o=t;if(typeof o.json=="function")o.json().then(l=>{const i=(l==null?void 0:l.statusCode)||(l==null?void 0:l.code)||a+"";r(new Pce(Eke(l),a,i))}).catch(()=>{const l=a+"",i=o.statusText||`HTTP ${a} error`;r(new Pce(i,a,l))});else{const l=a+"",i=o.statusText||`HTTP ${a} error`;r(new Pce(i,a,l))}}else r(new Dnt(Eke(t),t))}),znt=(t,r,s,n)=>{const a={method:t,headers:(r==null?void 0:r.headers)||{}};return n?(Rnt(n)?(a.headers=Object.assign({"Content-Type":"application/json"},r==null?void 0:r.headers),a.body=JSON.stringify(n)):a.body=n,Object.assign(Object.assign({},a),s)):a};function Bnt(t,r,s,n,a,o){return Xn(this,void 0,void 0,function*(){return new Promise((l,i)=>{t(s,znt(r,n,a,o)).then(d=>{if(!d.ok)throw d;if(n!=null&&n.noResolveJson)return d;const m=d.headers.get("content-type");return!m||!m.includes("application/json")?{}:d.json()}).then(d=>l(d)).catch(d=>Fnt(d,i,n))})})}function hm(t,r,s,n,a){return Xn(this,void 0,void 0,function*(){return Bnt(t,"POST",r,n,a,s)})}class $nt{constructor(r,s={},n){this.shouldThrowOnError=!1,this.url=r.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},$xe),s),this.fetch=Uxe(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(r){return Xn(this,void 0,void 0,function*(){try{return{data:(yield hm(this.fetch,`${this.url}/CreateIndex`,r,{headers:this.headers}))||{},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(um(s))return{data:null,error:s};throw s}})}getIndex(r,s){return Xn(this,void 0,void 0,function*(){try{return{data:yield hm(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:r,indexName:s},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(um(n))return{data:null,error:n};throw n}})}listIndexes(r){return Xn(this,void 0,void 0,function*(){try{return{data:yield hm(this.fetch,`${this.url}/ListIndexes`,r,{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(um(s))return{data:null,error:s};throw s}})}deleteIndex(r,s){return Xn(this,void 0,void 0,function*(){try{return{data:(yield hm(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:r,indexName:s},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(um(n))return{data:null,error:n};throw n}})}}class Unt{constructor(r,s={},n){this.shouldThrowOnError=!1,this.url=r.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},$xe),s),this.fetch=Uxe(n)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(r){return Xn(this,void 0,void 0,function*(){try{if(r.vectors.length<1||r.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:(yield hm(this.fetch,`${this.url}/PutVectors`,r,{headers:this.headers}))||{},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(um(s))return{data:null,error:s};throw s}})}getVectors(r){return Xn(this,void 0,void 0,function*(){try{return{data:yield hm(this.fetch,`${this.url}/GetVectors`,r,{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(um(s))return{data:null,error:s};throw s}})}listVectors(r){return Xn(this,void 0,void 0,function*(){try{if(r.segmentCount!==void 0){if(r.segmentCount<1||r.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(r.segmentIndex!==void 0&&(r.segmentIndex<0||r.segmentIndex>=r.segmentCount))throw new Error(`segmentIndex must be between 0 and ${r.segmentCount-1}`)}return{data:yield hm(this.fetch,`${this.url}/ListVectors`,r,{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(um(s))return{data:null,error:s};throw s}})}queryVectors(r){return Xn(this,void 0,void 0,function*(){try{return{data:yield hm(this.fetch,`${this.url}/QueryVectors`,r,{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(um(s))return{data:null,error:s};throw s}})}deleteVectors(r){return Xn(this,void 0,void 0,function*(){try{if(r.keys.length<1||r.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:(yield hm(this.fetch,`${this.url}/DeleteVectors`,r,{headers:this.headers}))||{},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(um(s))return{data:null,error:s};throw s}})}}class qnt{constructor(r,s={},n){this.shouldThrowOnError=!1,this.url=r.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},$xe),s),this.fetch=Uxe(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(r){return Xn(this,void 0,void 0,function*(){try{return{data:(yield hm(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:r},{headers:this.headers}))||{},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(um(s))return{data:null,error:s};throw s}})}getBucket(r){return Xn(this,void 0,void 0,function*(){try{return{data:yield hm(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:r},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(um(s))return{data:null,error:s};throw s}})}listBuckets(){return Xn(this,arguments,void 0,function*(r={}){try{return{data:yield hm(this.fetch,`${this.url}/ListVectorBuckets`,r,{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(um(s))return{data:null,error:s};throw s}})}deleteBucket(r){return Xn(this,void 0,void 0,function*(){try{return{data:(yield hm(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:r},{headers:this.headers}))||{},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(um(s))return{data:null,error:s};throw s}})}}class Vnt extends qnt{constructor(r,s={}){super(r,s.headers||{},s.fetch)}from(r){return new Hnt(this.url,this.headers,r,this.fetch)}}class Hnt extends $nt{constructor(r,s,n,a){super(r,s,a),this.vectorBucketName=n}createIndex(r){const s=Object.create(null,{createIndex:{get:()=>super.createIndex}});return Xn(this,void 0,void 0,function*(){return s.createIndex.call(this,Object.assign(Object.assign({},r),{vectorBucketName:this.vectorBucketName}))})}listIndexes(){const r=Object.create(null,{listIndexes:{get:()=>super.listIndexes}});return Xn(this,arguments,void 0,function*(s={}){return r.listIndexes.call(this,Object.assign(Object.assign({},s),{vectorBucketName:this.vectorBucketName}))})}getIndex(r){const s=Object.create(null,{getIndex:{get:()=>super.getIndex}});return Xn(this,void 0,void 0,function*(){return s.getIndex.call(this,this.vectorBucketName,r)})}deleteIndex(r){const s=Object.create(null,{deleteIndex:{get:()=>super.deleteIndex}});return Xn(this,void 0,void 0,function*(){return s.deleteIndex.call(this,this.vectorBucketName,r)})}index(r){return new Wnt(this.url,this.headers,this.vectorBucketName,r,this.fetch)}}class Wnt extends Unt{constructor(r,s,n,a,o){super(r,s,o),this.vectorBucketName=n,this.indexName=a}putVectors(r){const s=Object.create(null,{putVectors:{get:()=>super.putVectors}});return Xn(this,void 0,void 0,function*(){return s.putVectors.call(this,Object.assign(Object.assign({},r),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}getVectors(r){const s=Object.create(null,{getVectors:{get:()=>super.getVectors}});return Xn(this,void 0,void 0,function*(){return s.getVectors.call(this,Object.assign(Object.assign({},r),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}listVectors(){const r=Object.create(null,{listVectors:{get:()=>super.listVectors}});return Xn(this,arguments,void 0,function*(s={}){return r.listVectors.call(this,Object.assign(Object.assign({},s),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}queryVectors(r){const s=Object.create(null,{queryVectors:{get:()=>super.queryVectors}});return Xn(this,void 0,void 0,function*(){return s.queryVectors.call(this,Object.assign(Object.assign({},r),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}deleteVectors(r){const s=Object.create(null,{deleteVectors:{get:()=>super.deleteVectors}});return Xn(this,void 0,void 0,function*(){return s.deleteVectors.call(this,Object.assign(Object.assign({},r),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}}class Gnt extends Lnt{constructor(r,s={},n,a){super(r,s,n,a)}from(r){return new Pnt(this.url,this.headers,r,this.fetch)}get vectors(){return new Vnt(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Ont(this.url+"/iceberg",this.headers,this.fetch)}}const Knt="2.78.0";let WT="";typeof Deno<"u"?WT="deno":typeof document<"u"?WT="web":typeof navigator<"u"&&navigator.product==="ReactNative"?WT="react-native":WT="node";const Znt={"X-Client-Info":`supabase-js-${WT}/${Knt}`},Ynt={headers:Znt},Xnt={schema:"public"},Qnt={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Jnt={},eat=t=>{let r;return t?r=t:typeof fetch>"u"?r=P6e:r=fetch,(...s)=>r(...s)},tat=()=>typeof Headers>"u"?L6e:Headers,rat=(t,r,s)=>{const n=eat(s),a=tat();return async(o,l)=>{var i;const d=(i=await r())!==null&&i!==void 0?i:t;let m=new a(l==null?void 0:l.headers);return m.has("apikey")||m.set("apikey",t),m.has("Authorization")||m.set("Authorization",`Bearer ${d}`),n(o,Object.assign(Object.assign({},l),{headers:m}))}};function sat(t){return t.endsWith("/")?t:t+"/"}function nat(t,r){var s,n;const{db:a,auth:o,realtime:l,global:i}=t,{db:d,auth:m,realtime:g,global:y}=r,v={db:Object.assign(Object.assign({},d),a),auth:Object.assign(Object.assign({},m),o),realtime:Object.assign(Object.assign({},g),l),storage:{},global:Object.assign(Object.assign(Object.assign({},y),i),{headers:Object.assign(Object.assign({},(s=y==null?void 0:y.headers)!==null&&s!==void 0?s:{}),(n=i==null?void 0:i.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?v.accessToken=t.accessToken:delete v.accessToken,v}function aat(t){const r=t==null?void 0:t.trim();if(!r)throw new Error("supabaseUrl is required.");if(!r.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(sat(r))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const aLe="2.78.0",X4=30*1e3,ome=3,Lce=ome*X4,iat="http://localhost:9999",oat="supabase.auth.token",lat={"X-Client-Info":`gotrue-js/${aLe}`},lme="X-Supabase-Api-Version",iLe={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},cat=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,dat=10*60*1e3;class HE extends Error{constructor(r,s,n){super(r),this.__isAuthError=!0,this.name="AuthError",this.status=s,this.code=n}}function ma(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class uat extends HE{constructor(r,s,n){super(r,s,n),this.name="AuthApiError",this.status=s,this.code=n}}function hat(t){return ma(t)&&t.name==="AuthApiError"}class nj extends HE{constructor(r,s){super(r),this.name="AuthUnknownError",this.originalError=s}}class Tv extends HE{constructor(r,s,n,a){super(r,n,a),this.name=s,this.status=n}}class uf extends Tv{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function mat(t){return ma(t)&&t.name==="AuthSessionMissingError"}class I4 extends Tv{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class f8 extends Tv{constructor(r){super(r,"AuthInvalidCredentialsError",400,void 0)}}class g8 extends Tv{constructor(r,s=null){super(r,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=s}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function pat(t){return ma(t)&&t.name==="AuthImplicitGrantRedirectError"}class Ike extends Tv{constructor(r,s=null){super(r,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=s}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class cme extends Tv{constructor(r,s){super(r,"AuthRetryableFetchError",s,void 0)}}function Oce(t){return ma(t)&&t.name==="AuthRetryableFetchError"}class Pke extends Tv{constructor(r,s,n){super(r,"AuthWeakPasswordError",s,"weak_password"),this.reasons=n}}class dme extends Tv{constructor(r){super(r,"AuthInvalidJwtError",400,"invalid_jwt")}}const $te="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Lke=` \r=`.split(""),fat=(()=>{const t=new Array(128);for(let r=0;r=6;){const n=r.queue>>r.queuedBits-6&63;s($te[n]),r.queuedBits-=6}else if(r.queuedBits>0)for(r.queue=r.queue<<6-r.queuedBits,r.queuedBits=6;r.queuedBits>=6;){const n=r.queue>>r.queuedBits-6&63;s($te[n]),r.queuedBits-=6}}function oLe(t,r,s){const n=fat[t];if(n>-1)for(r.queue=r.queue<<6|n,r.queuedBits+=6;r.queuedBits>=8;)s(r.queue>>r.queuedBits-8&255),r.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function Dke(t){const r=[],s=l=>{r.push(String.fromCodePoint(l))},n={utf8seq:0,codepoint:0},a={queue:0,queuedBits:0},o=l=>{yat(l,n,s)};for(let l=0;l>6),r(128|t&63);return}else if(t<=65535){r(224|t>>12),r(128|t>>6&63),r(128|t&63);return}else if(t<=1114111){r(240|t>>18),r(128|t>>12&63),r(128|t>>6&63),r(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function xat(t,r){for(let s=0;s55295&&n<=56319){const a=(n-55296)*1024&65535;n=(t.charCodeAt(s+1)-56320&65535|a)+65536,s+=1}gat(n,r)}}function yat(t,r,s){if(r.utf8seq===0){if(t<=127){s(t);return}for(let n=1;n<6;n+=1)if(!(t>>7-n&1)){r.utf8seq=n;break}if(r.utf8seq===2)r.codepoint=t&31;else if(r.utf8seq===3)r.codepoint=t&15;else if(r.utf8seq===4)r.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");r.utf8seq-=1}else if(r.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");r.codepoint=r.codepoint<<6|t&63,r.utf8seq-=1,r.utf8seq===0&&s(r.codepoint)}}function nC(t){const r=[],s={queue:0,queuedBits:0},n=a=>{r.push(a)};for(let a=0;ar.push(s)),new Uint8Array(r)}function uj(t){const r=[],s={queue:0,queuedBits:0},n=a=>{r.push(a)};return t.forEach(a=>Oke(a,s,n)),Oke(null,s,n),r.join("")}function _at(t){return Math.round(Date.now()/1e3)+t}function bat(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const r=Math.random()*16|0;return(t=="x"?r:r&3|8).toString(16)})}const Wu=()=>typeof window<"u"&&typeof document<"u",E_={tested:!1,writable:!1},lLe=()=>{if(!Wu())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(E_.tested)return E_.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),E_.tested=!0,E_.writable=!0}catch{E_.tested=!0,E_.writable=!1}return E_.writable};function wat(t){const r={},s=new URL(t);if(s.hash&&s.hash[0]==="#")try{new URLSearchParams(s.hash.substring(1)).forEach((a,o)=>{r[o]=a})}catch{}return s.searchParams.forEach((n,a)=>{r[a]=n}),r}const cLe=t=>{let r;return t?r=t:typeof fetch>"u"?r=(...s)=>F3(async()=>{const{default:n}=await Promise.resolve().then(()=>zk);return{default:n}},void 0).then(({default:n})=>n(...s)):r=fetch,(...s)=>r(...s)},jat=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",Q4=async(t,r,s)=>{await t.setItem(r,JSON.stringify(s))},I_=async(t,r)=>{const s=await t.getItem(r);if(!s)return null;try{return JSON.parse(s)}catch{return s}},$0=async(t,r)=>{await t.removeItem(r)};class Pne{constructor(){this.promise=new Pne.promiseConstructor((r,s)=>{this.resolve=r,this.reject=s})}}Pne.promiseConstructor=Promise;function Dce(t){const r=t.split(".");if(r.length!==3)throw new dme("Invalid JWT structure");for(let n=0;n{setTimeout(()=>r(null),t)})}function Nat(t,r){return new Promise((n,a)=>{(async()=>{for(let o=0;o<1/0;o++)try{const l=await t(o);if(!r(o,null,l)){n(l);return}}catch(l){if(!r(o,l)){a(l);return}}})()})}function Sat(t){return("0"+t.toString(16)).substr(-2)}function Cat(){const r=new Uint32Array(56);if(typeof crypto>"u"){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=s.length;let a="";for(let o=0;o<56;o++)a+=s.charAt(Math.floor(Math.random()*n));return a}return crypto.getRandomValues(r),Array.from(r,Sat).join("")}async function Mat(t){const s=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",s),a=new Uint8Array(n);return Array.from(a).map(o=>String.fromCharCode(o)).join("")}async function Tat(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const s=await Mat(t);return btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function P4(t,r,s=!1){const n=Cat();let a=n;s&&(a+="/PASSWORD_RECOVERY"),await Q4(t,`${r}-code-verifier`,a);const o=await Tat(n);return[o,n===o?"plain":"s256"]}const Aat=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Eat(t){const r=t.headers.get(lme);if(!r||!r.match(Aat))return null;try{return new Date(`${r}T00:00:00.0Z`)}catch{return null}}function Iat(t){if(!t)throw new Error("Missing exp claim");const r=Math.floor(Date.now()/1e3);if(t<=r)throw new Error("JWT has expired")}function Pat(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const Lat=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function L4(t){if(!Lat.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Rce(){const t={};return new Proxy(t,{get:(r,s)=>{if(s==="__isUserNotAvailableProxy")return!0;if(typeof s=="symbol"){const n=s.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="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 "${s}" property of the session object is not supported. Please use getUser() instead.`)},set:(r,s)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${s}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(r,s)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${s}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function Oat(t,r){return new Proxy(t,{get:(s,n,a)=>{if(n==="__isInsecureUserWarningProxy")return!0;if(typeof n=="symbol"){const o=n.toString();if(o==="Symbol(Symbol.toPrimitive)"||o==="Symbol(Symbol.toStringTag)"||o==="Symbol(util.inspect.custom)"||o==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(s,n,a)}return!r.value&&typeof n=="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."),r.value=!0),Reflect.get(s,n,a)}})}function Rke(t){return JSON.parse(JSON.stringify(t))}const Qw=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),Dat=[502,503,504];async function Fke(t){var r;if(!jat(t))throw new cme(Qw(t),0);if(Dat.includes(t.status))throw new cme(Qw(t),t.status);let s;try{s=await t.json()}catch(o){throw new nj(Qw(o),o)}let n;const a=Eat(t);if(a&&a.getTime()>=iLe["2024-01-01"].timestamp&&typeof s=="object"&&s&&typeof s.code=="string"?n=s.code:typeof s=="object"&&s&&typeof s.error_code=="string"&&(n=s.error_code),n){if(n==="weak_password")throw new Pke(Qw(s),t.status,((r=s.weak_password)===null||r===void 0?void 0:r.reasons)||[]);if(n==="session_not_found")throw new uf}else if(typeof s=="object"&&s&&typeof s.weak_password=="object"&&s.weak_password&&Array.isArray(s.weak_password.reasons)&&s.weak_password.reasons.length&&s.weak_password.reasons.reduce((o,l)=>o&&typeof l=="string",!0))throw new Pke(Qw(s),t.status,s.weak_password.reasons);throw new uat(Qw(s),t.status||500,n)}const Rat=(t,r,s,n)=>{const a={method:t,headers:(r==null?void 0:r.headers)||{}};return t==="GET"?a:(a.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},r==null?void 0:r.headers),a.body=JSON.stringify(n),Object.assign(Object.assign({},a),s))};async function Ha(t,r,s,n){var a;const o=Object.assign({},n==null?void 0:n.headers);o[lme]||(o[lme]=iLe["2024-01-01"].name),n!=null&&n.jwt&&(o.Authorization=`Bearer ${n.jwt}`);const l=(a=n==null?void 0:n.query)!==null&&a!==void 0?a:{};n!=null&&n.redirectTo&&(l.redirect_to=n.redirectTo);const i=Object.keys(l).length?"?"+new URLSearchParams(l).toString():"",d=await Fat(t,r,s+i,{headers:o,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(d):{data:Object.assign({},d),error:null}}async function Fat(t,r,s,n,a,o){const l=Rat(r,n,a,o);let i;try{i=await t(s,Object.assign({},l))}catch(d){throw console.error(d),new cme(Qw(d),0)}if(i.ok||await Fke(i),n!=null&&n.noResolveJson)return i;try{return await i.json()}catch(d){await Fke(d)}}function hf(t){var r;let s=null;$at(t)&&(s=Object.assign({},t),t.expires_at||(s.expires_at=_at(t.expires_in)));const n=(r=t.user)!==null&&r!==void 0?r:t;return{data:{session:s,user:n},error:null}}function zke(t){const r=hf(t);return!r.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((s,n)=>s&&typeof n=="string",!0)&&(r.data.weak_password=t.weak_password),r}function h1(t){var r;return{data:{user:(r=t.user)!==null&&r!==void 0?r:t},error:null}}function zat(t){return{data:t,error:null}}function Bat(t){const{action_link:r,email_otp:s,hashed_token:n,redirect_to:a,verification_type:o}=t,l=Mv(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),i={action_link:r,email_otp:s,hashed_token:n,redirect_to:a,verification_type:o},d=Object.assign({},l);return{data:{properties:i,user:d},error:null}}function Bke(t){return t}function $at(t){return t.access_token&&t.refresh_token&&t.expires_in}const Fce=["global","local","others"];class Uat{constructor({url:r="",headers:s={},fetch:n}){this.url=r,this.headers=s,this.fetch=cLe(n),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(r,s=Fce[0]){if(Fce.indexOf(s)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Fce.join(", ")}`);try{return await Ha(this.fetch,"POST",`${this.url}/logout?scope=${s}`,{headers:this.headers,jwt:r,noResolveJson:!0}),{data:null,error:null}}catch(n){if(ma(n))return{data:null,error:n};throw n}}async inviteUserByEmail(r,s={}){try{return await Ha(this.fetch,"POST",`${this.url}/invite`,{body:{email:r,data:s.data},headers:this.headers,redirectTo:s.redirectTo,xform:h1})}catch(n){if(ma(n))return{data:{user:null},error:n};throw n}}async generateLink(r){try{const{options:s}=r,n=Mv(r,["options"]),a=Object.assign(Object.assign({},n),s);return"newEmail"in n&&(a.new_email=n==null?void 0:n.newEmail,delete a.newEmail),await Ha(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:a,headers:this.headers,xform:Bat,redirectTo:s==null?void 0:s.redirectTo})}catch(s){if(ma(s))return{data:{properties:null,user:null},error:s};throw s}}async createUser(r){try{return await Ha(this.fetch,"POST",`${this.url}/admin/users`,{body:r,headers:this.headers,xform:h1})}catch(s){if(ma(s))return{data:{user:null},error:s};throw s}}async listUsers(r){var s,n,a,o,l,i,d;try{const m={nextPage:null,lastPage:0,total:0},g=await Ha(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(s=r==null?void 0:r.page)===null||s===void 0?void 0:s.toString())!==null&&n!==void 0?n:"",per_page:(o=(a=r==null?void 0:r.perPage)===null||a===void 0?void 0:a.toString())!==null&&o!==void 0?o:""},xform:Bke});if(g.error)throw g.error;const y=await g.json(),v=(l=g.headers.get("x-total-count"))!==null&&l!==void 0?l:0,b=(d=(i=g.headers.get("link"))===null||i===void 0?void 0:i.split(","))!==null&&d!==void 0?d:[];return b.length>0&&(b.forEach(N=>{const j=parseInt(N.split(";")[0].split("=")[1].substring(0,1)),S=JSON.parse(N.split(";")[1].split("=")[1]);m[`${S}Page`]=j}),m.total=parseInt(v)),{data:Object.assign(Object.assign({},y),m),error:null}}catch(m){if(ma(m))return{data:{users:[]},error:m};throw m}}async getUserById(r){L4(r);try{return await Ha(this.fetch,"GET",`${this.url}/admin/users/${r}`,{headers:this.headers,xform:h1})}catch(s){if(ma(s))return{data:{user:null},error:s};throw s}}async updateUserById(r,s){L4(r);try{return await Ha(this.fetch,"PUT",`${this.url}/admin/users/${r}`,{body:s,headers:this.headers,xform:h1})}catch(n){if(ma(n))return{data:{user:null},error:n};throw n}}async deleteUser(r,s=!1){L4(r);try{return await Ha(this.fetch,"DELETE",`${this.url}/admin/users/${r}`,{headers:this.headers,body:{should_soft_delete:s},xform:h1})}catch(n){if(ma(n))return{data:{user:null},error:n};throw n}}async _listFactors(r){L4(r.userId);try{const{data:s,error:n}=await Ha(this.fetch,"GET",`${this.url}/admin/users/${r.userId}/factors`,{headers:this.headers,xform:a=>({data:{factors:a},error:null})});return{data:s,error:n}}catch(s){if(ma(s))return{data:null,error:s};throw s}}async _deleteFactor(r){L4(r.userId),L4(r.id);try{return{data:await Ha(this.fetch,"DELETE",`${this.url}/admin/users/${r.userId}/factors/${r.id}`,{headers:this.headers}),error:null}}catch(s){if(ma(s))return{data:null,error:s};throw s}}async _listOAuthClients(r){var s,n,a,o,l,i,d;try{const m={nextPage:null,lastPage:0,total:0},g=await Ha(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(s=r==null?void 0:r.page)===null||s===void 0?void 0:s.toString())!==null&&n!==void 0?n:"",per_page:(o=(a=r==null?void 0:r.perPage)===null||a===void 0?void 0:a.toString())!==null&&o!==void 0?o:""},xform:Bke});if(g.error)throw g.error;const y=await g.json(),v=(l=g.headers.get("x-total-count"))!==null&&l!==void 0?l:0,b=(d=(i=g.headers.get("link"))===null||i===void 0?void 0:i.split(","))!==null&&d!==void 0?d:[];return b.length>0&&(b.forEach(N=>{const j=parseInt(N.split(";")[0].split("=")[1].substring(0,1)),S=JSON.parse(N.split(";")[1].split("=")[1]);m[`${S}Page`]=j}),m.total=parseInt(v)),{data:Object.assign(Object.assign({},y),m),error:null}}catch(m){if(ma(m))return{data:{clients:[]},error:m};throw m}}async _createOAuthClient(r){try{return await Ha(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:r,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(ma(s))return{data:null,error:s};throw s}}async _getOAuthClient(r){try{return await Ha(this.fetch,"GET",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(ma(s))return{data:null,error:s};throw s}}async _updateOAuthClient(r,s){try{return await Ha(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${r}`,{body:s,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ma(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(r){try{return await Ha(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(ma(s))return{data:null,error:s};throw s}}async _regenerateOAuthClientSecret(r){try{return await Ha(this.fetch,"POST",`${this.url}/admin/oauth/clients/${r}/regenerate_secret`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(ma(s))return{data:null,error:s};throw s}}}function $ke(t={}){return{getItem:r=>t[r]||null,setItem:(r,s)=>{t[r]=s},removeItem:r=>{delete t[r]}}}const O4={debug:!!(globalThis&&lLe()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class dLe extends Error{constructor(r){super(r),this.isAcquireTimeout=!0}}class qat extends dLe{}async function Vat(t,r,s){O4.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,r);const n=new globalThis.AbortController;return r>0&&setTimeout(()=>{n.abort(),O4.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},r),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,r===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async a=>{if(a){O4.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,a.name);try{return await s()}finally{O4.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,a.name)}}else{if(r===0)throw O4.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new qat(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(O4.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 s()}}))}function Hat(){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 uLe(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function Wat(t){return parseInt(t,16)}function Gat(t){const r=new TextEncoder().encode(t);return"0x"+Array.from(r,n=>n.toString(16).padStart(2,"0")).join("")}function Kat(t){var r;const{chainId:s,domain:n,expirationTime:a,issuedAt:o=new Date,nonce:l,notBefore:i,requestId:d,resources:m,scheme:g,uri:y,version:v}=t;{if(!Number.isInteger(s))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${s}`);if(!n)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(v!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${v}`);if(!((r=t.statement)===null||r===void 0)&&r.includes(` `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const b=uLe(t.address),N=g?`${g}://${n}`:n,j=t.statement?`${t.statement} `:"",S=`${N} wants you to sign in with your Ethereum account: ${b} ${j}`;let A=`URI: ${y} Version: ${v} Chain ID: ${s}${l?` Nonce: ${l}`:""} Issued At: ${o.toISOString()}`;if(a&&(A+=` Expiration Time: ${a.toISOString()}`),i&&(A+=` Not Before: ${i.toISOString()}`),d&&(A+=` Request ID: ${d}`),m){let M=` Resources:`;for(const I of m){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}`);M+=` - ${I}`}A+=M}return`${S} ${A}`}class Kc extends Error{constructor({message:r,code:s,cause:n,name:a}){var o;super(r,{cause:n}),this.__isWebAuthnError=!0,this.name=(o=a??(n instanceof Error?n.name:void 0))!==null&&o!==void 0?o:"Unknown Error",this.code=s}}class Ute extends Kc{constructor(r,s){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s,message:r}),this.name="WebAuthnUnknownError",this.originalError=s}}function Zat({error:t,options:r}){var s,n,a;const{publicKey:o}=r;if(!o)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(r.signal instanceof AbortSignal)return new Kc({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((s=o.authenticatorSelection)===null||s===void 0?void 0:s.requireResidentKey)===!0)return new Kc({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(r.mediation==="conditional"&&((n=o.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new Kc({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((a=o.authenticatorSelection)===null||a===void 0?void 0:a.userVerification)==="required")return new Kc({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new Kc({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Kc({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return o.pubKeyCredParams.filter(i=>i.type==="public-key").length===0?new Kc({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Kc({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const l=window.location.hostname;if(hLe(l)){if(o.rp.id!==l)return new Kc({message:`The RP ID "${o.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Kc({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(o.user.id.byteLength<1||o.user.id.byteLength>64)return new Kc({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new Kc({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Kc({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function Yat({error:t,options:r}){const{publicKey:s}=r;if(!s)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(r.signal instanceof AbortSignal)return new Kc({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Kc({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const n=window.location.hostname;if(hLe(n)){if(s.rpId!==n)return new Kc({message:`The RP ID "${s.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Kc({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Kc({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Kc({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class Xat{createNewAbortSignal(){if(this.controller){const s=new Error("Cancelling existing WebAuthn API call for new one");s.name="AbortError",this.controller.abort(s)}const r=new AbortController;return this.controller=r,r.signal}cancelCeremony(){if(this.controller){const r=new Error("Manually cancelling existing WebAuthn API call");r.name="AbortError",this.controller.abort(r),this.controller=void 0}}}const Qat=new Xat;function Jat(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:r,user:s,excludeCredentials:n}=t,a=Mv(t,["challenge","user","excludeCredentials"]),o=nC(r).buffer,l=Object.assign(Object.assign({},s),{id:nC(s.id).buffer}),i=Object.assign(Object.assign({},a),{challenge:o,user:l});if(n&&n.length>0){i.excludeCredentials=new Array(n.length);for(let d=0;d0){o.allowCredentials=new Array(s.length);for(let l=0;la!==null&&typeof a=="object"&&!Array.isArray(a),s=a=>a instanceof ArrayBuffer||ArrayBuffer.isView(a),n={};for(const a of t)if(a)for(const o in a){const l=a[o];if(l!==void 0)if(Array.isArray(l))n[o]=l;else if(s(l))n[o]=l;else if(r(l)){const i=n[o];r(i)?n[o]=qte(i,l):n[o]=qte(l)}else n[o]=l}return n}function oit(t,r){return qte(ait,t,r||{})}function lit(t,r){return qte(iit,t,r||{})}class cit{constructor(r){this.client=r,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(r){return this.client.mfa.enroll(Object.assign(Object.assign({},r),{factorType:"webauthn"}))}async _challenge({factorId:r,webauthn:s,friendlyName:n,signal:a},o){try{const{data:l,error:i}=await this.client.mfa.challenge({factorId:r,webauthn:s});if(!l)return{data:null,error:i};const d=a??Qat.createNewAbortSignal();if(l.webauthn.type==="create"){const{user:m}=l.webauthn.credential_options.publicKey;m.name||(m.name=`${m.id}:${n}`),m.displayName||(m.displayName=m.name)}switch(l.webauthn.type){case"create":{const m=oit(l.webauthn.credential_options.publicKey,o==null?void 0:o.create),{data:g,error:y}=await sit({publicKey:m,signal:d});return g?{data:{factorId:r,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:g}},error:null}:{data:null,error:y}}case"request":{const m=lit(l.webauthn.credential_options.publicKey,o==null?void 0:o.request),{data:g,error:y}=await nit(Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:m,signal:d}));return g?{data:{factorId:r,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:g}},error:null}:{data:null,error:y}}}}catch(l){return ma(l)?{data:null,error:l}:{data:null,error:new nj("Unexpected error in challenge",l)}}}async _verify({challengeId:r,factorId:s,webauthn:n}){return this.client.mfa.verify({factorId:s,challengeId:r,webauthn:n})}async _authenticate({factorId:r,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:a}},o){if(!s)return{data:null,error:new HE("rpId is required for WebAuthn authentication")};try{if(!Uke())return{data:null,error:new nj("Browser does not support WebAuthn",null)};const{data:l,error:i}=await this.challenge({factorId:r,webauthn:{rpId:s,rpOrigins:n},signal:a},{request:o});if(!l)return{data:null,error:i};const{webauthn:d}=l;return this._verify({factorId:r,challengeId:l.challengeId,webauthn:{type:d.type,rpId:s,rpOrigins:n,credential_response:d.credential_response}})}catch(l){return ma(l)?{data:null,error:l}:{data:null,error:new nj("Unexpected error in authenticate",l)}}}async _register({friendlyName:r,rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:a},o){if(!s)return{data:null,error:new HE("rpId is required for WebAuthn registration")};try{if(!Uke())return{data:null,error:new nj("Browser does not support WebAuthn",null)};const{data:l,error:i}=await this._enroll({friendlyName:r});if(!l)return await this.client.mfa.listFactors().then(g=>{var y;return(y=g.data)===null||y===void 0?void 0:y.all.find(v=>v.factor_type==="webauthn"&&v.friendly_name===r&&v.status!=="unverified")}).then(g=>g?this.client.mfa.unenroll({factorId:g==null?void 0:g.id}):void 0),{data:null,error:i};const{data:d,error:m}=await this._challenge({factorId:l.id,friendlyName:l.friendly_name,webauthn:{rpId:s,rpOrigins:n},signal:a},{create:o});return d?this._verify({factorId:l.id,challengeId:d.challengeId,webauthn:{rpId:s,rpOrigins:n,type:d.webauthn.type,credential_response:d.webauthn.credential_response}}):{data:null,error:m}}catch(l){return ma(l)?{data:null,error:l}:{data:null,error:new nj("Unexpected error in register",l)}}}}Hat();const dit={url:iat,storageKey:oat,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:lat,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function qke(t,r,s){return await s()}const D4={};class WE{get jwks(){var r,s;return(s=(r=D4[this.storageKey])===null||r===void 0?void 0:r.jwks)!==null&&s!==void 0?s:{keys:[]}}set jwks(r){D4[this.storageKey]=Object.assign(Object.assign({},D4[this.storageKey]),{jwks:r})}get jwks_cached_at(){var r,s;return(s=(r=D4[this.storageKey])===null||r===void 0?void 0:r.cachedAt)!==null&&s!==void 0?s:Number.MIN_SAFE_INTEGER}set jwks_cached_at(r){D4[this.storageKey]=Object.assign(Object.assign({},D4[this.storageKey]),{cachedAt:r})}constructor(r){var s,n;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=WE.nextInstanceID,WE.nextInstanceID+=1,this.instanceID>0&&Wu()&&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({},dit),r);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 Uat({url:a.url,headers:a.headers,fetch:a.fetch}),this.url=a.url,this.headers=a.headers,this.fetch=cLe(a.fetch),this.lock=a.lock||qke,this.detectSessionInUrl=a.detectSessionInUrl,this.flowType=a.flowType,this.hasCustomAuthorizationHeader=a.hasCustomAuthorizationHeader,a.lock?this.lock=a.lock:Wu()&&(!((s=globalThis==null?void 0:globalThis.navigator)===null||s===void 0)&&s.locks)?this.lock=Vat:this.lock=qke,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 cit(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:lLe()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=$ke(this.memoryStorage)),a.userStorage&&(this.userStorage=a.userStorage)):(this.memoryStorage={},this.storage=$ke(this.memoryStorage)),Wu()&&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)}(n=this.broadcastChannel)===null||n===void 0||n.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(...r){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${aLe}) ${new Date().toISOString()}`,...r),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 r;try{const s=wat(window.location.href);let n="none";if(this._isImplicitGrantCallback(s)?n="implicit":await this._isPKCECallback(s)&&(n="pkce"),Wu()&&this.detectSessionInUrl&&n!=="none"){const{data:a,error:o}=await this._getSessionFromURL(s,n);if(o){if(this._debug("#_initialize()","error detecting session from URL",o),pat(o)){const d=(r=o.details)===null||r===void 0?void 0:r.code;if(d==="identity_already_exists"||d==="identity_not_found"||d==="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(s){return ma(s)?{error:s}:{error:new nj("Unexpected error during initialization",s)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(r){var s,n,a;try{const o=await Ha(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(s=r==null?void 0:r.options)===null||s===void 0?void 0:s.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(a=r==null?void 0:r.options)===null||a===void 0?void 0:a.captchaToken}},xform:hf}),{data:l,error:i}=o;if(i||!l)return{data:{user:null,session:null},error:i};const d=l.session,m=l.user;return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",d)),{data:{user:m,session:d},error:null}}catch(o){if(ma(o))return{data:{user:null,session:null},error:o};throw o}}async signUp(r){var s,n,a;try{let o;if("email"in r){const{email:g,password:y,options:v}=r;let b=null,N=null;this.flowType==="pkce"&&([b,N]=await P4(this.storage,this.storageKey)),o=await Ha(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:v==null?void 0:v.emailRedirectTo,body:{email:g,password:y,data:(s=v==null?void 0:v.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:v==null?void 0:v.captchaToken},code_challenge:b,code_challenge_method:N},xform:hf})}else if("phone"in r){const{phone:g,password:y,options:v}=r;o=await Ha(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:g,password:y,data:(n=v==null?void 0:v.data)!==null&&n!==void 0?n:{},channel:(a=v==null?void 0:v.channel)!==null&&a!==void 0?a:"sms",gotrue_meta_security:{captcha_token:v==null?void 0:v.captchaToken}},xform:hf})}else throw new f8("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 d=l.session,m=l.user;return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",d)),{data:{user:m,session:d},error:null}}catch(o){if(ma(o))return{data:{user:null,session:null},error:o};throw o}}async signInWithPassword(r){try{let s;if("email"in r){const{email:o,password:l,options:i}=r;s=await Ha(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:zke})}else if("phone"in r){const{phone:o,password:l,options:i}=r;s=await Ha(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:zke})}else throw new f8("You must provide either an email or phone number and a password");const{data:n,error:a}=s;return a?{data:{user:null,session:null},error:a}:!n||!n.session||!n.user?{data:{user:null,session:null},error:new I4}:(n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),{data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:a})}catch(s){if(ma(s))return{data:{user:null,session:null},error:s};throw s}}async signInWithOAuth(r){var s,n,a,o;return await this._handleProviderSignIn(r.provider,{redirectTo:(s=r.options)===null||s===void 0?void 0:s.redirectTo,scopes:(n=r.options)===null||n===void 0?void 0:n.scopes,queryParams:(a=r.options)===null||a===void 0?void 0:a.queryParams,skipBrowserRedirect:(o=r.options)===null||o===void 0?void 0:o.skipBrowserRedirect})}async exchangeCodeForSession(r){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(r))}async signInWithWeb3(r){const{chain:s}=r;switch(s){case"ethereum":return await this.signInWithEthereum(r);case"solana":return await this.signInWithSolana(r);default:throw new Error(`@supabase/auth-js: Unsupported chain "${s}"`)}}async signInWithEthereum(r){var s,n,a,o,l,i,d,m,g,y,v;let b,N;if("message"in r)b=r.message,N=r.signature;else{const{chain:j,wallet:S,statement:A,options:M}=r;let I;if(Wu())if(typeof S=="object")I=S;else{const W=window;if("ethereum"in W&&typeof W.ethereum=="object"&&"request"in W.ethereum&&typeof W.ethereum.request=="function")I=W.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof S!="object"||!(M!=null&&M.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");I=S}const F=new URL((s=M==null?void 0:M.url)!==null&&s!==void 0?s:window.location.href),O=await I.request({method:"eth_requestAccounts"}).then(W=>W).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!O||O.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const B=uLe(O[0]);let $=(n=M==null?void 0:M.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!$){const W=await I.request({method:"eth_chainId"});$=Wat(W)}const H={domain:F.host,address:B,statement:A,uri:F.href,version:"1",chainId:$,nonce:(a=M==null?void 0:M.signInWithEthereum)===null||a===void 0?void 0:a.nonce,issuedAt:(l=(o=M==null?void 0:M.signInWithEthereum)===null||o===void 0?void 0:o.issuedAt)!==null&&l!==void 0?l:new Date,expirationTime:(i=M==null?void 0:M.signInWithEthereum)===null||i===void 0?void 0:i.expirationTime,notBefore:(d=M==null?void 0:M.signInWithEthereum)===null||d===void 0?void 0:d.notBefore,requestId:(m=M==null?void 0:M.signInWithEthereum)===null||m===void 0?void 0:m.requestId,resources:(g=M==null?void 0:M.signInWithEthereum)===null||g===void 0?void 0:g.resources};b=Kat(H),N=await I.request({method:"personal_sign",params:[Gat(b),B]})}try{const{data:j,error:S}=await Ha(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:b,signature:N},!((y=r.options)===null||y===void 0)&&y.captchaToken?{gotrue_meta_security:{captcha_token:(v=r.options)===null||v===void 0?void 0:v.captchaToken}}:null),xform:hf});if(S)throw S;return!j||!j.session||!j.user?{data:{user:null,session:null},error:new I4}:(j.session&&(await this._saveSession(j.session),await this._notifyAllSubscribers("SIGNED_IN",j.session)),{data:Object.assign({},j),error:S})}catch(j){if(ma(j))return{data:{user:null,session:null},error:j};throw j}}async signInWithSolana(r){var s,n,a,o,l,i,d,m,g,y,v,b;let N,j;if("message"in r)N=r.message,j=r.signature;else{const{chain:S,wallet:A,statement:M,options:I}=r;let F;if(Wu())if(typeof A=="object")F=A;else{const B=window;if("solana"in B&&typeof B.solana=="object"&&("signIn"in B.solana&&typeof B.solana.signIn=="function"||"signMessage"in B.solana&&typeof B.solana.signMessage=="function"))F=B.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 A!="object"||!(I!=null&&I.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");F=A}const O=new URL((s=I==null?void 0:I.url)!==null&&s!==void 0?s:window.location.href);if("signIn"in F&&F.signIn){const B=await F.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},I==null?void 0:I.signInWithSolana),{version:"1",domain:O.host,uri:O.href}),M?{statement:M}:null));let $;if(Array.isArray(B)&&B[0]&&typeof B[0]=="object")$=B[0];else if(B&&typeof B=="object"&&"signedMessage"in B&&"signature"in B)$=B;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in $&&"signature"in $&&(typeof $.signedMessage=="string"||$.signedMessage instanceof Uint8Array)&&$.signature instanceof Uint8Array)N=typeof $.signedMessage=="string"?$.signedMessage:new TextDecoder().decode($.signedMessage),j=$.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in F)||typeof F.signMessage!="function"||!("publicKey"in F)||typeof F!="object"||!F.publicKey||!("toBase58"in F.publicKey)||typeof F.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");N=[`${O.host} wants you to sign in with your Solana account:`,F.publicKey.toBase58(),...M?["",M,""]:[""],"Version: 1",`URI: ${O.href}`,`Issued At: ${(a=(n=I==null?void 0:I.signInWithSolana)===null||n===void 0?void 0:n.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}`]:[],...!((d=I==null?void 0:I.signInWithSolana)===null||d===void 0)&&d.nonce?[`Nonce: ${I.signInWithSolana.nonce}`]:[],...!((m=I==null?void 0:I.signInWithSolana)===null||m===void 0)&&m.requestId?[`Request ID: ${I.signInWithSolana.requestId}`]:[],...!((y=(g=I==null?void 0:I.signInWithSolana)===null||g===void 0?void 0:g.resources)===null||y===void 0)&&y.length?["Resources",...I.signInWithSolana.resources.map($=>`- ${$}`)]:[]].join(` `);const B=await F.signMessage(new TextEncoder().encode(N),"utf8");if(!B||!(B instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");j=B}}try{const{data:S,error:A}=await Ha(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:N,signature:uj(j)},!((v=r.options)===null||v===void 0)&&v.captchaToken?{gotrue_meta_security:{captcha_token:(b=r.options)===null||b===void 0?void 0:b.captchaToken}}:null),xform:hf});if(A)throw A;return!S||!S.session||!S.user?{data:{user:null,session:null},error:new I4}:(S.session&&(await this._saveSession(S.session),await this._notifyAllSubscribers("SIGNED_IN",S.session)),{data:Object.assign({},S),error:A})}catch(S){if(ma(S))return{data:{user:null,session:null},error:S};throw S}}async _exchangeCodeForSession(r){const s=await I_(this.storage,`${this.storageKey}-code-verifier`),[n,a]=(s??"").split("/");try{const{data:o,error:l}=await Ha(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:r,code_verifier:n},xform:hf});if(await $0(this.storage,`${this.storageKey}-code-verifier`),l)throw l;return!o||!o.session||!o.user?{data:{user:null,session:null,redirectType:null},error:new I4}:(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(ma(o))return{data:{user:null,session:null,redirectType:null},error:o};throw o}}async signInWithIdToken(r){try{const{options:s,provider:n,token:a,access_token:o,nonce:l}=r,i=await Ha(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:a,access_token:o,nonce:l,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}},xform:hf}),{data:d,error:m}=i;return m?{data:{user:null,session:null},error:m}:!d||!d.session||!d.user?{data:{user:null,session:null},error:new I4}:(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("SIGNED_IN",d.session)),{data:d,error:m})}catch(s){if(ma(s))return{data:{user:null,session:null},error:s};throw s}}async signInWithOtp(r){var s,n,a,o,l;try{if("email"in r){const{email:i,options:d}=r;let m=null,g=null;this.flowType==="pkce"&&([m,g]=await P4(this.storage,this.storageKey));const{error:y}=await Ha(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:i,data:(s=d==null?void 0:d.data)!==null&&s!==void 0?s:{},create_user:(n=d==null?void 0:d.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken},code_challenge:m,code_challenge_method:g},redirectTo:d==null?void 0:d.emailRedirectTo});return{data:{user:null,session:null},error:y}}if("phone"in r){const{phone:i,options:d}=r,{data:m,error:g}=await Ha(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:i,data:(a=d==null?void 0:d.data)!==null&&a!==void 0?a:{},create_user:(o=d==null?void 0:d.shouldCreateUser)!==null&&o!==void 0?o:!0,gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken},channel:(l=d==null?void 0:d.channel)!==null&&l!==void 0?l:"sms"}});return{data:{user:null,session:null,messageId:m==null?void 0:m.message_id},error:g}}throw new f8("You must provide either an email or phone number.")}catch(i){if(ma(i))return{data:{user:null,session:null},error:i};throw i}}async verifyOtp(r){var s,n;try{let a,o;"options"in r&&(a=(s=r.options)===null||s===void 0?void 0:s.redirectTo,o=(n=r.options)===null||n===void 0?void 0:n.captchaToken);const{data:l,error:i}=await Ha(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},r),{gotrue_meta_security:{captcha_token:o}}),redirectTo:a,xform:hf});if(i)throw i;if(!l)throw new Error("An error occurred on token verification.");const d=l.session,m=l.user;return d!=null&&d.access_token&&(await this._saveSession(d),await this._notifyAllSubscribers(r.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",d)),{data:{user:m,session:d},error:null}}catch(a){if(ma(a))return{data:{user:null,session:null},error:a};throw a}}async signInWithSSO(r){var s,n,a;try{let o=null,l=null;return this.flowType==="pkce"&&([o,l]=await P4(this.storage,this.storageKey)),await Ha(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in r?{provider_id:r.providerId}:null),"domain"in r?{domain:r.domain}:null),{redirect_to:(n=(s=r.options)===null||s===void 0?void 0:s.redirectTo)!==null&&n!==void 0?n:void 0}),!((a=r==null?void 0:r.options)===null||a===void 0)&&a.captchaToken?{gotrue_meta_security:{captcha_token:r.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:l}),headers:this.headers,xform:zat})}catch(o){if(ma(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 r=>{const{data:{session:s},error:n}=r;if(n)throw n;if(!s)throw new uf;const{error:a}=await Ha(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:s.access_token});return{data:{user:null,session:null},error:a}})}catch(r){if(ma(r))return{data:{user:null,session:null},error:r};throw r}}async resend(r){try{const s=`${this.url}/resend`;if("email"in r){const{email:n,type:a,options:o}=r,{error:l}=await Ha(this.fetch,"POST",s,{headers:this.headers,body:{email:n,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 r){const{phone:n,type:a,options:o}=r,{data:l,error:i}=await Ha(this.fetch,"POST",s,{headers:this.headers,body:{phone:n,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 f8("You must provide either an email or phone number and a type")}catch(s){if(ma(s))return{data:{user:null,session:null},error:s};throw s}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async s=>s))}async _acquireLock(r,s){this._debug("#_acquireLock","begin",r);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),a=(async()=>(await n,await s()))();return this.pendingInLock.push((async()=>{try{await a}catch{}})()),a}return await this.lock(`lock:${this.storageKey}`,r,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=s();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const a=[...this.pendingInLock];await Promise.all(a),this.pendingInLock.splice(0,a.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(r){this._debug("#_useSession","begin");try{const s=await this.__loadSession();return await r(s)}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 r=null;const s=await I_(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",s),s!==null&&(this._isValidSession(s)?r=s:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!r)return{data:{session:null},error:null};const n=r.expires_at?r.expires_at*1e3-Date.now()await this._getUser()))}async _getUser(r){try{return r?await Ha(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:r,xform:h1}):await this._useSession(async s=>{var n,a,o;const{data:l,error:i}=s;if(i)throw i;return!(!((n=l.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new uf}:await Ha(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:h1})})}catch(s){if(ma(s))return mat(s)&&(await this._removeSession(),await $0(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:s};throw s}}async updateUser(r,s={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(r,s))}async _updateUser(r,s={}){try{return await this._useSession(async n=>{const{data:a,error:o}=n;if(o)throw o;if(!a.session)throw new uf;const l=a.session;let i=null,d=null;this.flowType==="pkce"&&r.email!=null&&([i,d]=await P4(this.storage,this.storageKey));const{data:m,error:g}=await Ha(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:s==null?void 0:s.emailRedirectTo,body:Object.assign(Object.assign({},r),{code_challenge:i,code_challenge_method:d}),jwt:l.access_token,xform:h1});if(g)throw g;return l.user=m.user,await this._saveSession(l),await this._notifyAllSubscribers("USER_UPDATED",l),{data:{user:l.user},error:null}})}catch(n){if(ma(n))return{data:{user:null},error:n};throw n}}async setSession(r){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(r))}async _setSession(r){try{if(!r.access_token||!r.refresh_token)throw new uf;const s=Date.now()/1e3;let n=s,a=!0,o=null;const{payload:l}=Dce(r.access_token);if(l.exp&&(n=l.exp,a=n<=s),a){const{data:i,error:d}=await this._callRefreshToken(r.refresh_token);if(d)return{data:{user:null,session:null},error:d};if(!i)return{data:{user:null,session:null},error:null};o=i}else{const{data:i,error:d}=await this._getUser(r.access_token);if(d)throw d;o={access_token:r.access_token,refresh_token:r.refresh_token,user:i.user,token_type:"bearer",expires_in:n-s,expires_at:n},await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)}return{data:{user:o.user,session:o},error:null}}catch(s){if(ma(s))return{data:{session:null,user:null},error:s};throw s}}async refreshSession(r){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(r))}async _refreshSession(r){try{return await this._useSession(async s=>{var n;if(!r){const{data:l,error:i}=s;if(i)throw i;r=(n=l.session)!==null&&n!==void 0?n:void 0}if(!(r!=null&&r.refresh_token))throw new uf;const{data:a,error:o}=await this._callRefreshToken(r.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(s){if(ma(s))return{data:{user:null,session:null},error:s};throw s}}async _getSessionFromURL(r,s){try{if(!Wu())throw new g8("No browser detected.");if(r.error||r.error_description||r.error_code)throw new g8(r.error_description||"Error in URL with unspecified error_description",{error:r.error||"unspecified_error",code:r.error_code||"unspecified_code"});switch(s){case"implicit":if(this.flowType==="pkce")throw new Ike("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new g8("Not a valid implicit grant flow url.");break;default:}if(s==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!r.code)throw new Ike("No code detected.");const{data:M,error:I}=await this._exchangeCodeForSession(r.code);if(I)throw I;const F=new URL(window.location.href);return F.searchParams.delete("code"),window.history.replaceState(window.history.state,"",F.toString()),{data:{session:M.session,redirectType:null},error:null}}const{provider_token:n,provider_refresh_token:a,access_token:o,refresh_token:l,expires_in:i,expires_at:d,token_type:m}=r;if(!o||!i||!l||!m)throw new g8("No session defined in URL");const g=Math.round(Date.now()/1e3),y=parseInt(i);let v=g+y;d&&(v=parseInt(d));const b=v-g;b*1e3<=X4&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${b}s, should have been closer to ${y}s`);const N=v-y;g-N>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",N,v,g):g-N<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",N,v,g);const{data:j,error:S}=await this._getUser(o);if(S)throw S;const A={provider_token:n,provider_refresh_token:a,access_token:o,expires_in:y,expires_at:v,refresh_token:l,token_type:m,user:j.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:A,redirectType:r.type},error:null}}catch(n){if(ma(n))return{data:{session:null,redirectType:null},error:n};throw n}}_isImplicitGrantCallback(r){return!!(r.access_token||r.error_description)}async _isPKCECallback(r){const s=await I_(this.storage,`${this.storageKey}-code-verifier`);return!!(r.code&&s)}async signOut(r={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(r))}async _signOut({scope:r}={scope:"global"}){return await this._useSession(async s=>{var n;const{data:a,error:o}=s;if(o)return{error:o};const l=(n=a.session)===null||n===void 0?void 0:n.access_token;if(l){const{error:i}=await this.admin.signOut(l,r);if(i&&!(hat(i)&&(i.status===404||i.status===401||i.status===403)))return{error:i}}return r!=="others"&&(await this._removeSession(),await $0(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(r){const s=bat(),n={id:s,callback:r,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",s),this.stateChangeEmitters.delete(s)}};return this._debug("#onAuthStateChange()","registered callback with id",s),this.stateChangeEmitters.set(s,n),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(s)})))(),{data:{subscription:n}}}async _emitInitialSession(r){return await this._useSession(async s=>{var n,a;try{const{data:{session:o},error:l}=s;if(l)throw l;await((n=this.stateChangeEmitters.get(r))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",o)),this._debug("INITIAL_SESSION","callback id",r,"session",o)}catch(o){await((a=this.stateChangeEmitters.get(r))===null||a===void 0?void 0:a.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",r,"error",o),console.error(o)}})}async resetPasswordForEmail(r,s={}){let n=null,a=null;this.flowType==="pkce"&&([n,a]=await P4(this.storage,this.storageKey,!0));try{return await Ha(this.fetch,"POST",`${this.url}/recover`,{body:{email:r,code_challenge:n,code_challenge_method:a,gotrue_meta_security:{captcha_token:s.captchaToken}},headers:this.headers,redirectTo:s.redirectTo})}catch(o){if(ma(o))return{data:null,error:o};throw o}}async getUserIdentities(){var r;try{const{data:s,error:n}=await this.getUser();if(n)throw n;return{data:{identities:(r=s.user.identities)!==null&&r!==void 0?r:[]},error:null}}catch(s){if(ma(s))return{data:null,error:s};throw s}}async linkIdentity(r){return"token"in r?this.linkIdentityIdToken(r):this.linkIdentityOAuth(r)}async linkIdentityOAuth(r){var s;try{const{data:n,error:a}=await this._useSession(async o=>{var l,i,d,m,g;const{data:y,error:v}=o;if(v)throw v;const b=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,r.provider,{redirectTo:(l=r.options)===null||l===void 0?void 0:l.redirectTo,scopes:(i=r.options)===null||i===void 0?void 0:i.scopes,queryParams:(d=r.options)===null||d===void 0?void 0:d.queryParams,skipBrowserRedirect:!0});return await Ha(this.fetch,"GET",b,{headers:this.headers,jwt:(g=(m=y.session)===null||m===void 0?void 0:m.access_token)!==null&&g!==void 0?g:void 0})});if(a)throw a;return Wu()&&!(!((s=r.options)===null||s===void 0)&&s.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),{data:{provider:r.provider,url:n==null?void 0:n.url},error:null}}catch(n){if(ma(n))return{data:{provider:r.provider,url:null},error:n};throw n}}async linkIdentityIdToken(r){return await this._useSession(async s=>{var n;try{const{error:a,data:{session:o}}=s;if(a)throw a;const{options:l,provider:i,token:d,access_token:m,nonce:g}=r,y=await Ha(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=o==null?void 0:o.access_token)!==null&&n!==void 0?n:void 0,body:{provider:i,id_token:d,access_token:m,nonce:g,link_identity:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:hf}),{data:v,error:b}=y;return b?{data:{user:null,session:null},error:b}:!v||!v.session||!v.user?{data:{user:null,session:null},error:new I4}:(v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("USER_UPDATED",v.session)),{data:v,error:b})}catch(a){if(ma(a))return{data:{user:null,session:null},error:a};throw a}})}async unlinkIdentity(r){try{return await this._useSession(async s=>{var n,a;const{data:o,error:l}=s;if(l)throw l;return await Ha(this.fetch,"DELETE",`${this.url}/user/identities/${r.identity_id}`,{headers:this.headers,jwt:(a=(n=o.session)===null||n===void 0?void 0:n.access_token)!==null&&a!==void 0?a:void 0})})}catch(s){if(ma(s))return{data:null,error:s};throw s}}async _refreshAccessToken(r){const s=`#_refreshAccessToken(${r.substring(0,5)}...)`;this._debug(s,"begin");try{const n=Date.now();return await Nat(async a=>(a>0&&await kat(200*Math.pow(2,a-1)),this._debug(s,"refreshing attempt",a),await Ha(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:r},headers:this.headers,xform:hf})),(a,o)=>{const l=200*Math.pow(2,a);return o&&Oce(o)&&Date.now()+l-n{try{await i.callback(r,s)}catch(d){o.push(d)}});if(await Promise.all(l),o.length>0){for(let i=0;ithis._autoRefreshTokenTick(),X4);this.autoRefreshTicker=r,r&&typeof r=="object"&&typeof r.unref=="function"?r.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(r),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const r=this.autoRefreshTicker;this.autoRefreshTicker=null,r&&clearInterval(r)}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 r=Date.now();try{return await this._useSession(async s=>{const{data:{session:n}}=s;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const a=Math.floor((n.expires_at*1e3-r)/X4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${a} ticks, a tick lasts ${X4}ms, refresh threshold is ${ome} ticks`),a<=ome&&await this._callRefreshToken(n.refresh_token)})}catch(s){console.error("Auto refresh tick failed with error. This is likely a transient error.",s)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(r){if(r.isAcquireTimeout||r instanceof dLe)this._debug("auto refresh token tick lock not available");else throw r}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Wu()||!(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(r){console.error("_handleVisibilityChange",r)}}async _onVisibilityChanged(r){const s=`#_onVisibilityChanged(${r})`;this._debug(s,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),r||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(s,"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(r,s,n){const a=[`provider=${encodeURIComponent(s)}`];if(n!=null&&n.redirectTo&&a.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&a.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[o,l]=await P4(this.storage,this.storageKey),i=new URLSearchParams({code_challenge:`${encodeURIComponent(o)}`,code_challenge_method:`${encodeURIComponent(l)}`});a.push(i.toString())}if(n!=null&&n.queryParams){const o=new URLSearchParams(n.queryParams);a.push(o.toString())}return n!=null&&n.skipBrowserRedirect&&a.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${r}?${a.join("&")}`}async _unenroll(r){try{return await this._useSession(async s=>{var n;const{data:a,error:o}=s;return o?{data:null,error:o}:await Ha(this.fetch,"DELETE",`${this.url}/factors/${r.factorId}`,{headers:this.headers,jwt:(n=a==null?void 0:a.session)===null||n===void 0?void 0:n.access_token})})}catch(s){if(ma(s))return{data:null,error:s};throw s}}async _enroll(r){try{return await this._useSession(async s=>{var n,a;const{data:o,error:l}=s;if(l)return{data:null,error:l};const i=Object.assign({friendly_name:r.friendlyName,factor_type:r.factorType},r.factorType==="phone"?{phone:r.phone}:r.factorType==="totp"?{issuer:r.issuer}:{}),{data:d,error:m}=await Ha(this.fetch,"POST",`${this.url}/factors`,{body:i,headers:this.headers,jwt:(n=o==null?void 0:o.session)===null||n===void 0?void 0:n.access_token});return m?{data:null,error:m}:(r.factorType==="totp"&&d.type==="totp"&&(!((a=d==null?void 0:d.totp)===null||a===void 0)&&a.qr_code)&&(d.totp.qr_code=`data:image/svg+xml;utf-8,${d.totp.qr_code}`),{data:d,error:null})})}catch(s){if(ma(s))return{data:null,error:s};throw s}}async _verify(r){return this._acquireLock(-1,async()=>{try{return await this._useSession(async s=>{var n;const{data:a,error:o}=s;if(o)return{data:null,error:o};const l=Object.assign({challenge_id:r.challengeId},"webauthn"in r?{webauthn:Object.assign(Object.assign({},r.webauthn),{credential_response:r.webauthn.type==="create"?tit(r.webauthn.credential_response):rit(r.webauthn.credential_response)})}:{code:r.code}),{data:i,error:d}=await Ha(this.fetch,"POST",`${this.url}/factors/${r.factorId}/verify`,{body:l,headers:this.headers,jwt:(n=a==null?void 0:a.session)===null||n===void 0?void 0:n.access_token});return d?{data:null,error:d}:(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:d})})}catch(s){if(ma(s))return{data:null,error:s};throw s}})}async _challenge(r){return this._acquireLock(-1,async()=>{try{return await this._useSession(async s=>{var n;const{data:a,error:o}=s;if(o)return{data:null,error:o};const l=await Ha(this.fetch,"POST",`${this.url}/factors/${r.factorId}/challenge`,{body:r,headers:this.headers,jwt:(n=a==null?void 0:a.session)===null||n===void 0?void 0:n.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:Jat(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:eit(i.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(s){if(ma(s))return{data:null,error:s};throw s}})}async _challengeAndVerify(r){const{data:s,error:n}=await this._challenge({factorId:r.factorId});return n?{data:null,error:n}:await this._verify({factorId:r.factorId,challengeId:s.id,code:r.code})}async _listFactors(){var r;const{data:{user:s},error:n}=await this.getUser();if(n)return{data:null,error:n};const a={all:[],phone:[],totp:[],webauthn:[]};for(const o of(r=s==null?void 0:s.factors)!==null&&r!==void 0?r:[])a.all.push(o),o.status==="verified"&&a[o.factor_type].push(o);return{data:a,error:null}}async _getAuthenticatorAssuranceLevel(){var r,s;const{data:{session:n},error:a}=await this.getSession();if(a)return{data:null,error:a};if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=Dce(n.access_token);let l=null;o.aal&&(l=o.aal);let i=l;((s=(r=n.user.factors)===null||r===void 0?void 0:r.filter(g=>g.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(i="aal2");const m=o.amr||[];return{data:{currentLevel:l,nextLevel:i,currentAuthenticationMethods:m},error:null}}async _getAuthorizationDetails(r){try{return await this._useSession(async s=>{const{data:{session:n},error:a}=s;return a?{data:null,error:a}:n?await Ha(this.fetch,"GET",`${this.url}/oauth/authorizations/${r}`,{headers:this.headers,jwt:n.access_token,xform:o=>({data:o,error:null})}):{data:null,error:new uf}})}catch(s){if(ma(s))return{data:null,error:s};throw s}}async _approveAuthorization(r,s){try{return await this._useSession(async n=>{const{data:{session:a},error:o}=n;if(o)return{data:null,error:o};if(!a)return{data:null,error:new uf};const l=await Ha(this.fetch,"POST",`${this.url}/oauth/authorizations/${r}/consent`,{headers:this.headers,jwt:a.access_token,body:{action:"approve"},xform:i=>({data:i,error:null})});return l.data&&l.data.redirect_url&&Wu()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(l.data.redirect_url),l})}catch(n){if(ma(n))return{data:null,error:n};throw n}}async _denyAuthorization(r,s){try{return await this._useSession(async n=>{const{data:{session:a},error:o}=n;if(o)return{data:null,error:o};if(!a)return{data:null,error:new uf};const l=await Ha(this.fetch,"POST",`${this.url}/oauth/authorizations/${r}/consent`,{headers:this.headers,jwt:a.access_token,body:{action:"deny"},xform:i=>({data:i,error:null})});return l.data&&l.data.redirect_url&&Wu()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(l.data.redirect_url),l})}catch(n){if(ma(n))return{data:null,error:n};throw n}}async fetchJwk(r,s={keys:[]}){let n=s.keys.find(i=>i.kid===r);if(n)return n;const a=Date.now();if(n=this.jwks.keys.find(i=>i.kid===r),n&&this.jwks_cached_at+dat>a)return n;const{data:o,error:l}=await Ha(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,n=o.keys.find(i=>i.kid===r),!n)?null:n}async getClaims(r,s={}){try{let n=r;if(!n){const{data:b,error:N}=await this.getSession();if(N||!b.session)return{data:null,error:N};n=b.session.access_token}const{header:a,payload:o,signature:l,raw:{header:i,payload:d}}=Dce(n);s!=null&&s.allowExpired||Iat(o.exp);const m=!a.alg||a.alg.startsWith("HS")||!a.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(a.kid,s!=null&&s.keys?{keys:s.keys}:s==null?void 0:s.jwks);if(!m){const{error:b}=await this.getUser(n);if(b)throw b;return{data:{claims:o,header:a,signature:l},error:null}}const g=Pat(a.alg),y=await crypto.subtle.importKey("jwk",m,g,!0,["verify"]);if(!await crypto.subtle.verify(g,y,l,vat(`${i}.${d}`)))throw new dme("Invalid JWT signature");return{data:{claims:o,header:a,signature:l},error:null}}catch(n){if(ma(n))return{data:null,error:n};throw n}}}WE.nextInstanceID=0;const uit=WE;class hit extends uit{constructor(r){super(r)}}class mit{constructor(r,s,n){var a,o,l;this.supabaseUrl=r,this.supabaseKey=s;const i=aat(r);if(!s)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 d=`sb-${i.hostname.split(".")[0]}-auth-token`,m={db:Xnt,realtime:Jnt,auth:Object.assign(Object.assign({},Qnt),{storageKey:d}),global:Ynt},g=nat(n??{},m);this.storageKey=(a=g.auth.storageKey)!==null&&a!==void 0?a:"",this.headers=(o=g.global.headers)!==null&&o!==void 0?o:{},g.accessToken?(this.accessToken=g.accessToken,this.auth=new Proxy({},{get:(y,v)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(v)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((l=g.auth)!==null&&l!==void 0?l:{},this.headers,g.global.fetch),this.fetch=rat(s,this._getAccessToken.bind(this),g.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},g.realtime)),this.rest=new int(new URL("rest/v1",i).href,{headers:this.headers,schema:g.db.schema,fetch:this.fetch}),this.storage=new Gnt(this.storageUrl.href,this.headers,this.fetch,n==null?void 0:n.storage),g.accessToken||this._listenForAuthEvents()}get functions(){return new Qst(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(r){return this.rest.from(r)}schema(r){return this.rest.schema(r)}rpc(r,s={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(r,s,n)}channel(r,s={config:{}}){return this.realtime.channel(r,s)}getChannels(){return this.realtime.getChannels()}removeChannel(r){return this.realtime.removeChannel(r)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var r,s;if(this.accessToken)return await this.accessToken();const{data:n}=await this.auth.getSession();return(s=(r=n.session)===null||r===void 0?void 0:r.access_token)!==null&&s!==void 0?s:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:r,persistSession:s,detectSessionInUrl:n,storage:a,userStorage:o,storageKey:l,flowType:i,lock:d,debug:m},g,y){const v={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new hit({url:this.authUrl.href,headers:Object.assign(Object.assign({},v),g),storageKey:l,autoRefreshToken:r,persistSession:s,detectSessionInUrl:n,storage:a,userStorage:o,flowType:i,lock:d,debug:m,fetch:y,hasCustomAuthorizationHeader:Object.keys(this.headers).some(b=>b.toLowerCase()==="authorization")})}_initRealtimeClient(r){return new jnt(this.realtimeUrl.href,Object.assign(Object.assign({},r),{params:Object.assign({apikey:this.supabaseKey},r==null?void 0:r.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((s,n)=>{this._handleTokenChanged(s,"CLIENT",n==null?void 0:n.access_token)})}_handleTokenChanged(r,s,n){(r==="TOKEN_REFRESHED"||r==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):r==="SIGNED_OUT"&&(this.realtime.setAuth(),s=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const pit=(t,r,s)=>new mit(t,r,s);function fit(){if(typeof window<"u"||typeof process>"u")return!1;const t=process.version;if(t==null)return!1;const r=t.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}fit()&&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 git="https://relzejiswnotikjgvjhz.supabase.co",xit="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJlbHplamlzd25vdGlramd2amh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE5NTAzNDQsImV4cCI6MjA3NzUyNjM0NH0.dzIkIr_oFSbFE3oWS0ktIr83iKHHkZxt40Gc7SpC_mM",Z=pit(git,xit,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),mLe=E.createContext(void 0),yit=({children:t})=>{const[r,s]=E.useState(null),[n,a]=E.useState(null),[o,l]=E.useState(!0),[i,d]=E.useState(!1),[m,g]=E.useState(!1),[y,v]=E.useState(null),[b,N]=E.useState([]),[j,S]=E.useState(null),A=Ws(),M=async B=>{try{console.log("Checking roles via RPC for user:",B);const[{data:$,error:H},{data:W,error:X}]=await Promise.all([Z.rpc("has_role",{_user_id:B,_role:"admin"}),Z.rpc("has_role",{_user_id:B,_role:"brokerage_manager"})]);if(H||X)console.error("Role RPC errors:",{isAdminError:H,isBrokerError:X}),d(!1),g(!1);else{const le=!!$,ne=!!W;console.log("RPC roles result:",{adminValue:le,brokerValue:ne}),d(le),g(ne)}const{data:se,error:ae}=await Z.from("profiles").select("brokerage_id").eq("id",B).single();if(v(!ae&&se?se.brokerage_id:null),W){console.log("Fetching managed brokerages for user:",B);const{data:le,error:ne}=await Z.from("brokerage_manager_assignments").select("brokerage_id").eq("user_id",B);if(console.log("Managed brokerage assignments result:",{assignments:le,assignmentsError:ne}),ne||!le){console.error("Error fetching managed brokerage assignments:",ne),N([]);return}const fe=Array.from(new Set(le.map(xe=>xe.brokerage_id).filter(Boolean)));if(fe.length===0){N([]);return}const{data:oe,error:de}=await Z.from("brokerages").select("id, name").in("id",fe);if(console.log("Managed brokerages details result:",{brokeragesData:oe,brokeragesError:de}),de||!oe){console.error("Error fetching managed brokerages details:",de),N([]);return}const ue=oe.map(xe=>({id:xe.id,name:xe.name})).sort((xe,Te)=>fe.indexOf(xe.id)-fe.indexOf(Te.id));console.log("Parsed managed brokerages:",ue),N(ue),ue.length>0&&!j&&S(ue[0].id)}else console.log("User is not a brokerage manager, skipping managed brokerages fetch"),N([])}catch($){console.error("Unexpected error in checkRoles:",$),d(!1),g(!1),v(null),N([])}};E.useEffect(()=>{const{data:{subscription:B}}=Z.auth.onAuthStateChange(($,H)=>{console.log("Auth event:",$),a(H),s((H==null?void 0:H.user)??null),$==="PASSWORD_RECOVERY"&&(console.log("Password recovery detected, redirecting to profile"),setTimeout(()=>{A("/profile?reset=true")},100)),H!=null&&H.user?setTimeout(()=>{M(H.user.id)},0):(d(!1),g(!1),v(null),N([]),S(null))});return Z.auth.getSession().then(({data:{session:$}})=>{a($),s(($==null?void 0:$.user)??null),$!=null&&$.user?M($.user.id).finally(()=>{l(!1)}):l(!1)}),()=>B.unsubscribe()},[]);const I=async(B,$)=>{const{error:H}=await Z.auth.signInWithPassword({email:B,password:$});if(H)throw Se.error(H.message),H;Se.success("Welcome back!"),A("/dashboard")},F=async(B,$,H)=>{const W=`${window.location.origin}/dashboard`,{error:X}=await Z.auth.signUp({email:B,password:$,options:{emailRedirectTo:W,data:{name:H}}});if(X)throw Se.error(X.message),X;Se.success("Account created! Welcome to LevelUp."),A("/dashboard")},O=async()=>{try{const{data:{session:B}}=await Z.auth.getSession();if(B){const{error:$}=await Z.auth.signOut();$?$.message==="Auth session missing!"?console.warn("Sign out warning (ignored):",$.message):(console.error("Sign out error:",$),Se.error($.message)):Se.success("Signed out successfully")}else console.log("No active session found, redirecting to auth");s(null),a(null),d(!1),g(!1),v(null),N([]),S(null),A("/auth")}catch(B){console.error("Unexpected sign out error:",B),A("/auth")}};return e.jsx(mLe.Provider,{value:{user:r,session:n,loading:o,signIn:I,signUp:F,signOut:O,isAdmin:i,isBrokerageManager:m,brokerageId:y,managedBrokerages:b,selectedBrokerageId:j,setSelectedBrokerageId:S},children:t})},Gr=()=>{const t=E.useContext(mLe);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t},pLe=E.createContext(void 0),P_="levelup_admin_session",U0="levelup_impersonation",vit=({children:t})=>{const[r,s]=E.useState(!1),[n,a]=E.useState(null),[o,l]=E.useState(!1);E.useEffect(()=>{const m=sessionStorage.getItem(U0);if(m)try{const g=JSON.parse(m);s(!0),a(g)}catch{sessionStorage.removeItem(U0)}},[]);const i=async m=>{l(!0);try{const{data:{session:g}}=await Z.auth.getSession();if(!g)return Se.error("No active session found"),!1;const y={access_token:g.access_token,refresh_token:g.refresh_token};sessionStorage.setItem(P_,JSON.stringify(y));const v=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/impersonate-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${g.access_token}`},body:JSON.stringify({targetUserId:m})}),b=await v.json();if(!v.ok)throw new Error(b.error||"Failed to impersonate user");const N={id:b.targetUser.id,name:b.targetUser.name,email:b.targetUser.email};if(sessionStorage.setItem(U0,JSON.stringify(N)),b.method==="session"){const{error:j}=await Z.auth.setSession({access_token:b.access_token,refresh_token:b.refresh_token});if(j)throw console.error("Set session error:",j),sessionStorage.removeItem(P_),sessionStorage.removeItem(U0),new Error("Failed to establish impersonation session")}else{const j=b.type||"recovery",{error:S}=await Z.auth.verifyOtp({token_hash:b.token_hash,type:j});if(S)throw console.error("Verify OTP error:",S),sessionStorage.removeItem(P_),sessionStorage.removeItem(U0),new Error("Failed to establish impersonation session")}return s(!0),a(N),Se.success(`Now viewing as ${N.name}`),window.location.href="/dashboard",!0}catch(g){return console.error("Impersonation error:",g),Se.error(g.message||"Failed to impersonate user"),sessionStorage.removeItem(P_),sessionStorage.removeItem(U0),!1}finally{l(!1)}},d=async()=>{l(!0);try{const m=sessionStorage.getItem(P_);if(!m){await Z.auth.signOut(),window.location.href="/auth";return}const g=JSON.parse(m);await Z.auth.signOut();const{error:y}=await Z.auth.setSession({access_token:g.access_token,refresh_token:g.refresh_token});if(sessionStorage.removeItem(P_),sessionStorage.removeItem(U0),y){console.error("Failed to restore admin session:",y),Se.error("Admin session expired, please sign in again"),window.location.href="/auth";return}s(!1),a(null),Se.success("Returned to admin account"),window.location.href="/admin/members"}catch(m){console.error("Stop impersonation error:",m),Se.error("Failed to restore admin session"),sessionStorage.removeItem(P_),sessionStorage.removeItem(U0),window.location.href="/auth"}finally{l(!1)}};return e.jsx(pLe.Provider,{value:{isImpersonating:r,impersonatedUser:n,startImpersonation:i,stopImpersonation:d,isLoading:o},children:t})},qxe=()=>{const t=E.useContext(pLe);if(t===void 0)throw new Error("useImpersonation must be used within an ImpersonationProvider");return t},GE=T3("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"}}),Q=E.forwardRef(({className:t,variant:r,size:s,asChild:n=!1,...a},o)=>{const l=n?lxe:"button";return e.jsx(l,{className:qt(GE({variant:r,size:s,className:t})),ref:o,...a})});Q.displayName="Button";const _it=()=>{const{isImpersonating:t,impersonatedUser:r,stopImpersonation:s,isLoading:n}=qxe();return!t||!r?null:e.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:e.jsxs("div",{className:"container mx-auto flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Qu,{className:"h-5 w-5 flex-shrink-0"}),e.jsxs("span",{className:"font-medium text-sm md:text-base",children:[e.jsx("span",{className:"hidden sm:inline",children:"You are viewing as "}),e.jsx("strong",{children:r.name}),e.jsxs("span",{className:"hidden md:inline text-amber-800",children:[" (",r.email,")"]})]})]}),e.jsx(Q,{size:"sm",variant:"secondary",onClick:s,disabled:n,className:"bg-amber-100 hover:bg-amber-200 text-amber-950 border-0",children:n?e.jsx(Hr,{className:"h-4 w-4 animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(rn,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"Exit Impersonation"}),e.jsx("span",{className:"sm:hidden",children:"Exit"})]})})]})})},fLe=E.createContext(void 0),yT="levelup_acting_as",bit=({children:t})=>{const{user:r}=Gr(),[s,n]=E.useState(!1),[a,o]=E.useState([]),[l,i]=E.useState(null),[d,m]=E.useState({}),[g,y]=E.useState(!0);E.useEffect(()=>{if(!(r!=null&&r.id)){n(!1),o([]),i(null),m({}),y(!1);return}(async()=>{y(!0);try{const{data:S}=await Z.rpc("has_role",{_user_id:r.id,_role:"assistant"});if(!S){n(!1),o([]),i(null),m({}),y(!1);return}n(!0);const{data:A,error:M}=await Z.from("agent_assistant_assignments").select("agent_id, permissions").eq("assistant_id",r.id);if(M||!A||A.length===0){o([]),y(!1);return}const I=A.map($=>$.agent_id),{data:F}=await Z.from("profiles").select("id, name, email, avatar_url").in("id",I),O=(F||[]).map($=>({id:$.id,name:$.name||$.email||"Unknown",email:$.email||"",avatar_url:$.avatar_url}));o(O);const B=sessionStorage.getItem(yT);if(B){const $=O.find(H=>H.id===B);if($){i($);const H=A.find(W=>W.agent_id===B);m((H==null?void 0:H.permissions)||{})}else if(O.length>0){i(O[0]);const H=A.find(W=>W.agent_id===O[0].id);m((H==null?void 0:H.permissions)||{}),sessionStorage.setItem(yT,O[0].id)}}else if(O.length>0){i(O[0]);const $=A.find(H=>H.agent_id===O[0].id);m(($==null?void 0:$.permissions)||{}),sessionStorage.setItem(yT,O[0].id)}}catch(S){console.error("Error loading assistant data:",S)}finally{y(!1)}})()},[r==null?void 0:r.id]);const v=j=>{i(j),j?(sessionStorage.setItem(yT,j.id),Z.from("agent_assistant_assignments").select("permissions").eq("assistant_id",(r==null?void 0:r.id)||"").eq("agent_id",j.id).single().then(({data:S})=>{m((S==null?void 0:S.permissions)||{})})):(sessionStorage.removeItem(yT),m({}))},b=j=>s?d[j]===!0:!0,N=s&&l?l.id:(r==null?void 0:r.id)||null;return e.jsx(fLe.Provider,{value:{isAssistant:s,assignedAgents:a,actingAsAgent:l,setActingAsAgent:v,effectiveUserId:N,permissions:d,hasPermission:b,isLoading:g},children:t})},Vxe=()=>{const t=E.useContext(fLe);if(t===void 0)throw new Error("useActingAs must be used within an ActingAsProvider");return t},Ll=()=>{const{effectiveUserId:t}=Vxe();return t};var gLe={exports:{}},xLe={};/** * @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 BC=E;function wit(t,r){return t===r&&(t!==0||1/t===1/r)||t!==t&&r!==r}var jit=typeof Object.is=="function"?Object.is:wit,kit=BC.useState,Nit=BC.useEffect,Sit=BC.useLayoutEffect,Cit=BC.useDebugValue;function Mit(t,r){var s=r(),n=kit({inst:{value:s,getSnapshot:r}}),a=n[0].inst,o=n[1];return Sit(function(){a.value=s,a.getSnapshot=r,zce(a)&&o({inst:a})},[t,s,r]),Nit(function(){return zce(a)&&o({inst:a}),t(function(){zce(a)&&o({inst:a})})},[t]),Cit(s),s}function zce(t){var r=t.getSnapshot;t=t.value;try{var s=r();return!jit(t,s)}catch{return!0}}function Tit(t,r){return r()}var Ait=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Tit:Mit;xLe.useSyncExternalStore=BC.useSyncExternalStore!==void 0?BC.useSyncExternalStore:Ait;gLe.exports=xLe;var Eit=gLe.exports;function Iit(){return Eit.useSyncExternalStore(Pit,()=>!0,()=>!1)}function Pit(){return()=>{}}var Hxe="Avatar",[Lit]=fc(Hxe),[Oit,yLe]=Lit(Hxe),vLe=E.forwardRef((t,r)=>{const{__scopeAvatar:s,...n}=t,[a,o]=E.useState("idle");return e.jsx(Oit,{scope:s,imageLoadingStatus:a,onImageLoadingStatusChange:o,children:e.jsx(qs.span,{...n,ref:r})})});vLe.displayName=Hxe;var _Le="AvatarImage",bLe=E.forwardRef((t,r)=>{const{__scopeAvatar:s,src:n,onLoadingStatusChange:a=()=>{},...o}=t,l=yLe(_Le,s),i=Dit(n,o),d=cc(m=>{a(m),l.onImageLoadingStatusChange(m)});return mc(()=>{i!=="idle"&&d(i)},[i,d]),i==="loaded"?e.jsx(qs.img,{...o,ref:r,src:n}):null});bLe.displayName=_Le;var wLe="AvatarFallback",jLe=E.forwardRef((t,r)=>{const{__scopeAvatar:s,delayMs:n,...a}=t,o=yLe(wLe,s),[l,i]=E.useState(n===void 0);return E.useEffect(()=>{if(n!==void 0){const d=window.setTimeout(()=>i(!0),n);return()=>window.clearTimeout(d)}},[n]),l&&o.imageLoadingStatus!=="loaded"?e.jsx(qs.span,{...a,ref:r}):null});jLe.displayName=wLe;function Vke(t,r){return t?r?(t.src!==r&&(t.src=r),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function Dit(t,{referrerPolicy:r,crossOrigin:s}){const n=Iit(),a=E.useRef(null),o=n?(a.current||(a.current=new window.Image),a.current):null,[l,i]=E.useState(()=>Vke(o,t));return mc(()=>{i(Vke(o,t))},[o,t]),mc(()=>{const d=y=>()=>{i(y)};if(!o)return;const m=d("loaded"),g=d("error");return o.addEventListener("load",m),o.addEventListener("error",g),r&&(o.referrerPolicy=r),typeof s=="string"&&(o.crossOrigin=s),()=>{o.removeEventListener("load",m),o.removeEventListener("error",g)}},[o,s,r]),l}var kLe=vLe,NLe=bLe,SLe=jLe;const ln=E.forwardRef(({className:t,...r},s)=>e.jsx(kLe,{ref:s,className:qt("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...r}));ln.displayName=kLe.displayName;const pa=E.forwardRef(({className:t,...r},s)=>e.jsx(NLe,{ref:s,className:qt("aspect-square h-full w-full",t),...r}));pa.displayName=NLe.displayName;const cn=E.forwardRef(({className:t,...r},s)=>e.jsx(SLe,{ref:s,className:qt("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...r}));cn.displayName=SLe.displayName;const Rit=T3("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 bt({className:t,variant:r,...s}){return e.jsx("div",{className:qt(Rit({variant:r}),t),...s})}var Fit=E.createContext(void 0);function Bk(t){const r=E.useContext(Fit);return t||r||"ltr"}var Bce=0;function Lne(){E.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Hke()),document.body.insertAdjacentElement("beforeend",t[1]??Hke()),Bce++,()=>{Bce===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),Bce--}},[])}function Hke(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var $ce="focusScope.autoFocusOnMount",Uce="focusScope.autoFocusOnUnmount",Wke={bubbles:!1,cancelable:!0},zit="FocusScope",fP=E.forwardRef((t,r)=>{const{loop:s=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...l}=t,[i,d]=E.useState(null),m=cc(a),g=cc(o),y=E.useRef(null),v=ga(r,j=>d(j)),b=E.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;E.useEffect(()=>{if(n){let j=function(I){if(b.paused||!i)return;const F=I.target;i.contains(F)?y.current=F:W0(y.current,{select:!0})},S=function(I){if(b.paused||!i)return;const F=I.relatedTarget;F!==null&&(i.contains(F)||W0(y.current,{select:!0}))},A=function(I){if(document.activeElement===document.body)for(const O of I)O.removedNodes.length>0&&W0(i)};document.addEventListener("focusin",j),document.addEventListener("focusout",S);const M=new MutationObserver(A);return i&&M.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",S),M.disconnect()}}},[n,i,b.paused]),E.useEffect(()=>{if(i){Kke.add(b);const j=document.activeElement;if(!i.contains(j)){const A=new CustomEvent($ce,Wke);i.addEventListener($ce,m),i.dispatchEvent(A),A.defaultPrevented||(Bit(Hit(CLe(i)),{select:!0}),document.activeElement===j&&W0(i))}return()=>{i.removeEventListener($ce,m),setTimeout(()=>{const A=new CustomEvent(Uce,Wke);i.addEventListener(Uce,g),i.dispatchEvent(A),A.defaultPrevented||W0(j??document.body,{select:!0}),i.removeEventListener(Uce,g),Kke.remove(b)},0)}}},[i,m,g,b]);const N=E.useCallback(j=>{if(!s&&!n||b.paused)return;const S=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,A=document.activeElement;if(S&&A){const M=j.currentTarget,[I,F]=$it(M);I&&F?!j.shiftKey&&A===F?(j.preventDefault(),s&&W0(I,{select:!0})):j.shiftKey&&A===I&&(j.preventDefault(),s&&W0(F,{select:!0})):A===M&&j.preventDefault()}},[s,n,b.paused]);return e.jsx(qs.div,{tabIndex:-1,...l,ref:v,onKeyDown:N})});fP.displayName=zit;function Bit(t,{select:r=!1}={}){const s=document.activeElement;for(const n of t)if(W0(n,{select:r}),document.activeElement!==s)return}function $it(t){const r=CLe(t),s=Gke(r,t),n=Gke(r.reverse(),t);return[s,n]}function CLe(t){const r=[],s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;s.nextNode();)r.push(s.currentNode);return r}function Gke(t,r){for(const s of t)if(!Uit(s,{upTo:r}))return s}function Uit(t,{upTo:r}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(r!==void 0&&t===r)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function qit(t){return t instanceof HTMLInputElement&&"select"in t}function W0(t,{select:r=!1}={}){if(t&&t.focus){const s=document.activeElement;t.focus({preventScroll:!0}),t!==s&&qit(t)&&r&&t.select()}}var Kke=Vit();function Vit(){let t=[];return{add(r){const s=t[0];r!==s&&(s==null||s.pause()),t=Zke(t,r),t.unshift(r)},remove(r){var s;t=Zke(t,r),(s=t[0])==null||s.resume()}}}function Zke(t,r){const s=[...t],n=s.indexOf(r);return n!==-1&&s.splice(n,1),s}function Hit(t){return t.filter(r=>r.tagName!=="A")}var qce="rovingFocusGroup.onEntryFocus",Wit={bubbles:!1,cancelable:!0},gP="RovingFocusGroup",[ume,MLe,Git]=oP(gP),[Kit,$3]=fc(gP,[Git]),[Zit,Yit]=Kit(gP),TLe=E.forwardRef((t,r)=>e.jsx(ume.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(ume.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(Xit,{...t,ref:r})})}));TLe.displayName=gP;var Xit=E.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:s,orientation:n,loop:a=!1,dir:o,currentTabStopId:l,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:d,onEntryFocus:m,preventScrollOnEntryFocus:g=!1,...y}=t,v=E.useRef(null),b=ga(r,v),N=Bk(o),[j,S]=oh({prop:l,defaultProp:i??null,onChange:d,caller:gP}),[A,M]=E.useState(!1),I=cc(m),F=MLe(s),O=E.useRef(!1),[B,$]=E.useState(0);return E.useEffect(()=>{const H=v.current;if(H)return H.addEventListener(qce,I),()=>H.removeEventListener(qce,I)},[I]),e.jsx(Zit,{scope:s,orientation:n,dir:N,loop:a,currentTabStopId:j,onItemFocus:E.useCallback(H=>S(H),[S]),onItemShiftTab:E.useCallback(()=>M(!0),[]),onFocusableItemAdd:E.useCallback(()=>$(H=>H+1),[]),onFocusableItemRemove:E.useCallback(()=>$(H=>H-1),[]),children:e.jsx(qs.div,{tabIndex:A||B===0?-1:0,"data-orientation":n,...y,ref:b,style:{outline:"none",...t.style},onMouseDown:bs(t.onMouseDown,()=>{O.current=!0}),onFocus:bs(t.onFocus,H=>{const W=!O.current;if(H.target===H.currentTarget&&W&&!A){const X=new CustomEvent(qce,Wit);if(H.currentTarget.dispatchEvent(X),!X.defaultPrevented){const se=F().filter(oe=>oe.focusable),ae=se.find(oe=>oe.active),le=se.find(oe=>oe.id===j),fe=[ae,le,...se].filter(Boolean).map(oe=>oe.ref.current);ILe(fe,g)}}O.current=!1}),onBlur:bs(t.onBlur,()=>M(!1))})})}),ALe="RovingFocusGroupItem",ELe=E.forwardRef((t,r)=>{const{__scopeRovingFocusGroup:s,focusable:n=!0,active:a=!1,tabStopId:o,children:l,...i}=t,d=bd(),m=o||d,g=Yit(ALe,s),y=g.currentTabStopId===m,v=MLe(s),{onFocusableItemAdd:b,onFocusableItemRemove:N,currentTabStopId:j}=g;return E.useEffect(()=>{if(n)return b(),()=>N()},[n,b,N]),e.jsx(ume.ItemSlot,{scope:s,id:m,focusable:n,active:a,children:e.jsx(qs.span,{tabIndex:y?0:-1,"data-orientation":g.orientation,...i,ref:r,onMouseDown:bs(t.onMouseDown,S=>{n?g.onItemFocus(m):S.preventDefault()}),onFocus:bs(t.onFocus,()=>g.onItemFocus(m)),onKeyDown:bs(t.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){g.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const A=eot(S,g.orientation,g.dir);if(A!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let I=v().filter(F=>F.focusable).map(F=>F.ref.current);if(A==="last")I.reverse();else if(A==="prev"||A==="next"){A==="prev"&&I.reverse();const F=I.indexOf(S.currentTarget);I=g.loop?tot(I,F+1):I.slice(F+1)}setTimeout(()=>ILe(I))}}),children:typeof l=="function"?l({isCurrentTabStop:y,hasTabStop:j!=null}):l})})});ELe.displayName=ALe;var Qit={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Jit(t,r){return r!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function eot(t,r,s){const n=Jit(t.key,s);if(!(r==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(r==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return Qit[n]}function ILe(t,r=!1){const s=document.activeElement;for(const n of t)if(n===s||(n.focus({preventScroll:r}),document.activeElement!==s))return}function tot(t,r){return t.map((s,n)=>t[(r+n)%t.length])}var Wxe=TLe,Gxe=ELe,rot=function(t){if(typeof document>"u")return null;var r=Array.isArray(t)?t[0]:t;return r.ownerDocument.body},R4=new WeakMap,x8=new WeakMap,y8={},Vce=0,PLe=function(t){return t&&(t.host||PLe(t.parentNode))},sot=function(t,r){return r.map(function(s){if(t.contains(s))return s;var n=PLe(s);return n&&t.contains(n)?n:(console.error("aria-hidden",s,"in not contained inside",t,". Doing nothing"),null)}).filter(function(s){return!!s})},not=function(t,r,s,n){var a=sot(r,Array.isArray(t)?t:[t]);y8[s]||(y8[s]=new WeakMap);var o=y8[s],l=[],i=new Set,d=new Set(a),m=function(y){!y||i.has(y)||(i.add(y),m(y.parentNode))};a.forEach(m);var g=function(y){!y||d.has(y)||Array.prototype.forEach.call(y.children,function(v){if(i.has(v))g(v);else try{var b=v.getAttribute(n),N=b!==null&&b!=="false",j=(R4.get(v)||0)+1,S=(o.get(v)||0)+1;R4.set(v,j),o.set(v,S),l.push(v),j===1&&N&&x8.set(v,!0),S===1&&v.setAttribute(s,"true"),N||v.setAttribute(n,"true")}catch(A){console.error("aria-hidden: cannot operate on ",v,A)}})};return g(r),i.clear(),Vce++,function(){l.forEach(function(y){var v=R4.get(y)-1,b=o.get(y)-1;R4.set(y,v),o.set(y,b),v||(x8.has(y)||y.removeAttribute(n),x8.delete(y)),b||y.removeAttribute(s)}),Vce--,Vce||(R4=new WeakMap,R4=new WeakMap,x8=new WeakMap,y8={})}},One=function(t,r,s){s===void 0&&(s="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),a=rot(t);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live]"))),not(n,a,s,"aria-hidden")):function(){return null}},Hee="right-scroll-bar-position",Wee="width-before-scroll-bar",aot="with-scroll-bars-hidden",iot="--removed-body-scroll-bar-size";function Hce(t,r){return typeof t=="function"?t(r):t&&(t.current=r),t}function oot(t,r){var s=E.useState(function(){return{value:t,callback:r,facade:{get current(){return s.value},set current(n){var a=s.value;a!==n&&(s.value=n,s.callback(n,a))}}}})[0];return s.callback=r,s.facade}var lot=typeof window<"u"?E.useLayoutEffect:E.useEffect,Yke=new WeakMap;function cot(t,r){var s=oot(null,function(n){return t.forEach(function(a){return Hce(a,n)})});return lot(function(){var n=Yke.get(s);if(n){var a=new Set(n),o=new Set(t),l=s.current;a.forEach(function(i){o.has(i)||Hce(i,null)}),o.forEach(function(i){a.has(i)||Hce(i,l)})}Yke.set(s,t)},[t]),s}function dot(t){return t}function uot(t,r){r===void 0&&(r=dot);var s=[],n=!1,a={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return s.length?s[s.length-1]:t},useMedium:function(o){var l=r(o,n);return s.push(l),function(){s=s.filter(function(i){return i!==l})}},assignSyncMedium:function(o){for(n=!0;s.length;){var l=s;s=[],l.forEach(o)}s={push:function(i){return o(i)},filter:function(){return s}}},assignMedium:function(o){n=!0;var l=[];if(s.length){var i=s;s=[],i.forEach(o),l=s}var d=function(){var g=l;l=[],g.forEach(o)},m=function(){return Promise.resolve().then(d)};m(),s={push:function(g){l.push(g),m()},filter:function(g){return l=l.filter(g),s}}}};return a}function hot(t){t===void 0&&(t={});var r=uot(null);return r.options=cp({async:!0,ssr:!1},t),r}var LLe=function(t){var r=t.sideCar,s=Mv(t,["sideCar"]);if(!r)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=r.read();if(!n)throw new Error("Sidecar medium not found");return E.createElement(n,cp({},s))};LLe.isSideCarExport=!0;function mot(t,r){return t.useMedium(r),LLe}var OLe=hot(),Wce=function(){},Dne=E.forwardRef(function(t,r){var s=E.useRef(null),n=E.useState({onScrollCapture:Wce,onWheelCapture:Wce,onTouchMoveCapture:Wce}),a=n[0],o=n[1],l=t.forwardProps,i=t.children,d=t.className,m=t.removeScrollBar,g=t.enabled,y=t.shards,v=t.sideCar,b=t.noRelative,N=t.noIsolation,j=t.inert,S=t.allowPinchZoom,A=t.as,M=A===void 0?"div":A,I=t.gapMode,F=Mv(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=v,B=cot([s,r]),$=cp(cp({},F),a);return E.createElement(E.Fragment,null,g&&E.createElement(O,{sideCar:OLe,removeScrollBar:m,shards:y,noRelative:b,noIsolation:N,inert:j,setCallbacks:o,allowPinchZoom:!!S,lockRef:s,gapMode:I}),l?E.cloneElement(E.Children.only(i),cp(cp({},$),{ref:B})):E.createElement(M,cp({},$,{className:d,ref:B}),i))});Dne.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Dne.classNames={fullWidth:Wee,zeroRight:Hee};var pot=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function fot(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var r=pot();return r&&t.setAttribute("nonce",r),t}function got(t,r){t.styleSheet?t.styleSheet.cssText=r:t.appendChild(document.createTextNode(r))}function xot(t){var r=document.head||document.getElementsByTagName("head")[0];r.appendChild(t)}var yot=function(){var t=0,r=null;return{add:function(s){t==0&&(r=fot())&&(got(r,s),xot(r)),t++},remove:function(){t--,!t&&r&&(r.parentNode&&r.parentNode.removeChild(r),r=null)}}},vot=function(){var t=yot();return function(r,s){E.useEffect(function(){return t.add(r),function(){t.remove()}},[r&&s])}},DLe=function(){var t=vot(),r=function(s){var n=s.styles,a=s.dynamic;return t(n,a),null};return r},_ot={left:0,top:0,right:0,gap:0},Gce=function(t){return parseInt(t||"",10)||0},bot=function(t){var r=window.getComputedStyle(document.body),s=r[t==="padding"?"paddingLeft":"marginLeft"],n=r[t==="padding"?"paddingTop":"marginTop"],a=r[t==="padding"?"paddingRight":"marginRight"];return[Gce(s),Gce(n),Gce(a)]},wot=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return _ot;var r=bot(t),s=document.documentElement.clientWidth,n=window.innerWidth;return{left:r[0],top:r[1],right:r[2],gap:Math.max(0,n-s+r[2]-r[0])}},jot=DLe(),aC="data-scroll-locked",kot=function(t,r,s,n){var a=t.left,o=t.top,l=t.right,i=t.gap;return s===void 0&&(s="margin"),` .`.concat(aot,` { overflow: hidden `).concat(n,`; padding-right: `).concat(i,"px ").concat(n,`; } body[`).concat(aC,`] { overflow: hidden `).concat(n,`; overscroll-behavior: contain; `).concat([r&&"position: relative ".concat(n,";"),s==="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(n,`; `),s==="padding"&&"padding-right: ".concat(i,"px ").concat(n,";")].filter(Boolean).join(""),` } .`).concat(Hee,` { right: `).concat(i,"px ").concat(n,`; } .`).concat(Wee,` { margin-right: `).concat(i,"px ").concat(n,`; } .`).concat(Hee," .").concat(Hee,` { right: 0 `).concat(n,`; } .`).concat(Wee," .").concat(Wee,` { margin-right: 0 `).concat(n,`; } body[`).concat(aC,`] { `).concat(iot,": ").concat(i,`px; } `)},Xke=function(){var t=parseInt(document.body.getAttribute(aC)||"0",10);return isFinite(t)?t:0},Not=function(){E.useEffect(function(){return document.body.setAttribute(aC,(Xke()+1).toString()),function(){var t=Xke()-1;t<=0?document.body.removeAttribute(aC):document.body.setAttribute(aC,t.toString())}},[])},Sot=function(t){var r=t.noRelative,s=t.noImportant,n=t.gapMode,a=n===void 0?"margin":n;Not();var o=E.useMemo(function(){return wot(a)},[a]);return E.createElement(jot,{styles:kot(o,!r,a,s?"":"!important")})},hme=!1;if(typeof window<"u")try{var v8=Object.defineProperty({},"passive",{get:function(){return hme=!0,!0}});window.addEventListener("test",v8,v8),window.removeEventListener("test",v8,v8)}catch{hme=!1}var F4=hme?{passive:!1}:!1,Cot=function(t){return t.tagName==="TEXTAREA"},RLe=function(t,r){if(!(t instanceof Element))return!1;var s=window.getComputedStyle(t);return s[r]!=="hidden"&&!(s.overflowY===s.overflowX&&!Cot(t)&&s[r]==="visible")},Mot=function(t){return RLe(t,"overflowY")},Tot=function(t){return RLe(t,"overflowX")},Qke=function(t,r){var s=r.ownerDocument,n=r;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var a=FLe(t,n);if(a){var o=zLe(t,n),l=o[1],i=o[2];if(l>i)return!0}n=n.parentNode}while(n&&n!==s.body);return!1},Aot=function(t){var r=t.scrollTop,s=t.scrollHeight,n=t.clientHeight;return[r,s,n]},Eot=function(t){var r=t.scrollLeft,s=t.scrollWidth,n=t.clientWidth;return[r,s,n]},FLe=function(t,r){return t==="v"?Mot(r):Tot(r)},zLe=function(t,r){return t==="v"?Aot(r):Eot(r)},Iot=function(t,r){return t==="h"&&r==="rtl"?-1:1},Pot=function(t,r,s,n,a){var o=Iot(t,window.getComputedStyle(r).direction),l=o*n,i=s.target,d=r.contains(i),m=!1,g=l>0,y=0,v=0;do{if(!i)break;var b=zLe(t,i),N=b[0],j=b[1],S=b[2],A=j-S-o*N;(N||A)&&FLe(t,i)&&(y+=A,v+=N);var M=i.parentNode;i=M&&M.nodeType===Node.DOCUMENT_FRAGMENT_NODE?M.host:M}while(!d&&i!==document.body||d&&(r.contains(i)||r===i));return(g&&Math.abs(y)<1||!g&&Math.abs(v)<1)&&(m=!0),m},_8=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},Jke=function(t){return[t.deltaX,t.deltaY]},eNe=function(t){return t&&"current"in t?t.current:t},Lot=function(t,r){return t[0]===r[0]&&t[1]===r[1]},Oot=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} `)},Dot=0,z4=[];function Rot(t){var r=E.useRef([]),s=E.useRef([0,0]),n=E.useRef(),a=E.useState(Dot++)[0],o=E.useState(DLe)[0],l=E.useRef(t);E.useEffect(function(){l.current=t},[t]),E.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(a));var j=Lxe([t.lockRef.current],(t.shards||[]).map(eNe),!0).filter(Boolean);return j.forEach(function(S){return S.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),j.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(a))})}}},[t.inert,t.lockRef.current,t.shards]);var i=E.useCallback(function(j,S){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!l.current.allowPinchZoom;var A=_8(j),M=s.current,I="deltaX"in j?j.deltaX:M[0]-A[0],F="deltaY"in j?j.deltaY:M[1]-A[1],O,B=j.target,$=Math.abs(I)>Math.abs(F)?"h":"v";if("touches"in j&&$==="h"&&B.type==="range")return!1;var H=Qke($,B);if(!H)return!0;if(H?O=$:(O=$==="v"?"h":"v",H=Qke($,B)),!H)return!1;if(!n.current&&"changedTouches"in j&&(I||F)&&(n.current=O),!O)return!0;var W=n.current||O;return Pot(W,S,j,W==="h"?I:F)},[]),d=E.useCallback(function(j){var S=j;if(!(!z4.length||z4[z4.length-1]!==o)){var A="deltaY"in S?Jke(S):_8(S),M=r.current.filter(function(O){return O.name===S.type&&(O.target===S.target||S.target===O.shadowParent)&&Lot(O.delta,A)})[0];if(M&&M.should){S.cancelable&&S.preventDefault();return}if(!M){var I=(l.current.shards||[]).map(eNe).filter(Boolean).filter(function(O){return O.contains(S.target)}),F=I.length>0?i(S,I[0]):!l.current.noIsolation;F&&S.cancelable&&S.preventDefault()}}},[]),m=E.useCallback(function(j,S,A,M){var I={name:j,delta:S,target:A,should:M,shadowParent:Fot(A)};r.current.push(I),setTimeout(function(){r.current=r.current.filter(function(F){return F!==I})},1)},[]),g=E.useCallback(function(j){s.current=_8(j),n.current=void 0},[]),y=E.useCallback(function(j){m(j.type,Jke(j),j.target,i(j,t.lockRef.current))},[]),v=E.useCallback(function(j){m(j.type,_8(j),j.target,i(j,t.lockRef.current))},[]);E.useEffect(function(){return z4.push(o),t.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:v}),document.addEventListener("wheel",d,F4),document.addEventListener("touchmove",d,F4),document.addEventListener("touchstart",g,F4),function(){z4=z4.filter(function(j){return j!==o}),document.removeEventListener("wheel",d,F4),document.removeEventListener("touchmove",d,F4),document.removeEventListener("touchstart",g,F4)}},[]);var b=t.removeScrollBar,N=t.inert;return E.createElement(E.Fragment,null,N?E.createElement(o,{styles:Oot(a)}):null,b?E.createElement(Sot,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function Fot(t){for(var r=null;t!==null;)t instanceof ShadowRoot&&(r=t.host,t=t.host),t=t.parentNode;return r}const zot=mot(OLe,Rot);var xP=E.forwardRef(function(t,r){return E.createElement(Dne,cp({},t,{ref:r,sideCar:zot}))});xP.classNames=Dne.classNames;var mme=["Enter"," "],Bot=["ArrowDown","PageUp","Home"],BLe=["ArrowUp","PageDown","End"],$ot=[...Bot,...BLe],Uot={ltr:[...mme,"ArrowRight"],rtl:[...mme,"ArrowLeft"]},qot={ltr:["ArrowLeft"],rtl:["ArrowRight"]},yP="Menu",[KE,Vot,Hot]=oP(yP),[$k,$Le]=fc(yP,[Hot,ux,$3]),Rne=ux(),ULe=$3(),[Wot,Uk]=$k(yP),[Got,vP]=$k(yP),qLe=t=>{const{__scopeMenu:r,open:s=!1,children:n,dir:a,onOpenChange:o,modal:l=!0}=t,i=Rne(r),[d,m]=E.useState(null),g=E.useRef(!1),y=cc(o),v=Bk(a);return E.useEffect(()=>{const b=()=>{g.current=!0,document.addEventListener("pointerdown",N,{capture:!0,once:!0}),document.addEventListener("pointermove",N,{capture:!0,once:!0})},N=()=>g.current=!1;return document.addEventListener("keydown",b,{capture:!0}),()=>{document.removeEventListener("keydown",b,{capture:!0}),document.removeEventListener("pointerdown",N,{capture:!0}),document.removeEventListener("pointermove",N,{capture:!0})}},[]),e.jsx(uP,{...i,children:e.jsx(Wot,{scope:r,open:s,onOpenChange:y,content:d,onContentChange:m,children:e.jsx(Got,{scope:r,onClose:E.useCallback(()=>y(!1),[y]),isUsingKeyboardRef:g,dir:v,modal:l,children:n})})})};qLe.displayName=yP;var Kot="MenuAnchor",Kxe=E.forwardRef((t,r)=>{const{__scopeMenu:s,...n}=t,a=Rne(s);return e.jsx(P3,{...a,...n,ref:r})});Kxe.displayName=Kot;var Zxe="MenuPortal",[Zot,VLe]=$k(Zxe,{forceMount:void 0}),HLe=t=>{const{__scopeMenu:r,forceMount:s,children:n,container:a}=t,o=Uk(Zxe,r);return e.jsx(Zot,{scope:r,forceMount:s,children:e.jsx(zc,{present:s||o.open,children:e.jsx(M3,{asChild:!0,container:a,children:n})})})};HLe.displayName=Zxe;var jp="MenuContent",[Yot,Yxe]=$k(jp),WLe=E.forwardRef((t,r)=>{const s=VLe(jp,t.__scopeMenu),{forceMount:n=s.forceMount,...a}=t,o=Uk(jp,t.__scopeMenu),l=vP(jp,t.__scopeMenu);return e.jsx(KE.Provider,{scope:t.__scopeMenu,children:e.jsx(zc,{present:n||o.open,children:e.jsx(KE.Slot,{scope:t.__scopeMenu,children:l.modal?e.jsx(Xot,{...a,ref:r}):e.jsx(Qot,{...a,ref:r})})})})}),Xot=E.forwardRef((t,r)=>{const s=Uk(jp,t.__scopeMenu),n=E.useRef(null),a=ga(r,n);return E.useEffect(()=>{const o=n.current;if(o)return One(o)},[]),e.jsx(Xxe,{...t,ref:a,trapFocus:s.open,disableOutsidePointerEvents:s.open,disableOutsideScroll:!0,onFocusOutside:bs(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>s.onOpenChange(!1)})}),Qot=E.forwardRef((t,r)=>{const s=Uk(jp,t.__scopeMenu);return e.jsx(Xxe,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>s.onOpenChange(!1)})}),Jot=fv("MenuContent.ScrollLock"),Xxe=E.forwardRef((t,r)=>{const{__scopeMenu:s,loop:n=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:l,disableOutsidePointerEvents:i,onEntryFocus:d,onEscapeKeyDown:m,onPointerDownOutside:g,onFocusOutside:y,onInteractOutside:v,onDismiss:b,disableOutsideScroll:N,...j}=t,S=Uk(jp,s),A=vP(jp,s),M=Rne(s),I=ULe(s),F=Vot(s),[O,B]=E.useState(null),$=E.useRef(null),H=ga(r,$,S.onContentChange),W=E.useRef(0),X=E.useRef(""),se=E.useRef(0),ae=E.useRef(null),le=E.useRef("right"),ne=E.useRef(0),fe=N?xP:E.Fragment,oe=N?{as:Jot,allowPinchZoom:!0}:void 0,de=xe=>{var Ue,Ye;const Te=X.current+xe,be=F().filter(Ie=>!Ie.disabled),we=document.activeElement,ve=(Ue=be.find(Ie=>Ie.ref.current===we))==null?void 0:Ue.textValue,tt=be.map(Ie=>Ie.textValue),Ae=ult(tt,Te,ve),Le=(Ye=be.find(Ie=>Ie.textValue===Ae))==null?void 0:Ye.ref.current;(function Ie(et){X.current=et,window.clearTimeout(W.current),et!==""&&(W.current=window.setTimeout(()=>Ie(""),1e3))})(Te),Le&&setTimeout(()=>Le.focus())};E.useEffect(()=>()=>window.clearTimeout(W.current),[]),Lne();const ue=E.useCallback(xe=>{var be,we;return le.current===((be=ae.current)==null?void 0:be.side)&&mlt(xe,(we=ae.current)==null?void 0:we.area)},[]);return e.jsx(Yot,{scope:s,searchRef:X,onItemEnter:E.useCallback(xe=>{ue(xe)&&xe.preventDefault()},[ue]),onItemLeave:E.useCallback(xe=>{var Te;ue(xe)||((Te=$.current)==null||Te.focus(),B(null))},[ue]),onTriggerLeave:E.useCallback(xe=>{ue(xe)&&xe.preventDefault()},[ue]),pointerGraceTimerRef:se,onPointerGraceIntentChange:E.useCallback(xe=>{ae.current=xe},[]),children:e.jsx(fe,{...oe,children:e.jsx(fP,{asChild:!0,trapped:a,onMountAutoFocus:bs(o,xe=>{var Te;xe.preventDefault(),(Te=$.current)==null||Te.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:e.jsx(Sv,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:m,onPointerDownOutside:g,onFocusOutside:y,onInteractOutside:v,onDismiss:b,children:e.jsx(Wxe,{asChild:!0,...I,dir:A.dir,orientation:"vertical",loop:n,currentTabStopId:O,onCurrentTabStopIdChange:B,onEntryFocus:bs(d,xe=>{A.isUsingKeyboardRef.current||xe.preventDefault()}),preventScrollOnEntryFocus:!0,children:e.jsx(hP,{role:"menu","aria-orientation":"vertical","data-state":l8e(S.open),"data-radix-menu-content":"",dir:A.dir,...M,...j,ref:H,style:{outline:"none",...j.style},onKeyDown:bs(j.onKeyDown,xe=>{const be=xe.target.closest("[data-radix-menu-content]")===xe.currentTarget,we=xe.ctrlKey||xe.altKey||xe.metaKey,ve=xe.key.length===1;be&&(xe.key==="Tab"&&xe.preventDefault(),!we&&ve&&de(xe.key));const tt=$.current;if(xe.target!==tt||!$ot.includes(xe.key))return;xe.preventDefault();const Le=F().filter(Ue=>!Ue.disabled).map(Ue=>Ue.ref.current);BLe.includes(xe.key)&&Le.reverse(),clt(Le)}),onBlur:bs(t.onBlur,xe=>{xe.currentTarget.contains(xe.target)||(window.clearTimeout(W.current),X.current="")}),onPointerMove:bs(t.onPointerMove,ZE(xe=>{const Te=xe.target,be=ne.current!==xe.clientX;if(xe.currentTarget.contains(Te)&&be){const we=xe.clientX>ne.current?"right":"left";le.current=we,ne.current=xe.clientX}}))})})})})})})});WLe.displayName=jp;var elt="MenuGroup",Qxe=E.forwardRef((t,r)=>{const{__scopeMenu:s,...n}=t;return e.jsx(qs.div,{role:"group",...n,ref:r})});Qxe.displayName=elt;var tlt="MenuLabel",GLe=E.forwardRef((t,r)=>{const{__scopeMenu:s,...n}=t;return e.jsx(qs.div,{...n,ref:r})});GLe.displayName=tlt;var Vte="MenuItem",tNe="menu.itemSelect",Fne=E.forwardRef((t,r)=>{const{disabled:s=!1,onSelect:n,...a}=t,o=E.useRef(null),l=vP(Vte,t.__scopeMenu),i=Yxe(Vte,t.__scopeMenu),d=ga(r,o),m=E.useRef(!1),g=()=>{const y=o.current;if(!s&&y){const v=new CustomEvent(tNe,{bubbles:!0,cancelable:!0});y.addEventListener(tNe,b=>n==null?void 0:n(b),{once:!0}),cxe(y,v),v.defaultPrevented?m.current=!1:l.onClose()}};return e.jsx(KLe,{...a,ref:d,disabled:s,onClick:bs(t.onClick,g),onPointerDown:y=>{var v;(v=t.onPointerDown)==null||v.call(t,y),m.current=!0},onPointerUp:bs(t.onPointerUp,y=>{var v;m.current||(v=y.currentTarget)==null||v.click()}),onKeyDown:bs(t.onKeyDown,y=>{const v=i.searchRef.current!=="";s||v&&y.key===" "||mme.includes(y.key)&&(y.currentTarget.click(),y.preventDefault())})})});Fne.displayName=Vte;var KLe=E.forwardRef((t,r)=>{const{__scopeMenu:s,disabled:n=!1,textValue:a,...o}=t,l=Yxe(Vte,s),i=ULe(s),d=E.useRef(null),m=ga(r,d),[g,y]=E.useState(!1),[v,b]=E.useState("");return E.useEffect(()=>{const N=d.current;N&&b((N.textContent??"").trim())},[o.children]),e.jsx(KE.ItemSlot,{scope:s,disabled:n,textValue:a??v,children:e.jsx(Gxe,{asChild:!0,...i,focusable:!n,children:e.jsx(qs.div,{role:"menuitem","data-highlighted":g?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:m,onPointerMove:bs(t.onPointerMove,ZE(N=>{n?l.onItemLeave(N):(l.onItemEnter(N),N.defaultPrevented||N.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:bs(t.onPointerLeave,ZE(N=>l.onItemLeave(N))),onFocus:bs(t.onFocus,()=>y(!0)),onBlur:bs(t.onBlur,()=>y(!1))})})})}),rlt="MenuCheckboxItem",ZLe=E.forwardRef((t,r)=>{const{checked:s=!1,onCheckedChange:n,...a}=t;return e.jsx(e8e,{scope:t.__scopeMenu,checked:s,children:e.jsx(Fne,{role:"menuitemcheckbox","aria-checked":Hte(s)?"mixed":s,...a,ref:r,"data-state":eye(s),onSelect:bs(a.onSelect,()=>n==null?void 0:n(Hte(s)?!0:!s),{checkForDefaultPrevented:!1})})})});ZLe.displayName=rlt;var YLe="MenuRadioGroup",[slt,nlt]=$k(YLe,{value:void 0,onValueChange:()=>{}}),XLe=E.forwardRef((t,r)=>{const{value:s,onValueChange:n,...a}=t,o=cc(n);return e.jsx(slt,{scope:t.__scopeMenu,value:s,onValueChange:o,children:e.jsx(Qxe,{...a,ref:r})})});XLe.displayName=YLe;var QLe="MenuRadioItem",JLe=E.forwardRef((t,r)=>{const{value:s,...n}=t,a=nlt(QLe,t.__scopeMenu),o=s===a.value;return e.jsx(e8e,{scope:t.__scopeMenu,checked:o,children:e.jsx(Fne,{role:"menuitemradio","aria-checked":o,...n,ref:r,"data-state":eye(o),onSelect:bs(n.onSelect,()=>{var l;return(l=a.onValueChange)==null?void 0:l.call(a,s)},{checkForDefaultPrevented:!1})})})});JLe.displayName=QLe;var Jxe="MenuItemIndicator",[e8e,alt]=$k(Jxe,{checked:!1}),t8e=E.forwardRef((t,r)=>{const{__scopeMenu:s,forceMount:n,...a}=t,o=alt(Jxe,s);return e.jsx(zc,{present:n||Hte(o.checked)||o.checked===!0,children:e.jsx(qs.span,{...a,ref:r,"data-state":eye(o.checked)})})});t8e.displayName=Jxe;var ilt="MenuSeparator",r8e=E.forwardRef((t,r)=>{const{__scopeMenu:s,...n}=t;return e.jsx(qs.div,{role:"separator","aria-orientation":"horizontal",...n,ref:r})});r8e.displayName=ilt;var olt="MenuArrow",s8e=E.forwardRef((t,r)=>{const{__scopeMenu:s,...n}=t,a=Rne(s);return e.jsx(mP,{...a,...n,ref:r})});s8e.displayName=olt;var llt="MenuSub",[Brr,n8e]=$k(llt),GT="MenuSubTrigger",a8e=E.forwardRef((t,r)=>{const s=Uk(GT,t.__scopeMenu),n=vP(GT,t.__scopeMenu),a=n8e(GT,t.__scopeMenu),o=Yxe(GT,t.__scopeMenu),l=E.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:d}=o,m={__scopeMenu:t.__scopeMenu},g=E.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return E.useEffect(()=>g,[g]),E.useEffect(()=>{const y=i.current;return()=>{window.clearTimeout(y),d(null)}},[i,d]),e.jsx(Kxe,{asChild:!0,...m,children:e.jsx(KLe,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":a.contentId,"data-state":l8e(s.open),...t,ref:Iy(r,a.onTriggerChange),onClick:y=>{var v;(v=t.onClick)==null||v.call(t,y),!(t.disabled||y.defaultPrevented)&&(y.currentTarget.focus(),s.open||s.onOpenChange(!0))},onPointerMove:bs(t.onPointerMove,ZE(y=>{o.onItemEnter(y),!y.defaultPrevented&&!t.disabled&&!s.open&&!l.current&&(o.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{s.onOpenChange(!0),g()},100))})),onPointerLeave:bs(t.onPointerLeave,ZE(y=>{var b,N;g();const v=(b=s.content)==null?void 0:b.getBoundingClientRect();if(v){const j=(N=s.content)==null?void 0:N.dataset.side,S=j==="right",A=S?-5:5,M=v[S?"left":"right"],I=v[S?"right":"left"];o.onPointerGraceIntentChange({area:[{x:y.clientX+A,y:y.clientY},{x:M,y:v.top},{x:I,y:v.top},{x:I,y:v.bottom},{x:M,y:v.bottom}],side:j}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(y),y.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:bs(t.onKeyDown,y=>{var b;const v=o.searchRef.current!=="";t.disabled||v&&y.key===" "||Uot[n.dir].includes(y.key)&&(s.onOpenChange(!0),(b=s.content)==null||b.focus(),y.preventDefault())})})})});a8e.displayName=GT;var i8e="MenuSubContent",o8e=E.forwardRef((t,r)=>{const s=VLe(jp,t.__scopeMenu),{forceMount:n=s.forceMount,...a}=t,o=Uk(jp,t.__scopeMenu),l=vP(jp,t.__scopeMenu),i=n8e(i8e,t.__scopeMenu),d=E.useRef(null),m=ga(r,d);return e.jsx(KE.Provider,{scope:t.__scopeMenu,children:e.jsx(zc,{present:n||o.open,children:e.jsx(KE.Slot,{scope:t.__scopeMenu,children:e.jsx(Xxe,{id:i.contentId,"aria-labelledby":i.triggerId,...a,ref:m,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:g=>{var y;l.isUsingKeyboardRef.current&&((y=d.current)==null||y.focus()),g.preventDefault()},onCloseAutoFocus:g=>g.preventDefault(),onFocusOutside:bs(t.onFocusOutside,g=>{g.target!==i.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:bs(t.onEscapeKeyDown,g=>{l.onClose(),g.preventDefault()}),onKeyDown:bs(t.onKeyDown,g=>{var b;const y=g.currentTarget.contains(g.target),v=qot[l.dir].includes(g.key);y&&v&&(o.onOpenChange(!1),(b=i.trigger)==null||b.focus(),g.preventDefault())})})})})})});o8e.displayName=i8e;function l8e(t){return t?"open":"closed"}function Hte(t){return t==="indeterminate"}function eye(t){return Hte(t)?"indeterminate":t?"checked":"unchecked"}function clt(t){const r=document.activeElement;for(const s of t)if(s===r||(s.focus(),document.activeElement!==r))return}function dlt(t,r){return t.map((s,n)=>t[(r+n)%t.length])}function ult(t,r,s){const a=r.length>1&&Array.from(r).every(m=>m===r[0])?r[0]:r,o=s?t.indexOf(s):-1;let l=dlt(t,Math.max(o,0));a.length===1&&(l=l.filter(m=>m!==s));const d=l.find(m=>m.toLowerCase().startsWith(a.toLowerCase()));return d!==s?d:void 0}function hlt(t,r){const{x:s,y:n}=t;let a=!1;for(let o=0,l=r.length-1;on!=v>n&&s<(y-m)*(n-g)/(v-g)+m&&(a=!a)}return a}function mlt(t,r){if(!r)return!1;const s={x:t.clientX,y:t.clientY};return hlt(s,r)}function ZE(t){return r=>r.pointerType==="mouse"?t(r):void 0}var plt=qLe,flt=Kxe,glt=HLe,xlt=WLe,ylt=Qxe,vlt=GLe,_lt=Fne,blt=ZLe,wlt=XLe,jlt=JLe,klt=t8e,Nlt=r8e,Slt=s8e,Clt=a8e,Mlt=o8e,zne="DropdownMenu",[Tlt]=fc(zne,[$Le]),hh=$Le(),[Alt,c8e]=Tlt(zne),d8e=t=>{const{__scopeDropdownMenu:r,children:s,dir:n,open:a,defaultOpen:o,onOpenChange:l,modal:i=!0}=t,d=hh(r),m=E.useRef(null),[g,y]=oh({prop:a,defaultProp:o??!1,onChange:l,caller:zne});return e.jsx(Alt,{scope:r,triggerId:bd(),triggerRef:m,contentId:bd(),open:g,onOpenChange:y,onOpenToggle:E.useCallback(()=>y(v=>!v),[y]),modal:i,children:e.jsx(plt,{...d,open:g,onOpenChange:y,dir:n,modal:i,children:s})})};d8e.displayName=zne;var u8e="DropdownMenuTrigger",h8e=E.forwardRef((t,r)=>{const{__scopeDropdownMenu:s,disabled:n=!1,...a}=t,o=c8e(u8e,s),l=hh(s);return e.jsx(flt,{asChild:!0,...l,children:e.jsx(qs.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":n?"":void 0,disabled:n,...a,ref:Iy(r,o.triggerRef),onPointerDown:bs(t.onPointerDown,i=>{!n&&i.button===0&&i.ctrlKey===!1&&(o.onOpenToggle(),o.open||i.preventDefault())}),onKeyDown:bs(t.onKeyDown,i=>{n||(["Enter"," "].includes(i.key)&&o.onOpenToggle(),i.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});h8e.displayName=u8e;var Elt="DropdownMenuPortal",m8e=t=>{const{__scopeDropdownMenu:r,...s}=t,n=hh(r);return e.jsx(glt,{...n,...s})};m8e.displayName=Elt;var p8e="DropdownMenuContent",f8e=E.forwardRef((t,r)=>{const{__scopeDropdownMenu:s,...n}=t,a=c8e(p8e,s),o=hh(s),l=E.useRef(!1);return e.jsx(xlt,{id:a.contentId,"aria-labelledby":a.triggerId,...o,...n,ref:r,onCloseAutoFocus:bs(t.onCloseAutoFocus,i=>{var d;l.current||(d=a.triggerRef.current)==null||d.focus(),l.current=!1,i.preventDefault()}),onInteractOutside:bs(t.onInteractOutside,i=>{const d=i.detail.originalEvent,m=d.button===0&&d.ctrlKey===!0,g=d.button===2||m;(!a.modal||g)&&(l.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});f8e.displayName=p8e;var Ilt="DropdownMenuGroup",Plt=E.forwardRef((t,r)=>{const{__scopeDropdownMenu:s,...n}=t,a=hh(s);return e.jsx(ylt,{...a,...n,ref:r})});Plt.displayName=Ilt;var Llt="DropdownMenuLabel",g8e=E.forwardRef((t,r)=>{const{__scopeDropdownMenu:s,...n}=t,a=hh(s);return e.jsx(vlt,{...a,...n,ref:r})});g8e.displayName=Llt;var Olt="DropdownMenuItem",x8e=E.forwardRef((t,r)=>{const{__scopeDropdownMenu:s,...n}=t,a=hh(s);return e.jsx(_lt,{...a,...n,ref:r})});x8e.displayName=Olt;var Dlt="DropdownMenuCheckboxItem",y8e=E.forwardRef((t,r)=>{const{__scopeDropdownMenu:s,...n}=t,a=hh(s);return e.jsx(blt,{...a,...n,ref:r})});y8e.displayName=Dlt;var Rlt="DropdownMenuRadioGroup",Flt=E.forwardRef((t,r)=>{const{__scopeDropdownMenu:s,...n}=t,a=hh(s);return e.jsx(wlt,{...a,...n,ref:r})});Flt.displayName=Rlt;var zlt="DropdownMenuRadioItem",v8e=E.forwardRef((t,r)=>{const{__scopeDropdownMenu:s,...n}=t,a=hh(s);return e.jsx(jlt,{...a,...n,ref:r})});v8e.displayName=zlt;var Blt="DropdownMenuItemIndicator",_8e=E.forwardRef((t,r)=>{const{__scopeDropdownMenu:s,...n}=t,a=hh(s);return e.jsx(klt,{...a,...n,ref:r})});_8e.displayName=Blt;var $lt="DropdownMenuSeparator",b8e=E.forwardRef((t,r)=>{const{__scopeDropdownMenu:s,...n}=t,a=hh(s);return e.jsx(Nlt,{...a,...n,ref:r})});b8e.displayName=$lt;var Ult="DropdownMenuArrow",qlt=E.forwardRef((t,r)=>{const{__scopeDropdownMenu:s,...n}=t,a=hh(s);return e.jsx(Slt,{...a,...n,ref:r})});qlt.displayName=Ult;var Vlt="DropdownMenuSubTrigger",w8e=E.forwardRef((t,r)=>{const{__scopeDropdownMenu:s,...n}=t,a=hh(s);return e.jsx(Clt,{...a,...n,ref:r})});w8e.displayName=Vlt;var Hlt="DropdownMenuSubContent",j8e=E.forwardRef((t,r)=>{const{__scopeDropdownMenu:s,...n}=t,a=hh(s);return e.jsx(Mlt,{...a,...n,ref:r,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});j8e.displayName=Hlt;var Wlt=d8e,Glt=h8e,Klt=m8e,k8e=f8e,N8e=g8e,S8e=x8e,C8e=y8e,M8e=v8e,T8e=_8e,A8e=b8e,E8e=w8e,I8e=j8e;const mh=Wlt,ph=Glt,Zlt=E.forwardRef(({className:t,inset:r,children:s,...n},a)=>e.jsxs(E8e,{ref:a,className:qt("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",r&&"pl-8",t),...n,children:[s,e.jsx(Wi,{className:"ml-auto h-4 w-4"})]}));Zlt.displayName=E8e.displayName;const Ylt=E.forwardRef(({className:t,...r},s)=>e.jsx(I8e,{ref:s,className:qt("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r}));Ylt.displayName=I8e.displayName;const Au=E.forwardRef(({className:t,sideOffset:r=4,...s},n)=>e.jsx(Klt,{children:e.jsx(k8e,{ref:n,sideOffset:r,className:qt("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s})}));Au.displayName=k8e.displayName;const Ba=E.forwardRef(({className:t,inset:r,...s},n)=>e.jsx(S8e,{ref:n,className:qt("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",r&&"pl-8",t),...s}));Ba.displayName=S8e.displayName;const Xlt=E.forwardRef(({className:t,children:r,checked:s,...n},a)=>e.jsxs(C8e,{ref:a,className:qt("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t),checked:s,...n,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(T8e,{children:e.jsx(li,{className:"h-4 w-4"})})}),r]}));Xlt.displayName=C8e.displayName;const Qlt=E.forwardRef(({className:t,children:r,...s},n)=>e.jsxs(M8e,{ref:n,className:qt("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t),...s,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(T8e,{children:e.jsx(ah,{className:"h-2 w-2 fill-current"})})}),r]}));Qlt.displayName=M8e.displayName;const pme=E.forwardRef(({className:t,inset:r,...s},n)=>e.jsx(N8e,{ref:n,className:qt("px-2 py-1.5 text-sm font-semibold",r&&"pl-8",t),...s}));pme.displayName=N8e.displayName;const yk=E.forwardRef(({className:t,...r},s)=>e.jsx(A8e,{ref:s,className:qt("-mx-1 my-1 h-px bg-muted",t),...r}));yk.displayName=A8e.displayName;const Jlt=()=>{const{isAssistant:t,actingAsAgent:r,assignedAgents:s,setActingAsAgent:n}=Vxe();if(!(t&&!!r))return null;const o=l=>l.split(" ").map(i=>i[0]).join("").toUpperCase().slice(0,2);return e.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:e.jsxs("div",{className:"container mx-auto flex items-center justify-between gap-4 h-full",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ws,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"font-medium text-sm",children:"Acting as"}),s.length>1?e.jsxs(mh,{children:[e.jsx(ph,{asChild:!0,children:e.jsxs(Q,{variant:"secondary",size:"sm",className:"gap-2 bg-primary-foreground/20 hover:bg-primary-foreground/30 text-primary-foreground border-0",children:[e.jsxs(ln,{className:"h-5 w-5",children:[e.jsx(pa,{src:r.avatar_url||void 0}),e.jsx(cn,{className:"text-[10px] bg-primary-foreground/30",children:o(r.name)})]}),e.jsx("strong",{children:r.name}),e.jsx(Jc,{className:"h-3 w-3"})]})}),e.jsx(Au,{align:"start",children:s.map(l=>e.jsxs(Ba,{onClick:()=>n(l),className:"gap-2",children:[e.jsxs(ln,{className:"h-6 w-6",children:[e.jsx(pa,{src:l.avatar_url||void 0}),e.jsx(cn,{className:"text-[10px]",children:o(l.name)})]}),e.jsx("span",{children:l.name}),l.id===r.id&&e.jsx(bt,{variant:"secondary",className:"ml-auto text-[10px]",children:"Current"})]},l.id))})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(ln,{className:"h-5 w-5",children:[e.jsx(pa,{src:r.avatar_url||void 0}),e.jsx(cn,{className:"text-[10px] bg-primary-foreground/30",children:o(r.name)})]}),e.jsx("strong",{children:r.name})]})]}),e.jsx(bt,{variant:"secondary",className:"bg-primary-foreground/20 text-primary-foreground border-0 text-xs",children:"Assistant Mode"})]})})},Ms=({children:t,requireAdmin:r=!1,requireBrokerageManager:s=!1})=>{const{user:n,loading:a,isAdmin:o,isBrokerageManager:l}=Gr();return a?e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})}):n?r&&!o?e.jsx(Sce,{to:"/dashboard",replace:!0}):s&&!l&&!o?e.jsx(Sce,{to:"/dashboard",replace:!0}):e.jsx(e.Fragment,{children:t}):e.jsx(Sce,{to:"/auth",replace:!0})};var tye={};(function t(r,s,n,a){var o=!!(r.Worker&&r.Blob&&r.Promise&&r.OffscreenCanvas&&r.OffscreenCanvasRenderingContext2D&&r.HTMLCanvasElement&&r.HTMLCanvasElement.prototype.transferControlToOffscreen&&r.URL&&r.URL.createObjectURL),l=typeof Path2D=="function"&&typeof DOMMatrix=="function",i=function(){if(!r.OffscreenCanvas)return!1;try{var Te=new OffscreenCanvas(1,1),be=Te.getContext("2d");be.fillRect(0,0,1,1);var we=Te.transferToImageBitmap();be.createPattern(we,"no-repeat")}catch{return!1}return!0}();function d(){}function m(Te){var be=s.exports.Promise,we=be!==void 0?be:r.Promise;return typeof we=="function"?new we(Te):(Te(d,d),null)}var g=function(Te,be){return{transform:function(we){if(Te)return we;if(be.has(we))return be.get(we);var ve=new OffscreenCanvas(we.width,we.height),tt=ve.getContext("2d");return tt.drawImage(we,0,0),be.set(we,ve),ve},clear:function(){be.clear()}}}(i,new Map),y=function(){var Te=Math.floor(16.666666666666668),be,we,ve={},tt=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(be=function(Ae){var Le=Math.random();return ve[Le]=requestAnimationFrame(function Ue(Ye){tt===Ye||tt+Te-1{const{data:r,error:s}=await Z.from("celebration_queue").select("*").eq("user_id",t.id).is("seen_at",null).order("created_at",{ascending:!0});if(s)throw s;return r},enabled:!!(t!=null&&t.id),refetchOnWindowFocus:!0,staleTime:0})}function tct(){const t=qr();return Jt({mutationFn:async r=>{const{error:s}=await Z.from("celebration_queue").update({seen_at:new Date().toISOString()}).eq("id",r);if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["celebrations"]})}})}function rct(){const t=qr(),{user:r}=Gr();return Jt({mutationFn:async s=>{const{error:n}=await Z.from("celebration_queue").insert({user_id:s.user_id,celebration_type:s.celebration_type,title:s.title,message:s.message||null,points_amount:s.points_amount||null,created_by:r==null?void 0:r.id});if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["celebrations"]})}})}var Bne="Dialog",[P8e,L8e]=fc(Bne),[sct,Xf]=P8e(Bne),O8e=t=>{const{__scopeDialog:r,children:s,open:n,defaultOpen:a,onOpenChange:o,modal:l=!0}=t,i=E.useRef(null),d=E.useRef(null),[m,g]=oh({prop:n,defaultProp:a??!1,onChange:o,caller:Bne});return e.jsx(sct,{scope:r,triggerRef:i,contentRef:d,contentId:bd(),titleId:bd(),descriptionId:bd(),open:m,onOpenChange:g,onOpenToggle:E.useCallback(()=>g(y=>!y),[g]),modal:l,children:s})};O8e.displayName=Bne;var D8e="DialogTrigger",R8e=E.forwardRef((t,r)=>{const{__scopeDialog:s,...n}=t,a=Xf(D8e,s),o=ga(r,a.triggerRef);return e.jsx(qs.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":nye(a.open),...n,ref:o,onClick:bs(t.onClick,a.onOpenToggle)})});R8e.displayName=D8e;var rye="DialogPortal",[nct,F8e]=P8e(rye,{forceMount:void 0}),z8e=t=>{const{__scopeDialog:r,forceMount:s,children:n,container:a}=t,o=Xf(rye,r);return e.jsx(nct,{scope:r,forceMount:s,children:E.Children.map(n,l=>e.jsx(zc,{present:s||o.open,children:e.jsx(M3,{asChild:!0,container:a,children:l})}))})};z8e.displayName=rye;var Wte="DialogOverlay",B8e=E.forwardRef((t,r)=>{const s=F8e(Wte,t.__scopeDialog),{forceMount:n=s.forceMount,...a}=t,o=Xf(Wte,t.__scopeDialog);return o.modal?e.jsx(zc,{present:n||o.open,children:e.jsx(ict,{...a,ref:r})}):null});B8e.displayName=Wte;var act=fv("DialogOverlay.RemoveScroll"),ict=E.forwardRef((t,r)=>{const{__scopeDialog:s,...n}=t,a=Xf(Wte,s);return e.jsx(xP,{as:act,allowPinchZoom:!0,shards:[a.contentRef],children:e.jsx(qs.div,{"data-state":nye(a.open),...n,ref:r,style:{pointerEvents:"auto",...n.style}})})}),vk="DialogContent",$8e=E.forwardRef((t,r)=>{const s=F8e(vk,t.__scopeDialog),{forceMount:n=s.forceMount,...a}=t,o=Xf(vk,t.__scopeDialog);return e.jsx(zc,{present:n||o.open,children:o.modal?e.jsx(oct,{...a,ref:r}):e.jsx(lct,{...a,ref:r})})});$8e.displayName=vk;var oct=E.forwardRef((t,r)=>{const s=Xf(vk,t.__scopeDialog),n=E.useRef(null),a=ga(r,s.contentRef,n);return E.useEffect(()=>{const o=n.current;if(o)return One(o)},[]),e.jsx(U8e,{...t,ref:a,trapFocus:s.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:bs(t.onCloseAutoFocus,o=>{var l;o.preventDefault(),(l=s.triggerRef.current)==null||l.focus()}),onPointerDownOutside:bs(t.onPointerDownOutside,o=>{const l=o.detail.originalEvent,i=l.button===0&&l.ctrlKey===!0;(l.button===2||i)&&o.preventDefault()}),onFocusOutside:bs(t.onFocusOutside,o=>o.preventDefault())})}),lct=E.forwardRef((t,r)=>{const s=Xf(vk,t.__scopeDialog),n=E.useRef(!1),a=E.useRef(!1);return e.jsx(U8e,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,i;(l=t.onCloseAutoFocus)==null||l.call(t,o),o.defaultPrevented||(n.current||(i=s.triggerRef.current)==null||i.focus(),o.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:o=>{var d,m;(d=t.onInteractOutside)==null||d.call(t,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=o.target;((m=s.triggerRef.current)==null?void 0:m.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}})}),U8e=E.forwardRef((t,r)=>{const{__scopeDialog:s,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:o,...l}=t,i=Xf(vk,s),d=E.useRef(null),m=ga(r,d);return Lne(),e.jsxs(e.Fragment,{children:[e.jsx(fP,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:o,children:e.jsx(Sv,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":nye(i.open),...l,ref:m,onDismiss:()=>i.onOpenChange(!1)})}),e.jsxs(e.Fragment,{children:[e.jsx(dct,{titleId:i.titleId}),e.jsx(hct,{contentRef:d,descriptionId:i.descriptionId})]})]})}),sye="DialogTitle",q8e=E.forwardRef((t,r)=>{const{__scopeDialog:s,...n}=t,a=Xf(sye,s);return e.jsx(qs.h2,{id:a.titleId,...n,ref:r})});q8e.displayName=sye;var V8e="DialogDescription",H8e=E.forwardRef((t,r)=>{const{__scopeDialog:s,...n}=t,a=Xf(V8e,s);return e.jsx(qs.p,{id:a.descriptionId,...n,ref:r})});H8e.displayName=V8e;var W8e="DialogClose",G8e=E.forwardRef((t,r)=>{const{__scopeDialog:s,...n}=t,a=Xf(W8e,s);return e.jsx(qs.button,{type:"button",...n,ref:r,onClick:bs(t.onClick,()=>a.onOpenChange(!1))})});G8e.displayName=W8e;function nye(t){return t?"open":"closed"}var K8e="DialogTitleWarning",[cct,Z8e]=BXe(K8e,{contentName:vk,titleName:sye,docsSlug:"dialog"}),dct=({titleId:t})=>{const r=Z8e(K8e),s=`\`${r.contentName}\` requires a \`${r.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${r.titleName}\`, you can wrap it with our VisuallyHidden component. For more information, see https://radix-ui.com/primitives/docs/components/${r.docsSlug}`;return E.useEffect(()=>{t&&(document.getElementById(t)||console.error(s))},[s,t]),null},uct="DialogDescriptionWarning",hct=({contentRef:t,descriptionId:r})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Z8e(uct).contentName}}.`;return E.useEffect(()=>{var o;const a=(o=t.current)==null?void 0:o.getAttribute("aria-describedby");r&&a&&(document.getElementById(r)||console.warn(n))},[n,t,r]),null},$ne=O8e,aye=R8e,Une=z8e,U3=B8e,q3=$8e,_P=q8e,bP=H8e,qne=G8e;const Dr=$ne,xo=aye,mct=Une,Y8e=E.forwardRef(({className:t,...r},s)=>e.jsx(U3,{ref:s,className:qt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r}));Y8e.displayName=U3.displayName;const Lr=E.forwardRef(({className:t,children:r,...s},n)=>e.jsxs(mct,{children:[e.jsx(Y8e,{}),e.jsxs(q3,{ref:n,className:qt("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...s,children:[r,e.jsxs(qne,{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:[e.jsx(rn,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Lr.displayName=q3.displayName;const Ur=({className:t,...r})=>e.jsx("div",{className:qt("flex flex-col space-y-1.5 text-center sm:text-left",t),...r});Ur.displayName="DialogHeader";const Dn=({className:t,...r})=>e.jsx("div",{className:qt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r});Dn.displayName="DialogFooter";const Br=E.forwardRef(({className:t,...r},s)=>e.jsx(_P,{ref:s,className:qt("text-lg font-semibold leading-none tracking-tight",t),...r}));Br.displayName=_P.displayName;const Gs=E.forwardRef(({className:t,...r},s)=>e.jsx(bP,{ref:s,className:qt("text-sm text-muted-foreground",t),...r}));Gs.displayName=bP.displayName;const pct={points_earned:ho,listing_created:Wn,deal_closed:yd,custom:Ln},sNe={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 fct(){const{user:t}=Gr(),r=qr(),{data:s}=ect(),n=tct(),[a,o]=E.useState(null),[l,i]=E.useState(!1),d=E.useCallback(()=>{const b=Date.now()+3e3,N={startVelocity:30,spread:360,ticks:60,zIndex:9999},j=(A,M)=>Math.random()*(M-A)+A,S=setInterval(()=>{const A=b-Date.now();if(A<=0){clearInterval(S);return}const M=50*(A/3e3);rNe({...N,particleCount:M,origin:{x:j(.1,.3),y:Math.random()-.2},colors:["#ff6b6b","#feca57","#48dbfb","#ff9ff3","#54a0ff","#5f27cd"]}),rNe({...N,particleCount:M,origin:{x:j(.7,.9),y:Math.random()-.2},colors:["#ff6b6b","#feca57","#48dbfb","#ff9ff3","#54a0ff","#5f27cd"]})},250)},[]);E.useEffect(()=>{s&&s.length>0&&!a&&(o(s[0]),i(!0),setTimeout(d,100))},[s,a,d]);const m=async()=>{if(a){const v=a.id;i(!1),o(null),r.setQueryData(["celebrations","pending",t==null?void 0:t.id],b=>(b==null?void 0:b.filter(N=>N.id!==v))??[]),await n.mutateAsync(v)}};if(!a)return null;const g=pct[a.celebration_type]||Ln,y=sNe[a.celebration_type]||sNe.custom;return e.jsx(Dr,{open:l,onOpenChange:v=>!v&&m(),children:e.jsxs(Lr,{className:"sm:max-w-md text-center border-0 overflow-hidden",children:[e.jsx("div",{className:`absolute inset-0 bg-gradient-to-br ${y} opacity-10`}),e.jsxs("div",{className:"relative z-10 py-6",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("div",{className:`w-20 h-20 rounded-full bg-gradient-to-br ${y} flex items-center justify-center animate-bounce`,children:e.jsx(g,{className:"w-10 h-10 text-white"})})}),e.jsxs("div",{className:"flex justify-center gap-1 mb-4",children:[e.jsx(An,{className:"w-5 h-5 text-yellow-500 animate-pulse"}),e.jsx(An,{className:"w-5 h-5 text-yellow-500 animate-pulse delay-75"}),e.jsx(An,{className:"w-5 h-5 text-yellow-500 animate-pulse delay-150"})]}),e.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&&e.jsxs("div",{className:"text-4xl font-bold text-primary mb-2",children:["+",a.points_amount," points!"]}),a.message&&e.jsx("p",{className:"text-muted-foreground mb-6",children:a.message}),e.jsx(Q,{onClick:m,className:"w-full",size:"lg",children:"Awesome! 🙌"}),s&&s.length>1&&e.jsxs("p",{className:"text-sm text-muted-foreground mt-3",children:["+",s.length-1," more celebration",s.length>2?"s":""," waiting"]})]})]})})}const X8e="/assets/levelup-logo-horizontal-DEFNc0ms.png",iye="/assets/levelup-logo-white-C2RAgAoG.png",gct="/assets/listings-hero-BI9Ki9Dq.jpg",Qe=E.forwardRef(({className:t,type:r,...s},n)=>e.jsx("input",{type:r,className:qt("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...s}));Qe.displayName="Input";var Q8e={exports:{}};(function(t,r){(function(s,n){t.exports=n()})(ny,function(){var s,n,a;function o(i,d){if(!s)s=d;else if(!n)n=d;else{var m="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+s+")(sharedChunk); ("+n+")(sharedChunk); self.onerror = null;",g={};s(g),a=d(g),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(a.workerUrl=window.URL.createObjectURL(new Blob([m],{type:"text/javascript"})))}}o(["exports"],function(i){var d=1e-6,m=typeof Float32Array<"u"?Float32Array:Array;function g(p,c){var h=c[0],x=c[1],_=c[2],C=c[3],T=h*C-_*x;return T?(p[0]=C*(T=1/T),p[1]=-x*T,p[2]=-_*T,p[3]=h*T,p):null}function y(){var p=new m(9);return m!=Float32Array&&(p[1]=0,p[2]=0,p[3]=0,p[5]=0,p[6]=0,p[7]=0),p[0]=1,p[4]=1,p[8]=1,p}function v(p,c){var h=c[0],x=c[1],_=c[2],C=c[3],T=c[4],L=c[5],z=c[6],q=c[7],K=c[8];return p[0]=T*K-L*q,p[1]=_*q-x*K,p[2]=x*L-_*T,p[3]=L*z-C*K,p[4]=h*K-_*z,p[5]=_*C-h*L,p[6]=C*q-T*z,p[7]=x*z-h*q,p[8]=h*T-x*C,p}function b(p,c,h){var x=c[0],_=c[1],C=c[2],T=c[3],L=c[4],z=c[5],q=c[6],K=c[7],Y=c[8],ee=h[0],re=h[1],ie=h[2],ge=h[3],Ce=h[4],Ne=h[5],Fe=h[6],Be=h[7],Ze=h[8];return p[0]=ee*x+re*T+ie*q,p[1]=ee*_+re*L+ie*K,p[2]=ee*C+re*z+ie*Y,p[3]=ge*x+Ce*T+Ne*q,p[4]=ge*_+Ce*L+Ne*K,p[5]=ge*C+Ce*z+Ne*Y,p[6]=Fe*x+Be*T+Ze*q,p[7]=Fe*_+Be*L+Ze*K,p[8]=Fe*C+Be*z+Ze*Y,p}function N(){var p=new m(16);return m!=Float32Array&&(p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[11]=0,p[12]=0,p[13]=0,p[14]=0),p[0]=1,p[5]=1,p[10]=1,p[15]=1,p}function j(p){var c=new m(16);return c[0]=p[0],c[1]=p[1],c[2]=p[2],c[3]=p[3],c[4]=p[4],c[5]=p[5],c[6]=p[6],c[7]=p[7],c[8]=p[8],c[9]=p[9],c[10]=p[10],c[11]=p[11],c[12]=p[12],c[13]=p[13],c[14]=p[14],c[15]=p[15],c}function S(p){return p[0]=1,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=1,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[10]=1,p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,p}function A(p,c){var h=c[0],x=c[1],_=c[2],C=c[3],T=c[4],L=c[5],z=c[6],q=c[7],K=c[8],Y=c[9],ee=c[10],re=c[11],ie=c[12],ge=c[13],Ce=c[14],Ne=c[15],Fe=h*L-x*T,Be=h*z-_*T,Ze=h*q-C*T,yt=x*z-_*L,ht=x*q-C*L,jt=_*q-C*z,Et=K*ge-Y*ie,Dt=K*Ce-ee*ie,tr=K*Ne-re*ie,$t=Y*Ce-ee*ge,or=Y*Ne-re*ge,mr=ee*Ne-re*Ce,pr=Fe*mr-Be*or+Ze*$t+yt*tr-ht*Dt+jt*Et;return pr?(p[0]=(L*mr-z*or+q*$t)*(pr=1/pr),p[1]=(_*or-x*mr-C*$t)*pr,p[2]=(ge*jt-Ce*ht+Ne*yt)*pr,p[3]=(ee*ht-Y*jt-re*yt)*pr,p[4]=(z*tr-T*mr-q*Dt)*pr,p[5]=(h*mr-_*tr+C*Dt)*pr,p[6]=(Ce*Ze-ie*jt-Ne*Be)*pr,p[7]=(K*jt-ee*Ze+re*Be)*pr,p[8]=(T*or-L*tr+q*Et)*pr,p[9]=(x*tr-h*or-C*Et)*pr,p[10]=(ie*ht-ge*Ze+Ne*Fe)*pr,p[11]=(Y*Ze-K*ht-re*Fe)*pr,p[12]=(L*Dt-T*$t-z*Et)*pr,p[13]=(h*$t-x*Dt+_*Et)*pr,p[14]=(ge*Be-ie*yt-Ce*Fe)*pr,p[15]=(K*yt-Y*Be+ee*Fe)*pr,p):null}function M(p,c,h){var x=c[0],_=c[1],C=c[2],T=c[3],L=c[4],z=c[5],q=c[6],K=c[7],Y=c[8],ee=c[9],re=c[10],ie=c[11],ge=c[12],Ce=c[13],Ne=c[14],Fe=c[15],Be=h[0],Ze=h[1],yt=h[2],ht=h[3];return p[0]=Be*x+Ze*L+yt*Y+ht*ge,p[1]=Be*_+Ze*z+yt*ee+ht*Ce,p[2]=Be*C+Ze*q+yt*re+ht*Ne,p[3]=Be*T+Ze*K+yt*ie+ht*Fe,p[4]=(Be=h[4])*x+(Ze=h[5])*L+(yt=h[6])*Y+(ht=h[7])*ge,p[5]=Be*_+Ze*z+yt*ee+ht*Ce,p[6]=Be*C+Ze*q+yt*re+ht*Ne,p[7]=Be*T+Ze*K+yt*ie+ht*Fe,p[8]=(Be=h[8])*x+(Ze=h[9])*L+(yt=h[10])*Y+(ht=h[11])*ge,p[9]=Be*_+Ze*z+yt*ee+ht*Ce,p[10]=Be*C+Ze*q+yt*re+ht*Ne,p[11]=Be*T+Ze*K+yt*ie+ht*Fe,p[12]=(Be=h[12])*x+(Ze=h[13])*L+(yt=h[14])*Y+(ht=h[15])*ge,p[13]=Be*_+Ze*z+yt*ee+ht*Ce,p[14]=Be*C+Ze*q+yt*re+ht*Ne,p[15]=Be*T+Ze*K+yt*ie+ht*Fe,p}function I(p,c,h){var x,_,C,T,L,z,q,K,Y,ee,re,ie,ge=h[0],Ce=h[1],Ne=h[2];return c===p?(p[12]=c[0]*ge+c[4]*Ce+c[8]*Ne+c[12],p[13]=c[1]*ge+c[5]*Ce+c[9]*Ne+c[13],p[14]=c[2]*ge+c[6]*Ce+c[10]*Ne+c[14],p[15]=c[3]*ge+c[7]*Ce+c[11]*Ne+c[15]):(_=c[1],C=c[2],T=c[3],L=c[4],z=c[5],q=c[6],K=c[7],Y=c[8],ee=c[9],re=c[10],ie=c[11],p[0]=x=c[0],p[1]=_,p[2]=C,p[3]=T,p[4]=L,p[5]=z,p[6]=q,p[7]=K,p[8]=Y,p[9]=ee,p[10]=re,p[11]=ie,p[12]=x*ge+L*Ce+Y*Ne+c[12],p[13]=_*ge+z*Ce+ee*Ne+c[13],p[14]=C*ge+q*Ce+re*Ne+c[14],p[15]=T*ge+K*Ce+ie*Ne+c[15]),p}function F(p,c,h){var x=h[0],_=h[1],C=h[2];return p[0]=c[0]*x,p[1]=c[1]*x,p[2]=c[2]*x,p[3]=c[3]*x,p[4]=c[4]*_,p[5]=c[5]*_,p[6]=c[6]*_,p[7]=c[7]*_,p[8]=c[8]*C,p[9]=c[9]*C,p[10]=c[10]*C,p[11]=c[11]*C,p[12]=c[12],p[13]=c[13],p[14]=c[14],p[15]=c[15],p}function O(p,c,h){var x=Math.sin(h),_=Math.cos(h),C=c[4],T=c[5],L=c[6],z=c[7],q=c[8],K=c[9],Y=c[10],ee=c[11];return c!==p&&(p[0]=c[0],p[1]=c[1],p[2]=c[2],p[3]=c[3],p[12]=c[12],p[13]=c[13],p[14]=c[14],p[15]=c[15]),p[4]=C*_+q*x,p[5]=T*_+K*x,p[6]=L*_+Y*x,p[7]=z*_+ee*x,p[8]=q*_-C*x,p[9]=K*_-T*x,p[10]=Y*_-L*x,p[11]=ee*_-z*x,p}function B(p,c,h){var x=Math.sin(h),_=Math.cos(h),C=c[0],T=c[1],L=c[2],z=c[3],q=c[8],K=c[9],Y=c[10],ee=c[11];return c!==p&&(p[4]=c[4],p[5]=c[5],p[6]=c[6],p[7]=c[7],p[12]=c[12],p[13]=c[13],p[14]=c[14],p[15]=c[15]),p[0]=C*_-q*x,p[1]=T*_-K*x,p[2]=L*_-Y*x,p[3]=z*_-ee*x,p[8]=C*x+q*_,p[9]=T*x+K*_,p[10]=L*x+Y*_,p[11]=z*x+ee*_,p}function $(p,c,h){var x=Math.sin(h),_=Math.cos(h),C=c[0],T=c[1],L=c[2],z=c[3],q=c[4],K=c[5],Y=c[6],ee=c[7];return c!==p&&(p[8]=c[8],p[9]=c[9],p[10]=c[10],p[11]=c[11],p[12]=c[12],p[13]=c[13],p[14]=c[14],p[15]=c[15]),p[0]=C*_+q*x,p[1]=T*_+K*x,p[2]=L*_+Y*x,p[3]=z*_+ee*x,p[4]=q*_-C*x,p[5]=K*_-T*x,p[6]=Y*_-L*x,p[7]=ee*_-z*x,p}function H(p,c){return p[0]=c[0],p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=c[1],p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[10]=c[2],p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,p}function W(p,c,h){var x,_,C,T=h[0],L=h[1],z=h[2],q=Math.sqrt(T*T+L*L+z*z);return q0&&(C=1/Math.sqrt(C)),p[0]=c[0]*C,p[1]=c[1]*C,p[2]=c[2]*C,p}function et(p,c){return p[0]*c[0]+p[1]*c[1]+p[2]*c[2]}function It(p,c,h){var x=c[0],_=c[1],C=c[2],T=h[0],L=h[1],z=h[2];return p[0]=_*z-C*L,p[1]=C*T-x*z,p[2]=x*L-_*T,p}function Pe(p,c,h,x){var _=c[0],C=c[1],T=c[2];return p[0]=_+x*(h[0]-_),p[1]=C+x*(h[1]-C),p[2]=T+x*(h[2]-T),p}function at(p,c,h){var x=c[0],_=c[1],C=c[2],T=h[3]*x+h[7]*_+h[11]*C+h[15];return p[0]=(h[0]*x+h[4]*_+h[8]*C+h[12])/(T=T||1),p[1]=(h[1]*x+h[5]*_+h[9]*C+h[13])/T,p[2]=(h[2]*x+h[6]*_+h[10]*C+h[14])/T,p}function ce(p,c,h){var x=c[0],_=c[1],C=c[2];return p[0]=x*h[0]+_*h[3]+C*h[6],p[1]=x*h[1]+_*h[4]+C*h[7],p[2]=x*h[2]+_*h[5]+C*h[8],p}function $e(p,c,h){var x=h[0],_=h[1],C=h[2],T=h[3],L=c[0],z=c[1],q=c[2],K=_*q-C*z,Y=C*L-x*q,ee=x*z-_*L;return p[0]=L+T*(K+=K)+_*(ee+=ee)-C*(Y+=Y),p[1]=z+T*Y+C*K-x*ee,p[2]=q+T*ee+x*Y-_*K,p}function Ge(p){return p[0]=0,p[1]=0,p[2]=0,p}function rt(p,c){return p[0]===c[0]&&p[1]===c[1]&&p[2]===c[2]}var je=xe,it=Te,Me=fe;function Je(){var p=new m(4);return m!=Float32Array&&(p[0]=0,p[1]=0,p[2]=0,p[3]=0),p}function Xe(p,c,h){return p[0]=c[0]*h,p[1]=c[1]*h,p[2]=c[2]*h,p[3]=c[3]*h,p}function Ve(p,c){var h=c[0],x=c[1],_=c[2],C=c[3],T=h*h+x*x+_*_+C*C;return T>0&&(T=1/Math.sqrt(T)),p[0]=h*T,p[1]=x*T,p[2]=_*T,p[3]=C*T,p}function ot(p,c,h){var x=c[0],_=c[1],C=c[2],T=c[3];return p[0]=h[0]*x+h[4]*_+h[8]*C+h[12]*T,p[1]=h[1]*x+h[5]*_+h[9]*C+h[13]*T,p[2]=h[2]*x+h[6]*_+h[10]*C+h[14]*T,p[3]=h[3]*x+h[7]*_+h[11]*C+h[15]*T,p}function mt(){var p=new m(4);return m!=Float32Array&&(p[0]=0,p[1]=0,p[2]=0),p[3]=1,p}function ft(p){return p[0]=0,p[1]=0,p[2]=0,p[3]=1,p}function ct(p,c,h){h*=.5;var x=c[0],_=c[1],C=c[2],T=c[3],L=Math.sin(h),z=Math.cos(h);return p[0]=x*z+T*L,p[1]=_*z+C*L,p[2]=C*z-_*L,p[3]=T*z-x*L,p}function Mt(p,c,h){h*=.5;var x=c[0],_=c[1],C=c[2],T=c[3],L=Math.sin(h),z=Math.cos(h);return p[0]=x*z-C*L,p[1]=_*z+T*L,p[2]=C*z+x*L,p[3]=T*z-_*L,p}le(),Je();var Ot,rr,Ir,cr=Ve,Mr=(Ot=le(),rr=oe(1,0,0),Ir=oe(0,1,0),function(p,c,h){var x=et(c,h);return x<-.999999?(It(Ot,rr,c),Me(Ot)<1e-6&&It(Ot,Ir,c),Ie(Ot,Ot),function(_,C,T){T*=.5;var L=Math.sin(T);_[0]=L*C[0],_[1]=L*C[1],_[2]=L*C[2],_[3]=Math.cos(T)}(p,Ot,Math.PI),p):x>.999999?(p[0]=0,p[1]=0,p[2]=0,p[3]=1,p):(It(Ot,c,h),p[0]=Ot[0],p[1]=Ot[1],p[2]=Ot[2],p[3]=1+x,cr(p,p))});function As(){var p=new m(2);return m!=Float32Array&&(p[0]=0,p[1]=0),p}function At(p,c){var h=new m(2);return h[0]=p,h[1]=c,h}function Rt(p,c,h){return p[0]=c,p[1]=h,p}function Cr(p,c,h){return p[0]=c[0]+h[0],p[1]=c[1]+h[1],p}function fs(p,c,h){return p[0]=c[0]-h[0],p[1]=c[1]-h[1],p}function Vs(p,c,h){return p[0]=c[0]*h,p[1]=c[1]*h,p}function Js(p){var c=p[0],h=p[1];return Math.sqrt(c*c+h*h)}function hi(p,c){var h=c[0],x=c[1],_=h*h+x*x;return _>0&&(_=1/Math.sqrt(_)),p[0]=c[0]*_,p[1]=c[1]*_,p}function Ia(p,c){return p[0]*c[0]+p[1]*c[1]}mt(),mt(),y();var dn,na,en=fs;function Un(p){return p&&p.__esModule&&Object.prototype.hasOwnProperty.call(p,"default")?p.default:p}As();var Gn=function(){if(na)return dn;function p(c,h,x,_){this.cx=3*c,this.bx=3*(x-c)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*h,this.by=3*(_-h)-this.cy,this.ay=1-this.cy-this.by,this.p1x=c,this.p1y=h,this.p2x=x,this.p2y=_}return na=1,dn=p,p.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 x=c,_=0;_<8;_++){var C=this.sampleCurveX(x)-c;if(Math.abs(C)C?L=x:z=x,x=.5*(z-L)+L;return x},solve:function(c,h){return this.sampleCurveY(this.solveCurveX(c,h))}},dn}(),Ai=Un(Gn);function dr(p,c){this.x=p,this.y=c}function Fa(p,c){if(Array.isArray(p)){if(!Array.isArray(c)||p.length!==c.length)return!1;for(let h=0;h=1)return 1;const c=p*p,h=c*p;return 4*(p<.5?h:3*(p-c)+h-.75)}function xc(p,c,h,x){const _=new Ai(p,c,h,x);return function(C){return _.solve(C)}}const st=xc(.25,.1,.25,1);function ye(p,c,h){return Math.min(h,Math.max(c,p))}function Oe(p,c,h){return(h=ye((h-p)/(c-p),0,1))*h*(3-2*h)}function Ke(p,c,h){const x=h-c,_=((p-c)%x+x)%x+c;return _===c?h:_}function St(p,c,h){if(!p.length)return h(null,[]);let x=p.length;const _=new Array(p.length);let C=null;p.forEach((T,L)=>{c(T,(z,q)=>{z&&(C=z),_[L]=q,--x==0&&h(C,_)})})}let wt=1;function Lt(){return wt++}function Gt(p){return p<=1?1:Math.pow(2,Math.ceil(Math.log2(p)))}function Ft(p,c){p.forEach(h=>{c[h]&&(c[h]=c[h].bind(c))})}function Yt(p,c,h){const x={};for(const _ in p)x[_]=c.call(this,p[_],_,p);return x}function yr(p,c,h){const x={};for(const _ in p)c.call(this,p[_],_,p)&&(x[_]=p[_]);return x}function hr(p){return Array.isArray(p)?p.map(hr):typeof p=="object"&&p?Yt(p,hr):p}function ss(p,c){for(let h=0;h=0)return!0;return!1}const Is={};function es(p){Is[p]||(typeof console<"u"&&console.warn(p),Is[p]=!0)}function yn(p,c,h){return(h.y-p.y)*(c.x-p.x)>(c.y-p.y)*(h.x-p.x)}function vn(p){let c=0;for(let h,x,_=0,C=p.length,T=C-1;_@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(h,x,_,C)=>{const T=_||C;return c[x]=!T||T.toLowerCase(),""}),c["max-age"]){const h=parseInt(c["max-age"],10);isNaN(h)?delete c["max-age"]:c["max-age"]=h}return c}let Mo=null;function Sa(p,c){return[p[4*c],p[4*c+1],p[4*c+2],p[4*c+3]]}function Io(p,c,h,x){for(;c>1;p[_]>1;p[_]<=x?c=_+1:h=_}return c}function la(p){return p>0?1/(1.001-p):1+p}function zi(p){return p>0?1-1/(1.001-p):-p}function Ya(p,c,h){return(p-c.min)*(h.max-h.min)/(c.max-c.min)+h.min}const qn={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(!qn.API_URL)return null;try{const p=new URL(qn.API_URL);return p.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":p.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 Bi(p){return qn.API_URL_REGEX.test(p)}function wl(p){return qn.API_SPRITE_REGEX.test(p)}let Ol,ad,Om,Qo,Wd,yc;function fh(){return Ol==null&&(Ol=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),Ol}const Jo={now:()=>Qo!==void 0?Qo:performance.now(),setNow(p){Qo=p},restoreNow(){Qo=void 0},frame(p){const c=requestAnimationFrame(p);return{cancel:()=>cancelAnimationFrame(c)}},getImageData(p,c=0){const{width:h,height:x}=p;Wd||(Wd=document.createElement("canvas"));const _=Wd.getContext("2d",{willReadFrequently:!0});if(!_)throw new Error("failed to create canvas 2d context");return(h>Wd.width||x>Wd.height)&&(Wd.width=h,Wd.height=x),_.clearRect(-c,-c,h+2*c,x+2*c),_.drawImage(p,0,0,h,x),_.getImageData(-c,-c,h+2*c,x+2*c)},resolveURL:p=>(ad||(ad=document.createElement("a")),ad.href=p,ad.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(Om==null&&(Om=window.matchMedia("(prefers-reduced-motion: reduce)")),Om.matches)},hasCanvasFingerprintNoise(){if(yc!==void 0)return yc;if(!fh())return yc=!1,!1;const p=new OffscreenCanvas(85,1),c=p.getContext("2d",{willReadFrequently:!0});let h=0;for(let _=0;_0?`?${C}`:""}`}const Jy="mapbox-tiles";let e0=500,t0=50;const Gh=["language","worldview","jobid"];let Ou,id;function du(){try{return caches}catch{}}function vc(){const p=du();p&&Ou==null&&(Ou=p.open(Jy))}let od=1/0;const Go={supported:!1,testSupport:function(p){!Gd&&Kh&&(Dp?xx(p):Du=p)}};let Du,Kh,Gd=!1,Dp=!1;const r0=typeof self<"u"?self:{};function xx(p){const c=p.createTexture();p.bindTexture(p.TEXTURE_2D,c);try{if(p.texImage2D(p.TEXTURE_2D,0,p.RGBA,p.RGBA,p.UNSIGNED_BYTE,Kh),p.isContextLost())return;Go.supported=!0}catch{}p.deleteTexture(c),Gd=!0}r0.document&&(Kh=r0.document.createElement("img"),Kh.onload=function(){Du&&xx(Du),Du=null,Dp=!0},Kh.onerror=function(){Gd=!0,Du=null},Kh.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Rp={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(Rp);class kd extends Error{constructor(c,h,x){h===401&&Bi(x)&&(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=x}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const s0=ea()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,Dm=function(p,c){if(!(/^file:/.test(h=p.url)||/^file:/.test(s0())&&!/^\w+:/.test(h))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(x,_){const C=new AbortController,T=new Request(x.url,{method:x.method||"GET",body:x.body,credentials:x.credentials,headers:x.headers,referrer:s0(),referrerPolicy:x.referrerPolicy,signal:C.signal});let L=!1,z=!1;const q=(K=T.url).indexOf("sku=")>0&&Bi(K);var K;x.type==="json"&&T.headers.set("Accept","application/json");const Y=(re,ie,ge)=>{if(z)return;if(re&&re.message!=="SecurityError"&&es(re.toString()),ie&&ge)return ee(ie);const Ce=Date.now();fetch(T).then(Ne=>{if(Ne.ok){const Fe=q?Ne.clone():null;return ee(Ne,Fe,Ce)}return _(new kd(Ne.statusText,Ne.status,x.url))}).catch(Ne=>{Ne.name!=="AbortError"&&_(new Error(`${Ne.message} ${x.url}`))})},ee=(re,ie,ge)=>{(x.type==="arrayBuffer"?re.arrayBuffer():x.type==="json"?re.json():re.text()).then(Ce=>{z||(ie&&ge&&function(Ne,Fe,Be){if(vc(),Ou==null)return;const Ze=Zi(Fe.headers.get("Cache-Control")||"");if(Ze["no-store"])return;const yt={status:Fe.status,statusText:Fe.statusText,headers:new Headers};Fe.headers.forEach((Et,Dt)=>yt.headers.set(Dt,Et)),Ze["max-age"]&&yt.headers.set("Expires",new Date(Be+1e3*Ze["max-age"]).toUTCString());const ht=yt.headers.get("Expires");if(!ht||new Date(ht).getTime()-Be<42e4)return;let jt=rg(Ne.url,{persistentParams:Gh});if(Fe.status===206){const Et=Ne.headers.get("Range");if(!Et)return;yt.status=200,jt=Op(jt,{range:Et})}(function(Et,Dt){if(id===void 0)try{new Response(new ReadableStream),id=!0}catch{id=!1}id?Dt(Et.body):Et.blob().then(Dt).catch(tr=>es(tr.message))})(Fe,Et=>{const Dt=new Response((tr=Fe.status)!==200&&tr!==404&&[101,103,204,205,304].includes(tr)?null:Et,yt);var tr;vc(),Ou!=null&&Ou.then($t=>$t.put(jt,Dt)).catch($t=>es($t.message))})}(T,ie,ge),L=!0,_(null,Ce,re.headers))}).catch(Ce=>{z||_(new Error(Ce.message))})};return q?function(re,ie){if(vc(),Ou==null)return ie(null);Ou.then(ge=>{let Ce=rg(re.url,{persistentParams:Gh});const Ne=re.headers.get("Range");Ne&&(Ce=Op(Ce,{range:Ne})),ge.match(Ce).then(Fe=>{const Be=function(Ze){if(!Ze)return!1;const yt=new Date(Ze.headers.get("Expires")||0),ht=Zi(Ze.headers.get("Cache-Control")||"");return Number(yt)>Date.now()&&!ht["no-cache"]}(Fe);ge.delete(Ce).catch(ie),Be&&ge.put(Ce,Fe.clone()).catch(ie),ie(null,Fe,Be)}).catch(ie)}).catch(ie)}(T,Y):Y(null,null),{cancel:()=>{z=!0,L||C.abort()}}}(p,c);if(ea(self)&&self.worker.actor)return self.worker.actor.send("getResource",p,c,void 0,!0)}var h;return function(x,_){const C=new XMLHttpRequest;C.open(x.method||"GET",x.url,!0),x.type==="arrayBuffer"&&(C.responseType="arraybuffer");for(const T in x.headers)C.setRequestHeader(T,x.headers[T]);return x.type==="json"&&(C.responseType="text",C.setRequestHeader("Accept","application/json")),C.withCredentials=x.credentials==="include",C.onerror=()=>{_(new Error(C.statusText))},C.onload=()=>{if((C.status>=200&&C.status<300||C.status===0)&&C.response!==null){let T=C.response;if(x.type==="json")try{T=JSON.parse(C.response)}catch(z){return _(z)}const L=new Headers;C.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(z=>{const q=z.split(": "),K=q.shift(),Y=q.join(": ");L.append(K,Y)}),_(null,T,L)}else _(new kd(C.statusText,C.status,x.url))},C.send(x.body),{cancel:()=>C.abort()}}(p,c)},Ru=function(p,c){return Dm(Object.assign(p,{type:"arrayBuffer"}),c)};function p5(p){const c=document.createElement("a");return c.href=p,c.protocol===location.protocol&&c.host===location.host}const Yk="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let yx,aa;yx=[],aa=0;const n0=function(p,c){if(Go.supported&&(p.headers||(p.headers={}),p.headers.accept="image/webp,*/*"),aa>=qn.MAX_PARALLEL_IMAGE_REQUESTS){const C={requestParameters:p,callback:c,cancelled:!1,cancel(){this.cancelled=!0}};return yx.push(C),C}aa++;let h=!1;const x=()=>{if(!h)for(h=!0,aa--;yx.length&&aa{x(),C?c(C):T&&(self.createImageBitmap?function(z,q){const K=new Blob([new Uint8Array(z)],{type:"image/png"});createImageBitmap(K).then(Y=>{q(null,Y)}).catch(Y=>{q(new Error(`Could not load image because of ${Y.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(T,(z,q)=>c(z,q,L)):function(z,q){const K=new Image;K.onload=()=>{q(null,K),URL.revokeObjectURL(K.src),K.onload=null,requestAnimationFrame(()=>{K.src=Yk})},K.onerror=()=>q(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 Y=new Blob([new Uint8Array(z)],{type:"image/png"});K.src=z.byteLength?URL.createObjectURL(Y):Yk}(T,(z,q)=>c(z,q,L)))});return{cancel:()=>{_.cancel(),x()}}};var qv,Xk,Qk,Rm={exports:{}},sg={exports:{}},vx={exports:{}},Nt=function(){if(Qk)return Rm.exports;Qk=1;var p=(qv||(qv=1,sg.exports=function(h,x){var _,C,T,L,z,q,K,Y;for(C=h.length-(_=3&h.length),T=x,z=3432918353,q=461845907,Y=0;Y>>16)*z&65535)<<16)&4294967295)<<15|K>>>17))*q+(((K>>>16)*q&65535)<<16)&4294967295)<<13|T>>>19))+((5*(T>>>16)&65535)<<16)&4294967295))+((58964+(L>>>16)&65535)<<16);switch(K=0,_){case 3:K^=(255&h.charCodeAt(Y+2))<<16;case 2:K^=(255&h.charCodeAt(Y+1))<<8;case 1:T^=K=(65535&(K=(K=(65535&(K^=255&h.charCodeAt(Y)))*z+(((K>>>16)*z&65535)<<16)&4294967295)<<15|K>>>17))*q+(((K>>>16)*q&65535)<<16)&4294967295}return T^=h.length,T=2246822507*(65535&(T^=T>>>16))+((2246822507*(T>>>16)&65535)<<16)&4294967295,T=3266489909*(65535&(T^=T>>>13))+((3266489909*(T>>>16)&65535)<<16)&4294967295,(T^=T>>>16)>>>0}),sg.exports),c=(Xk||(Xk=1,vx.exports=function(h,x){for(var _,C=h.length,T=x^C,L=0;C>=4;)_=1540483477*(65535&(_=255&h.charCodeAt(L)|(255&h.charCodeAt(++L))<<8|(255&h.charCodeAt(++L))<<16|(255&h.charCodeAt(++L))<<24))+((1540483477*(_>>>16)&65535)<<16),T=1540483477*(65535&T)+((1540483477*(T>>>16)&65535)<<16)^(_=1540483477*(65535&(_^=_>>>24))+((1540483477*(_>>>16)&65535)<<16)),C-=4,++L;switch(C){case 3:T^=(255&h.charCodeAt(L+2))<<16;case 2:T^=(255&h.charCodeAt(L+1))<<8;case 1:T=1540483477*(65535&(T^=255&h.charCodeAt(L)))+((1540483477*(T>>>16)&65535)<<16)}return T=1540483477*(65535&(T^=T>>>13))+((1540483477*(T>>>16)&65535)<<16),(T^=T>>>15)>>>0}),vx.exports);return Rm.exports=p,Rm.exports.murmur3=p,Rm.exports.murmur2=c,Rm.exports}(),vr=Un(Nt);class Vr{constructor(c,...h){Object.assign(this,h[0]||{}),this.type=c}}class pn extends Vr{constructor(c,h={}){super("error",Object.assign({error:c},h))}}function fn(p,c,h){h[p]&&h[p].indexOf(c)!==-1||(h[p]=h[p]||[],h[p].push(c))}function ca(p,c,h){if(h&&h[p]){const x=h[p].indexOf(c);x!==-1&&h[p].splice(x,1)}}class Vn{on(c,h){return this._listeners=this._listeners||{},fn(c,h,this._listeners),this}off(c,h){return ca(c,h,this._listeners),ca(c,h,this._oneTimeListeners),this}once(c,h){return h?(this._oneTimeListeners=this._oneTimeListeners||{},fn(c,h,this._oneTimeListeners),this):new Promise(x=>{this.once(c,x)})}fire(c,h){const x=typeof c=="string"?new Vr(c,h):c,_=x.type;if(this.listens(_)){x.target=this;const C=this._listeners&&this._listeners[_]?this._listeners[_].slice():[];for(const z of C)z.call(this,x);const T=this._oneTimeListeners&&this._oneTimeListeners[_]?this._oneTimeListeners[_].slice():[];for(const z of T)ca(_,z,this._oneTimeListeners),z.call(this,x);const L=this._eventedParent;if(L){const z=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(x,z),L.fire(x)}}else x instanceof pn&&console.error(x.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 Ca{constructor(c){typeof c=="string"?this.name=c:(this.name=c.name,this.iconsetId=c.iconsetId)}static from(c){return new Ca(c)}static toString(c){return c.iconsetId?`${c.name}${c.iconsetId}`:c.name}static parse(c){const[h,x]=c.split("");return new Ca({name:h,iconsetId:x})}static isEqual(c,h){return c.name===h.name&&c.iconsetId===h.iconsetId}toString(){return Ca.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var Zh,uu={},Dl=function(){if(Zh)return uu;Zh=1;var p={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(C){return(C=Math.round(C))<0?0:C>255?255:C}function h(C){return c(C[C.length-1]==="%"?parseFloat(C)/100*255:parseInt(C))}function x(C){return(T=C[C.length-1]==="%"?parseFloat(C)/100:parseFloat(C))<0?0:T>1?1:T;var T}function _(C,T,L){return L<0?L+=1:L>1&&(L-=1),6*L<1?C+(T-C)*L*6:2*L<1?T:3*L<2?C+(T-C)*(2/3-L)*6:C}try{uu.parseCSSColor=function(C){var T,L=C.replace(/ /g,"").toLowerCase();if(L in p)return p[L].slice();if(L[0]==="#")return L.length===4?(T=parseInt(L.substr(1),16))>=0&&T<=4095?[(3840&T)>>4|(3840&T)>>8,240&T|(240&T)>>4,15&T|(15&T)<<4,1]:null:L.length===7&&(T=parseInt(L.substr(1),16))>=0&&T<=16777215?[(16711680&T)>>16,(65280&T)>>8,255&T,1]:null;var z=L.indexOf("("),q=L.indexOf(")");if(z!==-1&&q+1===L.length){var K=L.substr(0,z),Y=L.substr(z+1,q-(z+1)).split(","),ee=1;switch(K){case"rgba":if(Y.length!==4)return null;ee=x(Y.pop());case"rgb":return Y.length!==3?null:[h(Y[0]),h(Y[1]),h(Y[2]),ee];case"hsla":if(Y.length!==4)return null;ee=x(Y.pop());case"hsl":if(Y.length!==3)return null;var re=(parseFloat(Y[0])%360+360)%360/360,ie=x(Y[1]),ge=x(Y[2]),Ce=ge<=.5?ge*(ie+1):ge+ie-ge*ie,Ne=2*ge-Ce;return[c(255*_(Ne,Ce,re+1/3)),c(255*_(Ne,Ce,re)),c(255*_(Ne,Ce,re-1/3)),ee];default:return null}}return null}}catch{}return uu}();class Ma{constructor(c,h,x,_=1){this.r=c,this.g=h,this.b=x,this.a=_}static parse(c){if(!c)return;if(c instanceof Ma)return c;if(typeof c!="string")return;const h=Dl.parseCSSColor(c);return h?new Ma(h[0]/255,h[1]/255,h[2]/255,h[3]):void 0}toString(){const[c,h,x,_]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*c)},${Math.round(255*h)},${Math.round(255*x)},${_})`}toNonPremultipliedRenderColor(c){const{r:h,g:x,b:_,a:C}=this;return new WP(c,h,x,_,C)}toPremultipliedRenderColor(c){const{r:h,g:x,b:_,a:C}=this;return new GP(c,h*C,x*C,_*C,C)}clone(){return new Ma(this.r,this.g,this.b,this.a)}}class Jk{constructor(c,h,x,_,C,T=!1){if(this.premultiplied=!1,this.premultiplied=T,c){const L=c.image.height,z=L*L;this.premultiplied?(h=C===0?0:h/C*(L-1),x=C===0?0:x/C*(L-1),_=C===0?0:_/C*(L-1)):(h*=L-1,x*=L-1,_*=L-1);const q=Math.floor(h),K=Math.floor(x),Y=Math.floor(_),ee=Math.ceil(h),re=Math.ceil(x),ie=Math.ceil(_),ge=h-q,Ce=x-K,Ne=_-Y,Fe=c.image.data,Be=4*(q+K*z+Y*L),Ze=4*(q+K*z+ie*L),yt=4*(q+re*z+Y*L),ht=4*(q+re*z+ie*L),jt=4*(ee+K*z+Y*L),Et=4*(ee+K*z+ie*L),Dt=4*(ee+re*z+Y*L),tr=4*(ee+re*z+ie*L);if(Be<0||tr>=Fe.length)throw new Error("out of range");this.r=Hs(Hs(Hs(Fe[Be],Fe[Ze],Ne),Hs(Fe[yt],Fe[ht],Ne),Ce),Hs(Hs(Fe[jt],Fe[Et],Ne),Hs(Fe[Dt],Fe[tr],Ne),Ce),ge)/255*(this.premultiplied?C:1),this.g=Hs(Hs(Hs(Fe[Be+1],Fe[Ze+1],Ne),Hs(Fe[yt+1],Fe[ht+1],Ne),Ce),Hs(Hs(Fe[jt+1],Fe[Et+1],Ne),Hs(Fe[Dt+1],Fe[tr+1],Ne),Ce),ge)/255*(this.premultiplied?C:1),this.b=Hs(Hs(Hs(Fe[Be+2],Fe[Ze+2],Ne),Hs(Fe[yt+2],Fe[ht+2],Ne),Ce),Hs(Hs(Fe[jt+2],Fe[Et+2],Ne),Hs(Fe[Dt+2],Fe[tr+2],Ne),Ce),ge)/255*(this.premultiplied?C:1),this.a=C}else this.r=h,this.g=x,this.b=_,this.a=C}toArray(){const{r:c,g:h,b:x,a:_}=this;return[255*c,255*h,255*x,_]}toHslaArray(){let{r:c,g:h,b:x,a:_}=this;if(this.premultiplied){if(_===0)return[0,0,0,0];const ie=1/_;c*=ie,h*=ie,x*=ie}const C=Math.min(Math.max(c,0),1),T=Math.min(Math.max(h,0),1),L=Math.min(Math.max(x,0),1),z=Math.min(C,T,L),q=Math.max(C,T,L),K=q-z,Y=.5*(z+q);if(K===0)return[0,0,100*Y,_];const ee=Y>.5?K/(2-q-z):K/(q+z);let re;switch(q){case C:re=60*((T-L)/K+(THs(x,c[_],h))}Ma.black=new Ma(0,0,0,1),Ma.white=new Ma(1,1,1,1),Ma.transparent=new Ma(0,0,0,0),Ma.red=new Ma(1,0,0,1),Ma.blue=new Ma(0,0,1,1);var Vv=Object.freeze({__proto__:null,array:f5,color:function(p,c,h){return new Ma(Hs(p.r,c.r,h),Hs(p.g,c.g,h),Hs(p.b,c.b,h),Hs(p.a,c.a,h))},number:Hs});class gh extends Error{constructor(c,h){super(h),this.message=h,this.key=c}}class a0{constructor(c,h=[]){this.parent=c,this.bindings={};for(const[x,_]of h)this.bindings[x]=_}concat(c){return new a0(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 Yh={kind:"null"},Ts={kind:"number"},da={kind:"string"},Ka={kind:"boolean"},Kd={kind:"color"},Fm={kind:"object"},za={kind:"value"},eN={kind:"collator"},Hv={kind:"formatted"},Wv={kind:"resolvedImage"};function $c(p,c){return{kind:"array",itemType:p,N:c}}function qo(p){if(p.kind==="array"){const c=qo(p.itemType);return typeof p.N=="number"?`array<${c}, ${p.N}>`:p.itemType.kind==="value"?"array":`array<${c}>`}return p.kind}const Gie=[Yh,Ts,da,Ka,Kd,Hv,Fm,$c(za),Wv];function ng(p,c){if(c.kind==="error")return null;if(p.kind==="array"){if(c.kind==="array"&&(c.N===0&&c.itemType.kind==="value"||!ng(p.itemType,c.itemType))&&(typeof p.N!="number"||p.N===c.N))return null}else{if(p.kind===c.kind)return null;if(p.kind==="value"){for(const h of Gie)if(!ng(h,c))return null}}return`Expected ${qo(p)} but found ${qo(c)} instead.`}function g5(p,c){return c.some(h=>h.kind===p.kind)}function Gv(p,c){return c.some(h=>h==="null"?p===null:h==="array"?Array.isArray(p):h==="object"?p&&!Array.isArray(p)&&typeof p=="object":h===typeof p)}function tN(p,c){return p.kind==="array"&&c.kind==="array"?p.N===c.N&&tN(p.itemType,c.itemType):p.kind===c.kind}class x5{constructor(c,h,x){this.sensitivity=c?h?"variant":"case":h?"accent":"base",this.locale=x,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 rN{constructor(c,h,x,_,C){this.text=c.normalize?c.normalize():c,this.image=h,this.scale=x,this.fontStack=_,this.textColor=C}}class Nd{constructor(c){this.sections=c}static fromString(c){return new Nd([new rN(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 Nd?c:Nd.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 _=h.image.getPrimary().id.toString();c.push(["image",_]);continue}c.push(h.text);const x={};h.fontStack&&(x["text-font"]=["literal",h.fontStack.split(",")]),h.scale&&(x["font-scale"]=h.scale),h.textColor&&(x["text-color"]=["rgba"].concat(h.textColor.toNonPremultipliedRenderColor(null).toArray())),c.push(x)}return c}}class Fp{constructor(c,h={}){this.id=Ca.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,x,_,C;try{({id:h,params:x,sx:_,sy:C}=JSON.parse(c)||{})}catch{return null}return h?new Fp(h,{params:x,sx:_,sy:C}):null}scaleSelf(c,h=c){return this.sx*=c,this.sy*=h,this}}class Sd{constructor(c,h,x,_,C=!1){this.primaryId=Ca.from(c),this.primaryOptions=h,x&&(this.secondaryId=Ca.from(x)),this.secondaryOptions=_,this.available=C}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new Fp(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new Fp(this.secondaryId,this.secondaryOptions):null}static from(c){return typeof c=="string"?Sd.build({name:c}):c}static build(c,h,x,_){return!c||typeof c=="object"&&!("name"in c)?null:new Sd(c,x,h,_)}}function _x(p,c,h,x){return typeof p=="number"&&p>=0&&p<=255&&typeof c=="number"&&c>=0&&c<=255&&typeof h=="number"&&h>=0&&h<=255?x===void 0||typeof x=="number"&&x>=0&&x<=1?null:`Invalid rgba value [${[p,c,h,x].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof x=="number"?[p,c,h,x]:[p,c,h]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function i0(p){if(p===null||typeof p=="string"||typeof p=="boolean"||typeof p=="number"||p instanceof Ma||p instanceof x5||p instanceof Nd||p instanceof Sd)return!0;if(Array.isArray(p)){for(const c of p)if(!i0(c))return!1;return!0}if(typeof p=="object"){for(const c in p)if(!i0(p[c]))return!1;return!0}return!1}function jl(p){if(p===null)return Yh;if(typeof p=="string")return da;if(typeof p=="boolean")return Ka;if(typeof p=="number")return Ts;if(p instanceof Ma)return Kd;if(p instanceof x5)return eN;if(p instanceof Nd)return Hv;if(p instanceof Sd)return Wv;if(Array.isArray(p)){const c=p.length;let h;for(const x of p){const _=jl(x);if(h){if(h===_)continue;h=za;break}h=_}return $c(h||za,c)}return Fm}function xh(p){const c=typeof p;return p===null?"":c==="string"||c==="number"||c==="boolean"?String(p):p instanceof Nd||p instanceof Sd||p instanceof Ma?p.toString():JSON.stringify(p)}class zp{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(!i0(c[1]))return h.error("invalid value");const x=c[1];let _=jl(x);const C=h.expectedType;return _.kind!=="array"||_.N!==0||!C||C.kind!=="array"||typeof C.N=="number"&&C.N!==0||(_=C),new zp(_,x)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof Ma?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof Nd?this.value.serialize():this.value}}class hl{constructor(c){this.name="ExpressionEvaluationError",this.message=c}toJSON(){return this.message}}const y5={string:da,number:Ts,boolean:Ka,object:Fm};class Xh{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 x,_=1;const C=c[0];if(C==="array"){let L,z;if(c.length>2){const q=c[1];if(typeof q!="string"||!(q in y5)||q==="object")return h.error('The item type argument of "array" must be one of string, number, boolean',1);L=y5[q],_++}else L=za;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);z=c[2],_++}x=$c(L,z)}else x=y5[C];const T=[];for(;_c.outputDefined())}serialize(){const c=this.type,h=[c.kind];if(c.kind==="array"){const x=c.itemType;if(x.kind==="string"||x.kind==="number"||x.kind==="boolean"){h.push(x.kind);const _=c.N;(typeof _=="number"||this.args.length>1)&&h.push(_)}}return h.concat(this.args.map(x=>x.serialize()))}}class zm{constructor(c){this.type=Hv,this.sections=c}static parse(c,h){if(c.length<2)return h.error("Expected at least one argument.");const x=c[1];if(!Array.isArray(x)&&typeof x=="object")return h.error("First argument must be an image or text section.");const _=[];let C=!1;for(let T=1;T<=c.length-1;++T){const L=c[T];if(C&&typeof L=="object"&&!Array.isArray(L)){C=!1;let z=null;if(L["font-scale"]&&(z=h.parseObjectValue(L["font-scale"],T,"font-scale",Ts),!z))return null;let q=null;if(L["text-font"]&&(q=h.parseObjectValue(L["text-font"],T,"text-font",$c(da)),!q))return null;let K=null;if(L["text-color"]&&(K=h.parseObjectValue(L["text-color"],T,"text-color",Kd),!K))return null;const Y=_[_.length-1];Y.scale=z,Y.font=q,Y.textColor=K}else{const z=h.parse(c[T],T,za);if(!z)return null;const q=z.type.kind;if(q!=="string"&&q!=="value"&&q!=="null"&&q!=="resolvedImage")return h.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");C=!0,_.push({content:z,scale:null,font:null,textColor:null})}}return new zm(_)}evaluate(c){return new Nd(this.sections.map(h=>{const x=h.content.evaluate(c);return tN(jl(x),Wv)?new rN("",x,null,null,null):new rN(xh(x),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 x={};h.scale&&(x["font-scale"]=h.scale.serialize()),h.font&&(x["text-font"]=h.font.serialize()),h.textColor&&(x["text-color"]=h.textColor.serialize()),c.push(x)}return c}}class bn{constructor(c,h,x,_){this._imageWarnHistory={},this.type=Wv,this.namePrimary=c,this.nameSecondary=h,x&&(this.paramsPrimary=x.params,this.iconsetIdPrimary=x.iconset?x.iconset.id:void 0),_&&(this.paramsSecondary=_.params,this.iconsetIdSecondary=_.iconset?_.iconset.id:void 0)}static parse(c,h){if(c.length<2)return h.error("Expected two or more arguments.");let x=1;const _=[];function C(){if(xCa.isEqual(T,C)),_.available){const T=_.getSecondary()?_.getSecondary().id:null;T&&(_.available=c.availableImages.some(L=>Ca.isEqual(L,T)))}}return _}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 x={};if(h&&(x.iconset={id:h}),c){x.params={};for(const _ in c)c[_]&&(x.params[_]=c[_].serialize())}return Object.keys(x).length>0?x: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 ks(p){return Xs(p)?"string":o0(p)?"number":nN(p)?"boolean":Array.isArray(p)?"array":p===null?"null":sN(p)?"object":typeof p}function sN(p){return p!=null&&!Array.isArray(p)&&typeof p!="function"&&!(p instanceof String||p instanceof Number||p instanceof Boolean)&&typeof p=="object"}function Xs(p){return typeof p=="string"||p instanceof String}function o0(p){return typeof p=="number"||p instanceof Number}function nN(p){return typeof p=="boolean"||p instanceof Boolean}const Zs={"to-boolean":Ka,"to-color":Kd,"to-number":Ts,"to-string":da};class Bm{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 x=c[0],_=[];let C=Yh;if(x==="to-array"){if(!Array.isArray(c[1]))return null;const T=c[1].length;if(h.expectedType){if(h.expectedType.kind!=="array")return h.error(`Expected ${h.expectedType.kind} but found array.`);C=$c(h.expectedType.itemType,T)}else{if(!(T>0&&i0(c[1][0])))return null;C=$c(jl(c[1][0]),T)}for(let L=0;L4?`Invalid rbga value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:_x(h[0],h[1],h[2],h[3]),!x))return new Ma(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new hl(x||`Could not parse color from value '${typeof h=="string"?h:String(JSON.stringify(h))}'`)}if(this.type.kind==="number"){let h=null;for(const x of this.args){if(h=x.evaluate(c),h===null)return 0;const _=Number(h);if(!isNaN(_))return _}throw new hl(`Could not convert ${JSON.stringify(h)} to number.`)}return this.type.kind==="formatted"?Nd.fromString(xh(this.args[0].evaluate(c))):this.type.kind==="resolvedImage"?Sd.build(xh(this.args[0].evaluate(c))):this.type.kind==="array"?this.args.map(h=>h.evaluate(c)):xh(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 zm([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new bn(this.args[0]).serialize();const c=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(h=>{c.push(h.serialize())}),c}}const v5=["Unknown","Point","LineString","Polygon"];class aN{constructor(c,h,x){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=x}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?v5[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,y:_}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(x*h-c[0])+this.featureDistanceData.bearing[1]*(_*h-c[1])}return 0}parseColor(c){let h=this._parseColorCache[c];return h||(h=this._parseColorCache[c]=Ma.parse(c)),h}getConfig(c){return this.options?this.options.get(c):null}}class Cd{constructor(c,h,x,_,C){this.name=c,this.type=h,this._evaluate=x,this.args=_,this._overloadIndex=C}evaluate(c){if(!this._evaluate){const h=Cd.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 x=c[0],_=Cd.definitions[x];if(!_)return h.error(`Unknown expression "${x}". If you wanted a literal array, use ["literal", [...]].`,0);const C=Array.isArray(_)?_[0]:_.type,T=Array.isArray(_)?[[_[1],_[2]]]:_.overloads,L=[];let z=null,q=-1;for(const[K,Y]of T){if(Array.isArray(K)&&K.length!==c.length-1)continue;L.push(K),q++,z=new xN(h.registry,h.path,null,h.scope,void 0,h._scope,h.options,h.iconImageUseTheme);const ee=[];let re=!1;for(let ie=1;ieee)).map(iN).join(" | "),Y=[];for(let ee=1;eeh;){if(x-h>600){const z=x-h+1,q=c-h+1,K=Math.log(z),Y=.5*Math.exp(2*K/3),ee=.5*Math.sqrt(K*Y*(z-Y)/z)*(q-z/2<0?-1:1);oN(p,c,Math.max(h,Math.floor(c-q*Y/z+ee)),Math.min(x,Math.floor(c+(z-q)*Y/z+ee)),_)}const C=p[c];let T=h,L=x;for(Qh(p,h,c),_(p[x],C)>0&&Qh(p,h,x);T0;)L--}_(p[h],C)===0?Qh(p,h,L):(L++,Qh(p,L,x)),L<=c&&(h=L+1),c<=L&&(x=L-1)}}function Qh(p,c,h){const x=p[c];p[c]=p[h],p[h]=x}function _5(p,c){return pc?1:0}function ag(p){let c=0;for(let h,x,_=0,C=p.length,T=C-1;_=c[2]||p[1]<=c[1]||p[3]>=c[3])}function Kie(p,c,h){const x=p[0]-c[0],_=p[1]-c[1],C=p[0]-h[0],T=p[1]-h[1];return x*T-C*_==0&&x*C<=0&&_*T<=0}function l0(p,c,h=!1){let x=!1;for(let L=0,z=c.length;L(_=p)[1]!=(T=ie)[1]>_[1]&&_[0]<(T[0]-C[0])*(_[1]-C[1])/(T[1]-C[1])+C[0]&&(x=!x)}}var _,C,T;return x}function Zv(p,c,h,x){const _=x[0]-h[0],C=x[1]-h[1],T=(p[0]-h[0])*C-_*(p[1]-h[1]),L=(c[0]-h[0])*C-_*(c[1]-h[1]);return T>0&&L<0||T<0&&L>0}function Yv(p,c,h,x){return(_=[x[0]-h[0],x[1]-h[1]])[0]*(C=[c[0]-p[0],c[1]-p[1]])[1]-_[1]*C[0]!=0&&!(!Zv(p,c,h,x)||!Zv(h,x,p,c));var _,C}function Bp(p){const c=new dr(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),h=new dr(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const x of p[0])c.x>x.x&&(c.x=x.x),c.y>x.y&&(c.y=x.y),h.xh[2]){const _=.5*x;let C=p[0]-h[0]>_?-x:h[0]-p[0]>_?x:0;C===0&&(C=p[0]-h[2]>_?-x:h[2]-p[0]>_?x:0),p[0]+=C}yh(c,p)}function XP(p,c,h,x){const _=Math.pow(2,x.z)*ig,C=[x.x*ig,x.y*ig],T=[];if(!p)return T;for(const L of p)for(const z of L){const q=[z.x+C[0],z.y+C[1]];YP(q,c,h,_),T.push(q)}return T}function lN(p,c,h,x){const _=Math.pow(2,x.z)*ig,C=[x.x*ig,x.y*ig],T=[];if(!p)return T;for(const z of p){const q=[];for(const K of z){const Y=[K.x+C[0],K.y+C[1]];yh(c,Y),q.push(Y)}T.push(q)}if(c[2]-c[0]<=_/2){(L=c)[0]=L[1]=1/0,L[2]=L[3]=-1/0;for(const z of T)for(const q of z)YP(q,c,h,_)}var L;return T}class lg{constructor(c,h){this.type=Ka,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(i0(c[1])){const x=c[1];if(x.type==="FeatureCollection")for(let _=0;_h)return cN(C,T,(h-(x-L))/L)}return c[c.length-1]}pointToSegmentDistance(c,h,x){let[_,C]=h,T=Fu(x[0]-_)*this.kx,L=(x[1]-C)*this.ky;if(T!==0||L!==0){const z=(Fu(c[0]-_)*this.kx*T+(c[1]-C)*this.ky*L)/(T*T+L*L);z>1?(_=x[0],C=x[1]):z>0&&(_+=T/this.kx*z,C+=L/this.ky*z)}return T=Fu(c[0]-_)*this.kx,L=(c[1]-C)*this.ky,Math.sqrt(T*T+L*L)}pointOnLine(c,h){let x=1/0,_=c[0][0],C=c[0][1],T=0,L=0;for(let z=0;z1?(q=c[z+1][0],K=c[z+1][1]):re>0&&(q+=Y/this.kx*re,K+=ee/this.ky*re)),Y=Fu(h[0]-q)*this.kx,ee=(h[1]-K)*this.ky;const ie=Y*Y+ee*ee;ieC.index||_.index===C.index&&_.t>C.t){const q=_;_=C,C=q}const T=[_.point],L=_.index+1,z=C.index;!j5(x[L],T[0])&&L<=z&&T.push(x[L]);for(let q=L+1;q<=z;q++)T.push(x[q]);return j5(x[z],C.point)||T.push(C.point),T}lineSliceAlong(c,h,x){let _=0;const C=[];for(let T=0;Tc&&C.length===0&&C.push(cN(L,z,(c-(_-q))/q)),_>=h)return C.push(cN(L,z,(h-(_-q))/q)),C;_>c&&C.push(z)}return C}bufferPoint(c,h){const x=h/this.ky,_=h/this.kx;return[c[0]-_,c[1]-x,c[0]+_,c[1]+x]}bufferBBox(c,h){const x=h/this.ky,_=h/this.kx;return[c[0]-_,c[1]-x,c[2]+_,c[3]+x]}insideBBox(c,h){return Fu(c[0]-h[0])>=0&&Fu(c[0]-h[2])<=0&&c[1]>=h[1]&&c[1]<=h[3]}}function j5(p,c){return p[0]===c[0]&&p[1]===c[1]}function cN(p,c,h){const x=Fu(c[0]-p[0]);return[p[0]+x*h,p[1]+(c[1]-p[1])*h]}function Fu(p){for(;p<-180;)p+=360;for(;p>180;)p-=360;return p}class dN{constructor(c=[],h=(x,_)=>x<_?-1:x>_?1:0){if(this.data=c,this.length=this.data.length,this.compare=h,this.length>0)for(let x=(this.length>>1)-1;x>=0;x--)this._down(x)}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:x}=this,_=h[c];for(;c>0;){const C=c-1>>1,T=h[C];if(x(_,T)>=0)break;h[c]=T,c=C}h[c]=_}_down(c){const{data:h,compare:x}=this,_=this.length>>1,C=h[c];for(;c<_;){let T=1+(c<<1);const L=T+1;if(L=0)break;h[c]=h[T],c=T}h[c]=C}}var Rr=8192;function k5(p,c){return c.dist-p.dist}const uN=100,hN=50;function N5(p){const c=[1/0,1/0,-1/0,-1/0];if(c.length!==p.length)return!1;for(let h=0;h=p[0]&&p[1]p[1])return[null,null];const h=Qv(p);if(c){if(h===2)return[p,null];const x=Math.floor(h/2);return[[p[0],p[0]+x],[p[0]+x,p[1]]]}{if(h===1)return[p,null];const x=Math.floor(h/2)-1;return[[p[0],p[0]+x],[p[0]+x+1,p[1]]]}}function bx(p,c){const h=[1/0,1/0,-1/0,-1/0];if(!$m(c,p.length))return h;for(let x=c[0];x<=c[1];++x)yh(h,p[x]);return h}function wx(p){const c=[1/0,1/0,-1/0,-1/0];for(let h=0;hc[2]&&(x=p[0]-c[2]),p[1]>c[3]&&(_=p[1]-c[3]),p[3]=x)return x;if(Kv(_,C)){if(M5(p,c))return 0}else if(M5(c,p))return 0;let T=x;for(const L of p)for(let z=0,q=L.length,K=q-1;z=C)continue;const K=q.range1;if(Qv(K)<=L){if(!$m(K,p.length))return NaN;if(c){const Y=eoe(p,K,h,x);if((C=Math.min(C,Y))===0)return C}else for(let Y=K[0];Y<=K[1];++Y){const ee=Jie(p[Y],h,x);if((C=Math.min(C,ee))===0)return C}}else{const Y=S5(K,c);if(Y[0]!==null){const ee=cg(bx(p,Y[0]),z,x);ee=T)continue;const Y=K.range1,ee=K.range2;if(Qv(Y)<=z&&Qv(ee)<=q){if(!$m(Y,p.length)||!$m(ee,h.length))return NaN;if(c&&x?T=Math.min(T,ua(p,Y,h,ee,_)):c||x?c&&!x?T=Math.min(T,C5(h,ee,p,Y,_)):!c&&x&&(T=Math.min(T,C5(p,Y,h,ee,_))):T=Math.min(T,Qie(p,Y,h,ee,_)),T===0)return T}else{const re=S5(Y,c),ie=S5(ee,x);$i(L,T,_,p,h,re[0],ie[0]),$i(L,T,_,p,h,re[0],ie[1]),$i(L,T,_,p,h,re[1],ie[0]),$i(L,T,_,p,h,re[1],ie[1])}}return T}function T5(p,c,h,x,_=1/0){let C=_;const T=bx(p,[0,p.length-1]);for(const L of h)if(!(C!==1/0&&cg(T,bx(L,[0,L.length-1]),x)>=C)&&(C=Math.min(C,t6(p,c,L,!0,x,C)),C===0))return C;return C}function fN(p,c,h,x,_=1/0){let C=_;const T=bx(p,[0,p.length-1]);for(const L of h){if(C!==1/0&&cg(T,wx(L),x)>=C)continue;const z=roe(p,c,L,x,C);if(isNaN(z))return z;if((C=Math.min(C,z))===0)return C}return C}function A5(p){return p==="Point"||p==="MultiPoint"||p==="LineString"||p==="MultiLineString"||p==="Polygon"||p==="MultiPolygon"}class jx{constructor(c,h){this.type=Ts,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(i0(c[1])){const x=c[1];if(x.type==="FeatureCollection"){for(let _=0;_{c&&!u0(h)&&(c=!1)}),c}function Jv(p){if(p instanceof Cd&&p.name==="feature-state")return!1;let c=!0;return p.eachChild(h=>{c&&!Jv(h)&&(c=!1)}),c}function h0(p,c){if(p instanceof Cd&&c.indexOf(p.name)>=0)return!1;let h=!0;return p.eachChild(x=>{h&&!h0(x,c)&&(h=!1)}),h}function r6(p,c,h){return[p,c,h].filter(Boolean).join("")}function E5(p,c){switch(p){case"string":return xh(c);case"number":return+c;case"boolean":return!!c;case"color":return Ma.parse(c);case"formatted":return Nd.fromString(xh(c));case"resolvedImage":return Sd.build(xh(c))}return c}function s6(p,c,h,x){return x!==void 0&&(p=x*Math.round(p/x)),c!==void 0&&ph&&(p=h),p}class m0{constructor(c,h,x,_=!1){this.type=c,this.key=h,this.scope=x,this.featureConstant=_}static parse(c,h){let x=h.expectedType;if(x==null&&(x=za),c.length<2||c.length>3)return h.error("Invalid number of arguments for 'config' expression.");const _=h.parse(c[1],1);if(!(_ instanceof zp))return h.error("Key name of 'config' expression must be a string literal.");let C,T=!0;const L=xh(_.value);if(c.length>=3){const z=h.parse(c[2],2);if(!(z instanceof zp))return h.error("Scope of 'config' expression must be a string literal.");C=xh(z.value)}if(h.options){const z=r6(L,C,h._scope),q=h.options.get(z);q&&(T=u0(q.value||q.default))}return new m0(x,L,C,T)}evaluate(c){const h=r6(this.key,this.scope,c.scope),x=c.getConfig(h);if(!x)return null;const{type:_,value:C,values:T,minValue:L,maxValue:z,stepValue:q}=x,K=x.default.evaluate(c);let Y=K;if(C){const ee=c.scope;c.scope=(ee||"").split("").slice(1).join(""),Y=C.evaluate(c),c.scope=ee}return _&&(Y=E5(_,Y)),Y===void 0||L===void 0&&z===void 0&&q===void 0||(typeof Y=="number"?Y=s6(Y,L,z,q):Array.isArray(Y)&&(Y=Y.map(ee=>typeof ee=="number"?s6(ee,L,z,q):ee))),C!==void 0&&Y!==void 0&&T&&!T.includes(Y)&&(Y=K,_&&(Y=E5(_,Y))),(_&&_!==this.type||Y!==void 0&&!tN(jl(Y),this.type))&&(Y=E5(this.type.kind,Y)),Y}eachChild(){}outputDefined(){return!1}serialize(){const c=["config",this.key];return this.scope&&c.concat(this.scope),c}}class gN{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 x=c[1];return h.scope.has(x)?new gN(x,h.scope.get(x)):h.error(`Unknown variable "${x}". Make sure "${x}" 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 xN{constructor(c,h=[],x,_=new a0,C=[],T,L,z){this.registry=c,this.path=h,this.key=h.map(q=>typeof q=="string"?`['${q}']`:`[${q}]`).join(""),this.scope=_,this.errors=C,this.expectedType=x,this._scope=T,this.options=L,this.iconImageUseTheme=z}parse(c,h,x,_,C={}){return h||x?this.concat(h,null,x,_)._parse(c,C):this._parse(c,C)}parseObjectValue(c,h,x,_,C,T={}){return this.concat(h,x,_,C)._parse(c,T)}_parse(c,h){function x(_,C,T){return T==="assert"?new Xh(C,[_]):T==="coerce"?new Bm(C,[_]):_}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 _=typeof c[0]=="string"?this.registry[c[0]]:void 0;if(_){let C=_.parse(c,this);if(!C)return null;if(this.expectedType){const T=this.expectedType,L=C.type;if(T.kind!=="string"&&T.kind!=="number"&&T.kind!=="boolean"&&T.kind!=="object"&&T.kind!=="array"||L.kind!=="value")if(T.kind!=="color"&&T.kind!=="formatted"&&T.kind!=="resolvedImage"||L.kind!=="value"&&L.kind!=="string"){if(this.checkSubtype(T,L))return null}else C=x(C,T,h.typeAnnotation||"coerce");else C=x(C,T,h.typeAnnotation||"assert")}if(!(C instanceof zp)&&C.type.kind!=="resolvedImage"&&I5(C)){const T=new aN(this._scope,this.options,this.iconImageUseTheme);try{C=new zp(C.type,C.evaluate(T))}catch(L){return this.error(L.message),null}}return C}return Bm.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,x,_){let C=typeof c=="number"?this.path.concat(c):this.path;C=typeof h=="string"?C.concat(h):C;const T=_?this.scope.concat(_):this.scope;return new xN(this.registry,C,x||null,T,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(c,...h){const x=`${this.key}${h.map(_=>`[${_}]`).join("")}`;this.errors.push(new gh(x,c))}checkSubtype(c,h){const x=ng(c,h);return x&&this.error(x),x}}function I5(p){if(p instanceof gN)return I5(p.boundExpression);if(p instanceof Cd&&p.name==="error"||p instanceof Rl||p instanceof lg||p instanceof jx||p instanceof m0)return!1;const c=p instanceof Bm||p instanceof Xh;let h=!0;return p.eachChild(x=>{h=c?h&&I5(x):h&&x instanceof zp}),!!h&&u0(p)&&h0(p,["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 yN(p,c){const h=p.length-1;let x,_,C=0,T=h,L=0;for(;C<=T;)if(L=Math.floor((C+T)/2),x=p[L],_=p[L+1],x<=c){if(L===h||c<_)return L;C=L+1}else{if(!(x>c))throw new hl("Input is not a number.");T=L-1}return 0}class e_{constructor(c,h,x){this.type=c,this.input=h,this.labels=[],this.outputs=[];for(const[_,C]of x)this.labels.push(_),this.outputs.push(C)}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 x=h.parse(c[1],1,Ts);if(!x)return null;const _=[];let C=null;h.expectedType&&h.expectedType.kind!=="value"&&(C=h.expectedType);for(let T=1;T=L)return h.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',q);const Y=h.parse(z,K,C);if(!Y)return null;C=C||Y.type,_.push([L,Y])}return new e_(C,x,_)}evaluate(c){const h=this.labels,x=this.outputs;if(h.length===1)return x[0].evaluate(c);const _=this.input.evaluate(c);if(_<=h[0])return x[0].evaluate(c);const C=h.length;return _>=h[C-1]?x[C-1].evaluate(c):x[yN(h,_)].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 n6=.95047,a6=1.08883,i6=4/29,p0=6/29,o6=3*p0*p0,soe=p0*p0*p0,noe=Math.PI/180,aoe=180/Math.PI;function P5(p){return p>soe?Math.pow(p,1/3):p/o6+i6}function L5(p){return p>p0?p*p*p:o6*(p-i6)}function O5(p){return 255*(p<=.0031308?12.92*p:1.055*Math.pow(p,1/2.4)-.055)}function D5(p){return(p/=255)<=.04045?p/12.92:Math.pow((p+.055)/1.055,2.4)}function l6(p){const c=D5(p.r),h=D5(p.g),x=D5(p.b),_=P5((.4124564*c+.3575761*h+.1804375*x)/n6),C=P5((.2126729*c+.7151522*h+.072175*x)/1);return{l:116*C-16,a:500*(_-C),b:200*(C-P5((.0193339*c+.119192*h+.9503041*x)/a6)),alpha:p.a}}function vN(p){let c=(p.l+16)/116,h=isNaN(p.a)?c:c+p.a/500,x=isNaN(p.b)?c:c-p.b/200;return c=1*L5(c),h=n6*L5(h),x=a6*L5(x),new Ma(O5(3.2404542*h-1.5371385*c-.4985314*x),O5(-.969266*h+1.8760108*c+.041556*x),O5(.0556434*h-.2040259*c+1.0572252*x),p.alpha)}function _N(p,c,h){const x=c-p;return p+h*(x>180||x<-180?x-360*Math.round(x/360):x)}const f0={forward:l6,reverse:vN,interpolate:function(p,c,h){return{l:Hs(p.l,c.l,h),a:Hs(p.a,c.a,h),b:Hs(p.b,c.b,h),alpha:Hs(p.alpha,c.alpha,h)}}},t_={forward:function(p){const{l:c,a:h,b:x}=l6(p),_=Math.atan2(x,h)*aoe;return{h:_<0?_+360:_,c:Math.sqrt(h*h+x*x),l:c,alpha:p.a}},reverse:function(p){const c=p.h*noe,h=p.c;return vN({l:p.l,a:Math.cos(c)*h,b:Math.sin(c)*h,alpha:p.alpha})},interpolate:function(p,c,h){return{h:_N(p.h,c.h,h),c:Hs(p.c,c.c,h),l:Hs(p.l,c.l,h),alpha:Hs(p.alpha,c.alpha,h)}}};var c6=Object.freeze({__proto__:null,hcl:t_,lab:f0});class zu{constructor(c,h,x,_,C){this.type=c,this.operator=h,this.interpolation=x,this.input=_,this.labels=[],this.outputs=[];for(const[T,L]of C)this.labels.push(T),this.outputs.push(L)}static interpolationFactor(c,h,x,_){let C=0;if(c.name==="exponential")C=bN(h,c.base,x,_);else if(c.name==="linear")C=bN(h,1,x,_);else if(c.name==="cubic-bezier"){const T=c.controlPoints;C=new Ai(T[0],T[1],T[2],T[3]).solve(bN(h,1,x,_))}return C}static parse(c,h){let[x,_,C,...T]=c;if(!Array.isArray(_)||_.length===0)return h.error("Expected an interpolation type expression.",1);if(_[0]==="linear")_={name:"linear"};else if(_[0]==="exponential"){const q=_[1];if(typeof q!="number")return h.error("Exponential interpolation requires a numeric base.",1,1);_={name:"exponential",base:q}}else{if(_[0]!=="cubic-bezier")return h.error(`Unknown interpolation type ${String(_[0])}`,1,0);{const q=_.slice(1);if(q.length!==4||q.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);_={name:"cubic-bezier",controlPoints:q}}}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(C=h.parse(C,2,Ts),!C)return null;const L=[];let z=null;x==="interpolate-hcl"||x==="interpolate-lab"?z=Kd:h.expectedType&&h.expectedType.kind!=="value"&&(z=h.expectedType);for(let q=0;q=K)return h.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',ee);const ie=h.parse(Y,re,z);if(!ie)return null;z=z||ie.type,L.push([K,ie])}return z.kind==="number"||z.kind==="color"||z.kind==="array"&&z.itemType.kind==="number"&&typeof z.N=="number"?new zu(z,x,_,C,L):h.error(`Type ${qo(z)} is not interpolatable.`)}evaluate(c){const h=this.labels,x=this.outputs;if(h.length===1)return x[0].evaluate(c);const _=this.input.evaluate(c);if(_<=h[0])return x[0].evaluate(c);const C=h.length;if(_>=h[C-1])return x[C-1].evaluate(c);const T=yN(h,_),L=zu.interpolationFactor(this.interpolation,_,h[T],h[T+1]),z=x[T].evaluate(c),q=x[T+1].evaluate(c);return this.operator==="interpolate"?Vv[this.type.kind.toLowerCase()](z,q,L):this.operator==="interpolate-hcl"?t_.reverse(t_.interpolate(t_.forward(z),t_.forward(q),L)):f0.reverse(f0.interpolate(f0.forward(z),f0.forward(q),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 x=0;xng(_,L.type));return new r_(T?za:x,C)}evaluate(c){let h,x=null,_=0;for(const C of this.args){if(_++,x=C.evaluate(c),x&&x instanceof Sd&&!x.available&&(h||(h=x),x=null,_===this.args.length))return h;if(x!==null)break}return x}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 $p{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 x=[];for(let C=1;C=x.length)throw new hl("Array index out of bounds: index exceeds array size");if(h!==Math.floor(h))throw new hl("Array index must be an integer. Use at-interpolated for fractional indices");return x[h]}eachChild(c){c(this.index),c(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class jN{constructor(c,h,x){this.type=c,this.index=h,this.input=x}static parse(c,h){if(c.length!==3)return h.error(`Expected 2 arguments, but found ${c.length-1} instead.`);const x=h.parse(c[1],1,Ts),_=h.parse(c[2],2,$c(h.expectedType||za));return x&&_?new jN(_.type.itemType,x,_):null}evaluate(c){const h=this.index.evaluate(c),x=this.input.evaluate(c);if(h<0)throw new hl(`Array index out of bounds: ${h} < 0.`);if(h>x.length-1)throw new hl(`Array index out of bounds: ${h} > ${x.length-1}.`);if(h===Math.floor(h))return x[h];const _=Math.floor(h),C=Math.ceil(h),T=x[_],L=x[C];if(typeof T!="number"||typeof L!="number")throw new hl(`Cannot interpolate between non-number values at index ${h}.`);const z=h-_;return T*(1-z)+L*z}eachChild(c){c(this.index),c(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class R5{constructor(c,h){this.type=Ka,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 x=h.parse(c[1],1,za),_=h.parse(c[2],2,za);return x&&_?g5(x.type,[Ka,da,Ts,Yh,za])?new R5(x,_):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${qo(x.type)} instead`):null}evaluate(c){const h=this.needle.evaluate(c),x=this.haystack.evaluate(c);if(x==null)return!1;if(!Gv(h,["boolean","string","number","null"]))throw new hl(`Expected first argument to be of type boolean, string, number or null, but found ${qo(jl(h))} instead.`);if(!Gv(x,["string","array"]))throw new hl(`Expected second argument to be of type array or string, but found ${qo(jl(x))} instead.`);return x.indexOf(h)>=0}eachChild(c){c(this.needle),c(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class g0{constructor(c,h,x){this.type=Ts,this.needle=c,this.haystack=h,this.fromIndex=x}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 x=h.parse(c[1],1,za),_=h.parse(c[2],2,za);if(!x||!_)return null;if(!g5(x.type,[Ka,da,Ts,Yh,za]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${qo(x.type)} instead`);if(c.length===4){const C=h.parse(c[3],3,Ts);return C?new g0(x,_,C):null}return new g0(x,_)}evaluate(c){const h=this.needle.evaluate(c),x=this.haystack.evaluate(c);if(!Gv(h,["boolean","string","number","null"]))throw new hl(`Expected first argument to be of type boolean, string, number or null, but found ${qo(jl(h))} instead.`);if(!Gv(x,["string","array"]))throw new hl(`Expected second argument to be of type array or string, but found ${qo(jl(x))} instead.`);if(this.fromIndex){const _=this.fromIndex.evaluate(c);return x.indexOf(h,_)}return x.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 s_{constructor(c,h,x,_,C,T){this.inputType=c,this.type=h,this.input=x,this.cases=_,this.outputs=C,this.otherwise=T}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 x,_;h.expectedType&&h.expectedType.kind!=="value"&&(_=h.expectedType);const C={},T=[];for(let q=2;qNumber.MAX_SAFE_INTEGER)return ee.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof ie=="number"&&Math.floor(ie)!==ie)return ee.error("Numeric branch labels must be integer values.");if(x){if(ee.checkSubtype(x,jl(ie)))return null}else x=jl(ie);if(C[String(ie)]!==void 0)return ee.error("Branch labels must be unique.");C[String(ie)]=T.length}const re=h.parse(Y,q,_);if(!re)return null;_=_||re.type,T.push(re)}const L=h.parse(c[1],1,za);if(!L)return null;const z=h.parse(c[c.length-1],c.length-1,_);return z?L.type.kind!=="value"&&h.concat(1).checkSubtype(x,L.type)?null:new s_(x,_,L,C,T,z):null}evaluate(c){const h=this.input.evaluate(c);return(tN(jl(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(),x=[],_={};for(const T of h){const L=_[this.cases[T]];L===void 0?(_[this.cases[T]]=x.length,x.push([this.cases[T],[T]])):x[L][1].push(T)}const C=T=>this.inputType.kind==="number"?Number(T):T;for(const[T,L]of x)c.push(L.length===1?C(L[0]):L.map(C)),c.push(this.outputs[T].serialize());return c.push(this.otherwise.serialize()),c}}class n_{constructor(c,h,x){this.type=c,this.branches=h,this.otherwise=x}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 x;h.expectedType&&h.expectedType.kind!=="value"&&(x=h.expectedType);const _=[];for(let T=1;Th.outputDefined())&&this.otherwise.outputDefined()}serialize(){const c=["case"];return this.eachChild(h=>{c.push(h.serialize())}),c}}class kN{constructor(c,h,x,_){this.type=c,this.input=h,this.beginIndex=x,this.endIndex=_}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 x=h.parse(c[1],1,za),_=h.parse(c[2],2,Ts);if(!x||!_)return null;if(!g5(x.type,[$c(za),da,za]))return h.error(`Expected first argument to be of type array or string, but found ${qo(x.type)} instead`);if(c.length===4){const C=h.parse(c[3],3,Ts);return C?new kN(x.type,x,_,C):null}return new kN(x.type,x,_)}evaluate(c){const h=this.input.evaluate(c),x=this.beginIndex.evaluate(c);if(!Gv(h,["string","array"]))throw new hl(`Expected first argument to be of type array or string, but found ${qo(jl(h))} instead.`);if(this.endIndex){const _=this.endIndex.evaluate(c);return h.slice(x,_)}return h.slice(x)}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 F5{constructor(c,h){this.type=$c(da),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 x=h.parse(c[1],1,da),_=h.parse(c[2],2,da);return x&&_?new F5(x,_):void 0}evaluate(c){const h=this.str.evaluate(c),x=this.delimiter.evaluate(c);return h.split(x)}eachChild(c){c(this.str),c(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function z5(p,c){return p==="=="||p==="!="?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 B5(p,c,h,x){return x.compare(c,h)===0}function x0(p,c,h){const x=p!=="=="&&p!=="!=";return class J8e{constructor(C,T,L){this.type=Ka,this.lhs=C,this.rhs=T,this.collator=L,this.hasUntypedArgument=C.type.kind==="value"||T.type.kind==="value"}static parse(C,T){if(C.length!==3&&C.length!==4)return T.error("Expected two or three arguments.");const L=C[0];let z=T.parse(C[1],1,za);if(!z)return null;if(!z5(L,z.type))return T.concat(1).error(`"${L}" comparisons are not supported for type '${qo(z.type)}'.`);let q=T.parse(C[2],2,za);if(!q)return null;if(!z5(L,q.type))return T.concat(2).error(`"${L}" comparisons are not supported for type '${qo(q.type)}'.`);if(z.type.kind!==q.type.kind&&z.type.kind!=="value"&&q.type.kind!=="value")return T.error(`Cannot compare types '${qo(z.type)}' and '${qo(q.type)}'.`);x&&(z.type.kind==="value"&&q.type.kind!=="value"?z=new Xh(q.type,[z]):z.type.kind!=="value"&&q.type.kind==="value"&&(q=new Xh(z.type,[q])));let K=null;if(C.length===4){if(z.type.kind!=="string"&&q.type.kind!=="string"&&z.type.kind!=="value"&&q.type.kind!=="value")return T.error("Cannot use collator to compare non-string types.");if(K=T.parse(C[3],3,eN),!K)return null}return new J8e(z,q,K)}evaluate(C){const T=this.lhs.evaluate(C),L=this.rhs.evaluate(C);if(x&&this.hasUntypedArgument){const z=jl(T),q=jl(L);if(z.kind!==q.kind||z.kind!=="string"&&z.kind!=="number")throw new hl(`Expected arguments for "${p}" to be (string, string) or (number, number), but found (${z.kind}, ${q.kind}) instead.`)}if(this.collator&&!x&&this.hasUntypedArgument){const z=jl(T),q=jl(L);if(z.kind!=="string"||q.kind!=="string")return c(C,T,L)}return this.collator?h(C,T,L,this.collator.evaluate(C)):c(C,T,L)}eachChild(C){C(this.lhs),C(this.rhs),this.collator&&C(this.collator)}outputDefined(){return!0}serialize(){const C=[p];return this.eachChild(T=>{C.push(T.serialize())}),C}}}const ioe=x0("==",function(p,c,h){return c===h},B5),ooe=x0("!=",function(p,c,h){return c!==h},function(p,c,h,x){return!B5(0,c,h,x)}),d6=x0("<",function(p,c,h){return c",function(p,c,h){return c>h},function(p,c,h,x){return x.compare(c,h)>0}),NN=x0("<=",function(p,c,h){return c<=h},function(p,c,h,x){return x.compare(c,h)<=0}),loe=x0(">=",function(p,c,h){return c>=h},function(p,c,h,x){return x.compare(c,h)>=0});class SN{constructor(c,h,x,_,C,T){this.type=da,this.number=c,this.locale=h,this.currency=x,this.unit=_,this.minFractionDigits=C,this.maxFractionDigits=T}static parse(c,h){if(c.length!==3)return h.error("Expected two arguments.");const x=h.parse(c[1],1,Ts);if(!x)return null;const _=c[2];if(typeof _!="object"||Array.isArray(_))return h.error("NumberFormat options argument must be an object.");let C=null;if(_.locale&&(C=h.parseObjectValue(_.locale,2,"locale",da),!C))return null;let T=null;if(_.currency&&(T=h.parseObjectValue(_.currency,2,"currency",da),!T))return null;let L=null;if(_.unit&&(L=h.parseObjectValue(_.unit,2,"unit",da),!L))return null;let z=null;if(_["min-fraction-digits"]&&(z=h.parseObjectValue(_["min-fraction-digits"],2,"min-fraction-digits",Ts),!z))return null;let q=null;return _["max-fraction-digits"]&&(q=h.parseObjectValue(_["max-fraction-digits"],2,"max-fraction-digits",Ts),!q)?null:new SN(x,C,T,L,z,q)}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 $5{constructor(c){this.type=Ts,this.input=c}static parse(c,h){if(c.length!==2)return h.error(`Expected 1 argument, but found ${c.length-1} instead.`);const x=h.parse(c[1],1);return x?x.type.kind!=="array"&&x.type.kind!=="string"&&x.type.kind!=="value"?h.error(`Expected argument of type string or array, but found ${qo(x.type)} instead.`):new $5(x):null}evaluate(c){const h=this.input.evaluate(c);if(typeof h=="string"||Array.isArray(h))return h.length;throw new hl(`Expected value to be of type string or array, but found ${qo(jl(h))} instead.`)}eachChild(c){c(this.input)}outputDefined(){return!1}serialize(){const c=["length"];return this.eachChild(h=>{c.push(h.serialize())}),c}}function h6(p){return function(){p=1831565813+(p|=0)|0;let c=Math.imul(p^p>>>15,1|p);return c=c+Math.imul(c^c>>>7,61|c)^c,((c^c>>>14)>>>0)/4294967296}}const y0={"==":ioe,"!=":ooe,">":u6,"<":d6,">=":loe,"<=":NN,array:Xh,at:wN,"at-interpolated":jN,boolean:Xh,case:n_,coalesce:r_,collator:Rl,format:zm,image:bn,in:R5,"index-of":g0,interpolate:zu,"interpolate-hcl":zu,"interpolate-lab":zu,length:$5,let:$p,literal:zp,match:s_,number:Xh,"number-format":SN,object:Xh,slice:kN,step:e_,string:Xh,"to-boolean":Bm,"to-color":Bm,"to-number":Bm,"to-string":Bm,var:gN,within:lg,distance:jx,config:m0,split:F5};function U5(p,[c,h,x,_]){c=c.evaluate(p),h=h.evaluate(p),x=x.evaluate(p);const C=_?_.evaluate(p):1,T=_x(c,h,x,C);if(T)throw new hl(T);return new Ma(c/255,h/255,x/255,C)}function q5(p,[c,h,x,_]){c=c.evaluate(p),h=h.evaluate(p),x=x.evaluate(p);const C=_?_.evaluate(p):1,T=function(q,K,Y,ee){return typeof q=="number"&&q>=0&&q<=360?typeof K=="number"&&K>=0&&K<=100&&typeof Y=="number"&&Y>=0&&Y<=100?ee===void 0||typeof ee=="number"&&ee>=0&&ee<=1?null:`Invalid hsla value [${[q,K,Y,ee].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof ee=="number"?[q,K,Y,ee]:[q,K,Y]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof ee=="number"?[q,K,Y,ee]:[q,K,Y]).join(", ")}]: 'h' must be between 0 and 360.`}(c,h,x,C);if(T)throw new hl(T);const L=`hsla(${c}, ${h}%, ${x}%, ${C})`,z=Ma.parse(L);if(!z)throw new hl(`Failed to parse HSLA color: ${L}`);return z}function m6(p,c){return p in c}function V5(p,c){const h=c[p];return h===void 0?null:h}function ug(p){return{type:p}}function kx(p){if(p instanceof m0)return new Set([p.key]);let c=new Set;return p.eachChild(h=>{c=new Set([...c,...kx(h)])}),c}function CN(p){if(p instanceof Cd&&p.name==="is-active-floor")return!0;let c=!1;return p.eachChild(h=>{!c&&CN(h)&&(c=!0)}),c}function p6(p){return{result:"success",value:p}}function hg(p){return{result:"error",value:p}}function H5(p,c){return!!p&&!!p.parameters&&p.parameters.indexOf(c)>-1}function a_(p){return p["property-type"]==="data-driven"}function f6(p){return H5(p.expression,"measure-light")}function g6(p){return H5(p.expression,"zoom")}function MN(p){return!!p.expression&&p.expression.interpolated}function TN(p){return typeof p=="object"&&p!==null&&!Array.isArray(p)}function x6(p){return p}function y6(p,c){const h=c.type==="color",x=p.stops&&typeof p.stops[0][0]=="object",_=x||!(x||p.property!==void 0),C=p.type||(MN(c)?"exponential":"interval");if(h&&((p=Object.assign({},p)).stops&&(p.stops=p.stops.map(q=>[q[0],Ma.parse(q[1])])),p.default=Ma.parse(p.default?p.default:c.default)),p.colorSpace&&p.colorSpace!=="rgb"&&!c6[p.colorSpace])throw new Error(`Unknown color space: ${p.colorSpace}`);let T,L,z;if(C==="exponential")T=v6;else if(C==="interval")T=doe;else if(C==="categorical"){T=coe,L=Object.create(null);for(const q of p.stops)L[q[0]]=q[1];z=typeof p.stops[0][0]}else{if(C!=="identity")throw new Error(`Unknown function type "${C}"`);T=_6}if(x){const q={},K=[];for(let re=0;rere[0]),evaluate:({zoom:re},ie)=>v6({stops:Y,base:p.base},c,re).evaluate(re,ie)}}if(_){const q=C==="exponential"?{name:"exponential",base:p.base!==void 0?p.base:1}:null;return{kind:"camera",interpolationType:q,interpolationFactor:zu.interpolationFactor.bind(void 0,q),zoomStops:p.stops.map(K=>K[0]),evaluate:({zoom:K})=>T(p,c,K,L,z)}}return{kind:"source",evaluate(q,K){const Y=K&&K.properties?K.properties[p.property]:void 0;return Y===void 0?Um(p.default,c.default):T(p,c,Y,L,z)}}}function Um(p,c,h){return p!==void 0?p:c!==void 0?c:h!==void 0?h:void 0}function coe(p,c,h,x,_){return Um(typeof h===_?x[h]:void 0,p.default,c.default)}function doe(p,c,h){if(!o0(h))return Um(p.default,c.default);const x=p.stops.length;if(x===1||h<=p.stops[0][0])return p.stops[0][1];if(h>=p.stops[x-1][0])return p.stops[x-1][1];const _=yN(p.stops.map(C=>C[0]),h);return p.stops[_][1]}function v6(p,c,h){const x=p.base!==void 0?p.base:1;if(!o0(h))return Um(p.default,c.default);const _=p.stops.length;if(_===1||h<=p.stops[0][0])return p.stops[0][1];if(h>=p.stops[_-1][0])return p.stops[_-1][1];const C=yN(p.stops.map(K=>K[0]),h),T=function(K,Y,ee,re){const ie=re-ee,ge=K-ee;return ie===0?0:Y===1?ge/ie:(Math.pow(Y,ge)-1)/(Math.pow(Y,ie)-1)}(h,x,p.stops[C][0],p.stops[C+1][0]),L=p.stops[C][1],z=p.stops[C+1][1];let q=Vv[c.type]||x6;if(p.colorSpace&&p.colorSpace!=="rgb"){const K=c6[p.colorSpace];q=(Y,ee)=>K.reverse(K.interpolate(K.forward(Y),K.forward(ee),T))}return typeof L.evaluate=="function"?{evaluate(...K){const Y=L.evaluate.apply(void 0,K),ee=z.evaluate.apply(void 0,K);if(Y!==void 0&&ee!==void 0)return q(Y,ee,T)}}:q(L,z,T)}function _6(p,c,h){return c.type==="color"?h=Ma.parse(h):c.type==="formatted"?h=Nd.fromString(h.toString()):c.type==="resolvedImage"?h=Sd.build(h.toString()):ks(h)===c.type||c.type==="enum"&&c.values[h]||(h=void 0),Um(h,p.default,c.default)}Cd.register(y0,{error:[{kind:"error"},[da],(p,[c])=>{throw new hl(c.evaluate(p))}],typeof:[da,[za],(p,[c])=>qo(jl(c.evaluate(p)))],"to-rgba":[$c(Ts,4),[Kd],(p,[c])=>c.evaluate(p).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[$c(Ts,4),[Kd],(p,[c])=>c.evaluate(p).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[Kd,[Ts,Ts,Ts],U5],rgba:[Kd,[Ts,Ts,Ts,Ts],U5],hsl:[Kd,[Ts,Ts,Ts],q5],hsla:[Kd,[Ts,Ts,Ts,Ts],q5],has:{type:Ka,overloads:[[[da],(p,[c])=>m6(c.evaluate(p),p.properties())],[[da,Fm],(p,[c,h])=>m6(c.evaluate(p),h.evaluate(p))]]},get:{type:za,overloads:[[[da],(p,[c])=>V5(c.evaluate(p),p.properties())],[[da,Fm],(p,[c,h])=>V5(c.evaluate(p),h.evaluate(p))]]},"feature-state":[za,[da],(p,[c])=>V5(c.evaluate(p),p.featureState||{})],properties:[Fm,[],p=>p.properties()],"geometry-type":[da,[],p=>p.geometryType()],worldview:[da,[],p=>p.globals.worldview||""],"is-active-floor":[Ka,ug(da),(p,c)=>{if(!(p.globals.activeFloors&&p.globals.activeFloors.size>0))return!1;const h=p.globals.activeFloors;return c.some(x=>{const _=x.evaluate(p);return h.has(_)})}],id:[za,[],p=>p.id()],zoom:[Ts,[],p=>p.globals.zoom],pitch:[Ts,[],p=>p.globals.pitch||0],"distance-from-center":[Ts,[],p=>p.distanceFromCenter()],"measure-light":[Ts,[da],(p,[c])=>p.measureLight(c.evaluate(p))],"heatmap-density":[Ts,[],p=>p.globals.heatmapDensity||0],"line-progress":[Ts,[],p=>p.globals.lineProgress||0],"raster-value":[Ts,[],p=>p.globals.rasterValue||0],"raster-particle-speed":[Ts,[],p=>p.globals.rasterParticleSpeed||0],"sky-radial-progress":[Ts,[],p=>p.globals.skyRadialProgress||0],accumulated:[za,[],p=>p.globals.accumulated===void 0?null:p.globals.accumulated],"+":[Ts,ug(Ts),(p,c)=>{let h=0;for(const x of c)h+=x.evaluate(p);return h}],"*":[Ts,ug(Ts),(p,c)=>{let h=1;for(const x of c)h*=x.evaluate(p);return h}],"-":{type:Ts,overloads:[[[Ts,Ts],(p,[c,h])=>c.evaluate(p)-h.evaluate(p)],[[Ts],(p,[c])=>-c.evaluate(p)]]},"/":[Ts,[Ts,Ts],(p,[c,h])=>c.evaluate(p)/h.evaluate(p)],"%":[Ts,[Ts,Ts],(p,[c,h])=>c.evaluate(p)%h.evaluate(p)],ln2:[Ts,[],()=>Math.LN2],pi:[Ts,[],()=>Math.PI],e:[Ts,[],()=>Math.E],"^":[Ts,[Ts,Ts],(p,[c,h])=>Math.pow(c.evaluate(p),h.evaluate(p))],sqrt:[Ts,[Ts],(p,[c])=>Math.sqrt(c.evaluate(p))],log10:[Ts,[Ts],(p,[c])=>Math.log(c.evaluate(p))/Math.LN10],ln:[Ts,[Ts],(p,[c])=>Math.log(c.evaluate(p))],log2:[Ts,[Ts],(p,[c])=>Math.log2(c.evaluate(p))],sin:[Ts,[Ts],(p,[c])=>Math.sin(c.evaluate(p))],cos:[Ts,[Ts],(p,[c])=>Math.cos(c.evaluate(p))],tan:[Ts,[Ts],(p,[c])=>Math.tan(c.evaluate(p))],asin:[Ts,[Ts],(p,[c])=>Math.asin(c.evaluate(p))],acos:[Ts,[Ts],(p,[c])=>Math.acos(c.evaluate(p))],atan:[Ts,[Ts],(p,[c])=>Math.atan(c.evaluate(p))],min:[Ts,ug(Ts),(p,c)=>Math.min(...c.map(h=>h.evaluate(p)))],max:[Ts,ug(Ts),(p,c)=>Math.max(...c.map(h=>h.evaluate(p)))],abs:[Ts,[Ts],(p,[c])=>Math.abs(c.evaluate(p))],round:[Ts,[Ts],(p,[c])=>{const h=c.evaluate(p);return h<0?-Math.round(-h):Math.round(h)}],floor:[Ts,[Ts],(p,[c])=>Math.floor(c.evaluate(p))],ceil:[Ts,[Ts],(p,[c])=>Math.ceil(c.evaluate(p))],"filter-==":[Ka,[da,za],(p,[c,h])=>p.properties()[c.value]===h.value],"filter-id-==":[Ka,[za],(p,[c])=>p.id()===c.value],"filter-type-==":[Ka,[da],(p,[c])=>p.geometryType()===c.value],"filter-<":[Ka,[da,za],(p,[c,h])=>{const x=p.properties()[c.value],_=h.value;return typeof x==typeof _&&x<_}],"filter-id-<":[Ka,[za],(p,[c])=>{const h=p.id(),x=c.value;return typeof h==typeof x&&h":[Ka,[da,za],(p,[c,h])=>{const x=p.properties()[c.value],_=h.value;return typeof x==typeof _&&x>_}],"filter-id->":[Ka,[za],(p,[c])=>{const h=p.id(),x=c.value;return typeof h==typeof x&&h>x}],"filter-<=":[Ka,[da,za],(p,[c,h])=>{const x=p.properties()[c.value],_=h.value;return typeof x==typeof _&&x<=_}],"filter-id-<=":[Ka,[za],(p,[c])=>{const h=p.id(),x=c.value;return typeof h==typeof x&&h<=x}],"filter->=":[Ka,[da,za],(p,[c,h])=>{const x=p.properties()[c.value],_=h.value;return typeof x==typeof _&&x>=_}],"filter-id->=":[Ka,[za],(p,[c])=>{const h=p.id(),x=c.value;return typeof h==typeof x&&h>=x}],"filter-has":[Ka,[za],(p,[c])=>c.value in p.properties()],"filter-has-id":[Ka,[],p=>p.id()!==null&&p.id()!==void 0],"filter-type-in":[Ka,[$c(da)],(p,[c])=>c.value.indexOf(p.geometryType())>=0],"filter-id-in":[Ka,[$c(za)],(p,[c])=>c.value.indexOf(p.id())>=0],"filter-in-small":[Ka,[da,$c(za)],(p,[c,h])=>h.value.indexOf(p.properties()[c.value])>=0],"filter-in-large":[Ka,[da,$c(za)],(p,[c,h])=>function(x,_,C,T){for(;C<=T;){const L=C+T>>1;if(_[L]===x)return!0;_[L]>x?T=L-1:C=L+1}return!1}(p.properties()[c.value],h.value,0,h.value.length-1)],all:{type:Ka,overloads:[[[Ka,Ka],(p,[c,h])=>c.evaluate(p)&&h.evaluate(p)],[ug(Ka),(p,c)=>{for(const h of c)if(!h.evaluate(p))return!1;return!0}]]},any:{type:Ka,overloads:[[[Ka,Ka],(p,[c,h])=>c.evaluate(p)||h.evaluate(p)],[ug(Ka),(p,c)=>{for(const h of c)if(h.evaluate(p))return!0;return!1}]]},"!":[Ka,[Ka],(p,[c])=>!c.evaluate(p)],"is-supported-script":[Ka,[da],(p,[c])=>{const h=p.globals&&p.globals.isSupportedScript;return!h||h(c.evaluate(p))}],upcase:[da,[da],(p,[c])=>c.evaluate(p).toUpperCase()],downcase:[da,[da],(p,[c])=>c.evaluate(p).toLowerCase()],concat:[da,ug(za),(p,c)=>c.map(h=>xh(h.evaluate(p))).join("")],"resolved-locale":[da,[eN],(p,[c])=>c.evaluate(p).resolvedLocale()],random:[Ts,[Ts,Ts,za],(p,c)=>{const[h,x,_]=c.map(T=>T.evaluate(p));if(h>x||h===x)return h;let C;if(typeof _=="string")C=function(T){let L=0;if(T.length===0)return L;for(let z=0;zJSON.stringify(Y)).join(", ")}, but found ${JSON.stringify(K)} instead.`);return K}catch(K){const Y=K;return this._warningHistory[Y.message]||(this._warningHistory[Y.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${Y.message}`)),this._defaultValue}}}function i_(p){return Array.isArray(p)&&p.length>0&&typeof p[0]=="string"&&p[0]in y0}function mg(p,c,h,x,_){const C=new xN(y0,[],c?function(L){const z={color:Kd,string:da,number:Ts,enum:da,boolean:Ka,formatted:Hv,resolvedImage:Wv};return L.type==="array"?$c(z[L.value]||za,L.length):z[L.type]}(c):void 0,void 0,void 0,h,x,_),T=C.parse(p,void 0,void 0,void 0,c&&c.type==="string"?{typeAnnotation:"coerce"}:void 0);return T?p6(new AN(T,c,h,x,_)):hg(C.errors)}class v0{constructor(c,h,x,_){this.kind=c,this._styleExpression=h,this.isLightConstant=x,this.isLineProgressConstant=_,this.isStateDependent=c!=="constant"&&!Jv(h.expression),this.configDependencies=kx(h.expression),this.isIndoorDependent=CN(h.expression)}evaluateWithoutErrorHandling(c,h,x,_,C,T){return this._styleExpression.evaluateWithoutErrorHandling(c,h,x,_,C,T)}evaluate(c,h,x,_,C,T,L){return this._styleExpression.evaluate(c,h,x,_,C,T,void 0,void 0,L)}}class Nx{constructor(c,h,x,_,C,T){this.kind=c,this.zoomStops=x,this._styleExpression=h,this.isStateDependent=c!=="camera"&&!Jv(h.expression),this.isIndoorDependent=CN(h.expression),this.isLightConstant=C,this.isLineProgressConstant=T,this.configDependencies=kx(h.expression),this.interpolationType=_}evaluateWithoutErrorHandling(c,h,x,_,C,T){return this._styleExpression.evaluateWithoutErrorHandling(c,h,x,_,C,T)}evaluate(c,h,x,_,C,T){return this._styleExpression.evaluate(c,h,x,_,C,T)}interpolationFactor(c,h,x){return this.interpolationType?zu.interpolationFactor(this.interpolationType,c,h,x):0}}function W5(p,c,h,x,_){if((p=mg(p,c,h,x,_)).result==="error")return p;const C=p.value.expression,T=u0(C);if(!T&&!a_(c))return hg([new gh("","data expressions not supported")]);const L=h0(C,["zoom","pitch","distance-from-center"]);if(!L&&!g6(c))return hg([new gh("","zoom expressions not supported")]);const z=h0(C,["measure-light"]);if(!z&&!f6(c))return hg([new gh("","measure-light expression not supported")]);const q=h0(C,["line-progress"]);if(!q&&!function(ee){return H5(ee.expression,"line-progress")}(c))return hg([new gh("","line-progress expression not supported")]);const K=c.expression&&c.expression.relaxZoomRestriction,Y=Jh(C);return Y||L||K?Y instanceof gh?hg([Y]):Y instanceof zu&&!MN(c)?hg([new gh("",'"interpolate" expressions cannot be used with this property')]):p6(Y?new Nx(T&&q?"camera":"composite",p.value,Y.labels,Y instanceof zu?Y.interpolation:void 0,z,q):new v0(T&&q?"constant":"source",p.value,z,q)):hg([new gh("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class EN{constructor(c,h){this._parameters=c,this._specification=h,Object.assign(this,y6(this._parameters,this._specification))}static deserialize(c){return new EN(c._parameters,c._specification)}static serialize(c){return{_parameters:c._parameters,_specification:c._specification}}}function Jh(p){let c=null;if(p instanceof $p)c=Jh(p.result);else if(p instanceof r_){for(const h of p.args)if(c=Jh(h),c)break}else(p instanceof e_||p instanceof zu)&&p.input instanceof Cd&&p.input.name==="zoom"&&(c=p);return c instanceof gh||p.eachChild(h=>{const x=Jh(h);x instanceof gh?c=x:c&&x&&c!==x&&(c=new gh("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),c}var G5,b6,w6=function(){if(b6)return G5;b6=1,G5=c;var p=3;function c(h,x,_){var C=this.cells=[];if(h instanceof ArrayBuffer){this.arrayBuffer=h;var T=new Int32Array(this.arrayBuffer);h=T[0],this.d=(x=T[1])+2*(_=T[2]);for(var L=0;L=ee[ge+0]&&C>=ee[ge+1])?(z[ie]=!0,L.push(Y[ie])):z[ie]=!1}}},c.prototype._forEachCell=function(h,x,_,C,T,L,z,q){for(var K=this._convertToCellCoord(h),Y=this._convertToCellCoord(x),ee=this._convertToCellCoord(_),re=this._convertToCellCoord(C),ie=K;ie<=ee;ie++)for(var ge=Y;ge<=re;ge++){var Ce=this.d*ge+ie;if((!q||q(this._convertFromCellCoord(ie),this._convertFromCellCoord(ge),this._convertFromCellCoord(ie+1),this._convertFromCellCoord(ge+1)))&&T.call(this,h,x,_,C,Ce,L,z,q))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,x=p+this.cells.length+1+1,_=0,C=0;C=0||(_[C]=Up(p[C],c)));p instanceof Error&&(_.message=p.message)}if(_.$name)throw new Error("$name property is reserved for worker serialization logic.");return x!=="Object"&&(_.$name=x),_}throw new Error("can't serialize object of type "+typeof p)}function pg(p){if(p==null||typeof p=="boolean"||typeof p=="number"||typeof p=="string"||p instanceof Boolean||p instanceof Number||p instanceof String||p instanceof Date||p instanceof RegExp||o_(p)||p instanceof ImageBitmap||ArrayBuffer.isView(p)||p instanceof ImageData)return p;if(Array.isArray(p))return p.map(pg);if(typeof p=="object"){const c=p.$name||"Object";if(c==="Map"){const _=p.entries||[],C=new Map;for(let T=0;T<_.length;T+=2)C.set(pg(_[T]),pg(_[T+1]));return C}if(c==="Set"){const _=new Set;for(const C of Object.keys(p))C!=="$name"&&_.add(pg(p[C]));return _}if(c==="BigInt")return BigInt(p.value);const{klass:h}=Sx[c];if(!h)throw new Error(`Can't deserialize unregistered class "${c}".`);if(h.deserialize)return h.deserialize(p);const x=Object.create(h.prototype);for(const _ of Object.keys(p))_!=="$name"&&(x[_]=pg(p[_]));return x}throw new Error("can't deserialize object of type "+typeof p)}const Ds={"Latin-1 Supplement":p=>p>=128&&p<=255,Arabic:p=>p>=1536&&p<=1791,"Arabic Supplement":p=>p>=1872&&p<=1919,"Arabic Extended-A":p=>p>=2208&&p<=2303,"Hangul Jamo":p=>p>=4352&&p<=4607,"Unified Canadian Aboriginal Syllabics":p=>p>=5120&&p<=5759,Khmer:p=>p>=6016&&p<=6143,"Unified Canadian Aboriginal Syllabics Extended":p=>p>=6320&&p<=6399,"General Punctuation":p=>p>=8192&&p<=8303,"Letterlike Symbols":p=>p>=8448&&p<=8527,"Number Forms":p=>p>=8528&&p<=8591,"Miscellaneous Technical":p=>p>=8960&&p<=9215,"Control Pictures":p=>p>=9216&&p<=9279,"Optical Character Recognition":p=>p>=9280&&p<=9311,"Enclosed Alphanumerics":p=>p>=9312&&p<=9471,"Geometric Shapes":p=>p>=9632&&p<=9727,"Miscellaneous Symbols":p=>p>=9728&&p<=9983,"Miscellaneous Symbols and Arrows":p=>p>=11008&&p<=11263,"CJK Radicals Supplement":p=>p>=11904&&p<=12031,"Kangxi Radicals":p=>p>=12032&&p<=12255,"Ideographic Description Characters":p=>p>=12272&&p<=12287,"CJK Symbols and Punctuation":p=>p>=12288&&p<=12351,Hiragana:p=>p>=12352&&p<=12447,Katakana:p=>p>=12448&&p<=12543,Bopomofo:p=>p>=12544&&p<=12591,"Hangul Compatibility Jamo":p=>p>=12592&&p<=12687,Kanbun:p=>p>=12688&&p<=12703,"Bopomofo Extended":p=>p>=12704&&p<=12735,"CJK Strokes":p=>p>=12736&&p<=12783,"Katakana Phonetic Extensions":p=>p>=12784&&p<=12799,"Enclosed CJK Letters and Months":p=>p>=12800&&p<=13055,"CJK Compatibility":p=>p>=13056&&p<=13311,"CJK Unified Ideographs Extension A":p=>p>=13312&&p<=19903,"Yijing Hexagram Symbols":p=>p>=19904&&p<=19967,"CJK Unified Ideographs":p=>p>=19968&&p<=40959,"Yi Syllables":p=>p>=40960&&p<=42127,"Yi Radicals":p=>p>=42128&&p<=42191,"Hangul Jamo Extended-A":p=>p>=43360&&p<=43391,"Hangul Syllables":p=>p>=44032&&p<=55215,"Hangul Jamo Extended-B":p=>p>=55216&&p<=55295,"Private Use Area":p=>p>=57344&&p<=63743,"CJK Compatibility Ideographs":p=>p>=63744&&p<=64255,"Arabic Presentation Forms-A":p=>p>=64336&&p<=65023,"Vertical Forms":p=>p>=65040&&p<=65055,"CJK Compatibility Forms":p=>p>=65072&&p<=65103,"Small Form Variants":p=>p>=65104&&p<=65135,"Arabic Presentation Forms-B":p=>p>=65136&&p<=65279,"Halfwidth and Fullwidth Forms":p=>p>=65280&&p<=65519,Osage:p=>p>=66736&&p<=66815,"CJK Unified Ideographs Extension B":p=>p>=131072&&p<=173791};function l_(p){for(const c of p)if(IN(c.charCodeAt(0)))return!0;return!1}function K5(p){for(const c of p)if(!j6(c.charCodeAt(0)))return!1;return!0}function j6(p){return!(Ds.Arabic(p)||Ds["Arabic Supplement"](p)||Ds["Arabic Extended-A"](p)||Ds["Arabic Presentation Forms-A"](p)||Ds["Arabic Presentation Forms-B"](p))}function IN(p){return!(p!==746&&p!==747&&(p<4352||!(Ds["Bopomofo Extended"](p)||Ds.Bopomofo(p)||Ds["CJK Compatibility Forms"](p)&&!(p>=65097&&p<=65103)||Ds["CJK Compatibility Ideographs"](p)||Ds["CJK Compatibility"](p)||Ds["CJK Radicals Supplement"](p)||Ds["CJK Strokes"](p)||!(!Ds["CJK Symbols and Punctuation"](p)||p>=12296&&p<=12305||p>=12308&&p<=12319||p===12336)||Ds["CJK Unified Ideographs Extension A"](p)||Ds["CJK Unified Ideographs"](p)||Ds["Enclosed CJK Letters and Months"](p)||Ds["Hangul Compatibility Jamo"](p)||Ds["Hangul Jamo Extended-A"](p)||Ds["Hangul Jamo Extended-B"](p)||Ds["Hangul Jamo"](p)||Ds["Hangul Syllables"](p)||Ds.Hiragana(p)||Ds["Ideographic Description Characters"](p)||Ds.Kanbun(p)||Ds["Kangxi Radicals"](p)||Ds["Katakana Phonetic Extensions"](p)||Ds.Katakana(p)&&p!==12540||!(!Ds["Halfwidth and Fullwidth Forms"](p)||p===65288||p===65289||p===65293||p>=65306&&p<=65310||p===65339||p===65341||p===65343||p>=65371&&p<=65503||p===65507||p>=65512&&p<=65519)||!(!Ds["Small Form Variants"](p)||p>=65112&&p<=65118||p>=65123&&p<=65126)||Ds["Unified Canadian Aboriginal Syllabics"](p)||Ds["Unified Canadian Aboriginal Syllabics Extended"](p)||Ds["Vertical Forms"](p)||Ds["Yijing Hexagram Symbols"](p)||Ds["Yi Syllables"](p)||Ds["Yi Radicals"](p))))}function PN(p){return!(IN(p)||function(c){return!!(Ds["Latin-1 Supplement"](c)&&(c===167||c===169||c===174||c===177||c===188||c===189||c===190||c===215||c===247)||Ds["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)||Ds["Letterlike Symbols"](c)||Ds["Number Forms"](c)||Ds["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)||Ds["Control Pictures"](c)&&c!==9251||Ds["Optical Character Recognition"](c)||Ds["Enclosed Alphanumerics"](c)||Ds["Geometric Shapes"](c)||Ds["Miscellaneous Symbols"](c)&&!(c>=9754&&c<=9759)||Ds["Miscellaneous Symbols and Arrows"](c)&&(c>=11026&&c<=11055||c>=11088&&c<=11097||c>=11192&&c<=11243)||Ds["CJK Symbols and Punctuation"](c)||Ds.Katakana(c)||Ds["Private Use Area"](c)||Ds["CJK Compatibility Forms"](c)||Ds["Small Form Variants"](c)||Ds["Halfwidth and Fullwidth Forms"](c)||c===8734||c===8756||c===8757||c>=9984&&c<=10087||c>=10102&&c<=10131||c===65532||c===65533)}(p))}function LN(p){return Ds.Arabic(p)||Ds["Arabic Supplement"](p)||Ds["Arabic Extended-A"](p)||Ds["Arabic Presentation Forms-A"](p)||Ds["Arabic Presentation Forms-B"](p)}function Z5(p){return p>=1424&&p<=2303||Ds["Arabic Presentation Forms-A"](p)||Ds["Arabic Presentation Forms-B"](p)}function qp(p,c){return!(!c&&Z5(p)||p>=2304&&p<=3583||p>=3840&&p<=4255||Ds.Khmer(p))}function uoe(p){for(const c of p)if(Z5(c.charCodeAt(0)))return!0;return!1}const hu={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let Y5=null,Md=hu.unavailable,Vp=null;const c_=function(p){p&&typeof p=="string"&&p.indexOf("NetworkError")>-1&&(Md=hu.error),Y5&&Y5(p)};function ON(){DN.fire(new Vr("pluginStateChange",{pluginStatus:Md,pluginURL:Vp}))}const DN=new Vn,d_=function(){return Md},k6=function(){if(Md!==hu.deferred||!Vp)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Md=hu.loading,ON(),Vp&&Ru({url:Vp},p=>{p?c_(p):(Md=hu.loaded,ON())})},Hp={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Md===hu.loaded||Hp.applyArabicShaping!=null,isLoading:()=>Md===hu.loading,setState(p){Md=p.pluginStatus,Vp=p.pluginURL},isParsing:()=>Md===hu.parsing,isParsed:()=>Md===hu.parsed,getPluginURL:()=>Vp};class gi{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,x){for(const _ of h)if(!qp(_.charCodeAt(0),x))return!1;return!0}(c,Hp.isLoaded())}}class RN{constructor(c,h,x,_,C){this.property=c,this.value=h,this.expression=function(T,L,z,q,K){if(TN(T))return new EN(T,L);if(i_(T)||Array.isArray(T)&&T.length>0){const Y=W5(T,L,z,q,K);if(Y.result==="error")throw new Error(Y.value.map(ee=>`${ee.key}: ${ee.message}`).join(", "));return Y.value}{let Y=T;return typeof T=="string"&&L.type==="color"&&(Y=Ma.parse(T)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>Y}}}(h===void 0?c.specification.default:h,c.specification,x,_,C)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(c,h,x,_){return this.property.possiblyEvaluate(this,c,h,x,_)}}class X5{constructor(c,h,x,_){this.property=c,this.value=new RN(c,void 0,h,x,_)}transitioned(c,h){return new S6(this.property,this.value,h,Object.assign({},c.transition,this.transition),c.now)}untransitioned(){return new S6(this.property,this.value,null,{},0)}}class N6{constructor(c,h,x,_){this._properties=c,this._values=Object.create(c.defaultTransitionablePropertyValues),this._scope=h,this._options=x,this._iconImageUseTheme=_,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(c){return hr(this._values[c].value.value)}setValue(c,h){this._values.hasOwnProperty(c)||(this._values[c]=new X5(this._values[c].property,this._scope,this._options,this._iconImageUseTheme)),this._values[c].value=new RN(this._values[c].property,h===null?void 0:hr(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 x=this._properties.properties;if(c)for(const _ in c){const C=c[_];if(_.endsWith("-transition")){const T=_.slice(0,-11);x[T]&&this.setTransition(T,C)}else x.hasOwnProperty(_)&&this.setValue(_,C)}}getTransition(c){return hr(this._values[c].transition)}setTransition(c,h){this._values.hasOwnProperty(c)||(this._values[c]=new X5(this._values[c].property)),this._values[c].transition=hr(h)||void 0}serialize(){const c={};for(const h of Object.keys(this._values)){const x=this.getValue(h);x!==void 0&&(c[h]=x);const _=this.getTransition(h);_!==void 0&&(c[`${h}-transition`]=_)}return c}transitioned(c,h){const x=new C6(this._properties);for(const _ of Object.keys(this._values))x._values[_]=this._values[_].transitioned(c,h._values[_]);return x}untransitioned(){const c=new C6(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].untransitioned();return c}isIndoorDependent(){return this._isIndoorDependent}}class S6{constructor(c,h,x,_,C){const T=_.delay||0,L=_.duration||0;C=C||0,this.property=c,this.value=h,this.begin=C+T,this.end=this.begin+L,c.specification.transition&&(_.delay||_.duration)&&(this.prior=x)}possiblyEvaluate(c,h,x){const _=c.now||0,C=this.value.possiblyEvaluate(c,h,x),T=this.prior;if(T){if(_>this.end)return this.prior=null,C;if(this.value.isDataDriven())return this.prior=null,C;if(_":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 T6(p){return p instanceof Number||p instanceof String||p instanceof Boolean?p.valueOf():p}function FN(p){if(Array.isArray(p))return p.map(FN);if(p instanceof Object&&!(p instanceof Number||p instanceof String||p instanceof Boolean)){const c={};for(const h in p)c[h]=FN(p[h]);return c}return T6(p)}function qm(p){if(p===!0||p===!1)return!0;if(!Array.isArray(p)||p.length===0)return!1;switch(p[0]){case"has":return p.length>=2&&p[1]!=="$id"&&p[1]!=="$type";case"in":return p.length>=3&&(typeof p[1]!="string"||Array.isArray(p[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return p.length!==3||Array.isArray(p[1])||Array.isArray(p[2]);case"any":case"all":for(const c of p.slice(1))if(!qm(c)&&typeof c!="boolean")return!1;return!0;default:return!0}}function zN(p,c="",h=null,x="fill"){if(p==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};qm(p)||(p=BN(p));const _=p;let C=!0;try{C=function(K){if(!b0(K))return K;let Y=FN(K);return A6(Y),Y=Ax(Y),Y}(_)}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(_,null,2)} `)}let T=null,L=null;if(x!=="background"&&x!=="sky"&&x!=="slot"){L=Vt[`filter_${x}`];const K=mg(C,L,c,h);if(K.result==="error")throw new Error(K.value.map(Y=>`${Y.key}: ${Y.message}`).join(", "));T=(Y,ee,re)=>K.value.evaluate(Y,ee,{},re)}let z=null,q=null;if(C!==_){const K=mg(_,L,c,h);if(K.result==="error")throw new Error(K.value.map(Y=>`${Y.key}: ${Y.message}`).join(", "));z=(Y,ee,re,ie,ge)=>K.value.evaluate(Y,ee,{},re,void 0,void 0,ie,ge),q=!u0(K.value.expression)}return{filter:T,dynamicFilter:z||void 0,needGeometry:E6(C),needFeature:!!q}}function Ax(p){if(!Array.isArray(p))return p;const c=function(h){if(hoe.has(h[0])){for(let x=1;xAx(h))}function A6(p){let c=!1;const h=[];if(p[0]==="case"){for(let x=1;x",">=","<","<=","to-boolean"]);function moe(p,c){return pc?1:0}function E6(p){if(!Array.isArray(p))return!1;if(p[0]==="within"||p[0]==="distance")return!0;for(let c=1;c"||c==="<="||c===">="?$N(p[1],p[2],c):c==="any"?(h=p.slice(1),["any"].concat(h.map(BN))):c==="all"?["all"].concat(p.slice(1).map(BN)):c==="none"?["all"].concat(p.slice(1).map(BN).map(u_)):c==="in"?UN(p[1],p.slice(2)):c==="!in"?u_(UN(p[1],p.slice(2))):c==="has"?qN(p[1]):c!=="!has"||u_(qN(p[1]));var h}function $N(p,c,h){switch(p){case"$type":return[`filter-type-${h}`,c];case"$id":return[`filter-id-${h}`,c];default:return[`filter-${h}`,p,c]}}function UN(p,c){if(c.length===0)return!1;switch(p){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",p,["literal",c.sort(moe)]]:["filter-in-small",p,["literal",c]]}}function qN(p){switch(p){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",p]}}function u_(p){return["!",p]}const Ex="";function em(p,c){return c?`${p}${Ex}${c}`:p}let I6;const P6=()=>I6||(I6=new lo({"icon-size":new Wr(Vt.layout_symbol["icon-size"]),"icon-image":new Wr(Vt.layout_symbol["icon-image"]),"icon-rotate":new Wr(Vt.layout_symbol["icon-rotate"]),"icon-offset":new Wr(Vt.layout_symbol["icon-offset"]),"text-size":new Wr(Vt.layout_symbol["text-size"]),"text-rotate":new Wr(Vt.layout_symbol["text-rotate"]),"text-offset":new Wr(Vt.layout_symbol["text-offset"])}));class L6{constructor(c,h,x,_,C,T){const L=mg(c,Vt.appearance.condition);if(L.result==="success"&&(this.condition=L.value),this.name=h,x){this.properties=new Mx(P6()),this.unevaluatedLayout=new M6(P6(),_,C,T);for(const z in x)this.unevaluatedLayout.setValue(z,x[z])}}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,x){this.unevaluatedLayout&&(this.properties=this.unevaluatedLayout.possiblyEvaluate(c,void 0,h,x))}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"),x=this.hasProperty("icon-offset"),_=this.hasProperty("icon-rotate");return c||h||x||_}hasTextProperties(){const c=this.hasProperty("text-size"),h=this.hasProperty("text-offset"),x=this.hasProperty("text-rotate");return c||h||x}hasProperty(c){return this.getUnevaluatedProperty(c).value!==void 0}}const O6="-transition",Vm=new Set(["fill","line","background","hillshade","raster"]);class Td extends Vn{constructor(c,h,x,_,C,T){if(super(),this.id=c.id,this.fqid=em(this.id,x),this.type=c.type,this.scope=x,this.lut=_,this.options=C,this.iconImageUseTheme=T,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=mg(this.filter,Vt[`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 M6(h.layout,this.scope,C,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 N6(h.paint,this.scope,C);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 Mx(h.paint)}}}onAdd(c){}onRemove(c){}isDraped(c){return!this.is3D(!0)&&Vm.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 x=this._unevaluatedLayout;x._properties.properties[c]&&(x.setValue(c,h),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...x.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||x.isIndoorDependent(),c==="visibility"&&this.possiblyEvaluateVisibility())}setAppearances(c){this.appearances=[],c.forEach(h=>{this.appearances.push(new L6(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(O6)?this._transitionablePaint.getTransition(c.slice(0,-11)):this._transitionablePaint.getValue(c)}isPaintProperty(c){return!!this._transitionablePaint._properties.properties[c]}setPaintProperty(c,h){const x=this._transitionablePaint,_=x._properties.properties;if(c.endsWith(O6)){const Y=c.slice(0,-11);return _[Y]&&x.setTransition(Y,h||void 0),!1}if(!_[c])return!1;const C=x._values[c],T=C.value.isDataDriven(),L=C.value;x.setValue(c,h),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...x.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||x.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(c);const z=x._values[c].value,q=z.isDataDriven(),K=c.endsWith("pattern")||c==="line-dasharray";return q||T||K||this._handleOverridablePaintPropertyUpdate(c,L,z)}_handleSpecialPaintPropertyUpdate(c){}getProgramIds(){return null}getDefaultProgramParams(c,h,x){return null}_handleOverridablePaintPropertyUpdate(c,h,x){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())),yr(c,(h,x)=>!(h===void 0||x==="layout"&&!Object.keys(h).length||x==="paint"&&!Object.keys(h).length))}is3D(c){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(const c in this.paint._values){const h=this.paint.get(c);if(h instanceof Cx&&a_(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}for(const c of this.appearances)if(!Jv(c.condition.expression))return!0;return!1}compileFilter(c){this._filterCompiled||(this._featureFilter=zN(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,x){return{}}queryRadius(c){}queryIntersectsFeature(c,h,x,_,C,T,L,z,q){}}const D6={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class h_{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 poe=new ArrayBuffer(0);class Ei{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=poe),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 Kn(p,c=1){let h=0,x=0;return{members:p.map(_=>{const C=D6[_.type].BYTES_PER_ELEMENT,T=h=R6(h,Math.max(c,C)),L=_.components||1;return x=Math.max(x,C),h+=C*L,{name:_.name,type:_.type,components:L,offset:T}}),size:R6(h,Math.max(x,c)),alignment:c}}function R6(p,c){return Math.ceil(p/c)*c}class fg extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h){const x=this.length;return this.resize(x+1),this.emplace(x,c,h)}emplace(c,h,x){const _=2*c;return this.int16[_+0]=h,this.int16[_+1]=x,c}}fg.prototype.bytesPerElement=4,hs(fg,"StructArrayLayout2i4");class w0 extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,x){const _=this.length;return this.resize(_+1),this.emplace(_,c,h,x)}emplace(c,h,x,_){const C=3*c;return this.int16[C+0]=h,this.int16[C+1]=x,this.int16[C+2]=_,c}}w0.prototype.bytesPerElement=6,hs(w0,"StructArrayLayout3i6");class j0 extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,x,_){const C=this.length;return this.resize(C+1),this.emplace(C,c,h,x,_)}emplace(c,h,x,_,C){const T=4*c;return this.int16[T+0]=h,this.int16[T+1]=x,this.int16[T+2]=_,this.int16[T+3]=C,c}}j0.prototype.bytesPerElement=8,hs(j0,"StructArrayLayout4i8");class Wp extends Ei{_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}}Wp.prototype.bytesPerElement=4,hs(Wp,"StructArrayLayout1f4");class Q5 extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,x){const _=this.length;return this.resize(_+1),this.emplace(_,c,h,x)}emplace(c,h,x,_){const C=4*c,T=2*c;return this.int16[C+0]=h,this.int16[C+1]=x,this.float32[T+1]=_,c}}Q5.prototype.bytesPerElement=8,hs(Q5,"StructArrayLayout2i1f8");class J5 extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,x){const _=this.length;return this.resize(_+1),this.emplace(_,c,h,x)}emplace(c,h,x,_){const C=4*c;return this.int16[C+0]=h,this.int16[C+1]=x,this.int16[C+2]=_,c}}J5.prototype.bytesPerElement=8,hs(J5,"StructArrayLayout3i8");class eM extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,x,_,C){const T=this.length;return this.resize(T+1),this.emplace(T,c,h,x,_,C)}emplace(c,h,x,_,C,T){const L=5*c;return this.int16[L+0]=h,this.int16[L+1]=x,this.int16[L+2]=_,this.int16[L+3]=C,this.int16[L+4]=T,c}}eM.prototype.bytesPerElement=10,hs(eM,"StructArrayLayout5i10");class VN extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,x,_,C,T,L){const z=this.length;return this.resize(z+1),this.emplace(z,c,h,x,_,C,T,L)}emplace(c,h,x,_,C,T,L,z){const q=6*c,K=12*c,Y=3*c;return this.int16[q+0]=h,this.int16[q+1]=x,this.uint8[K+4]=_,this.uint8[K+5]=C,this.uint8[K+6]=T,this.uint8[K+7]=L,this.float32[Y+2]=z,c}}VN.prototype.bytesPerElement=12,hs(VN,"StructArrayLayout2i4ub1f12");class Bu extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,x){const _=this.length;return this.resize(_+1),this.emplace(_,c,h,x)}emplace(c,h,x,_){const C=3*c;return this.float32[C+0]=h,this.float32[C+1]=x,this.float32[C+2]=_,c}}Bu.prototype.bytesPerElement=12,hs(Bu,"StructArrayLayout3f12");class Zd extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,x,_,C){const T=this.length;return this.resize(T+1),this.emplace(T,c,h,x,_,C)}emplace(c,h,x,_,C,T){const L=6*c,z=3*c;return this.uint16[L+0]=h,this.uint16[L+1]=x,this.uint16[L+2]=_,this.uint16[L+3]=C,this.float32[z+2]=T,c}}Zd.prototype.bytesPerElement=12,hs(Zd,"StructArrayLayout4ui1f12");class Ix extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,h,x,_){const C=this.length;return this.resize(C+1),this.emplace(C,c,h,x,_)}emplace(c,h,x,_,C){const T=4*c;return this.uint16[T+0]=h,this.uint16[T+1]=x,this.uint16[T+2]=_,this.uint16[T+3]=C,c}}Ix.prototype.bytesPerElement=8,hs(Ix,"StructArrayLayout4ui8");class HN extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,x,_,C,T){const L=this.length;return this.resize(L+1),this.emplace(L,c,h,x,_,C,T)}emplace(c,h,x,_,C,T,L){const z=6*c;return this.int16[z+0]=h,this.int16[z+1]=x,this.int16[z+2]=_,this.int16[z+3]=C,this.int16[z+4]=T,this.int16[z+5]=L,c}}HN.prototype.bytesPerElement=12,hs(HN,"StructArrayLayout6i12");class tM extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,h,x,_,C,T,L,z,q,K,Y,ee){const re=this.length;return this.resize(re+1),this.emplace(re,c,h,x,_,C,T,L,z,q,K,Y,ee)}emplace(c,h,x,_,C,T,L,z,q,K,Y,ee,re){const ie=12*c;return this.int16[ie+0]=h,this.int16[ie+1]=x,this.int16[ie+2]=_,this.int16[ie+3]=C,this.uint16[ie+4]=T,this.uint16[ie+5]=L,this.uint16[ie+6]=z,this.uint16[ie+7]=q,this.int16[ie+8]=K,this.int16[ie+9]=Y,this.int16[ie+10]=ee,this.int16[ie+11]=re,c}}tM.prototype.bytesPerElement=24,hs(tM,"StructArrayLayout4i4ui4i24");class rM extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,x,_,C,T){const L=this.length;return this.resize(L+1),this.emplace(L,c,h,x,_,C,T)}emplace(c,h,x,_,C,T,L){const z=10*c,q=5*c;return this.int16[z+0]=h,this.int16[z+1]=x,this.int16[z+2]=_,this.float32[q+2]=C,this.float32[q+3]=T,this.float32[q+4]=L,c}}rM.prototype.bytesPerElement=20,hs(rM,"StructArrayLayout3i3f20");class gg extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,x,_){const C=this.length;return this.resize(C+1),this.emplace(C,c,h,x,_)}emplace(c,h,x,_,C){const T=4*c;return this.float32[T+0]=h,this.float32[T+1]=x,this.float32[T+2]=_,this.float32[T+3]=C,c}}gg.prototype.bytesPerElement=16,hs(gg,"StructArrayLayout4f16");class WN extends Ei{_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}}WN.prototype.bytesPerElement=4,hs(WN,"StructArrayLayout1ul4");class $u extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,h){const x=this.length;return this.resize(x+1),this.emplace(x,c,h)}emplace(c,h,x){const _=2*c;return this.uint16[_+0]=h,this.uint16[_+1]=x,c}}$u.prototype.bytesPerElement=4,hs($u,"StructArrayLayout2ui4");class GN extends Ei{_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,x,_,C,T,L,z,q,K,Y,ee,re){const ie=this.length;return this.resize(ie+1),this.emplace(ie,c,h,x,_,C,T,L,z,q,K,Y,ee,re)}emplace(c,h,x,_,C,T,L,z,q,K,Y,ee,re,ie){const ge=20*c,Ce=10*c;return this.int16[ge+0]=h,this.int16[ge+1]=x,this.int16[ge+2]=_,this.int16[ge+3]=C,this.int16[ge+4]=T,this.float32[Ce+3]=L,this.float32[Ce+4]=z,this.float32[Ce+5]=q,this.float32[Ce+6]=K,this.int16[ge+14]=Y,this.uint32[Ce+8]=ee,this.uint16[ge+18]=re,this.uint16[ge+19]=ie,c}}GN.prototype.bytesPerElement=40,hs(GN,"StructArrayLayout5i4f1i1ul2ui40");class KN extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,x,_,C,T,L){const z=this.length;return this.resize(z+1),this.emplace(z,c,h,x,_,C,T,L)}emplace(c,h,x,_,C,T,L,z){const q=8*c;return this.int16[q+0]=h,this.int16[q+1]=x,this.int16[q+2]=_,this.int16[q+4]=C,this.int16[q+5]=T,this.int16[q+6]=L,this.int16[q+7]=z,c}}KN.prototype.bytesPerElement=16,hs(KN,"StructArrayLayout3i2i2i16");class ZN extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,x,_,C){const T=this.length;return this.resize(T+1),this.emplace(T,c,h,x,_,C)}emplace(c,h,x,_,C,T){const L=4*c,z=8*c;return this.float32[L+0]=h,this.float32[L+1]=x,this.float32[L+2]=_,this.int16[z+6]=C,this.int16[z+7]=T,c}}ZN.prototype.bytesPerElement=16,hs(ZN,"StructArrayLayout2f1f2i16");class sM extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,x,_,C,T){const L=this.length;return this.resize(L+1),this.emplace(L,c,h,x,_,C,T)}emplace(c,h,x,_,C,T,L){const z=20*c,q=5*c;return this.uint8[z+0]=h,this.uint8[z+1]=x,this.float32[q+1]=_,this.float32[q+2]=C,this.float32[q+3]=T,this.float32[q+4]=L,c}}sM.prototype.bytesPerElement=20,hs(sM,"StructArrayLayout2ub4f20");class el extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,h,x){const _=this.length;return this.resize(_+1),this.emplace(_,c,h,x)}emplace(c,h,x,_){const C=3*c;return this.uint16[C+0]=h,this.uint16[C+1]=x,this.uint16[C+2]=_,c}}el.prototype.bytesPerElement=6,hs(el,"StructArrayLayout3ui6");class k0 extends Ei{_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,x,_,C,T,L,z,q,K,Y,ee,re,ie,ge,Ce,Ne,Fe,Be,Ze,yt){const ht=this.length;return this.resize(ht+1),this.emplace(ht,c,h,x,_,C,T,L,z,q,K,Y,ee,re,ie,ge,Ce,Ne,Fe,Be,Ze,yt)}emplace(c,h,x,_,C,T,L,z,q,K,Y,ee,re,ie,ge,Ce,Ne,Fe,Be,Ze,yt,ht){const jt=30*c,Et=15*c,Dt=60*c;return this.int16[jt+0]=h,this.int16[jt+1]=x,this.int16[jt+2]=_,this.float32[Et+2]=C,this.float32[Et+3]=T,this.uint16[jt+8]=L,this.uint16[jt+9]=z,this.uint32[Et+5]=q,this.uint32[Et+6]=K,this.uint32[Et+7]=Y,this.uint16[jt+16]=ee,this.uint16[jt+17]=re,this.uint16[jt+18]=ie,this.float32[Et+10]=ge,this.float32[Et+11]=Ce,this.uint8[Dt+48]=Ne,this.uint8[Dt+49]=Fe,this.uint8[Dt+50]=Be,this.uint32[Et+13]=Ze,this.int16[jt+28]=yt,this.uint8[Dt+58]=ht,c}}k0.prototype.bytesPerElement=60,hs(k0,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class nM extends Ei{_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,x,_,C,T,L,z,q,K,Y,ee,re,ie,ge,Ce,Ne,Fe,Be,Ze,yt,ht,jt,Et,Dt,tr,$t,or,mr,pr,wr,kr,xr){const _r=this.length;return this.resize(_r+1),this.emplace(_r,c,h,x,_,C,T,L,z,q,K,Y,ee,re,ie,ge,Ce,Ne,Fe,Be,Ze,yt,ht,jt,Et,Dt,tr,$t,or,mr,pr,wr,kr,xr)}emplace(c,h,x,_,C,T,L,z,q,K,Y,ee,re,ie,ge,Ce,Ne,Fe,Be,Ze,yt,ht,jt,Et,Dt,tr,$t,or,mr,pr,wr,kr,xr,_r){const ir=20*c,sr=40*c,br=80*c;return this.float32[ir+0]=h,this.float32[ir+1]=x,this.int16[sr+4]=_,this.int16[sr+5]=C,this.int16[sr+6]=T,this.int16[sr+7]=L,this.int16[sr+8]=z,this.int16[sr+9]=q,this.int16[sr+10]=K,this.int16[sr+11]=Y,this.int16[sr+12]=ee,this.uint16[sr+13]=re,this.uint16[sr+14]=ie,this.uint16[sr+15]=ge,this.uint16[sr+16]=Ce,this.uint16[sr+17]=Ne,this.uint16[sr+18]=Fe,this.uint16[sr+19]=Be,this.uint16[sr+20]=Ze,this.uint16[sr+21]=yt,this.uint16[sr+22]=ht,this.uint16[sr+23]=jt,this.uint16[sr+24]=Et,this.uint16[sr+25]=Dt,this.uint16[sr+26]=tr,this.uint16[sr+27]=$t,this.uint32[ir+14]=or,this.float32[ir+15]=mr,this.float32[ir+16]=pr,this.float32[ir+17]=wr,this.float32[ir+18]=kr,this.uint8[br+76]=xr,this.uint16[sr+39]=_r,c}}nM.prototype.bytesPerElement=80,hs(nM,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class aM extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,x,_,C,T){const L=this.length;return this.resize(L+1),this.emplace(L,c,h,x,_,C,T)}emplace(c,h,x,_,C,T,L){const z=6*c;return this.float32[z+0]=h,this.float32[z+1]=x,this.float32[z+2]=_,this.float32[z+3]=C,this.float32[z+4]=T,this.float32[z+5]=L,c}}aM.prototype.bytesPerElement=24,hs(aM,"StructArrayLayout6f24");class Px extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,x,_,C){const T=this.length;return this.resize(T+1),this.emplace(T,c,h,x,_,C)}emplace(c,h,x,_,C,T){const L=5*c;return this.float32[L+0]=h,this.float32[L+1]=x,this.float32[L+2]=_,this.float32[L+3]=C,this.float32[L+4]=T,c}}Px.prototype.bytesPerElement=20,hs(Px,"StructArrayLayout5f20");class iM extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,x,_,C,T,L){const z=this.length;return this.resize(z+1),this.emplace(z,c,h,x,_,C,T,L)}emplace(c,h,x,_,C,T,L,z){const q=7*c;return this.float32[q+0]=h,this.float32[q+1]=x,this.float32[q+2]=_,this.float32[q+3]=C,this.float32[q+4]=T,this.float32[q+5]=L,this.float32[q+6]=z,c}}iM.prototype.bytesPerElement=28,hs(iM,"StructArrayLayout7f28");class oM extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,x,_,C,T,L,z,q,K,Y){const ee=this.length;return this.resize(ee+1),this.emplace(ee,c,h,x,_,C,T,L,z,q,K,Y)}emplace(c,h,x,_,C,T,L,z,q,K,Y,ee){const re=11*c;return this.float32[re+0]=h,this.float32[re+1]=x,this.float32[re+2]=_,this.float32[re+3]=C,this.float32[re+4]=T,this.float32[re+5]=L,this.float32[re+6]=z,this.float32[re+7]=q,this.float32[re+8]=K,this.float32[re+9]=Y,this.float32[re+10]=ee,c}}oM.prototype.bytesPerElement=44,hs(oM,"StructArrayLayout11f44");class N0 extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,x,_,C,T,L,z,q){const K=this.length;return this.resize(K+1),this.emplace(K,c,h,x,_,C,T,L,z,q)}emplace(c,h,x,_,C,T,L,z,q,K){const Y=9*c;return this.float32[Y+0]=h,this.float32[Y+1]=x,this.float32[Y+2]=_,this.float32[Y+3]=C,this.float32[Y+4]=T,this.float32[Y+5]=L,this.float32[Y+6]=z,this.float32[Y+7]=q,this.float32[Y+8]=K,c}}N0.prototype.bytesPerElement=36,hs(N0,"StructArrayLayout9f36");class Hm extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h){const x=this.length;return this.resize(x+1),this.emplace(x,c,h)}emplace(c,h,x){const _=2*c;return this.float32[_+0]=h,this.float32[_+1]=x,c}}Hm.prototype.bytesPerElement=8,hs(Hm,"StructArrayLayout2f8");class Yd extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,h,x,_){const C=this.length;return this.resize(C+1),this.emplace(C,c,h,x,_)}emplace(c,h,x,_,C){const T=6*c;return this.uint32[3*c+0]=h,this.uint16[T+2]=x,this.uint16[T+3]=_,this.uint16[T+4]=C,c}}Yd.prototype.bytesPerElement=12,hs(Yd,"StructArrayLayout1ul3ui12");class xg extends Ei{_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}}xg.prototype.bytesPerElement=2,hs(xg,"StructArrayLayout1ui2");class lM extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,x,_,C,T,L,z,q,K,Y,ee,re,ie,ge,Ce){const Ne=this.length;return this.resize(Ne+1),this.emplace(Ne,c,h,x,_,C,T,L,z,q,K,Y,ee,re,ie,ge,Ce)}emplace(c,h,x,_,C,T,L,z,q,K,Y,ee,re,ie,ge,Ce,Ne){const Fe=16*c;return this.float32[Fe+0]=h,this.float32[Fe+1]=x,this.float32[Fe+2]=_,this.float32[Fe+3]=C,this.float32[Fe+4]=T,this.float32[Fe+5]=L,this.float32[Fe+6]=z,this.float32[Fe+7]=q,this.float32[Fe+8]=K,this.float32[Fe+9]=Y,this.float32[Fe+10]=ee,this.float32[Fe+11]=re,this.float32[Fe+12]=ie,this.float32[Fe+13]=ge,this.float32[Fe+14]=Ce,this.float32[Fe+15]=Ne,c}}lM.prototype.bytesPerElement=64,hs(lM,"StructArrayLayout16f64");class YN extends Ei{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,x,_,C,T,L){const z=this.length;return this.resize(z+1),this.emplace(z,c,h,x,_,C,T,L)}emplace(c,h,x,_,C,T,L,z){const q=10*c,K=5*c;return this.uint16[q+0]=h,this.uint16[q+1]=x,this.uint16[q+2]=_,this.uint16[q+3]=C,this.float32[K+2]=T,this.float32[K+3]=L,this.float32[K+4]=z,c}}YN.prototype.bytesPerElement=20,hs(YN,"StructArrayLayout4ui3f20");class cM extends Ei{_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}}cM.prototype.bytesPerElement=2,hs(cM,"StructArrayLayout1i2");class XN extends Ei{_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}}XN.prototype.bytesPerElement=1,hs(XN,"StructArrayLayout1ub1");class QN extends h_{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]}}QN.prototype.size=40;class F6 extends GN{get(c){return new QN(this,c)}}hs(F6,"CollisionBoxArray");class JN extends h_{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}}JN.prototype.size=60;class z6 extends k0{get(c){return new JN(this,c)}}hs(z6,"PlacedSymbolArray");class B6 extends h_{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]}}B6.prototype.size=80;class dM extends nM{get(c){return new B6(this,c)}}hs(dM,"SymbolInstanceArray");class e4 extends Wp{getoffsetX(c){return this.float32[1*c+0]}}hs(e4,"GlyphOffsetArray");class $6 extends fg{getx(c){return this.int16[2*c+0]}gety(c){return this.int16[2*c+1]}}hs($6,"SymbolLineVertexArray");class uM extends h_{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]}}uM.prototype.size=12;class hM extends Yd{get(c){return new uM(this,c)}}hs(hM,"FeatureIndexArray");class U6 extends $u{geta_centroid_pos0(c){return this.uint16[2*c+0]}geta_centroid_pos1(c){return this.uint16[2*c+1]}}hs(U6,"FillExtrusionCentroidArray");class t4 extends h_{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]}}t4.prototype.size=6;class m_ extends w0{get(c){return new t4(this,c)}}hs(m_,"FillExtrusionWallArray");const q6=Kn([{name:"a_pos",components:2,type:"Int16"}],4),foe=Kn([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),V6=Kn([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Yi{constructor(c=[]){this.segments=c}_prepareSegment(c,h,x,_){let C=this.segments[this.segments.length-1];return c>Yi.MAX_VERTEX_ARRAY_LENGTH&&es(`Max vertices per segment is ${Yi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${c}`),(!C||C.vertexLength+c>Yi.MAX_VERTEX_ARRAY_LENGTH||C.sortKey!==_)&&(C={vertexOffset:h,primitiveOffset:x,vertexLength:0,primitiveLength:0},_!==void 0&&(C.sortKey=_),this.segments.push(C)),C}prepareSegment(c,h,x,_){return this._prepareSegment(c,h.length,x.length,_)}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,x,_){return new Yi([{vertexOffset:c,primitiveOffset:h,vertexLength:x,primitiveLength:_,vaos:{},sortKey:0}])}}function r4(p,c){return 256*(p=ye(Math.floor(p),0,255))+ye(Math.floor(c),0,255)}Yi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,hs(Yi,"SegmentVector");const goe=Kn([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),xoe=Kn([{name:"a_pattern_b",components:4,type:"Uint16"}]),yoe=Kn([{name:"a_dash",components:4,type:"Uint16"}]);class p_{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(c,h,x,_){this.ids.push(mM(c)),this.positions.push(h,x,_)}eachPosition(c,h){const x=mM(c);let _=0,C=this.ids.length-1;for(;_>1;this.ids[T]>=x?C=T:_=T+1}for(;this.ids[_]===x;)h(this.positions[3*_],this.positions[3*_+1],this.positions[3*_+2]),_++}static serialize(c,h){const x=new Float64Array(c.ids),_=new Uint32Array(c.positions);return pM(x,_,0,x.length-1),h&&(h.add(x.buffer),h.add(_.buffer)),{ids:x,positions:_}}static deserialize(c){const h=new p_;let x;h.ids=c.ids,h.positions=c.positions;for(const _ of h.ids)_!==x&&h.uniqueIds.push(_),x=_;return h.indexed=!0,h}}function mM(p){const c=+p;return Number.isSafeInteger(c)?c:vr(String(p))}function pM(p,c,h,x){for(;h>1];let C=h-1,T=x+1;for(;;){do C++;while(p[C]<_);do T--;while(p[T]>_);if(C>=T)break;s4(p,C,T),s4(c,3*C,3*T),s4(c,3*C+1,3*T+1),s4(c,3*C+2,3*T+2)}T-h`u_${C}`),this.type=x,this.context=_}setUniform(c,h,x,_,C){const T=_.constantOr(this.value);h.set(c,C,T instanceof Ma?T.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):T)}getBinding(c,h){return this.type==="color"?new g_(c):new tl(c)}}class S0{constructor(c,h){this.uniformNames=h.map(x=>`u_${x}`),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,x,_,C){let T=null;C!=="u_pattern"&&C!=="u_dash"||(T=this.pattern),C==="u_pattern_b"&&(T=this.patternTransition),C==="u_pixel_ratio"&&(T=this.pixelRatio),T&&h.set(c,C,T)}getBinding(c,h){return h==="u_pattern"||h==="u_pattern_b"||h==="u_dash"?new a4(c):new tl(c)}}class Kp{constructor(c,h,x,_){this.expression=c,this.type=x,this.maxValue=0,this.paintVertexAttributes=h.map(C=>({name:`a_${C}`,type:"Float32",components:x==="color"?2:1,offset:0})),this.paintVertexArray=new _}populatePaintArray(c,h,x,_,C,T,L,z){const q=this.paintVertexArray.length,K=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new gi(0,{brightness:T,worldview:z}),h,{},C,_,L):this.expression.kind==="constant"&&this.expression.value,Y=y_(this.lutExpression,h,{},_,C,T,L,z);this.paintVertexArray.resize(c),this._setPaintValue(q,c,K,Y?null:this.context.lut)}updatePaintArray(c,h,x,_,C,T,L,z){const q=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:L,worldview:z},x,_,void 0,C):this.expression.kind==="constant"&&this.expression.value,K=y_(this.lutExpression,x,_,C,void 0,L,void 0,z);this._setPaintValue(c,h,q,K?null:this.context.lut)}_setPaintValue(c,h,x,_){if(this.type==="color"){const C=fM(x.toPremultipliedRenderColor(_));for(let T=c;T`u_${L}_t`),this.type=x,this.useIntegerZoom=_,this.context=C,this.maxValue=0,this.paintVertexAttributes=h.map(L=>({name:`a_${L}`,type:"Float32",components:x==="color"?4:2,offset:0})),this.paintVertexArray=new T}populatePaintArray(c,h,x,_,C,T,L,z){const q=this.expression.evaluate(new gi(this.context.zoom,{brightness:T,worldview:z}),h,{},C,_,L),K=this.expression.evaluate(new gi(this.context.zoom+1,{brightness:T,worldview:z}),h,{},C,_,L),Y=y_(this.lutExpression,h,{},_,C,T,L,z),ee=this.paintVertexArray.length;this.paintVertexArray.resize(c),this._setPaintValue(ee,c,q,K,Y?null:this.context.lut)}updatePaintArray(c,h,x,_,C,T,L,z){const q=this.expression.evaluate({zoom:this.context.zoom,brightness:L,worldview:z},x,_,void 0,C),K=this.expression.evaluate({zoom:this.context.zoom+1,brightness:L,worldview:z},x,_,void 0,C),Y=y_(this.lutExpression,x,_,C,void 0,L,void 0,z);this._setPaintValue(c,h,q,K,Y?null:this.context.lut)}_setPaintValue(c,h,x,_,C){if(this.type==="color"){const T=fM(x.toPremultipliedRenderColor(C)),L=fM(x.toPremultipliedRenderColor(C));for(let z=c;z!0){this.binders={},this._buffers=[],this.context=h;const _=[];for(const C in c.paint._values){const T=c.paint.get(C);if(C.endsWith("-use-theme")||!x(C)||!(T instanceof Cx&&a_(T.property.specification)))continue;const L=woe(C,c.type),z=T.value,q=T.property.specification.type,K=!!T.property.useIntegerZoom,Y=C==="line-dasharray"||C.endsWith("pattern"),ee=c.paint.get(`${C}-use-theme`),re=C==="line-dasharray"&&c.layout.get("line-cap").value.kind!=="constant"||ee&&ee.value.kind!=="constant";if(z.kind!=="constant"||re)if(z.kind==="source"||re||Y){const ie=gM(C,q,"source");this.binders[C]=Y?new Yp(z,L,q,ie,c.id):new Kp(z,L,q,ie),_.push(`/a_${C}`)}else{const ie=gM(C,q,"composite");this.binders[C]=new Zp(z,L,q,K,h,ie),_.push(`/z_${C}`)}else this.binders[C]=Y?new S0(z.value,L):new v_(z.value,L,q,h),_.push(`/u_${C}`);ee&&(this.binders[C].lutExpression=ee.value)}this.cacheKey=_.sort().join("")}getMaxValue(c){const h=this.binders[c];return h instanceof Kp||h instanceof Zp?h.maxValue:0}populatePaintArrays(c,h,x,_,C,T,L,z){for(const q in this.binders){const K=this.binders[q];K.context=this.context,(K instanceof Kp||K instanceof Zp||K instanceof Yp)&&K.populatePaintArray(c,h,x,_,C,T,L,z)}}setConstantPatternPositions(c,h){for(const x in this.binders){const _=this.binders[x];_ instanceof S0&&_.setConstantPatternPositions(c,h)}}getPatternTransitionVertexBuffer(c){const h=this.binders[c];return h instanceof Yp?h.paintTransitionVertexBuffer:null}updatePaintArrays(c,h,x,_,C,T,L,z,q,K){let Y=!1;const ee=Object.keys(c),re=ee.length!==0&&!z,ie=re?ee:h.uniqueIds;this.context.lut=C.lut;for(const ge in this.binders){const Ce=this.binders[ge];if(Ce.context=this.context,(Ce instanceof Kp||Ce instanceof Zp||Ce instanceof Yp)&&Ce.expression&&Ce.expression.kind&&Ce.expression.kind!=="constant"&&(Ce.expression.isStateDependent===!0||Ce.expression.isLightConstant===!1)){const Ne=C.paint.get(ge);Ce.expression=Ne.value;for(const Fe of ie){const Be=c[Fe.toString()];h.eachPosition(Fe,(Ze,yt,ht)=>{const jt=_.feature(Ze);Ce.updatePaintArray(yt,ht,jt,Be,T,L,q,K)})}if(!re)for(const Fe of x.uniqueIds){const Be=c[Fe.toString()];x.eachPosition(Fe,(Ze,yt,ht)=>{const jt=_.feature(Ze);Ce.updatePaintArray(yt,ht,jt,Be,T,L,q,K)})}Y=!0}}return Y}defines(){const c=[];for(const h in this.binders){const x=this.binders[h];(x instanceof v_||x instanceof S0)&&c.push(...x.uniformNames.map(_=>`#define HAS_UNIFORM_${_}`))}return c}getPaintVertexBuffers(){return this._buffers}getUniforms(c){const h=[];for(const x in this.binders){const _=this.binders[x];if(_ instanceof v_||_ instanceof S0||_ instanceof Zp)for(const C of _.uniformNames)h.push({name:C,property:x,binding:_.getBinding(c,C)})}return h}setUniforms(c,h,x,_,C){for(const{name:T,property:L,binding:z}of x)this.binders[L].setUniform(c,z,C,_.get(L),T)}updatePaintBuffers(){this._buffers=[];for(const c in this.binders){const h=this.binders[c];(h instanceof Kp||h instanceof Zp||h instanceof Yp)&&h.paintVertexBuffer&&this._buffers.push(h.paintVertexBuffer),h instanceof Yp&&h.paintTransitionVertexBuffer&&this._buffers.push(h.paintTransitionVertexBuffer)}}upload(c){for(const h in this.binders){const x=this.binders[h];(x instanceof Kp||x instanceof Zp||x instanceof Yp)&&x.upload(c)}this.updatePaintBuffers()}destroy(){for(const c in this.binders){const h=this.binders[c];(h instanceof Kp||h instanceof Zp||h instanceof Yp)&&h.destroy()}}}class tm{constructor(c,h,x=()=>!0){this.programConfigurations={};for(const _ of c)this.programConfigurations[_.id]=new yg(_,h,x);this.needsUpload=!1,this._featureMap=new p_,this._featureMapWithoutIds=new p_,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(c,h,x,_,C,T,L,z,q){for(const K in this.programConfigurations)this.programConfigurations[K].populatePaintArrays(c,h,_,C,T,L,z,q);h.id!==void 0?this._featureMap.add(h.id,x,this._bufferOffset,c):(this._featureMapWithoutIds.add(this._idlessCounter,x,this._bufferOffset,c),this._idlessCounter+=1),this._bufferOffset=c,this.needsUpload=!0}updatePaintArrays(c,h,x,_,C,T,L,z){for(const q of x)this.needsUpload=this.programConfigurations[q.id].updatePaintArrays(c,this._featureMap,this._featureMapWithoutIds,h,q,_,C,T,L||0,z)||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 boe={"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 woe(p,c){return boe[p]||[p.replace(`${c}-`,"").replace(/-/g,"_")]}const joe={"line-pattern":{source:Zd,composite:Zd},"fill-pattern":{source:Zd,composite:Zd},"fill-extrusion-pattern":{source:Zd,composite:Zd},"line-dasharray":{source:Ix,composite:Ix}},koe={color:{source:Hm,composite:gg},number:{source:Wp,composite:Hm}};function gM(p,c,h){const x=joe[p];return x&&x[h]||koe[c][h]}hs(v_,"ConstantBinder"),hs(S0,"PatternConstantBinder"),hs(Kp,"SourceExpressionBinder"),hs(Yp,"PatternCompositeBinder"),hs(Zp,"CompositeExpressionBinder"),hs(yg,"ProgramConfiguration",{omit:["_buffers"]}),hs(tm,"ProgramConfigurationSet");const Uc=Rr/Math.PI/2,_h=5,l4=6,Noe=16383,C0=64,xM=[C0,32,16],bh=-Uc,wh=Uc;function Lx(p,c,h,x=Uc){return h=Ys(h),[p*Math.sin(h)*x,-c*x,p*Math.cos(h)*x]}function M0(p,c,h){return Lx(Math.cos(Ys(p)),Math.sin(Ys(p)),c,h)}const w=63710088e-1,u=2*Math.PI*w;class f{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 f(Ke(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,x=this.lat*h,_=c.lat*h,C=Math.sin(x)*Math.sin(_)+Math.cos(x)*Math.cos(_)*Math.cos((c.lng-this.lng)*h);return w*Math.acos(Math.min(C,1))}toBounds(c=0){const h=360*c/40075017,x=h/Math.cos(Math.PI/180*this.lat);return new k({lng:this.lng-x,lat:this.lat-h},{lng:this.lng+x,lat:this.lat+h})}toEcef(c){return M0(this.lat,this.lng,Uc+c*Uc/w)}static convert(c){if(c instanceof f)return c;if(Array.isArray(c)&&(c.length===2||c.length===3))return new f(Number(c[0]),Number(c[1]));if(!Array.isArray(c)&&typeof c=="object"&&c!==null)return new f(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 k{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 f?new f(c.lng,c.lat):f.convert(c),this}setSouthWest(c){return this._sw=c instanceof f?new f(c.lng,c.lat):f.convert(c),this}extend(c){const h=this._sw,x=this._ne;let _,C;if(c instanceof f)_=c,C=c;else{if(!(c instanceof k))return Array.isArray(c)?c.length===4||c.every(Array.isArray)?this.extend(k.convert(c)):this.extend(f.convert(c)):typeof c=="object"&&c!==null&&c.hasOwnProperty("lat")&&(c.hasOwnProperty("lon")||c.hasOwnProperty("lng"))?this.extend(f.convert(c)):this;if(_=c._sw,C=c._ne,!_||!C)return this}return h||x?(h.lng=Math.min(_.lng,h.lng),h.lat=Math.min(_.lat,h.lat),x.lng=Math.max(C.lng,x.lng),x.lat=Math.max(C.lat,x.lat)):(this._sw=new f(_.lng,_.lat),this._ne=new f(C.lng,C.lat)),this}getCenter(){return new f((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 f(this.getWest(),this.getNorth())}getSouthEast(){return new f(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:x}=f.convert(c);let _=this._sw.lng<=h&&h<=this._ne.lng;return this._sw.lng>this._ne.lng&&(_=this._sw.lng>=h&&h>=this._ne.lng),this._sw.lat<=x&&x<=this._ne.lat&&_}static convert(c){if(c)return c instanceof k?c:new k(c)}}const P=0,D=25.5;function R(p){return u*Math.cos(p*Math.PI/180)}function U(p){return(180+p)/360}function G(p){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+p*Math.PI/360)))/360}function J(p,c){return p/R(c)}function te(p){return 360*p-180}function me(p){return 360/Math.PI*Math.atan(Math.exp((180-360*p)*Math.PI/180))-90}function he(p,c){return p*R(me(c))}const pe=85.051129;function ke(p){return Math.cos(Ys(ye(p,-pe,pe)))}function _e(p,c){const h=ye(c,P,D),x=Math.pow(2,h);return ke(p)*u/(512*x)}function Re(p){return 1/Math.cos(p*Math.PI/180)}function De(p,c=0){const h=Math.exp(Math.PI*(1-(p.y+c/Rr)/(1<=z?(nt(p,c,h,q,K,C,Y,L,z),nt(p,q,K,x,_,Y,T,L,z)):p.push(T)}function We(p,c,h){let x=p[0],_=x.x,C=x.y;c(x);const T=[x];for(let L=1;Lp.x+1||xp.y+1)&&es("Geometry exceeds allowed extent, reduce your vector tile buffer size"),p}function Tt(p,c,h){const x=p.loadGeometry(),_=p.extent,C=Rr/_;if(c&&h&&h.projection.isReprojectedInTileSpace){const T=1<{const re=te((c.x+ee.x/_)/T),ie=me((c.y+ee.y/_)/T),ge=K.project(re,ie);ee.x=(ge.x*L-z)*_,ee.y=(ge.y*L-q)*_};for(let ee=0;ee=_||ie.y<0||ie.y>=_||(Y(ie),re.push(ie));x[ee]=re}}for(const T of x)for(const L of T)ut(L,C);return x}function Bt(p,c){return{type:p.type,id:p.id,properties:p.properties,geometry:c?Tt(p):[]}}class zt{constructor(c,h,x,_,C){this.properties={},this.extent=x,this.type=0,this.id=void 0,this._pbf=c,this._geometry=-1,this._keys=_,this._values=C,c.readFields(Qt,this,h)}loadGeometry(){const c=this._pbf;c.pos=this._geometry;const h=c.readVarint()+c.pos,x=[];let _,C=1,T=0,L=0,z=0;for(;c.pos>3}if(T--,C===1||C===2)L+=c.readSVarint(),z+=c.readSVarint(),C===1&&(_&&x.push(_),_=[]),_&&_.push(new dr(L,z));else{if(C!==7)throw new Error(`unknown command ${C}`);_&&_.push(_[0].clone())}}return _&&x.push(_),x}bbox(){const c=this._pbf;c.pos=this._geometry;const h=c.readVarint()+c.pos;let x=1,_=0,C=0,T=0,L=1/0,z=-1/0,q=1/0,K=-1/0;for(;c.pos>3}if(_--,x===1||x===2)C+=c.readSVarint(),T+=c.readSVarint(),Cz&&(z=C),TK&&(K=T);else if(x!==7)throw new Error(`unknown command ${x}`)}return[L,q,z,K]}toGeoJSON(c,h,x){const _=this.extent*Math.pow(2,x),C=this.extent*c,T=this.extent*h,L=this.loadGeometry();function z(ee){return[360*(ee.x+C)/_-180,360/Math.PI*Math.atan(Math.exp((1-2*(ee.y+T)/_)*Math.PI))-90]}function q(ee){return ee.map(z)}let K;if(this.type===1){const ee=[];for(const ie of L)ee.push(ie[0]);const re=q(ee);K=ee.length===1?{type:"Point",coordinates:re[0]}:{type:"MultiPoint",coordinates:re}}else if(this.type===2){const ee=L.map(q);K=ee.length===1?{type:"LineString",coordinates:ee[0]}:{type:"MultiLineString",coordinates:ee}}else{if(this.type!==3)throw new Error("unknown feature type");{const ee=function(ie){const ge=ie.length;if(ge<=1)return[ie];const Ce=[];let Ne,Fe;for(let Be=0;Be=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 zt(this._pbf,h,this.extent,this._keys,this._values)}}function Sr(p,c,h){p===15?c.version=h.readVarint():p===1?c.name=h.readString():p===5?c.extent=h.readVarint():p===2?c._features.push(h.pos):p===3?c._keys.push(h.readString()):p===4&&c._values.push(function(x){let _=null;const C=x.readVarint()+x.pos;for(;x.pos>3;_=T===1?x.readString():T===2?x.readFloat():T===3?x.readDouble():T===4?x.readVarint64():T===5?x.readVarint():T===6?x.readSVarint():T===7?x.readBoolean():null}if(_==null)throw new Error("unknown feature value");return _}(h))}class Kt{constructor(c,h){this.layers=c.readFields(Pt,{},h)}}function Pt(p,c,h){if(p===3){const x=new ur(h,h.readVarint()+h.pos);x.length&&(c[x.name]=x)}}const nr="3d_elevation_id",Xt="level";class gr{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,x){return this.get(c,!0,h,x)}optional(c,h,x){return this.get(c,!1,h,x)}success(){return this._valid}get(c,h,x,_){const C=this.feature.properties.hasOwnProperty(c)?+this.feature.properties[c]:void 0;return this._valid&&C!==void 0&&!Number.isNaN(C)?x(_?_(C):C):h&&(this._valid=!1),this}}class $r{constructor(c,h){this.featureFunc=c,this.vertexFunc=h}parseFeature(c,h,x){return this.featureFunc(c,h,x)}parseVertex(c,h,x){return this.vertexFunc(c,h,x)}}const rs=new $r((p,c,h)=>p.reset(c).require(nr,x=>{h.id=x}).optional("fixed_height_relative",x=>{h.constantHeight=x},Tr.decodeRelativeHeight).geometry(x=>{h.bounds=x},Bp).success(),(p,c,h)=>p.reset(c).require(nr,x=>{h.id=x}).require("elevation_idx",x=>{h.idx=x}).require("extent",x=>{h.extent=x}).require("height_relative",x=>{h.height=x},Tr.decodeRelativeHeight).geometry(x=>{h.position=x},Tr.getPoint).success()),Or=new $r((p,c,h)=>p.reset(c).require(nr,x=>{h.id=x}).optional("fixed_height",x=>{h.constantHeight=x},Tr.decodeMetricHeight).geometry(x=>{h.bounds=x},Bp).success(),(p,c,h)=>p.reset(c).require(nr,x=>{h.id=x}).require("elevation_idx",x=>{h.idx=x}).require("extent",x=>{h.extent=x}).require("height",x=>{h.height=x},Tr.decodeMetricHeight).geometry(x=>{h.position=x},Tr.getPoint).success());class Tr{static getPoint(c){return At(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"?Or:void 0:rs}static parse(c){const h=[],x=[],_=c.length,C=new gr;for(let T=0;T<_;T++){const L=c.feature(T),z=L.properties.version,q=Tr.getVersionSchema(z);if(q===void 0){es(`Unknown elevation feature version number ${z||"(unknown)"}`);continue}const K=L.properties.type;if(!K)continue;const Y=zt.types[L.type];if(Y==="Point"&&K==="curve_point"){const ee={};q.parseVertex(C,L,ee)&&h.push(ee)}else if(Y==="Polygon"&&K==="curve_meta"){const ee={};q.parseFeature(C,L,ee)&&x.push(ee)}}return{vertices:h,features:x}}}class vs{constructor(c,h){this.pos=c,this.dir=h}intersectsPlane(c,h,x){const _=Ia(h,this.dir);if(Math.abs(_)<1e-6)return!1;const C=((c[0]-this.pos[0])*h[0]+(c[1]-this.pos[1])*h[1])/_;return x[0]=this.pos[0]+this.dir[0]*C,x[1]=this.pos[1]+this.dir[1]*C,!0}}class ps{constructor(c,h){this.pos=c,this.dir=h}intersectsPlane(c,h,x){const _=et(h,this.dir);if(Math.abs(_)<1e-6)return!1;const C=((c[0]-this.pos[0])*h[0]+(c[1]-this.pos[1])*h[1]+(c[2]-this.pos[2])*h[2])/_;return x[0]=this.pos[0]+this.dir[0]*C,x[1]=this.pos[1]+this.dir[1]*C,x[2]=this.pos[2]+this.dir[2]*C,!0}closestPointOnSphere(c,h,x){if(function(re,ie){var ge=re[0],Ce=re[1],Ne=re[2],Fe=ie[0],Be=ie[1],Ze=ie[2];return Math.abs(ge-Fe)<=d*Math.max(1,Math.abs(ge),Math.abs(Fe))&&Math.abs(Ce-Be)<=d*Math.max(1,Math.abs(Ce),Math.abs(Be))&&Math.abs(Ne-Ze)<=d*Math.max(1,Math.abs(Ne),Math.abs(Ze))}(this.pos,c)||h===0)return x[0]=x[1]=x[2]=0,!1;const[_,C,T]=this.dir,L=this.pos[0]-c[0],z=this.pos[1]-c[1],q=this.pos[2]-c[2],K=_*_+C*C+T*T,Y=2*(L*_+z*C+q*T),ee=Y*Y-4*K*(L*L+z*z+q*q-h*h);if(ee<0){const re=Math.max(-Y/2,0),ie=L+_*re,ge=z+C*re,Ce=q+T*re,Ne=Math.hypot(ie,ge,Ce);return x[0]=ie*h/Ne,x[1]=ge*h/Ne,x[2]=Ce*h/Ne,!1}{const re=(-Y-Math.sqrt(ee))/(2*K);if(re<0){const ie=Math.hypot(L,z,q);return x[0]=L*h/ie,x[1]=z*h/ie,x[2]=q*h/ie,!1}return x[0]=L+_*re,x[1]=z+C*re,x[2]=q+T*re,!0}}}class Qr{constructor(c,h,x,_,C){this.TL=c,this.TR=h,this.BR=x,this.BL=_,this.horizon=C}static fromInvProjectionMatrix(c,h,x){const _=[-1,1,1],C=[1,1,1],T=[1,-1,1],L=[-1,-1,1],z=at(_,_,c),q=at(C,C,c),K=at(T,T,c),Y=at(L,L,c);return new Qr(z,q,K,Y,h/x)}}function ns(p,c,h){let x=1/0,_=-1/0;const C=[];for(const T of p){je(C,T,c);const L=et(C,h);x=Math.min(x,L),_=Math.max(_,L)}return[x,_]}function Ps(p,c){let h=!0;for(let x=0;x=0);if(C===0)return 0;C!==c.length&&(h=!1)}return h?2:1}function hn(p,c){for(const h of p.projections){const x=ns(c,p.points[0],h.axis);if(h.projection[1]x[1])return 0}return 1}function ta(p,c){let h=0;const x=[0,0,0,0];for(let T=0;T=0&&h++;var _,C;return h}class Ta{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=js.fromPoints(this.points),this.projections=[],this.frustumEdges=[je([],this.points[2],this.points[3]),je([],this.points[0],this.points[3]),je([],this.points[4],this.points[0]),je([],this.points[5],this.points[1]),je([],this.points[6],this.points[2]),je([],this.points[7],this.points[3])];for(const x of this.frustumEdges){const _=[0,-x[2],x[1]],C=[x[2],0,-x[0]];this.projections.push({axis:_,projection:ns(this.points,this.points[0],_)}),this.projections.push({axis:C,projection:ns(this.points,this.points[0],C)})}}static fromInvProjectionMatrix(c,h,x,_){const C=Math.pow(2,x),T=[[-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(q=>{const K=ot([],q,c),Y=1/K[3]/h*C;return(ee=K)[0]=(re=K)[0]*(ie=[Y,Y,_?1/K[3]:Y,Y])[0],ee[1]=re[1]*ie[1],ee[2]=re[2]*ie[2],ee[3]=re[3]*ie[3],ee;var ee,re,ie}),L=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(q=>{const K=Ie([],It([],je([],T[q[0]],T[q[1]]),je([],T[q[2]],T[q[1]]))),Y=-et(K,T[q[1]]);return K.concat(Y)}),z=[];for(let q=0;qq[1]||q[0]>z[1])return 0}return 1}containsPoint(c){for(const h of this.planes){const x=h[3];if(et([h[0],h[1],h[2]],c)+x<0)return!1}return!0}}class js{static fromPoints(c){const h=[1/0,1/0,1/0],x=[-1/0,-1/0,-1/0];for(const _ of c)be(h,h,_),we(x,x,_);return new js(h,x)}static fromTileIdAndHeight(c,h,x){const _=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])]}}hs(js,"Aabb");class ba{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,x=h[1],_=-h[0],C=(c.extent+1)*this.metersToTile;return[new dr(Math.trunc(c.position[0]+x*C),Math.trunc(c.position[1]+_*C)),new dr(Math.trunc(c.position[0]-x*C),Math.trunc(c.position[1]-_*C))]}next(){this.index++}valid(){return this.index{return L.a0?ve(z,z,1/q):de(z,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(c){if(this.edges.length===0)return;let h=0,x=Number.POSITIVE_INFINITY,_=0;const[C,T,L,z,q,K,Y]=this._tmpVec2;Rt(Y,c.x,c.y);const ee=new vs(Y,null);for(let re=0;re0?Ia(z,L)/Ze:0,ht=ye(yt,0,1),jt=Math.abs((yt-ht)*this.edgeProps[re].len);fs(q,Y,Ce),Rt(K,ge[1],-ge[0]);const Et=jt+Math.abs(Ia(q,K));Et=0;--T){const L=this.edges[T].a,z=this.edges[T].b,{position:q,height:K,extent:Y}=this.vertices[L],{position:ee,height:re,extent:ie}=this.vertices[z],ge=this.vertexProps[L].dir,Ce=this.vertexProps[z].dir;if(de(h,q[0]/c,q[1]/c,K),de(x,ee[0]/c,ee[1]/c,re),de(_,ge[1],-ge[0],0),ve(_,_,Y),de(C,Ce[1],-Ce[0],0),ve(C,C,ie),this.distSqLines(oe(h[0]+.5*_[0],h[1]+.5*_[1],h[2]+.5*_[2]),oe(x[0]-.5*C[0],x[1]-.5*C[1],x[2]-.5*C[2]),oe(h[0]-.5*_[0],h[1]-.5*_[1],h[2]-.5*_[2]),oe(x[0]+.5*C[0],x[1]+.5*C[1],x[2]+.5*C[2]))<=.0025000000000000005)continue;const Ne=this.vertices.length,Fe=Cr(As(),q,ee);this.vertices.push({position:Vs(Fe,Fe,.5),height:.5*(K+re),extent:.5*(Y+ie)});const Be=Cr(As(),ge,Ce);this.vertexProps.push({dir:hi(Be,Be)}),this.edges.splice(T,1),this.edgeProps.splice(T,1),this.edges.push({a:L,b:Ne}),this.edges.push({a:Ne,b:z});const Ze=fs(As(),this.vertices[Ne].position,q),yt=Js(Ze),ht={vec:Ze,dir:Vs(As(),Ze,1/yt),len:yt};this.edgeProps.push(ht),this.edgeProps.push(ht)}}distSqLines(c,h,x,_){const C=xe(le(),h,c),T=xe(le(),_,x),L=xe(le(),c,x),z=et(C,C),q=et(C,T),K=et(C,L),Y=et(T,T),ee=et(T,L),re=z*Y-q*q;if(re===0)return Le(Pe(C,x,_,et(L,T)/et(T,T)),c);const ie=(z*ee-q*K)/re;return Le(Pe(C,c,h,(q*ee-K*Y)/re),Pe(T,x,_,ie))}}class La{static parseFrom(c,h){const x=Tr.parse(c);if(!x)return[];let{vertices:_,features:C}=x;const T=1/De(h);C.sort((K,Y)=>K.id-Y.id),_.sort((K,Y)=>K.id-Y.id||K.idx-Y.idx),_=_.filter((K,Y,ee)=>Y===ee.findIndex(re=>re.id===K.id&&re.idx===K.idx));const L=new Array;let z=0;const q=_.length;for(const K of C){if(K.constantHeight){L.push(new nn(K.id,K.bounds,K.constantHeight));continue}for(;z!==q&&_[z].id_.id===x)}}class Za{constructor(c,h){this.zScale=1,this.xOffset=0,this.yOffset=0,c.equals(h)||(this.zScale=Math.pow(2,h.z-c.z),this.xOffset=(c.x*this.zScale-h.x)*Rr,this.yOffset=(c.y*this.zScale-h.y)*Rr)}constantElevation(c,h){if(c.constantHeight!=null)return this.computeBiasedHeight(c.constantHeight,h)}pointElevation(c,h,x){const _=this.constantElevation(h,x);return _??(c.x=c.x*this.zScale+this.xOffset,c.y=c.y*this.zScale+this.yOffset,this.computeBiasedHeight(h.pointElevation(c),x))}computeBiasedHeight(c,h){return h<=0?c:c+h*Oe(0,h,c>=0?c:Math.abs(.5*c))}}hs(nn,"ElevationFeature");class Ua{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 fg,this.indexArray=new el,this.segments=new Yi,this.programConfigurations=new tm(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 Wp),this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,h){}updateAppearances(c,h,x,_){}populate(c,h,x,_){const C=this.layers[0],T=[];let L=null;C.type==="circle"&&(L=C.layout.get("circle-sort-key"));for(const{feature:q,id:K,index:Y,sourceLayerIndex:ee}of c){const re=this.layers[0]._featureFilter.needGeometry,ie=Bt(q,re);if(!this.layers[0]._featureFilter.filter(new gi(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),ie,x))continue;const ge=L?L.evaluate(ie,{},x):void 0,Ce={id:K,properties:q.properties,type:q.type,sourceLayerIndex:ee,index:Y,geometry:re?ie.geometry:Tt(q,x,_),patterns:{},sortKey:ge};T.push(Ce)}L&&T.sort((q,K)=>q.sortKey-K.sortKey);let z=null;_.projection.name==="globe"&&(this.globeExtVertexArray=new HN,z=_.projection);for(const q of T){const{geometry:K,index:Y,sourceLayerIndex:ee}=q,re=c[Y].feature;this.addFeature(q,K,Y,h.availableImages,x,z,h.brightness,h.elevationFeatures),h.featureIndex.insert(re,K,Y,ee,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(c,h,x,_,C,T,L){this.programConfigurations.updatePaintArrays(c,h,C,x,_,T,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,q6.members),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=c.createVertexBuffer(this.globeExtVertexArray,V6.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=c.createVertexBuffer(this.elevatedLayoutVertexArray,foe.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,x,_,C,T,L,z){let q;this.elevationMode!=="none"&&(q=La.getElevationFeature(c,z));for(const K of h)for(const Y of K){const ee=Y.x,re=Y.y;if(ee<0||ee>=Rr||re<0||re>=Rr)continue;if(T){const Ce=T.projectTilePoint(ee,re,C),Ne=T.upVector(C,ee,re);this.addGlobeExtVertex(Ce,Ne),this.addGlobeExtVertex(Ce,Ne),this.addGlobeExtVertex(Ce,Ne),this.addGlobeExtVertex(Ce,Ne)}const ie=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,c.sortKey),ge=ie.vertexLength;if(this.addCircleVertex(ee,re,-1,-1),this.addCircleVertex(ee,re,1,-1),this.addCircleVertex(ee,re,1,1),this.addCircleVertex(ee,re,-1,1),this.elevationMode!=="none"){const Ce=q?q.pointElevation(new dr(ee,re)):0;this.hasElevation=this.hasElevation||Ce!==0;for(let Ne=0;Ne<4;Ne++)this.elevatedLayoutVertexArray.emplaceBack(Ce)}this.indexArray.emplaceBack(ge,ge+1,ge+2),this.indexArray.emplaceBack(ge,ge+2,ge+3),ie.vertexLength+=4,ie.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,x,{},_,C,L,void 0,this.worldview)}addCircleVertex(c,h,x,_){this.layoutVertexArray.emplaceBack(2*c+(x+1)/2,2*h+(_+1)/2)}addGlobeExtVertex(c,h){this.globeExtVertexArray.emplaceBack(c.x,c.y,c.z,h[0]*16384,h[1]*16384,h[2]*16384)}}function _a(p,c){for(let h=0;h1){if(Ii(p,c))return!0;for(let x=0;x1?h:h.sub(c)._mult(_)._add(c))}function Xi(p,c){let h,x,_,C=!1;for(let T=0;Tc.y!=_.y>c.y&&c.x<(_.x-x.x)*(c.y-x.y)/(_.y-x.y)+x.x&&(C=!C)}return C}function si(p,c){let h=!1;for(let x=0,_=p.length-1;xc.y!=T.y>c.y&&c.x<(T.x-C.x)*(c.y-C.y)/(T.y-C.y)+C.x&&(h=!h)}return h}function Ad(p,c,h,x,_){for(const T of p)if(c<=T.x&&h<=T.y&&x>=T.x&&_>=T.y)return!0;const C=[new dr(c,h),new dr(c,_),new dr(x,_),new dr(x,h)];if(p.length>2){for(const T of C)if(si(p,T))return!0}for(let T=0;T_.x&&c.x>_.x||p.y_.y&&c.y>_.y)return!1;const C=yn(p,c,h[0]);return C!==yn(p,c,h[1])||C!==yn(p,c,h[2])||C!==yn(p,c,h[3])}function rl(p,c,h,x,_,C){let T=c.y-p.y,L=p.x-c.x;if(C=C||0){const z=T*T+L*L;if(z===0)return!0;const q=Math.sqrt(z);T/=q,L/=q}return!((h.x-p.x)*T+(h.y-p.y)*L-C<0||(x.x-p.x)*T+(x.y-p.y)*L-C<0||(_.x-p.x)*T+(_.y-p.y)*L-C<0)}function qc(p,c,h,x,_,C,T){return!(rl(p,c,x,_,C,T)||rl(c,h,x,_,C,T)||rl(h,p,x,_,C,T)||rl(x,_,p,c,h,T)||rl(_,C,p,c,h,T)||rl(C,x,p,c,h,T))}function Vc(p,c,h){const x=c.paint.get(p).value;return x.kind==="constant"?x.value:h.programConfigurations.get(c.id).getMaxValue(p)}function Ql(p){return Math.sqrt(p[0]*p[0]+p[1]*p[1])}function Uu(p,c,h,x,_){if(!c[0]&&!c[1])return p;const C=dr.convert(c)._mult(_);h==="viewport"&&C._rotate(-x);const T=[];for(let L=0;L>h&&c.y===this.y>>h}url(c,h){const x=function(C,T,L){var z=ko(256*C,256*(T=Math.pow(2,L)-T-1),L),q=ko(256*(C+1),256*(T+1),L);return z[0]+","+z[1]+","+q[0]+","+q[1]}(this.x,this.y,this.z),_=function(C,T,L){let z,q="";for(let K=C;K>0;K--)z=1<this.canonical.z?new no(c,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new no(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 Qi(this.wrap*+h,c,this.canonical.z,this.canonical.x,this.canonical.y);{const x=this.canonical.z-c;return Qi(this.wrap*+h,c,c,this.canonical.x>>x,this.canonical.y>>x)}}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 no(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const h=this.canonical.z+1,x=2*this.canonical.x,_=2*this.canonical.y;return[new no(h,this.wrap,h,x,_),new no(h,this.wrap,h,x+1,_),new no(h,this.wrap,h,x,_+1),new no(h,this.wrap,h,x+1,_+1)]}isLessThan(c){return this.wrapc.wrap)&&(this.overscaledZc.overscaledZ)&&(this.canonical.xc.canonical.x)&&this.canonical.y{let c=p.canonical.x-1,h=p.wrap;return c<0&&(c=(1<{let c=p.canonical.x+1,h=p.wrap;return c===1<new no(p.overscaledZ,p.wrap,p.canonical.z,p.canonical.x,(p.canonical.y===0?1<new no(p.overscaledZ,p.wrap,p.canonical.z,p.canonical.x,p.canonical.y===(1<1?null:function(x,_,C,T){const L=Math.sin(C);return x*(Math.sin((1-T)*C)/L)+_*(Math.sin(T*C)/L)}(p.a[c],p.b[c],p.angle,ye(h,0,1))+p.center[c]}function sm(p){if(p.z<=1)return Xp[p.z+2*p.y+p.x];const c=Soe(H6(p));return js.fromPoints(c)}function Jp(p,c,h){return ve(p,p,1-h),tt(p,p,c,h)}function bve(p,c,h){for(const x of p)at(x,x,c),ve(x,x,h)}function wve(p,c,h,x){const _=c/p.worldSize,C=p.globeMatrix;if(h.z<=1){const Dt=sm(h).getCorners();return bve(Dt,C,_),js.fromPoints(Dt)}const T=H6(h,x),L=Soe(T,Uc+Gm(p._tileCoverLift));bve(L,C,_);const z=Number.MAX_VALUE,q=[-z,-z,-z],K=[z,z,z];if(T.contains(p.center)){for(const $t of L)be(K,K,$t),we(q,q,$t);q[2]=0;const Dt=p.point,tr=[Dt.x*_,Dt.y*_,0];return be(K,K,tr),we(q,q,tr),new js(K,q)}if(p._tileCoverLift>0){for(const Dt of L)be(K,K,Dt),we(q,q,Dt);return new js(K,q)}const Y=[C[12]*_,C[13]*_,C[14]*_],ee=T.getCenter(),re=ye(p.center.lat,-pe,pe),ie=ye(ee.lat,-pe,pe),ge=U(p.center.lng),Ce=G(re);let Ne=ge-U(ee.lng);const Fe=Ce-G(ie);Ne>.5?Ne-=1:Ne<-.5&&(Ne+=1);let Be=0;Math.abs(Ne)>Math.abs(Fe)?Be=Ne>=0?1:3:(Be=Fe>=0?0:2,tt(Y,Y,[C[4]*_,C[5]*_,C[6]*_],-Math.sin(Ys(Fe>=0?T.getSouth():T.getNorth()))*Uc));const Ze=L[Be],yt=L[(Be+1)%4],ht=new vg(Ze,yt,Y),jt=[Qp(ht,0)||Ze[0],Qp(ht,1)||Ze[1],Qp(ht,2)||Ze[2]],Et=E0(p.zoom);if(Et>0){const Dt=function({x:$t,y:or,z:mr},pr,wr,kr,xr){const _r=1/(1<.5?Ar=-1:Ns<-.5&&(Ar=1),ir=((ir+Ar)*pr-(kr*=pr))*wr+kr,sr=((sr+Ar)*pr-kr)*wr+kr,br=(br*pr-(xr*=pr))*wr+xr,zr=(zr*pr-xr)*wr+xr,[[ir,zr,0],[sr,zr,0],[sr,br,0],[ir,br,0]]}(h,c,p._pixelsPerMercatorPixel,ge,Ce);for(let $t=0;$tMath.PI/2*1.01}const Cve=Ys(85),kHe=Math.cos(Cve),NHe=Math.sin(Cve),SHe=N(),Mve=p=>{const c=[];return p.paint.get("circle-pitch-alignment")==="map"&&c.push("PITCH_WITH_MAP"),p.paint.get("circle-pitch-scale")==="map"&&c.push("SCALE_WITH_MAP"),c};function Tve(p,c,h,x,_,C,T,L,z){if(C&&p.queryGeometry.isAboveHorizon)return!1;C&&(z*=p.pixelToTileUnitsFactor);const q=p.tileID.canonical,K=h.projection.upVectorScale(q,h.center.lat,h.worldSize).metersToTile;for(const Y of c)for(const ee of Y){const re=ee.add(L),ie=_&&h.elevation?h.elevation.exaggeration()*_.getElevationAt(re.x,re.y,!0):0,ge=h.projection.projectTilePoint(re.x,re.y,q);if(ie>0){const Be=h.projection.upVector(q,re.x,re.y);ge.x+=Be[0]*K*ie,ge.y+=Be[1]*K*ie,ge.z+=Be[2]*K*ie}const Ce=C?re:CHe(ge.x,ge.y,ge.z,x),Ne=C?p.tilespaceRays.map(Be=>THe(Be,ie)):p.queryGeometry.screenGeometry,Fe=ot([],[ge.x,ge.y,ge.z,1],x);if(!T&&C?z*=Fe[3]/h.cameraToCenterDistance:T&&!C&&(z*=h.cameraToCenterDistance/Fe[3]),C){const Be=me((ee.y/Rr+q.y)/(1<p.width||_.height>p.height||h.x>p.width-_.width||h.y>p.height-_.height)throw new RangeError("out of range source coordinates for image copy");if(_.width>c.width||_.height>c.height||x.x>c.width-_.width||x.y>c.height-_.height)throw new RangeError("out of range destination coordinates for image copy");const z=p.data,q=c.data,K=C===4&&L;for(let Y=0;Y<_.height;Y++){const ee=((h.y+Y)*p.width+h.x)*C,re=((x.y+Y)*c.width+x.x)*C;if(K)for(let ie=0;ie<_.width;ie++){const ge=ee+ie*C+3,Ce=re+ie*C;q[Ce+0]=255,q[Ce+1]=255,q[Ce+2]=255,q[Ce+3]=z[ge]}else if(T)for(let ie=0;ie<_.width;ie++){const ge=ee+ie*C,Ce=re+ie*C,Ne=new Ma(z[ge+0]/255,z[ge+1]/255,z[ge+2]/255,z[ge+3]).toNonPremultipliedRenderColor(T).toArray();q[Ce+0]=Ne[0],q[Ce+1]=Ne[1],q[Ce+2]=Ne[2],q[Ce+3]=Ne[3]}else for(let ie=0;ie<_.width*C;ie++)q[re+ie]=z[ee+ie]}return c}hs(Eve,"HeatmapBucket",{omit:["layers"]});class I0{constructor(c,h){Dve(this,c,1,h)}resize(c){Rve(this,new I0(c),1)}clone(){return new I0({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(c,h,x,_,C){Aoe(c,h,x,_,C,1,null)}}class Hc{constructor(c,h){Dve(this,c,4,h)}resize(c){Rve(this,new Hc(c),4)}replace(c,h){h?this.data.set(c):this.data=c instanceof Uint8ClampedArray?new Uint8Array(c.buffer):c}clone(){return new Hc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(c,h,x,_,C,T,L){Aoe(c,h,x,_,C,4,T,L)}}class Fve{constructor(c,h){this.width=c.width,this.height=c.height,this.data=h instanceof Uint8Array?new Float32Array(h.buffer):h}}function vM(p){const c={},h=p.resolution||256,x=p.clips?p.clips.length:1,_=p.image||new Hc({width:h,height:x}),C=(T,L,z)=>{c[p.evaluationKey]=z;const q=p.expression.evaluate(c),K=q?q.toNonPremultipliedRenderColor(null):null;K&&(_.data[T+L+0]=Math.floor(255*K.r),_.data[T+L+1]=Math.floor(255*K.g),_.data[T+L+2]=Math.floor(255*K.b),_.data[T+L+3]=Math.floor(255*K.a))};if(p.clips)for(let T=0,L=0;T80*h){L=p[0],z=p[1];let K=L,Y=z;for(let ee=h;ee<_;ee+=h){const re=p[ee],ie=p[ee+1];reK&&(K=re),ie>Y&&(Y=ie)}q=Math.max(K-L,Y-z),q=q!==0?32767/q:0}return _M(C,T,h,L,z,q,0),T}function zve(p,c,h,x,_){let C;if(_===function(T,L,z,q){let K=0;for(let Y=L,ee=z-q;Y0)for(let T=c;T=c;T-=x)C=qve(T/x|0,p[T],p[T+1],C);return C&&d4(C,C.next)&&(jM(C),C=C.next),C}function w_(p,c){if(!p)return p;c||(c=p);let h,x=p;do if(h=!1,x.steiner||!d4(x,x.next)&&Fl(x.prev,x,x.next)!==0)x=x.next;else{if(jM(x),x=c=x.prev,x===x.next)break;h=!0}while(h||x!==c);return c}function _M(p,c,h,x,_,C,T){if(!p)return;!T&&C&&function(z,q,K,Y){let ee=z;do ee.z===0&&(ee.z=Eoe(ee.x,ee.y,q,K,Y)),ee.prevZ=ee.prev,ee.nextZ=ee.next,ee=ee.next;while(ee!==z);ee.prevZ.nextZ=null,ee.prevZ=null,function(re){let ie,ge=1;do{let Ce,Ne=re;re=null;let Fe=null;for(ie=0;Ne;){ie++;let Be=Ne,Ze=0;for(let ht=0;ht0||yt>0&&Be;)Ze!==0&&(yt===0||!Be||Ne.z<=Be.z)?(Ce=Ne,Ne=Ne.nextZ,Ze--):(Ce=Be,Be=Be.nextZ,yt--),Fe?Fe.nextZ=Ce:re=Ce,Ce.prevZ=Fe,Fe=Ce;Ne=Be}Fe.nextZ=null,ge*=2}while(ie>1)}(ee)}(p,x,_,C);let L=p;for(;p.prev!==p.next;){const z=p.prev,q=p.next;if(C?OHe(p,x,_,C):LHe(p))c.push(z.i,p.i,q.i),jM(p),p=q.next,L=q.next;else if((p=q)===L){T?T===1?_M(p=DHe(w_(p),c),c,h,x,_,C,2):T===2&&RHe(p,c,h,x,_,C):_M(w_(p),c,h,x,_,C,1);break}}}function LHe(p){const c=p.prev,h=p,x=p.next;if(Fl(c,h,x)>=0)return!1;const _=c.x,C=h.x,T=x.x,L=c.y,z=h.y,q=x.y,K=Math.min(_,C,T),Y=Math.min(L,z,q),ee=Math.max(_,C,T),re=Math.max(L,z,q);let ie=x.next;for(;ie!==c;){if(ie.x>=K&&ie.x<=ee&&ie.y>=Y&&ie.y<=re&&bM(_,L,C,z,T,q,ie.x,ie.y)&&Fl(ie.prev,ie,ie.next)>=0)return!1;ie=ie.next}return!0}function OHe(p,c,h,x){const _=p.prev,C=p,T=p.next;if(Fl(_,C,T)>=0)return!1;const L=_.x,z=C.x,q=T.x,K=_.y,Y=C.y,ee=T.y,re=Math.min(L,z,q),ie=Math.min(K,Y,ee),ge=Math.max(L,z,q),Ce=Math.max(K,Y,ee),Ne=Eoe(re,ie,c,h,x),Fe=Eoe(ge,Ce,c,h,x);let Be=p.prevZ,Ze=p.nextZ;for(;Be&&Be.z>=Ne&&Ze&&Ze.z<=Fe;){if(Be.x>=re&&Be.x<=ge&&Be.y>=ie&&Be.y<=Ce&&Be!==_&&Be!==T&&bM(L,K,z,Y,q,ee,Be.x,Be.y)&&Fl(Be.prev,Be,Be.next)>=0||(Be=Be.prevZ,Ze.x>=re&&Ze.x<=ge&&Ze.y>=ie&&Ze.y<=Ce&&Ze!==_&&Ze!==T&&bM(L,K,z,Y,q,ee,Ze.x,Ze.y)&&Fl(Ze.prev,Ze,Ze.next)>=0))return!1;Ze=Ze.nextZ}for(;Be&&Be.z>=Ne;){if(Be.x>=re&&Be.x<=ge&&Be.y>=ie&&Be.y<=Ce&&Be!==_&&Be!==T&&bM(L,K,z,Y,q,ee,Be.x,Be.y)&&Fl(Be.prev,Be,Be.next)>=0)return!1;Be=Be.prevZ}for(;Ze&&Ze.z<=Fe;){if(Ze.x>=re&&Ze.x<=ge&&Ze.y>=ie&&Ze.y<=Ce&&Ze!==_&&Ze!==T&&bM(L,K,z,Y,q,ee,Ze.x,Ze.y)&&Fl(Ze.prev,Ze,Ze.next)>=0)return!1;Ze=Ze.nextZ}return!0}function DHe(p,c){let h=p;do{const x=h.prev,_=h.next.next;!d4(x,_)&&$ve(x,h,h.next,_)&&wM(x,_)&&wM(_,x)&&(c.push(x.i,h.i,_.i),jM(h),jM(h.next),h=p=_),h=h.next}while(h!==p);return w_(h)}function RHe(p,c,h,x,_,C){let T=p;do{let L=T.next.next;for(;L!==T.prev;){if(T.i!==L.i&&UHe(T,L)){let z=Uve(T,L);return T=w_(T,T.next),z=w_(z,z.next),_M(T,c,h,x,_,C,0),void _M(z,c,h,x,_,C,0)}L=L.next}T=T.next}while(T!==p)}function FHe(p,c){let h=p.x-c.x;return h===0&&(h=p.y-c.y,h===0)&&(h=(p.next.y-p.y)/(p.next.x-p.x)-(c.next.y-c.y)/(c.next.x-c.x)),h}function zHe(p,c){const h=function(_,C){let T=C;const L=_.x,z=_.y;let q,K=-1/0;if(d4(_,T))return T;do{if(d4(_,T.next))return T.next;if(z<=T.y&&z>=T.next.y&&T.next.y!==T.y){const ge=T.x+(z-T.y)*(T.next.x-T.x)/(T.next.y-T.y);if(ge<=L&&ge>K&&(K=ge,q=T.x=T.x&&T.x>=ee&&L!==T.x&&Bve(zq.x||T.x===q.x&&BHe(q,T)))&&(q=T,ie=ge)}T=T.next}while(T!==Y);return q}(p,c);if(!h)return c;const x=Uve(h,p);return w_(x,x.next),w_(h,h.next)}function BHe(p,c){return Fl(p.prev,p,c.prev)<0&&Fl(c.next,p,p.next)<0}function Eoe(p,c,h,x,_){return(p=1431655765&((p=858993459&((p=252645135&((p=16711935&((p=(p-h)*_|0)|p<<8))|p<<4))|p<<2))|p<<1))|(c=1431655765&((c=858993459&((c=252645135&((c=16711935&((c=(c-x)*_|0)|c<<8))|c<<4))|c<<2))|c<<1))<<1}function $He(p){let c=p,h=p;do(c.x=(p-T)*(C-L)&&(p-T)*(x-L)>=(h-T)*(c-L)&&(h-T)*(C-L)>=(_-T)*(x-L)}function bM(p,c,h,x,_,C,T,L){return!(p===T&&c===L)&&Bve(p,c,h,x,_,C,T,L)}function UHe(p,c){return p.next.i!==c.i&&p.prev.i!==c.i&&!function(h,x){let _=h;do{if(_.i!==h.i&&_.next.i!==h.i&&_.i!==x.i&&_.next.i!==x.i&&$ve(_,_.next,h,x))return!0;_=_.next}while(_!==h);return!1}(p,c)&&(wM(p,c)&&wM(c,p)&&function(h,x){let _=h,C=!1;const T=(h.x+x.x)/2,L=(h.y+x.y)/2;do _.y>L!=_.next.y>L&&_.next.y!==_.y&&T<(_.next.x-_.x)*(L-_.y)/(_.next.y-_.y)+_.x&&(C=!C),_=_.next;while(_!==h);return C}(p,c)&&(Fl(p.prev,p,c.prev)||Fl(p,c.prev,c))||d4(p,c)&&Fl(p.prev,p,p.next)>0&&Fl(c.prev,c,c.next)>0)}function Fl(p,c,h){return(c.y-p.y)*(h.x-c.x)-(c.x-p.x)*(h.y-c.y)}function d4(p,c){return p.x===c.x&&p.y===c.y}function $ve(p,c,h,x){const _=Z6(Fl(p,c,h)),C=Z6(Fl(p,c,x)),T=Z6(Fl(h,x,p)),L=Z6(Fl(h,x,c));return _!==C&&T!==L||!(_!==0||!K6(p,h,c))||!(C!==0||!K6(p,x,c))||!(T!==0||!K6(h,p,x))||!(L!==0||!K6(h,c,x))}function K6(p,c,h){return c.x<=Math.max(p.x,h.x)&&c.x>=Math.min(p.x,h.x)&&c.y<=Math.max(p.y,h.y)&&c.y>=Math.min(p.y,h.y)}function Z6(p){return p>0?1:p<0?-1:0}function wM(p,c){return Fl(p.prev,p,p.next)<0?Fl(p,c,p.next)>=0&&Fl(p,p.prev,c)>=0:Fl(p,c,p.prev)<0||Fl(p,p.next,c)<0}function Uve(p,c){const h=Ioe(p.i,p.x,p.y),x=Ioe(c.i,c.x,c.y),_=p.next,C=c.prev;return p.next=c,c.prev=p,h.next=_,_.prev=h,x.next=h,h.prev=x,C.next=x,x.prev=C,x}function qve(p,c,h,x){const _=Ioe(p,c,h);return x?(_.next=x.next,_.prev=x,x.next.prev=_,x.next=_):(_.prev=_,_.next=_),_}function jM(p){p.next.prev=p.prev,p.prev.next=p.next,p.prevZ&&(p.prevZ.nextZ=p.nextZ),p.nextZ&&(p.nextZ.prevZ=p.prevZ)}function Ioe(p,c,h){return{i:p,x:c,y:h,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function kM(p,c){const h=p.length;if(h<=1)return[p];const x=[];let _,C;for(let T=0;T1)for(let T=0;T=Rr&&h>=Rr}static evaluate(c){if(c.length===0)return new Ox;let h=[];for(const z of c)h.push(...z.portals);if(h.length===0)return new Ox;for(const z of h){const q=z.va,K=z.vb;(Ox.isOnBorder(q.x,K.x)||Ox.isOnBorder(q.y,K.y))&&(z.type="border")}const x=h.filter(z=>z.type!=="unevaluated"),_=h.filter(z=>z.type==="unevaluated");if(_.length===0)return new Ox;_.sort((z,q)=>z.hash===q.hash?z.isTunnel===q.isTunnel?0:z.isTunnel?-1:1:z.hashz.hashC!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new tm(h,{zoom:x,lut:_},C=>C!=="fill-bridge-guard-rail-color")}addVertices(c,h){const x=this.unevalVertices.length;for(let _=0;_=C.min.x&&Y.x<=C.max.x&&Y.y>=C.min.y&&Y.y<=C.max.y||ee.x>=C.min.x&&ee.x<=C.max.x&&ee.y>=C.min.y&&ee.y<=C.max.y||_c(Y,ee,L))||this.isOnBorder(Y.x,ee.x)||this.isOnBorder(Y.y,ee.y))continue;const re=qu.computeEdgeHash(this.unevalVertices[q],this.unevalVertices[K]);let ie,ge=this.vertexHashLookup.get(qu.computePosHash(Y));ge!=null?ie=ge.next:(ge=this.vertexHashLookup.get(qu.computePosHash(ee)),ie=ge!=null?ge.prev:re),this.unevalEdges.push({polygonIdx:c,a:q,b:K,hash:re,portalHash:ie,isTunnel:_,type:"unevaluated",featureInfo:T})}}addPortalCandidates(c,h,x,_,C){if(h.length===0)return;this.portalPolygons.add(c,{geometry:h,zLevel:C});const T=h[0];this.vertexHashLookup.clear();let L=qu.computeEdgeHash(T[T.length-2],T[T.length-1]);for(let z=0;z({vertexOffset:0,primitiveOffset:this.indexArray.length}),x=ee=>{ee.primitiveLength=this.indexArray.length-ee.primitiveOffset},_=new VHe(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(c.portals,this.unevalEdges);const C=h(),T=h(),L=h(),z=(ee,re)=>{ee.sort((ge,Ce)=>ge.type===re&&Ce.type!==re?-1:ge.type!==re&&Ce.type===re?1:0);const ie=ee.findIndex(ge=>ge.type!==re);return ie>=0?ie:ee.length};let q=0;this.unevalEdges.length>0&&(q=z(this.unevalEdges,"none"),this.constructBridgeStructures(_,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:q},this.tileToMeters)),x(L);const K=h(),Y=h();if(this.unevalEdges.length>0){const ee=this.unevalEdges.splice(q),re=z(ee,"tunnel")+q;this.unevalEdges.push(...ee),this.constructTunnelStructures(_,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:q},{min:q,max:re})}x(K),_.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),x(Y),_.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),x(T),_.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),x(C),this.maskSegments=Yi.simpleSegment(0,Y.primitiveOffset,0,Y.primitiveLength),this.depthSegments=Yi.simpleSegment(0,T.primitiveOffset,0,T.primitiveLength),this.renderableBridgeSegments=Yi.simpleSegment(0,L.primitiveOffset,0,L.primitiveLength),this.renderableTunnelSegments=Yi.simpleSegment(0,K.primitiveOffset,0,K.primitiveLength),this.shadowCasterSegments=Yi.simpleSegment(0,C.primitiveOffset,0,C.primitiveLength)}update(c,h,x,_,C,T,L,z){this.bridgeProgramConfigurations.updatePaintArrays(c,h,C,x,_,T,L,z),this.tunnelProgramConfigurations.updatePaintArrays(c,h,C,x,_,T,L,z)}upload(c){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=c.createVertexBuffer(this.vertexPositions,IHe.members),this.vertexBufferNormal=c.createVertexBuffer(this.vertexNormals,PHe.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,x,_,C){const T=(L,z)=>{for(let q=0;qde(wr,h[kr].x,h[kr].y,x[kr]*z),Y=le(),ee=le(),re=le(),ie=le(),ge=le(),Ce=(wr,kr)=>{const xr=L.get(qu.computePosHash(h[kr])),_r=xr.from,ir=xr.to;if(!_r||!ir)return;K(Y,_r),K(ee,kr),K(re,ir),Ge(ie),rt(Y,ee)||(je(ge,ee,Y),Ie(ie,ge)),rt(re,ee)||(je(ge,re,ee),ue(ie,ie,Ie(ge,ge)));const sr=Me(ie);return sr>0?ve(wr,ie,1/sr):void 0};let Ne=Number.POSITIVE_INFINITY;this.sortSubarray(_,C.min,C.max,(wr,kr)=>wr.featureInfo.featureIndex-kr.featureInfo.featureIndex);const Fe=le(),Be=le(),Ze=le(),yt=le(),ht=le(),jt=le(),Et=le(),Dt=le(),tr=le(),$t=[le(),le(),le(),le()],or=[le(),le(),le(),le()],mr=[{coord:new dr(0,0),height:0},{coord:new dr(0,0),height:0}],pr=(wr,kr)=>wr>kr;for(let wr=C.min;wrNe.featureInfo.featureIndex-Fe.featureInfo.featureIndex;this.sortSubarray(_,C.min,C.max,z),this.sortSubarray(_,T.min,T.max,z);const q=Ne=>Ie(Ne,Ne),K=[{coord:new dr(0,0),height:0},{coord:new dr(0,0),height:0}],Y=(Ne,Fe)=>NeL.hash===z.hash?z.polygonIdx-L.polygonIdx:z.hash>L.hash?1:-1);let x=0,_=0,C=0,T=h[x].polygonIdx;do _++,(_===h.length||h[x].hash!==h[_].hash)&&((_-x==1||h[_-1].polygonIdx!==T)&&(Cq.portalHashK.hash?L++:K.hash>q.portalHash?z++:(q.type=K.type,L++)}}}isOnBorder(c,h){return c<=0&&h<=0||c>=Rr&&h>=Rr}addFeatureSection(c,h,x,_){return c!==h&&(h=c,x.push({featureIndex:c,vertexStart:_.getVertexCount()}),_.clearVertexLookup()),h}sortSubarray(c,h,x,_){const C=c.slice(h,x);C.sort(_),c.splice(h,C.length,...C)}static computeEdgeHash(c,h){return(c.y===h.y&&c.x>h.x||c.y>h.y)&&([c,h]=[h,c]),BigInt(qu.computePosHash(c))<<32n|BigInt(qu.computePosHash(h))}static computePosHash(c){return((65535&c.x)<<16|65535&c.y)>>>0}}var Wve,Gve={exports:{}},Kve=(Wve||(Wve=1,function(p){function c(pt,vt){return pt>vt?1:pt0){var Cs=jr+Math.floor(Yr/2),Es={key:vt[Cs],data:lr[Cs],parent:pt};return Es.left=_(Es,vt,lr,jr,Cs),Es.right=_(Es,vt,lr,Cs+1,Zr),Es}return null}function C(pt,vt,lr,jr,Zr){if(!(lr>=jr)){for(var Yr=pt[lr+jr>>1],Cs=lr-1,Es=jr+1;;){do Cs++;while(Zr(pt[Cs],Yr)<0);do Es--;while(Zr(pt[Es],Yr)>0);if(Cs>=Es)break;var gn=pt[Cs];pt[Cs]=pt[Es],pt[Es]=gn,gn=vt[Cs],vt[Cs]=vt[Es],vt[Es]=gn}C(pt,vt,lr,Es,Zr),C(pt,vt,Es+1,jr,Zr)}}h.prototype.rotateLeft=function(pt){var vt=pt.right;vt&&(pt.right=vt.left,vt.left&&(vt.left.parent=pt),vt.parent=pt.parent),pt.parent?pt===pt.parent.left?pt.parent.left=vt:pt.parent.right=vt:this._root=vt,vt&&(vt.left=pt),pt.parent=vt},h.prototype.rotateRight=function(pt){var vt=pt.left;vt&&(pt.left=vt.right,vt.right&&(vt.right.parent=pt),vt.parent=pt.parent),pt.parent?pt===pt.parent.left?pt.parent.left=vt:pt.parent.right=vt:this._root=vt,vt&&(vt.right=pt),pt.parent=vt},h.prototype._splay=function(pt){for(;pt.parent;){var vt=pt.parent;vt.parent?vt.left===pt&&vt.parent.left===vt?(this.rotateRight(vt.parent),this.rotateRight(vt)):vt.right===pt&&vt.parent.right===vt?(this.rotateLeft(vt.parent),this.rotateLeft(vt)):vt.left===pt&&vt.parent.right===vt?(this.rotateRight(vt),this.rotateLeft(vt)):(this.rotateLeft(vt),this.rotateRight(vt)):vt.left===pt?this.rotateRight(vt):this.rotateLeft(vt)}},h.prototype.splay=function(pt){for(var vt,lr,jr,Zr,Yr;pt.parent;)(lr=(vt=pt.parent).parent)&&lr.parent?((jr=lr.parent).left===lr?jr.left=pt:jr.right=pt,pt.parent=jr):(pt.parent=null,this._root=pt),Zr=pt.left,Yr=pt.right,pt===vt.left?(lr&&(lr.left===vt?(vt.right?(lr.left=vt.right,lr.left.parent=lr):lr.left=null,vt.right=lr,lr.parent=vt):(Zr?(lr.right=Zr,Zr.parent=lr):lr.right=null,pt.left=lr,lr.parent=pt)),Yr?(vt.left=Yr,Yr.parent=vt):vt.left=null,pt.right=vt,vt.parent=pt):(lr&&(lr.right===vt?(vt.left?(lr.right=vt.left,lr.right.parent=lr):lr.right=null,vt.left=lr,lr.parent=vt):(Yr?(lr.left=Yr,Yr.parent=lr):lr.left=null,pt.right=lr,lr.parent=pt)),Zr?(vt.right=Zr,Zr.parent=vt):vt.right=null,pt.left=vt,vt.parent=pt)},h.prototype.replace=function(pt,vt){pt.parent?pt===pt.parent.left?pt.parent.left=vt:pt.parent.right=vt:this._root=vt,vt&&(vt.parent=pt.parent)},h.prototype.minNode=function(pt){if(pt===void 0&&(pt=this._root),pt)for(;pt.left;)pt=pt.left;return pt},h.prototype.maxNode=function(pt){if(pt===void 0&&(pt=this._root),pt)for(;pt.right;)pt=pt.right;return pt},h.prototype.insert=function(pt,vt){var lr=this._root,jr=null,Zr=this._compare;if(this._noDuplicates)for(;lr;){if(jr=lr,Zr(lr.key,pt)===0)return;lr=Zr(lr.key,pt)<0?lr.right:lr.left}else for(;lr;)jr=lr,lr=Zr(lr.key,pt)<0?lr.right:lr.left;return lr={key:pt,data:vt,left:null,right:null,parent:jr},jr?Zr(jr.key,lr.key)<0?jr.right=lr:jr.left=lr:this._root=lr,this.splay(lr),this._size++,lr},h.prototype.find=function(pt){for(var vt=this._root,lr=this._compare;vt;){var jr=lr(vt.key,pt);if(jr<0)vt=vt.right;else{if(!(jr>0))return vt;vt=vt.left}}return null},h.prototype.contains=function(pt){for(var vt=this._root,lr=this._compare;vt;){var jr=lr(pt,vt.key);if(jr===0)return!0;vt=jr<0?vt.left:vt.right}return!1},h.prototype.remove=function(pt){var vt=this.find(pt);if(!vt)return!1;if(this.splay(vt),vt.left)if(vt.right){var lr=this.minNode(vt.right);lr.parent!==vt&&(this.replace(lr,lr.right),lr.right=vt.right,lr.right.parent=lr),this.replace(vt,lr),lr.left=vt.left,lr.left.parent=lr}else this.replace(vt,vt.left);else this.replace(vt,vt.right);return this._size--,!0},h.prototype.removeNode=function(pt){if(!pt)return!1;if(this.splay(pt),pt.left)if(pt.right){var vt=this.minNode(pt.right);vt.parent!==pt&&(this.replace(vt,vt.right),vt.right=pt.right,vt.right.parent=vt),this.replace(pt,vt),vt.left=pt.left,vt.left.parent=vt}else this.replace(pt,pt.left);else this.replace(pt,pt.right);return this._size--,!0},h.prototype.erase=function(pt){var vt=this.find(pt);if(vt){this.splay(vt);var lr=vt.left,jr=vt.right,Zr=null;lr&&(lr.parent=null,Zr=this.maxNode(lr),this.splay(Zr),this._root=Zr),jr&&(lr?Zr.right=jr:this._root=jr,jr.parent=Zr),this._size--}},h.prototype.pop=function(){var pt=this._root,vt=null;if(pt){for(;pt.left;)pt=pt.left;vt={key:pt.key,data:pt.data},this.remove(pt.key)}return vt},h.prototype.next=function(pt){var vt=pt;if(vt)if(vt.right)for(vt=vt.right;vt&&vt.left;)vt=vt.left;else for(vt=pt.parent;vt&&vt.right===pt;)pt=vt,vt=vt.parent;return vt},h.prototype.prev=function(pt){var vt=pt;if(vt)if(vt.left)for(vt=vt.left;vt&&vt.right;)vt=vt.right;else for(vt=pt.parent;vt&&vt.left===pt;)pt=vt,vt=vt.parent;return vt},h.prototype.forEach=function(pt){for(var vt=this._root,lr=[],jr=!1,Zr=0;!jr;)vt?(lr.push(vt),vt=vt.left):lr.length>0?(pt(vt=lr.pop(),Zr++),vt=vt.right):jr=!0;return this},h.prototype.range=function(pt,vt,lr,jr){for(var Zr=[],Yr=this._compare,Cs=this._root;Zr.length!==0||Cs;)if(Cs)Zr.push(Cs),Cs=Cs.left;else{if(Yr((Cs=Zr.pop()).key,vt)>0)break;if(Yr(Cs.key,pt)>=0&&lr.call(jr,Cs))return this;Cs=Cs.right}return this},h.prototype.keys=function(){for(var pt=this._root,vt=[],lr=[],jr=!1;!jr;)pt?(vt.push(pt),pt=pt.left):vt.length>0?(pt=vt.pop(),lr.push(pt.key),pt=pt.right):jr=!0;return lr},h.prototype.values=function(){for(var pt=this._root,vt=[],lr=[],jr=!1;!jr;)pt?(vt.push(pt),pt=pt.left):vt.length>0?(pt=vt.pop(),lr.push(pt.data),pt=pt.right):jr=!0;return lr},h.prototype.at=function(pt){for(var vt=this._root,lr=[],jr=!1,Zr=0;!jr;)if(vt)lr.push(vt),vt=vt.left;else if(lr.length>0){if(vt=lr.pop(),Zr===pt)return vt;Zr++,vt=vt.right}else jr=!0;return null},h.prototype.load=function(pt,vt,lr){if(pt===void 0&&(pt=[]),vt===void 0&&(vt=[]),lr===void 0&&(lr=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var jr=pt.length;return lr&&C(pt,vt,0,jr-1,this._compare),this._root=_(null,pt,vt,0,jr),this._size=jr,this},h.prototype.min=function(){var pt=this.minNode(this._root);return pt?pt.key:null},h.prototype.max=function(){var pt=this.maxNode(this._root);return pt?pt.key:null},h.prototype.isEmpty=function(){return this._root===null},x.size.get=function(){return this._size},h.createTree=function(pt,vt,lr,jr,Zr){return new h(lr,Zr).load(pt,vt,jr)},Object.defineProperties(h.prototype,x);var T=0,L=1,z=2,q=3,K=0,Y=1,ee=2,re=3;function ie(pt,vt,lr){vt===null?(pt.inOut=!1,pt.otherInOut=!0):(pt.isSubject===vt.isSubject?(pt.inOut=!vt.inOut,pt.otherInOut=vt.otherInOut):(pt.inOut=!vt.otherInOut,pt.otherInOut=vt.isVertical()?!vt.inOut:vt.inOut),vt&&(pt.prevInResult=!ge(vt,lr)||vt.isVertical()?vt.prevInResult:vt));var jr=ge(pt,lr);pt.resultTransition=jr?function(Zr,Yr){var Cs,Es=!Zr.inOut,gn=!Zr.otherInOut;switch(Yr){case K:Cs=Es&&gn;break;case Y:Cs=Es||gn;break;case re:Cs=Es^gn;break;case ee:Cs=Zr.isSubject?Es&&!gn:gn&&!Es}return Cs?1:-1}(pt,lr):0}function ge(pt,vt){switch(pt.type){case T:switch(vt){case K:return!pt.otherInOut;case Y:return pt.otherInOut;case ee:return pt.isSubject&&pt.otherInOut||!pt.isSubject&&!pt.otherInOut;case re:return!0}break;case z:return vt===K||vt===Y;case q:return vt===ee;case L:return!1}return!1}var Ce=function(pt,vt,lr,jr,Zr){this.left=vt,this.point=pt,this.otherEvent=lr,this.isSubject=jr,this.type=Zr||T,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(pt,vt){return pt[0]===vt[0]&&pt[1]===vt[1]}Ce.prototype.isBelow=function(pt){var vt=this.point,lr=this.otherEvent.point;return this.left?(vt[0]-pt[0])*(lr[1]-pt[1])-(lr[0]-pt[0])*(vt[1]-pt[1])>0:(lr[0]-pt[0])*(vt[1]-pt[1])-(vt[0]-pt[0])*(lr[1]-pt[1])>0},Ce.prototype.isAbove=function(pt){return!this.isBelow(pt)},Ce.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},Ne.inResult.get=function(){return this.resultTransition!==0},Ce.prototype.clone=function(){var pt=new Ce(this.point,this.left,this.otherEvent,this.isSubject,this.type);return pt.contourId=this.contourId,pt.resultTransition=this.resultTransition,pt.prevInResult=this.prevInResult,pt.isExteriorRing=this.isExteriorRing,pt.inOut=this.inOut,pt.otherInOut=this.otherInOut,pt},Object.defineProperties(Ce.prototype,Ne);var Be=11102230246251565e-32,Ze=134217729,yt=(3+8*Be)*Be;function ht(pt,vt,lr,jr,Zr){var Yr,Cs,Es,gn,kn=vt[0],Tn=jr[0],Zn=0,Bs=0;Tn>kn==Tn>-kn?(Yr=kn,kn=vt[++Zn]):(Yr=Tn,Tn=jr[++Bs]);var Qs=0;if(Znkn==Tn>-kn?(Es=Yr-((Cs=kn+Yr)-kn),kn=vt[++Zn]):(Es=Yr-((Cs=Tn+Yr)-Tn),Tn=jr[++Bs]),Yr=Cs,Es!==0&&(Zr[Qs++]=Es);Znkn==Tn>-kn?(Es=Yr-((Cs=Yr+kn)-(gn=Cs-Yr))+(kn-gn),kn=vt[++Zn]):(Es=Yr-((Cs=Yr+Tn)-(gn=Cs-Yr))+(Tn-gn),Tn=jr[++Bs]),Yr=Cs,Es!==0&&(Zr[Qs++]=Es);for(;Zn0!=Zn>0)return Bs;var Qs=Math.abs(Tn+Zn);return Math.abs(Bs)>=Et*Qs?Bs:-function(xa,wa,ja,qa,ai,Qa,Aa){var Da,Nn,ia,Ui,Fs,Yn,ti,di,xi,No,mi,zs,Ji,Va,Pi,sl,Nl,Vo,Ho=xa-ai,pl=ja-ai,Qd=wa-Qa,pi=qa-Qa;$t[0]=(Pi=(di=Ho-(ti=(Yn=Ze*Ho)-(Yn-Ho)))*(No=pi-(xi=(Yn=Ze*pi)-(Yn-pi)))-((Va=Ho*pi)-ti*xi-di*xi-ti*No))-((mi=Pi-(Nl=(di=Qd-(ti=(Yn=Ze*Qd)-(Yn-Qd)))*(No=pl-(xi=(Yn=Ze*pl)-(Yn-pl)))-((sl=Qd*pl)-ti*xi-di*xi-ti*No)))+(Fs=Pi-mi))+(Fs-Nl),$t[1]=(Ji=Va-((zs=Va+mi)-(Fs=zs-Va))+(mi-Fs))-((mi=Ji-sl)+(Fs=Ji-mi))+(Fs-sl),$t[2]=zs-((Vo=zs+mi)-(Fs=Vo-zs))+(mi-Fs),$t[3]=Vo;var _o=function(wg,bc){for(var Ed=bc[0],Hu=1;Hu<4;Hu++)Ed+=bc[Hu];return Ed}(0,$t),So=Dt*Aa;if(_o>=So||-_o>=So||(Da=xa-(Ho+(Fs=xa-Ho))+(Fs-ai),ia=ja-(pl+(Fs=ja-pl))+(Fs-ai),Nn=wa-(Qd+(Fs=wa-Qd))+(Fs-Qa),Ui=qa-(pi+(Fs=qa-pi))+(Fs-Qa),Da===0&&Nn===0&&ia===0&&Ui===0)||(So=tr*Aa+yt*Math.abs(_o),(_o+=Ho*Ui+pi*Da-(Qd*ia+pl*Nn))>=So||-_o>=So))return _o;wr[0]=(Pi=(di=Da-(ti=(Yn=Ze*Da)-(Yn-Da)))*(No=pi-(xi=(Yn=Ze*pi)-(Yn-pi)))-((Va=Da*pi)-ti*xi-di*xi-ti*No))-((mi=Pi-(Nl=(di=Nn-(ti=(Yn=Ze*Nn)-(Yn-Nn)))*(No=pl-(xi=(Yn=Ze*pl)-(Yn-pl)))-((sl=Nn*pl)-ti*xi-di*xi-ti*No)))+(Fs=Pi-mi))+(Fs-Nl),wr[1]=(Ji=Va-((zs=Va+mi)-(Fs=zs-Va))+(mi-Fs))-((mi=Ji-sl)+(Fs=Ji-mi))+(Fs-sl),wr[2]=zs-((Vo=zs+mi)-(Fs=Vo-zs))+(mi-Fs),wr[3]=Vo;var mu=ht(4,$t,4,wr,or);wr[0]=(Pi=(di=Ho-(ti=(Yn=Ze*Ho)-(Yn-Ho)))*(No=Ui-(xi=(Yn=Ze*Ui)-(Yn-Ui)))-((Va=Ho*Ui)-ti*xi-di*xi-ti*No))-((mi=Pi-(Nl=(di=Qd-(ti=(Yn=Ze*Qd)-(Yn-Qd)))*(No=ia-(xi=(Yn=Ze*ia)-(Yn-ia)))-((sl=Qd*ia)-ti*xi-di*xi-ti*No)))+(Fs=Pi-mi))+(Fs-Nl),wr[1]=(Ji=Va-((zs=Va+mi)-(Fs=zs-Va))+(mi-Fs))-((mi=Ji-sl)+(Fs=Ji-mi))+(Fs-sl),wr[2]=zs-((Vo=zs+mi)-(Fs=Vo-zs))+(mi-Fs),wr[3]=Vo;var nl=ht(mu,or,4,wr,mr);wr[0]=(Pi=(di=Da-(ti=(Yn=Ze*Da)-(Yn-Da)))*(No=Ui-(xi=(Yn=Ze*Ui)-(Yn-Ui)))-((Va=Da*Ui)-ti*xi-di*xi-ti*No))-((mi=Pi-(Nl=(di=Nn-(ti=(Yn=Ze*Nn)-(Yn-Nn)))*(No=ia-(xi=(Yn=Ze*ia)-(Yn-ia)))-((sl=Nn*ia)-ti*xi-di*xi-ti*No)))+(Fs=Pi-mi))+(Fs-Nl),wr[1]=(Ji=Va-((zs=Va+mi)-(Fs=zs-Va))+(mi-Fs))-((mi=Ji-sl)+(Fs=Ji-mi))+(Fs-sl),wr[2]=zs-((Vo=zs+mi)-(Fs=Vo-zs))+(mi-Fs),wr[3]=Vo;var Zm=ht(nl,mr,4,wr,pr);return pr[Zm-1]}(Zr,Yr,Cs,Es,gn,kn,Qs)}(pt[0],pt[1],vt[0],vt[1],lr[0],lr[1]);return jr>0?-1:jr<0?1:0}function xr(pt,vt){var lr=pt.point,jr=vt.point;return lr[0]>jr[0]?1:lr[0]jr[1]?1:-1:function(Zr,Yr,Cs,Es){return Zr.left!==Yr.left?Zr.left?1:-1:kr(Cs,Zr.otherEvent.point,Yr.otherEvent.point)!==0?Zr.isBelow(Yr.otherEvent.point)?-1:1:!Zr.isSubject&&Yr.isSubject?1:-1}(pt,vt,lr)}function _r(pt,vt,lr){var jr=new Ce(vt,!1,pt,pt.isSubject),Zr=new Ce(vt,!0,pt.otherEvent,pt.isSubject);return Fe(pt.point,pt.otherEvent.point)&&console.warn("what is that, a collapsed segment?",pt),jr.contourId=Zr.contourId=pt.contourId,xr(Zr,pt.otherEvent)>0&&(pt.otherEvent.left=!0,Zr.left=!1),pt.otherEvent.otherEvent=Zr,pt.otherEvent=jr,lr.push(Zr),lr.push(jr),lr}function ir(pt,vt){return pt[0]*vt[1]-pt[1]*vt[0]}function sr(pt,vt){return pt[0]*vt[0]+pt[1]*vt[1]}function br(pt,vt,lr){var jr=function(gn,kn,Tn,Zn,Bs){var Qs=[kn[0]-gn[0],kn[1]-gn[1]],xa=[Zn[0]-Tn[0],Zn[1]-Tn[1]];function wa(Yn,ti,di){return[Yn[0]+ti*di[0],Yn[1]+ti*di[1]]}var ja=[Tn[0]-gn[0],Tn[1]-gn[1]],qa=ir(Qs,xa),ai=qa*qa,Qa=sr(Qs,Qs);if(ai>0){var Aa=ir(ja,xa)/qa;if(Aa<0||Aa>1)return null;var Da=ir(ja,Qs)/qa;return Da<0||Da>1?null:Aa===0||Aa===1?[wa(gn,Aa,Qs)]:Da===0||Da===1?[wa(Tn,Da,xa)]:[wa(gn,Aa,Qs)]}if((ai=(qa=ir(ja,Qs))*qa)>0)return null;var Nn=sr(Qs,ja)/Qa,ia=Nn+sr(Qs,xa)/Qa,Ui=Math.min(Nn,ia),Fs=Math.max(Nn,ia);return Ui<=1&&Fs>=0?Ui===1?[wa(gn,Ui>0?Ui:0,Qs)]:Fs===0?[wa(gn,Fs<1?Fs:1,Qs)]:[wa(gn,Ui>0?Ui:0,Qs),wa(gn,Fs<1?Fs:1,Qs)]:null}(pt.point,pt.otherEvent.point,vt.point,vt.otherEvent.point),Zr=jr?jr.length:0;if(Zr===0||Zr===1&&(Fe(pt.point,vt.point)||Fe(pt.otherEvent.point,vt.otherEvent.point))||Zr===2&&pt.isSubject===vt.isSubject)return 0;if(Zr===1)return Fe(pt.point,jr[0])||Fe(pt.otherEvent.point,jr[0])||_r(pt,jr[0],lr),Fe(vt.point,jr[0])||Fe(vt.otherEvent.point,jr[0])||_r(vt,jr[0],lr),1;var Yr=[],Cs=!1,Es=!1;return Fe(pt.point,vt.point)?Cs=!0:xr(pt,vt)===1?Yr.push(vt,pt):Yr.push(pt,vt),Fe(pt.otherEvent.point,vt.otherEvent.point)?Es=!0:xr(pt.otherEvent,vt.otherEvent)===1?Yr.push(vt.otherEvent,pt.otherEvent):Yr.push(pt.otherEvent,vt.otherEvent),Cs&&Es||Cs?(vt.type=L,pt.type=vt.inOut===pt.inOut?z:q,Cs&&!Es&&_r(Yr[1].otherEvent,Yr[0].point,lr),2):Es?(_r(Yr[0],Yr[1].point,lr),3):Yr[0]!==Yr[3].otherEvent?(_r(Yr[0],Yr[1].point,lr),_r(Yr[1],Yr[2].point,lr),3):(_r(Yr[0],Yr[1].point,lr),_r(Yr[3].otherEvent,Yr[2].point,lr),3)}function zr(pt,vt){if(pt===vt)return 0;if(kr(pt.point,pt.otherEvent.point,vt.point)!==0||kr(pt.point,pt.otherEvent.point,vt.otherEvent.point)!==0)return Fe(pt.point,vt.point)?pt.isBelow(vt.otherEvent.point)?-1:1:pt.point[0]===vt.point[0]?pt.point[1]vt.contourId?1:-1:xr(pt,vt)===1?1:-1}var Ar=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function Ns(pt,vt,lr,jr){var Zr,Yr=pt+1,Cs=vt[pt].point,Es=vt.length;for(Yrjr;)Yr--;return Yr}Ar.prototype.isExterior=function(){return this.holeOf==null};var Jr=xs,as=xs;function xs(pt,vt){if(!(this instanceof xs))return new xs(pt,vt);if(this.data=pt||[],this.length=this.data.length,this.compare=vt||In,this.length>0)for(var lr=(this.length>>1)-1;lr>=0;lr--)this._down(lr)}function In(pt,vt){return ptvt?1:0}xs.prototype={push:function(pt){this.data.push(pt),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var pt=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),pt}},peek:function(){return this.data[0]},_up:function(pt){for(var vt=this.data,lr=this.compare,jr=vt[pt];pt>0;){var Zr=pt-1>>1,Yr=vt[Zr];if(lr(jr,Yr)>=0)break;vt[pt]=Yr,pt=Zr}vt[pt]=jr},_down:function(pt){for(var vt=this.data,lr=this.compare,jr=this.length>>1,Zr=vt[pt];pt=0)break;vt[pt]=Es,pt=Yr}vt[pt]=Zr}},Jr.default=as;var Er=Math.max,ys=Math.min,tn=0;function ra(pt,vt,lr,jr,Zr,Yr){var Cs,Es,gn,kn,Tn,Zn;for(Cs=0,Es=pt.length-1;Cs0?Zn.left=!0:Tn.left=!0;var Bs=gn[0],Qs=gn[1];Zr[0]=ys(Zr[0],Bs),Zr[1]=ys(Zr[1],Qs),Zr[2]=Er(Zr[2],Bs),Zr[3]=Er(Zr[3],Qs),jr.push(Tn),jr.push(Zn)}}var oa=[];function _n(pt,vt,lr){typeof pt[0][0][0]=="number"&&(pt=[pt]),typeof vt[0][0][0]=="number"&&(vt=[vt]);var jr=function(Qs,xa,wa){var ja=null;return Qs.length*xa.length==0&&(wa===K?ja=oa:wa===ee?ja=Qs:wa!==Y&&wa!==re||(ja=Qs.length===0?xa:Qs)),ja}(pt,vt,lr);if(jr)return jr===oa?null:jr;var Zr=[1/0,1/0,-1/0,-1/0],Yr=[1/0,1/0,-1/0,-1/0],Cs=function(Qs,xa,wa,ja,qa){var ai,Qa,Aa,Da,Nn,ia,Ui=new Jr(null,xr);for(Aa=0,Da=Qs.length;Aaja[2]||ja[0]>wa[2]||wa[1]>ja[3]||ja[1]>wa[3])&&(qa===K?ai=oa:qa===ee?ai=Qs:qa!==Y&&qa!==re||(ai=Qs.concat(xa))),ai}(pt,vt,Zr,Yr,lr))return jr===oa?null:jr;for(var Es=function(Qs){var xa,wa,ja=function(Aa){var Da,Nn,ia,Ui,Fs=[];for(Nn=0,ia=Aa.length;Nn0){var mi=Yn[No];if(mi.holeOf!=null){var zs=mi.holeOf;Yn[zs].holeIds.push(ti),di.holeOf=zs,di.depth=Yn[No].depth}else Yn[No].holeIds.push(ti),di.holeOf=No,di.depth=Yn[No].depth+1}else di.holeOf=null,di.depth=Yn[No].depth}else di.holeOf=null,di.depth=0;return di}(ja[xa],ai,Aa),Nn=function(Fs){qa[Fs]=!0,Fs=ja.length)&&ja[ia];);ai.push(Da)}};for(xa=0,wa=ja.length;xaUi||ai===ee&&Fs.point[0]>ja[2])break;if(Fs.left){Aa=Qa=Nn.insert(Fs),Qa=Qa!==(Da=Nn.minNode())?Nn.prev(Qa):null,Aa=Nn.next(Aa);var Yn=Qa?Qa.key:null;if(ie(Fs,Yn,ai),Aa&&br(Fs,Aa.key,Qs)===2&&(ie(Fs,Yn,ai),ie(Aa.key,Fs,ai)),Qa&&br(Qa.key,Fs,Qs)===2){var ti=Qa;ie(Yn,(ti=ti!==Da?Nn.prev(ti):null)?ti.key:null,ai),ie(Fs,Yn,ai)}}else Aa=Qa=Nn.find(Fs=Fs.otherEvent),Qa&&Aa&&(Qa=Qa!==Da?Nn.prev(Qa):null,Aa=Nn.next(Aa),Nn.remove(Fs),Aa&&Qa&&br(Qa.key,Aa.key,Qs))}return ia}(Cs,0,0,Zr,Yr,lr)),gn=[],kn=0;kn * @license MIT * @preserve */function Y6(p,c,h,x){const _=[],C=x===0?(T,L,z,q,K,Y)=>{T.push(new dr(Y,z+(Y-L)/(q-L)*(K-z)))}:(T,L,z,q,K,Y)=>{T.push(new dr(L+(Y-z)/(K-z)*(q-L),Y))};for(const T of p){const L=[];for(const z of T){if(z.length<=2)continue;const q=[];for(let ee=0;eec&&C(q,re,ie,ge,Ce,c):Ne>h?Fe=c&&C(q,re,ie,ge,Ce,c),Fe>h&&Ne<=h&&C(q,re,ie,ge,Ce,h)}let K=z[z.length-1];const Y=x===0?K.x:K.y;Y>=c&&Y<=h&&q.push(K),q.length&&(K=q[q.length-1],q[0].x===K.x&&q[0].y===K.y||q.push(q[0]),L.push(q))}L.length&&_.push(L)}return _}function HHe(p,c){const h=Ooe(p),x=Ooe([c]),_=Kve.intersection(h,x);return _==null?[]:Zve(_)}function WHe(p,c){let x=Ooe(p,65536);const _=[];for(;c.valid();c.next()){const[C,T]=c.get(),L=C.x*65536,z=C.y*65536,q=T.x*65536,K=T.y*65536,Y=q-L,ee=K-z,re=Math.hypot(Y,ee);if(re===0)continue;const ie=Math.trunc(ee/re*3),ge=-Math.trunc(Y/re*3);_.push([[[L,z],[q,K],[q+ie,K+ge],[L+ie,z+ge],[L,z]]])}return _.length>0&&(x=Kve.diff(x,_)),Zve(x,1/65536)}function Ooe(p,c=1){return[p.map(h=>h.map(x=>[x.x*c,x.y*c]))]}function Zve(p,c=1){return p.map(h=>h.map((x,_)=>{const C=x.map(T=>new dr(T[0]*c,T[1]*c).round());return _>0&&C.reverse(),C}))}class Doe{constructor(c,h){this.layoutVertexArray=new fg,this.indexArray=new el,this.lineIndexArray=new $u,this.triangleSegments=new Yi,this.lineSegments=new Yi,this.programConfigurations=new tm(c.layers,{zoom:c.zoom,lut:c.lut}),this.uploaded=!1,h&&(this.elevatedLayoutVertexArray=new Wp)}update(c,h,x,_,C,T,L,z){this.programConfigurations.updatePaintArrays(c,h,C,x,_,T,L,z)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(c){this.uploaded||(this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,AHe.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,EHe.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,x,_,C,T,L){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,h,x,_,C,T,void 0,L)}}class Roe{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 Doe(c,!1),this.elevationBufferData=new Doe(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,x,_){}populate(c,h,x,_){this.hasPattern=Poe("fill",this.layers,this.pixelRatio,h);const C=this.layers[0].layout.get("fill-sort-key"),T=[];for(const{feature:L,id:z,index:q,sourceLayerIndex:K}of c){const Y=this.layers[0]._featureFilter.needGeometry,ee=Bt(L,Y);if(!this.layers[0]._featureFilter.filter(new gi(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),ee,x))continue;const re=C?C.evaluate(ee,{},x,h.availableImages):void 0,ie={id:z,properties:L.properties,type:L.type,sourceLayerIndex:K,index:q,geometry:Y?ee.geometry:Tt(L,x,_),patterns:{},sortKey:re};T.push(ie)}C&&T.sort((L,z)=>L.sortKey-z.sortKey);for(const L of T){const{geometry:z,index:q,sourceLayerIndex:K}=L;if(this.hasPattern){const Y=Loe("fill",this.layers,L,this.zoom,this.pixelRatio,h);this.patternFeatures.push(Y)}else this.addFeature(L,z,q,x,{},h.availableImages,h.brightness,h.elevationFeatures);h.featureIndex.insert(c[q].feature,z,q,K,this.index)}}update(c,h,x,_,C,T,L){this.bufferData.update(c,h,x,_,C,T,L,this.worldview),this.elevationBufferData.update(c,h,x,_,C,T,L,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(c,h,x,_,C,T,L,this.worldview)}addFeatures(c,h,x,_,C,T){for(const L of this.patternFeatures)this.addFeature(L,L.geometry,L.index,h,x,_,T,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,x,_,C,T=[],L,z){const q=kM(h,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(c,q,_,x,z):this.addGeometry(q,this.bufferData),this.bufferData.populatePaintArrays(c,x,C,T,_,L,this.worldview),this.elevationBufferData.populatePaintArrays(c,x,C,T,_,L,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(c,h,x,_,C){this.elevatedStructures&&(this.elevatedStructures.construct(c),this.elevatedStructures.populatePaintArrays(h,x,_,C,this.worldview))}addElevatedRoadFeature(c,h,x,_,C){const T=new Array,L=La.getElevationFeature(c,C);if(!L)return void this.addGeometry(h,this.bufferData);{const q=this.clipPolygonsToTile(h,1);q.length>0&&T.push({polygons:q,elevationFeature:L,elevationTileID:x})}const z={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(c,{},x),featureIndex:_};for(const q of T)if(q.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new qu(q.elevationTileID,this.layers,this.zoom,this.lut));const Y=q.elevationFeature.isTunnel();let ee=0;c.properties.hasOwnProperty(Xt)&&(ee=+c.properties[Xt]);for(const re of q.polygons)this.elevatedStructures.addPortalCandidates(q.elevationFeature.id,re,Y,q.elevationFeature,ee)}q.elevationFeature.constantHeight==null&&(q.polygons=this.prepareElevatedPolygons(q.polygons,q.elevationFeature,q.elevationTileID));const K=new Za(x,q.elevationTileID);this.addElevatedGeometry(q.polygons,K,q.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,_,z)}}addElevatedGeometry(c,h,x,_,C,T){const L={elevation:x,elevationSampler:h,bias:_,index:C,featureInfo:T},[z,q]=this.addGeometry(c,this.elevationBufferData,L);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:z,max:q}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,z),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,q))}addGeometry(c,h,x){let _=Number.POSITIVE_INFINITY,C=Number.NEGATIVE_INFINITY,T=null;x&&(T=x.elevationSampler.constantElevation(x.elevation,x.bias),T!=null&&(_=T,C=T));const L=(z,q,K)=>{if(x!=null)if(q.push(z),T!=null)h.elevatedLayoutVertexArray.emplaceBack(T),K.push(T);else{const Y=x.elevationSampler.pointElevation(z,x.elevation,x.bias);h.elevatedLayoutVertexArray.emplaceBack(Y),K.push(Y),_=Math.min(_,Y),C=Math.max(C,Y)}};for(const z of c){let q=0;for(const Be of z)q+=Be.length;const K=h.triangleSegments.prepareSegment(q,h.layoutVertexArray,h.indexArray),Y=K.vertexLength,ee=[],re=[],ie=[],ge=[],Ce=[],Ne=h.layoutVertexArray.length;for(const Be of z){if(Be.length===0)continue;Be!==z[0]&&re.push(ee.length/2);const Ze=h.lineSegments.prepareSegment(Be.length,h.layoutVertexArray,h.lineIndexArray),yt=Ze.vertexLength;x&&Ce.push(h.layoutVertexArray.length-Ne),L(Be[0],ie,ge),h.layoutVertexArray.emplaceBack(Be[0].x,Be[0].y),h.lineIndexArray.emplaceBack(yt+Be.length-1,yt),ee.push(Be[0].x),ee.push(Be[0].y);for(let ht=1;ht0&&x&&this.elevationMode==="hd-road-base"){const Be=x.elevation.isTunnel(),Ze=x.elevation.safeArea,yt=this.elevatedStructures.addVertices(ie,ge);this.elevatedStructures.addTriangles(Fe,yt,Be);const ht=Ce.length;if(ht>0){for(let jt=0;jt=x&&re.max.x<=C&&re.min.y>=_&&re.max.y<=T?z:q).push(ee)}if(z.length===c.length)return c;const K=[new dr(x,_),new dr(C,_),new dr(C,T),new dr(x,T),new dr(x,_)],Y=z;for(const ee of q)Y.push(...HHe(ee,K));return Y}}let Yve,Xve,Qve,Jve;hs(Roe,"FillBucket",{omit:["layers","patternFeatures"]}),hs(Doe,"FillBufferData"),hs(qu,"ElevatedStructures");class X6{constructor(c,h,x,_){if(this.triangleCount=h.length/3,this.min=new dr(0,0),this.max=new dr(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[C,T]=[c[0].clone(),c[0].clone()];for(let Y=1;YY.cellIdx-ee.cellIdx||Y.triIdx-ee.triIdx);let K=0;for(;Kthis.max.x||this.min.x>c.x||c.y>this.max.y||this.min.y>c.y)return;const x=_g(c.x-this.min.x,this.xScale,this.cellsX),_=_g(c.y-this.min.y,this.yScale,this.cellsY),C=this.cells[_*this.cellsX+x];if(C){this._lazyInitLookup();for(let T=0;Tthis.max.x||this.min.x>h.x||c.y>this.max.y||this.min.y>h.y)return;this._lazyInitLookup();const _=_g(c.x-this.min.x,this.xScale,this.cellsX),C=_g(h.x-this.min.x,this.xScale,this.cellsX),T=_g(c.y-this.min.y,this.yScale,this.cellsY),L=_g(h.y-this.min.y,this.yScale,this.cellsY);for(let z=T;z<=L;z++)for(let q=_;q<=C;q++){const K=this.cells[z*this.cellsX+q];if(K)for(let Y=0;Yh.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 x of this.footprints)h.push({footprint:x,id:c})}updateAppearances(c,h,x,_){}populate(c,h,x,_){const C=[];for(const{feature:T,id:L,index:z,sourceLayerIndex:q}of c){const K=this.layers[0]._featureFilter.needGeometry,Y=Bt(T,K);if(!this.layers[0]._featureFilter.filter(new gi(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),Y,x))continue;const ee={id:L,properties:T.properties,type:T.type,sourceLayerIndex:q,index:z,geometry:K?Y.geometry:Tt(T,x,_),patterns:{}};C.push(ee)}for(const T of C){const{geometry:L,index:z,sourceLayerIndex:q}=T;this.addFeature(T,L,z,x,{},h.availableImages,h.brightness),h.featureIndex.insert(c[z].feature,L,z,q,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(c){}update(c,h,x,_,C,T,L){}destroy(){}addFeature(c,h,x,_,C,T=[],L){for(const z of kM(h,2)){const q=[],K=[],Y=[],ee=new dr(1/0,1/0),re=new dr(-1/0,-1/0);for(const Ce of z)if(Ce.length!==0){Ce!==z[0]&&Y.push(K.length/2);for(let Ne=0;NeT===_)===void 0}(x,p.clipScope)}function Q6(p,c){return p.x-c.x||p.y-c.y}function s_e(p,c){return Q6(p.min,c.min)===0&&Q6(p.max,c.max)===0}function Foe(p,c){return!(p.min.x>c.max.x||p.max.xc.max.y||p.max.ynew dr((z.x+C.x*Rr)*L-T.x*Rr,(z.y+C.y*Rr)*L-T.y*Rr))}return zoe(h,_,p.indices,0,p.indices.length,0,0)}function i_e(p,c,h,x){const _=Math.pow(2,x.z-h.z);return new dr((p+h.x*Rr)*_-x.x*Rr,(c+h.y*Rr)*_-x.y*Rr)}function o_e(p,c){const h=[];c.grid.queryPoint(p,h);const x=c.indices,_=c.vertices;for(let C=0;C0&&(x.length>1&&h.push(x),x=[])}return x.length>1&&h.push(x),h}const $oe=zt.types,rWe=["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"],sWe=["fill-extrusion-flood-light-ground-radius"],nWe=Math.pow(2,13),aWe=Math.pow(2,15)-1,c_e=new dr(0,1),Dx=2147483648,d_e=7,u_e=450;function SM(p,c,h,x,_,C,T,L){p.emplaceBack((c<<1)+T,(h<<1)+C,(Math.floor(x*nWe)<<1)+_,Math.round(L))}function CM(p,c,h){p.emplaceBack(c.x*Rr,c.y*Rr,h?1:0)}function eL(p,c,h,x,_,C){p.emplaceBack(c.x,c.y,(h.x<<1)+x,(h.y<<1)+_,C)}function MM(p,c,h){p.emplaceBack(c.x,c.y,c.z,h[0]*16384,h[1]*16384,h[2]*16384)}class h_e{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class m_e{constructor(){this.centroidXY=new dr(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 dr(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new dr(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new dr(this.max.x-this.min.x,this.max.y-this.min.y)}}class p_e{constructor(){this.acc=new dr(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,x){this.accCount++,this.acc._add(h);let _=!!this.borders;h.xc.max.x&&(c.max.x=h.x,_=!0),h.yc.max.y&&(c.max.y=h.y,_=!0),((h.x===0||h.x===Rr)&&h.x===x.x)!=((h.y===0||h.y===Rr)&&h.y===x.y)&&this.processBorderOverlap(h,x),_&&this.checkBorderIntersection(h,x)}checkBorderIntersection(c,h){h.x<0!=c.x<0&&this.addBorderIntersection(0,Hs(h.y,c.y,(0-h.x)/(c.x-h.x))),h.x>Rr!=c.x>Rr&&this.addBorderIntersection(1,Hs(h.y,c.y,(Rr-h.x)/(c.x-h.x))),h.y<0!=c.y<0&&this.addBorderIntersection(2,Hs(h.x,c.x,(0-h.y)/(c.y-h.y))),h.y>Rr!=c.y>Rr&&this.addBorderIntersection(3,Hs(h.x,c.x,(Rr-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 x=this.borders[c];hx[1]&&(x[1]=h)}processBorderOverlap(c,h){if(c.x===h.x){if(c.y===h.y)return;const x=c.x===0?0:1;this.addBorderIntersection(x,h.y),this.addBorderIntersection(x,c.y)}else{const x=c.y===0?2:3;this.addBorderIntersection(x,h.x),this.addBorderIntersection(x,c.x)}}centroid(){return this.accCount===0?new dr(0,0):new dr(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 f_e(p,c){const h=p.add(c)._unit(),x=ye(p.x*h.x+p.y*h.y,-1,1);var _,C,T;return _=Math.acos(x),Math.min(4,Math.max(-4,Math.tan(_)))/4*aWe*((C=p).x*(T=c).y-C.y*T.x<0?-1:1)}const iWe=[p=>p.x<0,p=>p.x>Rr,p=>p.y<0,p=>p.y>Rr];function oWe(p,c,h,x){const _=[4];if(x===0)return _;h._mult(x);const C=p.sub(h),T=c.sub(h),L=[p,c,C,T];for(let z=0;z<4;z++)for(const q of L)if(iWe[z](q)){_.push(z);break}return _}class Uoe{constructor(c){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new eM,this.indexArray=new el,this.programConfigurations=new tm(c.layers,{zoom:c.zoom,lut:c.lut},h=>sWe.includes(h)),this._segments=new Yi,this.hiddenByLandmarkVertexArray=new XN,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Yi}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(c,h,x,_=!1){const C=c.length;if(C>2){let T=Math.max(0,this._segments.get().length-1);const L=this._segments._prepareSegment(4*C,this.vertexArray.length,2*this._segmentToGroundQuads[T].length);let z;T!==this._segments.get().length-1&&(T++,this._segmentToGroundQuads[T]=[],this._segmentToRegionTriCounts[T]=[0,0,0,0,0]);{const q=c[0],K=c[1];z=f_e(q.sub(c[C-1])._perp()._unit(),K.sub(q)._perp()._unit())}for(let q=0;q_.region-C.region);for(let x=0;xz+q,0);let L=0;for(let z=0;z<=4;z++){const q=T[z];if(q!==0){let K=this.regionSegments[z];K||(K=this.regionSegments[z]=new Yi);const Y={vertexOffset:C.vertexOffset,primitiveOffset:C.primitiveOffset+L,vertexLength:C.vertexLength,primitiveLength:q};K.get().push(Y)}L+=q}for(let z=0;z<_.length;z++){const q=_[z].id;this.indexArray.emplaceBack(q,q+1,q+3),this.indexArray.emplaceBack(q,q+3,q+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(c,h,x,_,C,T,L){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,c,h,x,_,C,T,void 0,L)}upload(c){this.hasData()&&(this.vertexBuffer=c.createVertexBuffer(this.vertexArray,KHe.members),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.groundRadiusArray!=null&&(this.groundRadiusBuffer=c.createVertexBuffer(this.groundRadiusArray,ZHe.members)))}uploadPaintProperties(c){this.hasData()&&this.programConfigurations.upload(c)}update(c,h,x,_,C,T,L,z){this.hasData()&&this.programConfigurations.updatePaintArrays(c,h,x,_,C,T,L,z)}updateHiddenByLandmark(c){this.updateHiddenByLandmarkRange(c.groundVertexArrayOffset,c.groundVertexCount,!!(c.flags&Dx))}updateHiddenByLandmarkRange(c,h,x){if(!this.hasData())return;const _=h+c;if(h!==0){for(let C=c;C<_;++C)this.hiddenByLandmarkVertexArray.emplace(C,x?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(c){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=c.createVertexBuffer(this.hiddenByLandmarkVertexArray,QHe.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 tL{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 el,this.footprintVertices=new fg,this.footprintSegments=[],this.layoutVertexArray=new j0,this.centroidVertexArray=new U6,this.wallVertexArray=new m_,this.indexArray=new el,this.programConfigurations=new tm(c.layers,{zoom:c.zoom,lut:c.lut},h=>rWe.includes(h)),this.segments=new Yi,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.groundEffect=new Uoe(c),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,h){}updateAppearances(c,h,x,_){}populate(c,h,x,_){this.features=[],this.hasPattern=Poe("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=De(x),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:C,id:T,index:L,sourceLayerIndex:z}of c){const q=this.layers[0]._featureFilter.needGeometry,K=Bt(C,q);if(!this.layers[0]._featureFilter.filter(new gi(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),K,x))continue;const Y={id:T,sourceLayerIndex:z,index:L,geometry:q?K.geometry:Tt(C,x,_),properties:C.properties,type:C.type,patterns:{}},ee=this.layoutVertexArray.length,re=$oe[Y.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:C.id,feature:Loe("fill-extrusion",this.layers,Y,this.zoom,this.pixelRatio,h)});else if(this.wallMode)for(const ie of Y.geometry)for(const ge of l_e(ie,re))this.addFeature(C.id,Y,[ge],L,x,{},h.availableImages,_,h.brightness);else this.addFeature(C.id,Y,Y.geometry,L,x,{},h.availableImages,_,h.brightness);h.featureIndex.insert(C,Y.geometry,L,z,this.index,ee)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(c,h,x,_,C,T){for(const{featureId:L,feature:z}of this.features){const q=$oe[z.type]==="Polygon",{geometry:K}=z;if(this.wallMode)for(const Y of K)for(const ee of l_e(Y,q))this.addFeature(L,z,[ee],z.index,h,x,_,C,T);else this.addFeature(L,z,K,z.index,h,x,_,C,T)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(c,h,x,_,C,T,L){this.programConfigurations.updatePaintArrays(c,h,C,x,_,T,L,this.worldview),this.groundEffect.update(c,h,C,x,_,T,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,eWe),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.wallVertexBuffer=c.createVertexBuffer(this.wallVertexArray,XHe.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=c.createVertexBuffer(this.layoutVertexExtArray,JHe.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,YHe.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,x,_,C,T,L,z,q){const K=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(h,{})/this.tileToMeter,Y=[new dr(0,0),new dr(Rr,Rr)],ee=z.projection,re=ee.name==="globe",ie=this.wallMode||$oe[h.type]==="Polygon",ge=new p_e;ge.centroidDataIndex=this.centroidData.length;const Ce=new m_e;Ce.buildingId=c,h.properties&&h.properties.hasOwnProperty("building_id")&&(Ce.buildingId=h.properties.building_id);const Ne=this.layers[0].paint.get("fill-extrusion-base").evaluate(h,{},C)<=0,Fe=this.layers[0].paint.get("fill-extrusion-height").evaluate(h,{},C);let Be;if(Ce.height=Fe,Ce.vertexArrayOffset=this.layoutVertexArray.length,Ce.groundVertexArrayOffset=this.groundEffect.vertexArray.length,re&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new HN),this.wallMode){if(re)return void es("Non zero fill-extrusion-line-width is not yet supported on globe.");if(x.length!==1)return;Be=function($t){const or=$t[0].x===$t[$t.length-1].x&&$t[0].y===$t[$t.length-1].y;(function(as){let xs=0;const In=as.length;for(let Er=0;Er=0})($t)||($t=$t.reverse());const pr={geometry:[],joinNormals:[],indices:[]},wr=[],kr=[],xr=[];let _r=$t.length;for(;_r>=2&&$t[_r-1].equals($t[_r-2]);)_r--;if(_r<(or?3:2))return pr;let ir,sr,br,zr,Ar,Ns=0;for(;Ns<_r-1&&$t[Ns].equals($t[Ns+1]);)Ns++;or&&(ir=$t[_r-2],Ar=$t[Ns].sub(ir)._unit()._perp());for(let as=Ns;as<_r;as++){if(br=as===_r-1?or?$t[Ns+1]:void 0:$t[as+1],br&&$t[as].equals(br))continue;Ar&&(zr=Ar),ir&&(sr=ir),ir=$t[as],Ar=br?br.sub(ir)._unit()._perp():zr,zr=zr||Ar;let xs=zr.add(Ar);xs.x===0&&xs.y===0||xs._unit();const In=xs.x*Ar.x+xs.y*Ar.y,Er=In!==0?1/In:1/0,ys=zr.x*Ar.y-zr.y*Ar.x>0;let tn="miter";const ra=2;tn==="miter"&&Er>ra&&(tn="bevel"),tn==="bevel"&&(Er>100&&(tn="flipbevel"),Er{const lr=new dr(_n.x,_n.y),jr=new dr(_n.x,_n.y);lr.x+=Xa.x*vt,lr.y+=Xa.y*vt,jr.x-=Xa.x*Math.max(pt,1),jr.y-=Xa.y*Math.max(pt,1),xr.push(Xa),wr.push(lr),kr.push(jr)};if(tn==="miter")xs._mult(Er),oa(ir,xs,0,0);else if(tn==="flipbevel")xs=Ar.mult(-1),oa(ir,xs,0,0),oa(ir,xs.mult(-1),0,0);else{const _n=-Math.sqrt(Er*Er-1),Xa=ys?_n:0,pt=ys?0:_n;sr&&oa(ir,zr,Xa,pt),br&&oa(ir,Ar,Xa,pt)}}pr.geometry=[...wr,...kr.reverse(),wr[0]],pr.joinNormals=[...xr,...xr.reverse(),xr[xr.length-1]];const Jr=pr.geometry.length-1;for(let as=0;as$t<(or.length-1)/2||$t===or.length-1,yt=this.wallMode?[x]:kM(x,500);for(let $t=yt.length-1;$t>=0;$t--){const or=yt[$t];(or.length===0||(ht=or[0]).every(mr=>mr.x<=0)||ht.every(mr=>mr.x>=Rr)||ht.every(mr=>mr.y<=0)||ht.every(mr=>mr.y>=Rr))&&yt.splice($t,1)}var ht;let jt;if(re)jt=w_e(yt,Y,C);else{jt=[];for(const $t of yt)jt.push({polygon:$t,bounds:Y})}const Et=ie?this.edgeRadius:0,Dt=Et>0&&this.zoom<17,tr=($t,or)=>{if($t.length===0)return!1;const mr=$t[$t.length-1];return or.x===mr.x&&or.y===mr.y};for(const{polygon:$t,bounds:or}of jt){let mr=0,pr=0;for(const _r of $t)ie&&!_r[0].equals(_r[_r.length-1])&&_r.push(_r[0]),pr+=ie?_r.length-1:_r.length;const wr=this.segments.prepareSegment((ie?5:4)*pr,this.layoutVertexArray,this.indexArray);Ce.footprintSegIdx<0&&(Ce.footprintSegIdx=this.footprintSegments.length),Ce.polygonSegIdx<0&&(Ce.polygonSegIdx=this.polygonSegments.length);const kr={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},xr=new h_e;if(xr.vertexOffset=this.footprintVertices.length,xr.indexOffset=3*this.footprintIndices.length,xr.ringIndices=[],ie){const _r=[],ir=[];mr=wr.vertexLength;for(let br=0;br<$t.length;br++){const zr=$t[br];zr.length&&br!==0&&ir.push(_r.length/2);const Ar=[];let Ns,Jr;Ns=zr[1].sub(zr[0])._perp()._unit(),xr.ringIndices.push(zr.length-1);for(let as=1;as4&&v_e(ir[ir.length-2],ir[0],ir[1]),br=Et?lWe(ir[ir.length-2],ir[0],ir[1],Et):0;const zr=[];let Ar,Ns,Jr;Ns=ir[1].sub(ir[0])._perp()._unit();let as=!0;for(let xs=1,In=0;xs0?1:0,Xa=Er.dist(ys);if(In+Xa>32768&&(In=0),Et){Jr=tn.sub(ys)._perp()._unit();let jr=x_e(Er,ys,tn,g_e(Ns,Jr),Et);isNaN(jr)&&(jr=0);const Zr=ys.sub(Er)._unit();Er=Er.add(Zr.mult(br))._round(),ys=ys.add(Zr.mult(-jr))._round(),br=jr,Ns=Jr,Ne&&this.zoom>=17&&(tr(zr,Er)||zr.push(Er),tr(zr,ys)||zr.push(ys))}const pt=wr.vertexLength,vt=ir.length>4&&v_e(Er,ys,tn);let lr=__e(In,sr,as);if(SM(this.layoutVertexArray,Er.x,Er.y,oa,_n,0,0,lr),SM(this.layoutVertexArray,Er.x,Er.y,oa,_n,0,1,lr),this.wallMode){const jr=Ze(xs-1,ir),Zr=Be.joinNormals[xs-1];CM(this.wallVertexArray,Zr,jr),CM(this.wallVertexArray,Zr,jr)}if(In+=Xa,lr=__e(In,vt,!as),sr=vt,SM(this.layoutVertexArray,ys.x,ys.y,oa,_n,0,0,lr),SM(this.layoutVertexArray,ys.x,ys.y,oa,_n,0,1,lr),this.wallMode){const jr=Ze(xs,ir),Zr=Be.joinNormals[xs];CM(this.wallVertexArray,Zr,jr),CM(this.wallVertexArray,Zr,jr)}if(wr.vertexLength+=4,this.indexArray.emplaceBack(pt+0,pt+1,pt+2),this.indexArray.emplaceBack(pt+1,pt+3,pt+2),wr.primitiveLength+=2,Et){const jr=mr+(xs===1?ir.length-2:xs-2),Zr=xs===1?mr:jr+1;if(this.indexArray.emplaceBack(pt+1,jr,pt+3),this.indexArray.emplaceBack(jr,Zr,pt+3),wr.primitiveLength+=2,Ar===void 0&&(Ar=pt),!qoe(tn,ir[xs],or)){const Yr=xs===ir.length-1?Ar:wr.vertexLength;this.indexArray.emplaceBack(pt+2,pt+3,Yr),this.indexArray.emplaceBack(pt+3,Yr+1,Yr),this.indexArray.emplaceBack(pt+3,Zr,Yr+1),wr.primitiveLength+=3}as=!as}if(re){const jr=this.layoutVertexExtArray,Zr=ee.projectTilePoint(Er.x,Er.y,C),Yr=ee.projectTilePoint(ys.x,ys.y,C),Cs=ee.upVector(C,Er.x,Er.y),Es=ee.upVector(C,ys.x,ys.y);MM(jr,Zr,Cs),MM(jr,Zr,Cs),MM(jr,Yr,Es),MM(jr,Yr,Es)}}ie&&(mr+=ir.length-1),Ne&&Et&&this.zoom>=17&&(zr.length!==0&&tr(zr,zr[0])&&zr.pop(),this.groundEffect.addData(zr,or,K,Et>0))}this.footprintSegments.push(xr),kr.triangleCount=this.indexArray.length-kr.triangleArrayOffset,this.polygonSegments.push(kr),++Ce.footprintSegLen,++Ce.polygonSegLen}if(Ce.vertexCount=this.layoutVertexArray.length-Ce.vertexArrayOffset,Ce.groundVertexCount=this.groundEffect.vertexArray.length-Ce.groundVertexArrayOffset,Ce.vertexCount!==0){if(Ce.centroidXY=ge.borders?c_e:this.encodeCentroid(ge,Ce),this.centroidData.push(Ce),ge.borders){this.featuresOnBorder.push(ge);const $t=this.featuresOnBorder.length-1;for(let or=0;orthis.featuresOnBorder[h].borders[c][0]-this.featuresOnBorder[x].borders[c][0])}splitToSubtiles(){const c=[];for(let L=0;LRr),K=2*q+(+(z.min.x+z.max.x>Rr)^q);for(let Y=0;YL.triangleSegmentIdx===z.triangleSegmentIdx?L.subtile-z.subtile:L.triangleSegmentIdx-z.triangleSegmentIdx);let x=0,_=0,C=0;for(const L of c){if(L.triangleSegmentIdx!==x)break;C++}const T=c.length;for(;_!==c.length;){x=c[_].triangleSegmentIdx;let L=0,z=_,q=_;for(let K=z;K0&&this.triangleSubSegments.push({segment:re,min:Y,max:ee}),z=q;for(let ie=z;ie[ge[0]*(1-Ne[0])+Ce[0]*Ne[0],ge[1]*(1-Ne[1])+Ce[1]*Ne[1]],re=[],ie=[];for(const ge of this.triangleSubSegments){re[0]=ge.min.x/Rr,re[1]=ge.min.y/Rr,ie[0]=ge.max.x/Rr,ie[1]=ge.max.y/Rr;const Ce=ee(K,Y,re),Ne=ee(K,Y,ie);if(new js([Ce[0],Ce[1],C],[Ne[0],Ne[1],T]).intersectsPrecise(x)===0){q&&(_.segments.push(q),q=void 0);continue}const Fe=ge.segment;q&&q.vertexOffset!==Fe.vertexOffset&&(_.segments.push(q),q=void 0),q?(q.vertexLength+=Fe.vertexLength,q.primitiveLength+=Fe.primitiveLength):q={vertexOffset:Fe.vertexOffset,primitiveLength:Fe.primitiveLength,vertexLength:Fe.vertexLength,primitiveOffset:Fe.primitiveOffset,sortKey:void 0,vaos:{}}}return q&&_.segments.push(q),_}encodeCentroid(c,h){const x=c.centroid(),_=h.span(),C=Math.min(7,Math.round(_.x*this.tileToMeter/10)),T=Math.min(7,Math.round(_.y*this.tileToMeter/10));return new dr(ye(x.x,1,Rr-1)<<3|C,ye(x.y,1,Rr-1)<<3|T)}encodeBorderCentroid(c){if(!c.borders)return new dr(0,0);const h=c.borders,x=Number.MAX_VALUE;if(h[0][0]!==x||h[1][0]!==x){const _=h[0][0]!==x?0:1;return new dr(6|(h[0][0]!==x?0:65528),(h[_][0]+h[_][1])/2<<3|6)}{const _=h[2][0]!==x?2:3;return new dr((h[_][0]+h[_][1])/2<<3|6,6|(h[2][0]!==x?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,x=c.vertexCount+c.vertexArrayOffset,_=c.flags&Dx?c_e:c.centroidXY,C=this.centroidVertexArray.geta_centroid_pos0(h);if(this.centroidVertexArray.geta_centroid_pos1(h)!==_.y||C!==_.x){for(let T=h;Tz.max.x||z.min.x>T.max.x||T.min.y>z.max.y||z.min.y>T.max.y||T.footprint.buildingIds.has(z.buildingId)&&(z.flags|=Dx);else for(const z of this.centroidData)if(!(z.flags&Dx||T.min.x>z.max.x||z.min.x>T.max.x||T.min.y>z.max.y||z.min.y>T.max.y))for(let q=0;qh!=re>h&&c<(this.footprintVertices.int16[2*(K+T.vertexOffset)+0]-Y)*(h-ee)/(re-ee)+Y&&(_=!_)}L=z}}return _}getHeightAtTileCoord(c,h){let x=Number.NEGATIVE_INFINITY,_=!0;const C=4*(c+Rr)*Rr+(h+Rr);if(this.partLookup.hasOwnProperty(C)){const T=this.partLookup[C];return T?{height:T.height,hidden:!!(T.flags&Dx)}:void 0}for(const T of this.centroidData)c>T.max.x||T.min.x>c||h>T.max.y||T.min.y>h||T.height<=x||this.footprintContainsPoint(c,h,T)&&(x=T.height,this.partLookup[C]=T,_=!!(T.flags&Dx));if(x!==Number.NEGATIVE_INFINITY)return{height:x,hidden:_};this.partLookup[C]=void 0}}function g_e(p,c){const h=p.add(c)._unit();return p.x*h.x+p.y*h.y}function lWe(p,c,h,x){const _=c.sub(p)._perp()._unit(),C=h.sub(c)._perp()._unit();return x_e(p,c,h,g_e(_,C),x)}function x_e(p,c,h,x,_){const C=Math.sqrt(1-x*x);return Math.min(p.dist(c)/3,c.dist(h)/3,_*C/x)}function qoe(p,c,h){return p.xh[1].x&&c.x>h[1].x||p.yh[1].y&&c.y>h[1].y}function y_e(p,c){return p.xc[1].x||p.yc[1].y}function v_e(p,c,h){if(p.x<0||p.x>=Rr||c.x<0||c.x>=Rr||h.x<0||h.x>=Rr)return!1;const x=h.sub(c),_=x.perp(),C=p.sub(c);return(x.x*C.x+x.y*C.y)/Math.sqrt((x.x*x.x+x.y*x.y)*(C.x*C.x+C.y*C.y))>-.866&&_.x*C.x+_.y*C.y<0}function __e(p,c,h){const x=c?2|p:-3&p;return h?1|x:-2&x}function b_e(){const p=Math.PI/32,c=Math.tan(p),h=w;return h*Math.sqrt(1+2*c*c)-h}function w_e(p,c,h){const x=1<{for(const Et of ht)ie.push({polygon:Et,bounds:jt})},Ce=Math.ceil(Math.log2(K)),Ne=Math.ceil(Math.log2(Y)),Fe=Ce-Ne,Be=[];for(let ht=0;ht0?0:1);for(let ht=0;htjt+1?yt.push({polygons:pr,bounds:kr,depth:jt+1}):ge(pr,kr)}if(wr.length){const kr=[new dr(Et===0?mr:Dt.x,Et===1?mr:Dt.y),tr];Be.length>jt+1?yt.push({polygons:wr,bounds:kr,depth:jt+1}):ge(wr,kr)}}return ie}(p,c,Math.ceil((C-_)/11.25),Math.ceil((T-L)/11.25),1,(z,q,K)=>{if(z===0)return .5*(q+K);{const Y=me((h.y+q/Rr)/x);return(G(.5*(me((h.y+K/Rr)/x)+Y))*x-h.y)*Rr}})}function cWe(p,c,h,x,_,C){const T=Math.pow(2,x.z-_.z);for(let L=0;L=z[T]&&(L=c,z=p),L[T]<_&&z[T]>_&&S_e(L,z,T,_),L[T]C&&S_e(z,L,T,C)}}function rL(p,c,h,x,_,C){const T=[];for(let L=0;L=x&&ie.x>=x||(re.x>=x?re=new dr(x,re.y+(x-re.x)/(ie.x-re.x)*(ie.y-re.y))._round():ie.x>=x&&(ie=new dr(x,re.y+(x-re.x)/(ie.x-re.x)*(ie.y-re.y))._round()),re.y>=_&&ie.y>=_||(re.y>=_?re=new dr(re.x+(_-re.y)/(ie.y-re.y)*(ie.x-re.x),_)._round():ie.y>=_&&(ie=new dr(re.x+(_-re.y)/(ie.y-re.y)*(ie.x-re.x),_)._round()),q&&re.equals(q[q.length-1])||(q=[re],T.push(q),C&&C.push({progress:{min:Ce+M_e(Ne,Fe,re)*ge,max:1},parentIndex:L,prevPoint:Ne,nextPoint:Fe})),q.push(ie),C&&(C[C.length-1].progress.max=Ce+M_e(Ne,Fe,ie)*ge,C[C.length-1].nextPoint=Fe)))))}if(C&&Y>0)for(let ee=K;eeq.t-K.t);let T=0,L=0,z=[];for(x.push(z);T!==p.length;){if(L===C.length){for(;T!==p.length;)z.length!==0&&z[z.length-1].equals(p[T])||z.push(p[T]),T++;break}C[L].t<=T?(z.length!==0&&z[z.length-1].equals(C[L].point)||z.push(C[L].point),Math.trunc(C[L].t),L++):(z.length!==0&&z[z.length-1].equals(p[T])||z.push(p[T]),T++)}}function M_e(p,c,h){return p.x!==c.x?(h.x-p.x)/(c.x-p.x):p.y!==c.y?(h.y-p.y)/(c.y-p.y):0}function TM(p,c){return p.x*c.x+p.y*c.y}function T_e(p,c){if(p.length===1){let h=0;const x=c[h++];let _;for(;!_||x.equals(_);)if(_=c[h++],!_)return 1/0;for(;h{mr[0]=pr,mr[1]=wr,mr[2]=kr,mr[3]=1},or=b_e();re>0&&(re+=or),ie+=or;for(const mr of ee){const pr=[],wr=[];for(const kr of mr){const xr=kr.x+ge.x,_r=kr.y+ge.y,ir=Y.projection.projectTilePoint(xr,_r,yt),sr=Y.projection.upVector(yt,kr.x,kr.y);let br=re,zr=ie;if(Ne){const Ar=I_e(xr,_r,re,ie,Ne,Fe,Be,Ze);br+=Ar.base,zr+=Ar.top}re!==0?$t(Dt,ir.x+sr[0]*Et*br,ir.y+sr[1]*Et*br,ir.z+sr[2]*Et*br):$t(Dt,ir.x,ir.y,ir.z),$t(tr,ir.x+sr[0]*Et*zr,ir.y+sr[1]*Et*zr,ir.z+sr[2]*Et*zr),at(Dt,Dt,Ce),at(tr,tr,Ce),pr.push(new j_(Dt[0],Dt[1],Dt[2])),wr.push(new j_(tr[0],tr[1],tr[2]))}ht.push(pr),jt.push(wr)}return[ht,jt]}(p,c,h,x,_,C,T,L,z,q,K):T?function(Y,ee,re,ie,ge,Ce,Ne,Fe,Be){const Ze=[],yt=[],ht=[0,0,0,1];for(const jt of Y){const Et=[],Dt=[];for(const tr of jt){const $t=tr.x+ie.x,or=tr.y+ie.y,mr=I_e($t,or,ee,re,Ce,Ne,Fe,Be);ht[0]=$t,ht[1]=or,ht[2]=mr.base,ht[3]=1,ot(ht,ht,ge),ht[3]=Math.max(ht[3],1e-5);const pr=new j_(ht[0]/ht[3],ht[1]/ht[3],ht[2]/ht[3]);ht[0]=$t,ht[1]=or,ht[2]=mr.top,ht[3]=1,ot(ht,ht,ge),ht[3]=Math.max(ht[3],1e-5);const wr=new j_(ht[0]/ht[3],ht[1]/ht[3],ht[2]/ht[3]);Et.push(pr),Dt.push(wr)}Ze.push(Et),yt.push(Dt)}return[Ze,yt]}(c,h,x,_,C,T,L,z,q):function(Y,ee,re,ie,ge){const Ce=[],Ne=[],Fe=ge[8]*ee,Be=ge[9]*ee,Ze=ge[10]*ee,yt=ge[11]*ee,ht=ge[8]*re,jt=ge[9]*re,Et=ge[10]*re,Dt=ge[11]*re;for(const tr of Y){const $t=[],or=[];for(const mr of tr){const pr=mr.x+ie.x,wr=mr.y+ie.y,kr=ge[0]*pr+ge[4]*wr+ge[12],xr=ge[1]*pr+ge[5]*wr+ge[13],_r=ge[2]*pr+ge[6]*wr+ge[14],ir=ge[3]*pr+ge[7]*wr+ge[15],sr=kr+Fe,br=xr+Be,zr=_r+Ze,Ar=Math.max(ir+yt,1e-5),Ns=kr+ht,Jr=xr+jt,as=_r+Et,xs=Math.max(ir+Dt,1e-5);$t.push(new j_(sr/Ar,br/Ar,zr/Ar)),or.push(new j_(Ns/xs,Jr/xs,as/xs))}Ce.push($t),Ne.push(or)}return[Ce,Ne]}(c,h,x,_,C)}function I_e(p,c,h,x,_,C,T,L){const z=T*_.getElevationAt(p,c,!0,!0),q=C[0]!==0,K=q?C[1]===0?T*(C[0]/d_e-u_e):T*function(Y,ee,re){const ie=Math.floor(ee[0]/8),ge=Math.floor(ee[1]/8),Ce=10*(ee[0]-8*ie),Ne=10*(ee[1]-8*ge),Fe=Y.getElevationAt(ie,ge,!0,!0),Be=Y.getMeterToDEM(re),Ze=Math.floor(.5*(Ce*Be-1)),yt=Math.floor(.5*(Ne*Be-1)),ht=Y.tileCoordToPixel(ie,ge),jt=2*Ze+1,Et=2*yt+1,Dt=function(wr,kr,xr,_r,ir){return[wr.getElevationAtPixel(kr,xr,!0),wr.getElevationAtPixel(kr+ir,xr,!0),wr.getElevationAtPixel(kr,xr+ir,!0),wr.getElevationAtPixel(kr+_r,xr+ir,!0)]}(Y,ht.x-Ze,ht.y-yt,jt,Et),tr=Math.abs(Dt[0]-Dt[1]),$t=Math.abs(Dt[2]-Dt[3]),or=Math.abs(Dt[0]-Dt[2])+Math.abs(Dt[1]-Dt[3]),mr=Math.min(.25,.5*Be*(tr+$t)/jt),pr=Math.min(.25,.5*Be*or/Et);return Fe+Math.max(mr*Ce,pr*Ne)}(_,C,L):z;return{base:z+(h===0?-1:h),top:q?Math.max(K+x,z+h+2):z+x}}class uWe{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 hWe{constructor(){this.tasks={},this.taskQueue=[],Ft(["process"],this),this.invoker=new uWe(this.process),this.nextId=0}add(c,h){const x=this.nextId++,_=function({type:C,isSymbolTile:T,zoom:L}){return L=L||0,C==="message"?0:C!=="maybePrepare"||T?C!=="parseTile"||T?C==="parseTile"&&T?300-L:C==="maybePrepare"&&T?400-L:500:200-L:100-L}(h);if(_===0){try{c()}finally{}return null}return this.tasks[x]={fn:c,metadata:h,priority:_,id:x},this.taskQueue.push(x),this.invoker.trigger(),{cancel:()=>{delete this.tasks[x]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(x=>!!this.tasks[x]),!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 _=0;_{x&&delete this.callbacks[L],this.target.postMessage({id:L,type:"",targetMapId:_,sourceMapId:this.mapId})}}}receive(c){const h=c.data;if(!h)return;const x=h.id;if(x&&(!h.targetMapId||this.mapId===h.targetMapId))if(h.type===""){const _=this.cancelCallbacks[x];delete this.cancelCallbacks[x],_&&_.cancel()}else if(h.mustQueue||ea(self)){const _=this.callbacks[x],C=this.scheduler.add(()=>this.processTask(x,h),_&&_.metadata||{type:"message"});C&&(this.cancelCallbacks[x]=C)}else this.processTask(x,h)}processTask(c,h){if(delete this.cancelCallbacks[c],h.type===""){const x=this.callbacks[c];delete this.callbacks[c],x&&(h.error?x(pg(h.error)):x(null,pg(h.data)))}else{const x=new Set,_=h.hasCallback?(T,L)=>{this.target.postMessage({id:c,type:"",sourceMapId:this.mapId,error:T?Up(T):null,data:Up(L,x)},x)}:()=>{},C=pg(h.data);if(this.parent[h.type])this.parent[h.type](h.sourceMapId,C,_);else if(this.parent.getWorkerSource){const T=h.type.split("."),{source:L,scope:z}=C;this.parent.getWorkerSource(h.sourceMapId,T[0],L,z)[T[1]](C,_)}else _(new Error(`Could not find function ${h.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var AM={workerUrl:"",workerClass:null,workerParams:void 0};const Voe="mapboxgl_preloaded_worker_pool";class k_{constructor(c){this.active={},this.name=c}acquire(c,h=k_.workerCount){if(!this.workers)for(this.workers=[];this.workers.length{h.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Voe]}numActive(){return Object.keys(this.active).length}}k_.workerCount=2;class u4{constructor(c,h,x="Worker",_=k_.workerCount){this.workerPool=c,this.actors=[],this.currentActor=0,this.id=Lt();const C=this.workerPool.acquire(this.id,_);for(let T=0;T{this.ready=!0})}broadcast(c,h,x){St(this.actors,(_,C)=>{_.send(c,h,C)},x=x||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 EM,Hoe;function sL(){return EM||(EM=new k_),EM}u4.Actor=P_e;const Woe=4096;class mWe{constructor(c){this.module=c,this.memoryStack=this.module.malloc(Woe),this.memoryStackNextFree=this.memoryStack}createIntArray(c){const h=this.memoryStackNextFree;return this.memoryStackNextFree+=c.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Woe?-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>Woe?-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,x){this.module.setFauxFacadeOptions(c?1:0,h?1:0,x)}setFacadeClassifierOptions(c){this.module.setFacadeClassifierOptions(c)}generateMesh(c,h){this.memoryStackNextFree=this.memoryStack;for(const L of c){const z=this.createIntArray(L.ringIndices),q=this.createFloatArray(L.coordinates);if(z===-1||q===-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,q,z,L.ringIndices.length-1)}for(const L of h){let z;z=L.entrances?JSON.parse(L.entrances):[];const q=this.createFloatArray(z),K=this.createFloatArray(L.coordinates);if(q===-1||K===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(L.sourceId,L.crossPerc,L.distanceToRoad,q,z.length,K,L.coordinates.length)}if(!this.module.generateMesh()){const L=this.module.getLastError();return this.readStringBuffer(L)}const x=this.module.getMeshCount(),_=new Array(x);for(let L=0;L_.arrayBuffer()).then(_=>{c.buffers[h]=_})}function $_e(p,c){const h=p.json.bufferViews[c];return new Uint8Array(p.buffers[h.buffer],h.byteOffset||0,h.byteLength)}function vWe(p,c,h,x){if(p.uri){const _=B_e(p.uri,x);return fetch(_).then(C=>C.blob()).then(C=>createImageBitmap(C)).then(C=>{c.images[h]=C})}if(p.bufferView!==void 0){const _=$_e(c,p.bufferView),C=new Blob([_],{type:p.mimeType});return createImageBitmap(C).then(T=>{c.images[h]=T})}}function U_e(p,c=0,h){const x={json:null,images:[],buffers:[]};if(new Uint32Array(p,c,1)[0]===F_e){const K=new Uint32Array(p,c);let Y=2;const ee=(K[Y++]>>2)-3,re=K[Y++]>>2;if(Y++,x.json=JSON.parse(z_e.decode(K.subarray(Y,Y+re))),Y+=re,Y{const K=[],Y=L&&L.includes(Zoe),ee=L&&L.includes(iL);if(Y&&K.push(function(){if(!ef)return IM??(IM=function(re){let ie,ge=null;function Ce(){ie=new Uint8Array(ge.buffer)}function Ne(){throw new Error("Unexpected Draco error.")}const Fe={a:{a:Ne,d:function(Be,Ze,yt){return ie.copyWithin(Be,Ze,Ze+yt)},c:function(Be){const Ze=ie.length,yt=Math.max(Be>>>0,Math.ceil(1.2*Ze)),ht=Math.ceil((yt-Ze)/65536);try{return ge.grow(ht),Ce(),!0}catch{return!1}},b:Ne}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(re,Fe):re.then(Be=>Be.arrayBuffer()).then(Be=>WebAssembly.instantiate(Be,Fe))).then(Be=>{const{Rb:Ze,Qb:yt,P:ht,T:jt,X:Et,Ja:Dt,La:tr,Qa:$t,Va:or,Wa:mr,eb:pr,jb:wr,f:kr,e:xr,yb:_r,zb:ir,Ab:sr,Bb:br,Db:zr,Gb:Ar}=Be.instance.exports;ge=xr;const Ns=(()=>{let Jr=0,as=0,xs=0,In=0;return Er=>{xs&&(Ze(In),Ze(Jr),as+=xs,xs=Jr=0),Jr||(as+=128,Jr=yt(as));const ys=Er.length+7&-8;let tn=Jr;ys>=as&&(xs=ys,tn=In=yt(ys));for(let ra=0;ra{ef=re,IM=void 0}))}()),ee&&K.push(function(){if(Koe)return;const re=function(ie){let ge;const Ce=WebAssembly.instantiateStreaming(ie,{}).then(Be=>{ge=Be.instance,ge.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:Ce,supported:!0,decodeGltfBuffer(Be,Ze,yt,ht,jt,Et){(function(Dt,tr,$t,or,mr,pr,wr){const kr=Dt.exports.sbrk,xr=or+3&-4,_r=kr(xr*mr),ir=kr(pr.length),sr=new Uint8Array(Dt.exports.memory.buffer);sr.set(pr,ir);const br=tr(_r,or,mr,ir,pr.length);if(br===0&&wr&&wr(_r,xr,mr),$t.set(sr.subarray(_r,_r+or*mr)),kr(_r-kr(0)),br!==0)throw new Error(`Malformed buffer data: ${br}`)})(ge,ge.exports[Fe[jt]],Be,Ze,yt,ht,ge.exports[Ne[Et]])}}}(fetch(D_e()));return re.ready.then(()=>{Koe=re})}()),C)for(let re=0;re{if(Y&&T)for(const{primitives:re}of T)for(const ie of re)gWe(ie,x);if(ee&&T&&z)for(const re of z)xWe(re,x);return x})})}function q_e(p){return fetch(p).then(c=>c.arrayBuffer()).then(c=>U_e(c,0,p))}function Yoe(p){switch(p){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 Xoe(p){switch(p){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 Qoe{constructor(c,h,x,_){this.context=c,this.format=x,this.useMipmap=_&&_.useMipmap,this.texture=c.gl.createTexture(),this.update(h,{premultiply:_&&_.premultiply})}update(c,h){const x=c&&c instanceof HTMLVideoElement&&c.width===0?c.videoWidth:c.width,_=c&&c instanceof HTMLVideoElement&&c.height===0?c.videoHeight:c.height,{context:C}=this,{gl:T}=C,{x:L,y:z}=h&&h.position?h.position:{x:0,y:0},q=L+x,K=z+_;!this.size||this.size[0]===q&&this.size[1]===K||(T.bindTexture(T.TEXTURE_2D,null),T.deleteTexture(this.texture),this.texture=T.createTexture(),this.size=null),T.bindTexture(T.TEXTURE_2D,this.texture),C.pixelStoreUnpackFlipY.set(!1),C.pixelStoreUnpack.set(1),C.pixelStoreUnpackPremultiplyAlpha.set(this.format===T.RGBA8&&(!h||h.premultiply!==!1));const Y=c instanceof HTMLImageElement||c instanceof HTMLCanvasElement||c instanceof HTMLVideoElement||c instanceof ImageData||ImageBitmap&&c instanceof ImageBitmap;if(!this.size&&q>0&&K>0){const ee=this.useMipmap?Math.floor(Math.log2(Math.max(q,K)))+1:1;T.texStorage2D(T.TEXTURE_2D,ee,this.format,q,K),this.size=[q,K]}this.size&&(Y?T.texSubImage2D(T.TEXTURE_2D,0,L,z,Yoe(this.format),Xoe(this.format),c):"data"in c&&c.data&&T.texSubImage2D(T.TEXTURE_2D,0,L,z,x,_,Yoe(this.format),Xoe(this.format),c.data)),this.useMipmap&&T.generateMipmap(T.TEXTURE_2D)}bind(c,h,x=!1){const{context:_}=this,{gl:C}=_;C.bindTexture(C.TEXTURE_2D,this.texture),c!==this.minFilter&&(C.texParameteri(C.TEXTURE_2D,C.TEXTURE_MAG_FILTER,c),C.texParameteri(C.TEXTURE_2D,C.TEXTURE_MIN_FILTER,this.useMipmap&&!x?c===C.NEAREST?C.NEAREST_MIPMAP_NEAREST:C.LINEAR_MIPMAP_LINEAR:c),this.minFilter=c),h!==this.wrapS&&(C.texParameteri(C.TEXTURE_2D,C.TEXTURE_WRAP_S,h),C.texParameteri(C.TEXTURE_2D,C.TEXTURE_WRAP_T,h),this.wrapS=h)}bindExtraParam(c,h,x,_,C){const{context:T}=this,{gl:L}=T;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),x!==this.wrapS&&(L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_S,x),this.wrapS=x),_!==this.wrapT&&(L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_T,_),this.wrapT=_),C!==this.compareMode&&(C?(L.texParameteri(L.TEXTURE_2D,L.TEXTURE_COMPARE_MODE,L.COMPARE_REF_TO_TEXTURE),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_COMPARE_FUNC,C)):L.texParameteri(L.TEXTURE_2D,L.TEXTURE_COMPARE_MODE,L.NONE),this.compareMode=C)}destroy(){const{gl:c}=this.context;c.deleteTexture(this.texture),this.texture=null}}class LM{constructor(c,h){this.context=c,this.texture=h}bind(c,h){const{context:x}=this,{gl:_}=x;_.bindTexture(_.TEXTURE_2D,this.texture),c!==this.minFilter&&(_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,c),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,c),this.minFilter=c),h!==this.wrapS&&(_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,h),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,h),this.wrapS=h)}}const _We=Kn([{name:"a_pos_3f",components:3,type:"Float32"}]),bWe=Kn([{name:"a_color_3f",components:3,type:"Float32"}]),wWe=Kn([{name:"a_color_4f",components:4,type:"Float32"}]),jWe=Kn([{name:"a_uv_2f",components:2,type:"Float32"}]),kWe=Kn([{name:"a_normal_3f",components:3,type:"Float32"}]),NWe=Kn([{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"}]),SWe=Kn([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function V_e(p,c){const h=oL(p.projection,p.zoom,p.width,p.height),x=function(C,T,L,z,q){const K=new f(L.lng-180*P0,L.lat),Y=new f(L.lng+180*P0,L.lat),ee=C.project(K.lng,K.lat),re=C.project(Y.lng,Y.lat),ie=-Math.atan2(re.y-ee.y,re.x-ee.x),ge=He.fromLngLat(L);ge.y=ye(ge.y,-1+P0,1-P0);const Ce=ge.toLngLat(),Ne=C.project(Ce.lng,Ce.lat),Fe=He.fromLngLat(Ce);Fe.x+=P0;const Be=Fe.toLngLat(),Ze=C.project(Be.lng,Be.lat),yt=W_e(Ze.x-Ne.x,Ze.y-Ne.y,ie),ht=He.fromLngLat(Ce);ht.y+=P0;const jt=ht.toLngLat(),Et=C.project(jt.lng,jt.lat),Dt=W_e(Et.x-Ne.x,Et.y-Ne.y,ie),tr=Math.abs(yt.x)/Math.abs(Dt.y),$t=S([]);$($t,$t,-ie*(1-(q?0:z)));const or=S([]);return F(or,or,[1,1-(1-tr)*z,1]),or[4]=-Dt.x/Dt.y*z,$(or,or,ie),M(or,$t,or),or}(p.projection,0,p.center,h,c),_=H_e(p);return F(x,x,[_,_,1]),x}function H_e(p){const c=p.projection,h=oL(p.projection,p.zoom,p.width,p.height),x=Joe(c,p.center),_=Joe(c,f.convert(c.center));return Math.pow(2,x*h+(1-h)*_)}function oL(p,c,h,x,_=1/0){const C=p.range;if(!C)return 0;const T=Math.min(_,Math.max(h,x)),L=Math.log2(T/1024);return Oe(C[0]+L,C[1]+L,c)}const P0=1/4e4;function Joe(p,c){const h=ye(c.lat,-pe,pe),x=new f(c.lng-180*P0,h),_=new f(c.lng+180*P0,h),C=p.project(x.lng,h),T=p.project(_.lng,h),L=He.fromLngLat(x),z=He.fromLngLat(_),q=T.x-C.x,K=T.y-C.y,Y=z.x-L.x,ee=z.y-L.y,re=Math.sqrt((Y*Y+ee*ee)/(q*q+K*K));return Math.log2(re)}function W_e(p,c,h){const x=Math.cos(h),_=Math.sin(h);return{x:p*x-c*_,y:p*_+c*x}}function G_e(p,c,h){S(p),$(p,p,Ys(c[2])),O(p,p,Ys(c[0])),B(p,p,Ys(c[1])),F(p,p,h),M(p,p,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function lL(p,c,h,x,_,C,T,L){const z=[h[0]-c[0],h[1]-c[1],0],q=[x[0]-c[0],x[1]-c[1],0];if(fe(z)<1e-12||fe(q)<1e-12)return ft(p);const K=It([],z,q);Ie(K,K),xe(q,x,c),z[2]=(C-_)*L,q[2]=(T-_)*L;const Y=z;return It(Y,z,q),Ie(Y,Y),Mr(p,K,Y)}function cL(p,c,h=!1){const x=E0(c.zoom),_=function(C,T,L){const z=T.worldSize,q=[C[12],C[13],C[14]],K=me(q[1]/z),Y=te(q[0]/z),ee=S([]),re=J(1,K)*z,ie=J(1,0)*z*_e(K,T.zoom),ge=1/Moe(z);let Ce=ie*ge;if(L){const Ze=oL(T.projection,T.zoom,T.width,T.height,1024);Ce=ge*T.projection.pixelSpaceConversion(T.center.lat,z,Ze)}const Ne=M0(K,Y);ue(Ne,Ne,ve([],Ie([],Ne),re*Ce*q[2]));const Fe=function(Ze){const yt=[Ze[0],Ze[1],Ze[2]];let ht=[0,1,0];const jt=It([],ht,yt);return It(ht,yt,jt),Ue(ht)===0&&(ht=[0,1,0],It(jt,yt,ht)),Ie(jt,jt),Ie(ht,ht),Ie(yt,yt),[jt[0],jt[1],jt[2],0,ht[0],ht[1],ht[2],0,yt[0],yt[1],yt[2],0,Ze[0],Ze[1],Ze[2],1]}(Ne);F(ee,ee,[Ce,Ce,Ce*re]),I(ee,ee,[-q[0],-q[1],-q[2]]);const Be=M([],T.globeMatrix,Fe);return M(Be,Be,ee),M(Be,Be,C),Be}(p,c,h);if(x>0){const C=function(T,L){const z=L.worldSize,q=J(1,0)*z*_e(L.center.lat,L.zoom)/Moe(z),K=J(1,L.center.lat)*z,Y=S([]);B(Y,Y,Ys(L.center.lng)),O(Y,Y,Ys(L.center.lat)),I(Y,Y,[0,0,Uc]),F(Y,Y,[q,q,q*K]);const ee=L.point;return I(Y,Y,[-ee.x,-ee.y,0]),M(Y,Y,T),M(Y,L.globeMatrix,Y)}(p,c);return function(T,L,z){const q=(ie,ge,Ce)=>{const Ne=fe(ie),Fe=fe(ge),Be=Jp(ie,ge,Ce);return ve(Be,Be,1/fe(Be)*Hs(Ne,Fe,Ce))},K=q([T[0],T[1],T[2]],[L[0],L[1],L[2]],z),Y=q([T[4],T[5],T[6]],[L[4],L[5],L[6]],z),ee=q([T[8],T[9],T[10]],[L[8],L[9],L[10]],z),re=Jp([T[12],T[13],T[14]],[L[12],L[13],L[14]],z);return[K[0],K[1],K[2],0,Y[0],Y[1],Y[2],0,ee[0],ee[1],ee[2],0,re[0],re[1],re[2],1]}(_,C,x)}return _}function ele(p,c,h,x){const _=js.projectAabbCorners(x,h);let C=Number.MAX_VALUE;for(let L=0;L<_.length;++L){const z=_[L];z[0]=(.5*z[0]+.5)*c.width,z[1]=(.5-.5*z[1])*c.height,z[2]0||Ce===0&&ie[0]*ge[0]+ie[1]*ge[1]>=0&&ie[0]*ie[0]+ie[1]*ie[1]>ge[0]*ge[0]+ge[1]*ge[1])&&(K=re)}Y=K}while(Y!==q);return z.length>0&&z.push(z[0]),z}(_);if(_a(p,T))return C}const N_=64,f4={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function dL(p,c,h,x,_,C,T,L,z,q=!1){const K=h.zoom,Y=h.project(x),ee=_e(x.lat,K),re=1/ee;S(p),I(p,p,[Y.x+T[0]*re,Y.y+T[1]*re,T[2]]);let ie=1,ge=1;const Ce=h.worldSize;if(q){if(h.projection.name==="mercator"){let Ze=0;h.elevation&&(Ze=h.elevation.getAtPointOrZero(new He(Y.x/Ce,Y.y/Ce),0));const yt=ot([],[Y.x,Y.y,Ze,1],h.projMatrix)[3]/h.cameraToCenterDistance;ie=yt,ge=yt*_e(h.center.lat,K)}else if(h.projection.name==="globe"){const Ze=cL(p,h),yt=[0,0,0,1];ot(yt,yt,M([],h.projMatrix,Ze));const ht=yt[3]/h.cameraToCenterDistance,jt=E0(K),Et=h.projection.pixelsPerMeter(x.lat,Ce)*_e(x.lat,K),Dt=h.projection.pixelsPerMeter(h.center.lat,Ce)*_e(h.center.lat,K);ie=ht/Hs(Et,ke(h.center.lat),jt),ge=ht*ee/Et,ie*=Dt,ge*=Dt}}else ie=re;F(p,p,[ie,ie,ge]);const Ne=[...p],Fe=c.orientation,Be=[];if(G_e(Be,[Fe[0]+(_?_[0]:0),Fe[1]+(_?_[1]:0),Fe[2]+(_?_[2]:0)],C),M(p,Ne,Be),L&&h.elevation){let Ze=0;const yt=[];if(z&&h.elevation){Ze=function(jt,Et,Dt,tr,$t){const or=Et.elevation;if(!or)return 0;const mr=js.projectAabbCorners(Dt,tr),pr=J(1,$t.lat)*Et.worldSize,wr=function(as,xs){const In=[0,0,1],Er=[{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 ys of Er){const tn=as[ys.corners[0]],ra=as[ys.corners[1]],oa=as[ys.corners[2]],_n=[ra[0]-tn[0],ra[1]-tn[1],xs*(ra[2]-tn[2])],Xa=It(_n,_n,[oa[0]-tn[0],oa[1]-tn[1],xs*(oa[2]-tn[2])]);Ie(Xa,Xa),ys.dotProductWithUp=et(Xa,In)}return Er.sort((ys,tn)=>ys.dotProductWithUp-tn.dotProductWithUp),Er[0].corners}(mr,pr),kr=mr[wr[0]],xr=mr[wr[1]],_r=mr[wr[2]],ir=mr[wr[3]],sr=or.getAtPointOrZero(new He(kr[0]/Et.worldSize,kr[1]/Et.worldSize),0),br=or.getAtPointOrZero(new He(xr[0]/Et.worldSize,xr[1]/Et.worldSize),0),zr=or.getAtPointOrZero(new He(_r[0]/Et.worldSize,_r[1]/Et.worldSize),0),Ar=or.getAtPointOrZero(new He(ir[0]/Et.worldSize,ir[1]/Et.worldSize),0),Ns=(sr+Ar)/2,Jr=(br+zr)/2;return Ns>Jr?br=c.gl.NEAREST_MIPMAP_NEAREST}),p.uploaded=!0,p.image=null)}function CWe(p,c,h){p.indexBuffer=c.createIndexBuffer(p.indexArray,!1,!0),p.vertexBuffer=c.createVertexBuffer(p.vertexArray,_We.members,!1,!0),p.normalArray&&(p.normalBuffer=c.createVertexBuffer(p.normalArray,kWe.members,!1,!0)),p.texcoordArray&&(p.texcoordBuffer=c.createVertexBuffer(p.texcoordArray,jWe.members,!1,!0)),p.colorArray&&(p.colorBuffer=c.createVertexBuffer(p.colorArray,(p.colorArray.bytesPerElement===12?bWe:wWe).members,!1,!0)),p.featureArray&&(p.pbrBuffer=c.createVertexBuffer(p.featureArray,SWe.members,!0)),p.segments=Yi.simpleSegment(0,0,p.vertexArray.length,p.indexArray.length);const x=p.material;x.pbrMetallicRoughness.baseColorTexture&&OM(x.pbrMetallicRoughness.baseColorTexture,c),x.pbrMetallicRoughness.metallicRoughnessTexture&&OM(x.pbrMetallicRoughness.metallicRoughnessTexture,c),x.normalTexture&&OM(x.normalTexture,c),x.occlusionTexture&&OM(x.occlusionTexture,c,h),x.emissionTexture&&OM(x.emissionTexture,c)}function tle(p,c,h){if(p.meshes)for(const x of p.meshes)CWe(x,c,h);if(p.children)for(const x of p.children)tle(x,c,h)}function uL(p){if(p.meshes)for(const c of p.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(p.children)for(const c of p.children)uL(c)}function rle(p){if(p.meshes)for(const h of p.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(p.children)for(const h of p.children)rle(h)}function S_(p,c){const h=p.json.bufferViews[c.bufferView],x=aL[c.componentType];return new x(p.buffers[h.buffer],(c.byteOffset||0)+(h.byteOffset||0),c.count*(h.byteStride&&h.byteStride!==PM[c.type]*x.BYTES_PER_ELEMENT?h.byteStride/x.BYTES_PER_ELEMENT:PM[c.type]))}function sle(p,c,h,x){const _=aL[c.componentType],C=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}}(_),T=p.json.bufferViews[c.bufferView],L=T.byteStride?T.byteStride/_.BYTES_PER_ELEMENT:PM[c.type],z=h.float32,q=z.length/h.capacity;for(let K=0,Y=0;K0){for(let Ce=0;Ce0){C.texcoordArray=new Hm;const ee=c.json.accessors[_.TEXCOORD_0];C.texcoordArray.resize(ee.count);const re=S_(c,ee);sle(c,ee,C.texcoordArray,re)}if(_._FEATURE_ID_RGBA4444!==void 0){const ee=c.json.accessors[_._FEATURE_ID_RGBA4444];c.json.extensionsUsed&&c.json.extensionsUsed.includes("EXT_meshopt_compression")&&(C.featureData=S_(c,ee))}_._FEATURE_RGBA4444!==void 0&&(C.featureData=new Uint32Array(S_(c,c.json.accessors[_._FEATURE_RGBA4444]).buffer));const Y=p.material;return C.material=function(ee,re){const{emissiveFactor:ie=[0,0,0],alphaMode:ge="OPAQUE",alphaCutoff:Ce=.5,normalTexture:Ne,occlusionTexture:Fe,emissiveTexture:Be,doubleSided:Ze,name:yt}=ee,{baseColorFactor:ht=[1,1,1,1],metallicFactor:jt=1,roughnessFactor:Et=1,baseColorTexture:Dt,metallicRoughnessTexture:tr}=ee.pbrMetallicRoughness||{},$t=Fe?re[Fe.index]:void 0;if(Fe&&Fe.extensions&&Fe.extensions.KHR_texture_transform&&$t){const or=Fe.extensions.KHR_texture_transform;$t.offsetScale=[or.offset[0],or.offset[1],or.scale[0],or.scale[1]]}return{name:yt,pbrMetallicRoughness:{baseColorFactor:new Ma(...ht),metallicFactor:jt,roughnessFactor:Et,baseColorTexture:Dt?re[Dt.index]:void 0,metallicRoughnessTexture:tr?re[tr.index]:void 0},doubleSided:Ze,emissiveFactor:new Ma(...ie),alphaMode:ge,alphaCutoff:Ce,normalTexture:Ne?re[Ne.index]:void 0,occlusionTexture:$t,emissionTexture:Be?re[Be.index]:void 0,defined:ee.defined===void 0}}(Y!==void 0?c.json.materials[Y]:{defined:!1},h),C}function Z_e(p,c,h){const{matrix:x,rotation:_,translation:C,scale:T,mesh:L,extras:z,children:q,name:K}=p,Y={};if(Y.name=K,Y.localMatrix=x||function(ee,re,ie,ge){var Ce=re[0],Ne=re[1],Fe=re[2],Be=re[3],Ze=Ce+Ce,yt=Ne+Ne,ht=Fe+Fe,jt=Ce*Ze,Et=Ce*yt,Dt=Ce*ht,tr=Ne*yt,$t=Ne*ht,or=Fe*ht,mr=Be*Ze,pr=Be*yt,wr=Be*ht,kr=ge[0],xr=ge[1],_r=ge[2];return ee[0]=(1-(tr+or))*kr,ee[1]=(Et+wr)*kr,ee[2]=(Dt-pr)*kr,ee[3]=0,ee[4]=(Et-wr)*xr,ee[5]=(1-(jt+or))*xr,ee[6]=($t+mr)*xr,ee[7]=0,ee[8]=(Dt+pr)*_r,ee[9]=($t-mr)*_r,ee[10]=(1-(jt+tr))*_r,ee[11]=0,ee[12]=ie[0],ee[13]=ie[1],ee[14]=ie[2],ee[15]=1,ee}([],_||[0,0,0,1],C||[0,0,0],T||[1,1,1]),Y.globalMatrix=j(Y.localMatrix),L!==void 0){Y.meshes=h[L];const ee=Y.anchor=[0,0];for(const re of Y.meshes){const{min:ie,max:ge}=re.aabb;ee[0]+=ie[0]+ge[0],ee[1]+=ie[1]+ge[1]}ee[0]=Math.floor(ee[0]/Y.meshes.length/2),ee[1]=Math.floor(ee[1]/Y.meshes.length/2)}if(z&&(z.id&&(Y.id=z.id),z.lights&&(Y.lights=function(ee){if(!ee.length)return[];const re=function(Fe){const Be=atob(Fe),Ze=new Uint8Array(Be.length);for(let yt=0;yt1&&x[x.length-1].equals(x[0])&&x.pop();let _=0;for(let T=0;T0&&x.reverse();const C=c4(x.flatMap(T=>[T.x,T.y]),[]);return C.length===0?null:{vertices:x,indices:C}}function EWe(p,c){const h=[],x=[];let _=0;const C=[];for(const T of p){_=h.length;const L=T.vertexArray.float32,z=T.indexArray.uint16;for(let q=0;q0&&([x[T+1],x[T+2]]=[x[T+2],x[T+1]])}return{vertices:h,indices:x}}function nle(p){const c=function(z,q){const K=[],Y=WebGL2RenderingContext;if(z.json.textures)for(const ee of z.json.textures){const re={magFilter:Y.LINEAR,minFilter:Y.NEAREST,wrapS:Y.REPEAT,wrapT:Y.REPEAT};ee.sampler!==void 0&&Object.assign(re,z.json.samplers[ee.sampler]),K.push({image:q[ee.source],sampler:re,uploaded:!1})}return K}(p,p.images),h=function(z,q){const K=[];for(const Y of z.json.meshes){const ee=[];for(const re of Y.primitives)ee.push(MWe(re,z,q));K.push(ee)}return K}(p,c),{scenes:x,scene:_,nodes:C}=p.json,T=x?x[_||0].nodes:[...C.keys()],L=[];for(const z of T)L.push(Z_e(C[z],p,h));return function(z,q,K){const Y={},ee=new Set;for(let re=0;re0){const re=Array.from(ee.values()).sort((ie,ge)=>ie-ge);for(let ie=re.length-1;ie>=0;ie--)z.splice(re[ie],1)}}(L,T,p.json.nodes),L}function IWe(p){p.heightmap=new Float32Array(4096),p.heightmap.fill(-1);const c=p.vertexArray.float32,h=p.aabb.min[0]-1,x=p.aabb.min[1]-1,_=N_/(p.aabb.max[0]-h+2),C=N_/(p.aabb.max[1]-x+2);for(let T=0;Tp.heightmap[q*N_+z]&&(p.heightmap[q*N_+z]=L)}}function Y_e(p,c,h,x,_){h.reserve(h.length+4*p.length),x.reserve(x.length+10*p.length),_.reserve(_.length+10*p.length);let C=x.length;for(const T of p){const L=Math.min(10,Math.max(4,1.3*T.height))*c,z=[-T.normal[1],T.normal[0],0],q=Math.min(.29,.1*T.width/T.depth),K=T.width-2*T.depth*c*(q+.01),Y=tt([],T.pos,z,K/2),ee=tt([],T.pos,z,-K/2),re=[Y[0],Y[1],Y[2]+T.height],ie=[ee[0],ee[1],ee[2]+T.height],ge=tt([],T.normal,z,q);ve(ge,ge,L);const Ce=tt([],T.normal,z,-q);ve(Ce,Ce,L),ue(ge,Y,ge),ue(Ce,ee,Ce),Y[2]+=.1,ee[2]+=.1,x.emplaceBack(ge[0],ge[1],ge[2]),x.emplaceBack(Ce[0],Ce[1],Ce[2]),x.emplaceBack(Y[0],Y[1],Y[2]),x.emplaceBack(ee[0],ee[1],ee[2]),x.emplaceBack(re[0],re[1],re[2]),x.emplaceBack(ie[0],ie[1],ie[2]),x.emplaceBack(Y[0],Y[1],Y[2]),x.emplaceBack(ee[0],ee[1],ee[2]),x.emplaceBack(ge[0],ge[1],ge[2]),x.emplaceBack(Ce[0],Ce[1],Ce[2]);const Ne=K/L/2;_.emplaceBack(-Ne-q,-1,Ne,.8),_.emplaceBack(Ne+q,-1,Ne,.8),_.emplaceBack(-Ne,0,Ne,1.3),_.emplaceBack(Ne,0,Ne,1.3),_.emplaceBack(Ne+q,-.8,Ne,.7),_.emplaceBack(Ne+q,-.8,Ne,.7),_.emplaceBack(0,0,Ne,1.3),_.emplaceBack(0,0,Ne,1.3),_.emplaceBack(Ne+q,-1.2,Ne,.8),_.emplaceBack(Ne+q,-1.2,Ne,.8),h.emplaceBack(6+C,4+C,8+C),h.emplaceBack(7+C,9+C,5+C),h.emplaceBack(0+C,1+C,2+C),h.emplaceBack(1+C,3+C,2+C),C+=10}}function PWe(p,c){const h={};h.indexArray=new el,h.vertexArray=new Bu,h.colorArray=new gg,Y_e(p,c,h.indexArray,h.vertexArray,h.colorArray);const x={defined:!0};x.emissiveFactor=Ma.black;const _={};return _.baseColorFactor=Ma.white,x.pbrMetallicRoughness=_,h.material=x,h.aabb=new js([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),h}const X_e=Kn([{name:"a_pos_3f",components:3,type:"Float32"}]),LWe=Kn([{name:"a_normal_3",components:3,type:"Int16"}]),OWe=Kn([{name:"a_centroid_3",components:3,type:"Int16"}]),Q_e=Kn([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),DWe=Kn([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),RWe=Kn([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),FWe=Kn([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),zWe=Kn([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),BWe=Kn([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),J_e=zt.types,hL=32767;function $We(p,c){const h=Rr+c;for(const x of p)for(const _ of x)if(_.x<-c||_.x>h||_.y<-c||_.y>h)return!1;return!0}function UWe(p){switch(p){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: ${p}`)}}class ale{constructor(){this.layoutVertexArray=new Bu,this.layoutAttenuationArray=new gg,this.layoutColorArray=new $u,this.indexArray=new el,this.indexArrayForConflation=new el,this.segmentsBucket=new Yi}}class ile{constructor(c){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new Yi,this.entranceBloom=new ale;const h=66560;this.layoutVertexArray=new Bu,this.layoutVertexArray.reserve(h),this.layoutNormalArray=new w0,this.layoutNormalArray.reserve(h),this.layoutCentroidArray=new w0,this.layoutCentroidArray.reserve(h),this.layoutColorArray=new $u,this.layoutColorArray.reserve(h),this.layoutFloodLightDataArray=new xg,this.layoutFloodLightDataArray.reserve(h),this.layoutAOArray=new XN,this.layoutAOArray.reserve(h),this.indexArray=new el,this.indexArray.reserve(66560),this.indexArrayForConflation=new el,this.segmentsBucket=new Yi,this.entranceBloom=new ale,c&&(this.layoutFacadePaintArray=new $u,this.layoutFacadeDataArray=new Ix,this.layoutFacadeVerticalRangeArray=new $u)}reserve(c,h,x){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),x&&(this.layoutFacadePaintArray.reserveForAdditional(c),this.layoutFacadeDataArray.reserveForAdditional(c),this.layoutFacadeVerticalRangeArray.reserveForAdditional(c))}}class ebe{constructor(c){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new Hm,this.footprintsIndices=new xg,this.footprintsMin=new dr(1/0,1/0),this.footprintsMax=new dr(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new ile(!1),this.buildingWithFacade=new ile(!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 tm(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 Uoe(c),this.groundEffect.groundRadiusArray=new Wp,this.hasAppearances=null}updateFootprints(c,h){const x=new X6([],[],1),_={vertices:[],indices:new Uint32Array(0),grid:x,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};h.push({footprint:_,id:c})}updateAppearances(c,h,x,_){}prepare(){return function(){if(nL!=null||L_e!=null)return null;if(p4!=null)return p4;const c=fetch(qn.BUILDING_GEN_URL);return p4=function(h){let x,_,C,T,L;function z(){x=new Uint8Array(L.buffer),_=new Int16Array(L.buffer),C=new Int32Array(L.buffer),T=new Float32Array(L.buffer)}function q(){throw new Error("Unexpected BuildingGen error.")}const K=()=>{},Y={a:{a:q,f:function(ee){const re=x.length,ie=Math.max(ee>>>0,Math.ceil(1.2*re)),ge=Math.ceil((ie-re)/65536);try{return L.grow(ge),z(),!0}catch{return!1}},g:q,b:K,c:K,d:K,e:K}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(h,Y):h.then(ee=>ee.arrayBuffer()).then(ee=>WebAssembly.instantiate(ee,Y))).then(ee=>{const re=ee.instance.exports;return(0,re.g)(),L=re.f,z(),new mWe({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:x,heap16:_,heap32:C,heapF32:T})})}(c).then(h=>(p4=null,nL=h,nL)).catch(h=>{es("Could not load building-gen"),p4=null,L_e=h}),p4}()}populate(c,h,x,_){const C=pWe();if(!C)return;const T=De(x);this.tileToMeter=T,this.brightness=h.brightness,C.setStyle({normalScale:[1,-1,T],tileToMeters:T}),C.setAOOptions(!1,.3),C.setMetricOptions(!1,16),C.setStructuralOptions(!0),C.setFacadeClassifierOptions(3);const L=new Map,z=new Map;let q=0;for(const{feature:Ne}of c){if(J_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 gi(this.zoom),Ne,x))continue;const Be=Bt(Ne,Fe);if(!Fe&&!this.layers[0]._featureFilter.filter(new gi(this.zoom),Be,x))continue;const Ze=Fe?Be.geometry:Tt(Ne,x,_),yt=[];for(const Dt of Ze)for(const tr of Dt)yt.push(tr.x),yt.push(tr.y);const ht={coordinates:yt,crossPerc:Ne.properties.cross_perc,distanceToRoad:Ne.properties.distance_to_road,entrances:Ne.properties.entrances,sourceId:0},jt=Ne.properties.source_id;let Et=z.get(jt);Et||(Et=[],z.set(jt,Et)),Et.push(ht),++q}this.maxHeight=0;const K=new Array,Y=new Set,ee=Ne=>{Ne!=null&&Y.add(Ne)},re=(Ne,Fe)=>{Ne!=null&&K.push({buildingId:Ne,footprintIndex:Fe})},ie=64*(c.length-q),ge=ie/2;this.buildingWithFacade.reserve(ie,ge,!0),this.buildingWithoutFacade.reserve(2*ie,2*ge,!1),this.footprintsIndices.reserve(16*(c.length-q)),this.footprintsVertices.reserve(8*(c.length-q));for(const{feature:Ne,id:Fe,index:Be,sourceLayerIndex:Ze}of c){if(J_e[Ne.type]==="LineString")continue;const yt=this.layers[0]._featureFilter.needGeometry;if(yt&&!this.layers[0]._featureFilter.filter(new gi(this.zoom),Ne,x))continue;let ht=null;if(Ne.properties&&Ne.properties.hasOwnProperty("building_id")&&(ht=Ne.properties.building_id,Y.has(ht)))continue;const jt=Bt(Ne,yt);if(!yt&&!this.layers[0]._featureFilter.filter(new gi(this.zoom),jt,x))continue;const Et=yt?jt.geometry:Tt(Ne,x,_),Dt=kM(Et,500);let tr=!1;for(const zs of Dt)if(zs.length!==1){tr=!0;break}if(tr){ee(ht);continue}if(!$We(Et,163)){ee(ht);continue}const $t=this.layers[0],or=UWe($t.layout.get("building-roof-shape").evaluate(Ne,{},x)),mr=$t.layout.get("building-base").evaluate(Ne,{},x),pr=$t.layout.get("building-height").evaluate(Ne,{},x),wr=$t.layout.get("building-flood-light-ground-radius").evaluate(Ne,{},x),kr=$t.paint.get("building-ambient-occlusion-intensity"),xr=wr/this.tileToMeter;Ne.properties["building-part"]="roof";const _r=$t.paint.get("building-color").evaluate(Ne,{},this.canonical).toPremultipliedRenderColor(this.lut),ir=$t.paint.get("building-emissive-strength").evaluate(Ne,{},this.canonical);Ne.properties["building-part"]="wall";const sr=$t.paint.get("building-color").evaluate(Ne,{},this.canonical).toPremultipliedRenderColor(this.lut),br=$t.paint.get("building-emissive-strength").evaluate(Ne,{},this.canonical);Ne.properties["building-part"]="window";const zr=$t.paint.get("building-color").evaluate(Ne,{},this.canonical).toPremultipliedRenderColor(this.lut),Ar=$t.paint.get("building-emissive-strength").evaluate(Ne,{},this.canonical);Ne.properties["building-part"]="door";const Ns=$t.paint.get("building-color").evaluate(Ne,{},this.canonical).toPremultipliedRenderColor(this.lut),Jr=$t.paint.get("building-emissive-strength").evaluate(Ne,{},this.canonical);let as=$t.layout.get("building-flood-light-wall-radius").evaluate(Ne,{},x);as=ye(as,0,2048);const xs=as/2048*hL,In=L.get(Fe),Er=z.get(In)||[],ys=Er.length!==0&&$t.layout.get("building-facade").evaluate(Ne,{},x);C.setFacadeOptions(4,!0),C.setFauxFacadeOptions(ys,!1,1);let tn=0,ra=0,oa=0,_n=0,Xa=0,pt=0,vt=0,lr=0,jr=0,Zr=0,Yr=0;if(ys){let zs=Math.round($t.layout.get("building-facade-floors").evaluate(Ne,{},x));if(mr===0){zs=Math.max(1,zs-(Er.length>0?1:0));let Va=4;if(pr>100){const Pi=[10,13,15];Va=Pi[Ne.id?Ne.id%Pi.length:0]}else pr<=10&&(Va=3);C.setFacadeOptions(Va,!0),Xa=(pr<15?1.3:1.61803)*Va/T}else Xa=mr/T;pt=pr/T,Xa=Math.min(Xa,pt),oa=$t.layout.get("building-facade-unit-width").evaluate(Ne,{},x)/T,_n=(pt-Xa)/zs,C.setFauxFacadeOptions(!0,!0,oa);const Ji=$t.layout.get("building-facade-window").evaluate(Ne,{},x);tn=Ji[0],ra=Ji[1],vt=Math.floor(65535*Math.min(1,Xa/Rr)),lr=Math.floor(65535*Math.min(1,pt/Rr)),jr=Math.floor(255*tn)<<8|Math.floor(255*ra),Zr=Math.floor(65535*Math.min(1,oa/Rr)),Yr=Math.floor(65535*Math.min(1,_n/Rr))}const Cs=Array(Dt.length),Es={x:1/0,y:1/0},gn={x:-1/0,y:-1/0},kn={x:0,y:0};let Tn=0;for(let zs=0;zs0){const Va=[],Pi=Array(Ji.length+1);Pi[0]=0;for(let sl=0;slRr||Es.y<0||gn.y>Rr)&&this.featuresOnBorder.push({featureId:Ne.id,footprintIndex:this.footprints.length});{const zs=c4(ti,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+zs.length),this.footprintsIndices.uint16.set(zs,Fs),this.buildingIds.add(ht??Ne.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,di.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,di.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,xi.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,xi.y);const Ji={footprintVertexOffset:Yn,footprintVertexLength:this.footprintsVertices.length-Yn,footprintIndexOffset:Fs,footprintIndexLength:this.footprintsIndices.length-Fs,min:di,max:xi,hiddenFlags:0,indicesOffset:Da,indicesLength:Ui,bloomIndicesOffset:qa,bloomIndicesLength:ai,groundEffectVertexOffset:No,groundEffectVertexLength:mi,hasFauxFacade:ys,height:Nn,promoteId:Fe,feature:jt,parts:wa,buildingBloom:ja},Va=this.footprints.length;Ne.id!==void 0&&this.featureFootprintLookup.set(Ne.id,Va),re(ht,Va),this.footprints.push(Ji)}this.programConfigurations.populatePaintArrays(Bs.layoutVertexArray.length,Ne,Be,{},h.availableImages,x,h.brightness),this.groundEffect.addPaintPropertiesData(Ne,Be,{},h.availableImages,x,h.brightness),h.featureIndex.insert(Ne,Et,Be,Ze,this.index,Qa)}K.forEach(({buildingId:Ne,footprintIndex:Fe})=>{Y.has(Ne)&&(this.footprints[Fe].hiddenFlags|=4)});const Ce=new Set;this.buildingIds.forEach((Ne,Fe,Be)=>{Y.has(Ne)||Ce.add(Ne)}),this.buildingIds=Ce,this.groundEffect.prepareBorderSegments()}update(c,h,x,_,C,T,L){this.programConfigurations.updatePaintArrays(c,h,C,x,_,T,L),this.groundEffect.update(c,h,C,x,_,T,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=x=>{x.layoutVertexBuffer=c.createVertexBuffer(x.layoutVertexArray,X_e.members),x.layoutNormalBuffer=c.createVertexBuffer(x.layoutNormalArray,LWe.members),x.layoutCentroidBuffer=c.createVertexBuffer(x.layoutCentroidArray,OWe.members),x.layoutFloodLightDataBuffer=c.createVertexBuffer(x.layoutFloodLightDataArray,BWe.members),x.layoutFacadeDataArray&&x.layoutFacadeDataArray.length&&(x.layoutFacadeDataBuffer=c.createVertexBuffer(x.layoutFacadeDataArray,RWe.members)),x.layoutFacadeVerticalRangeArray&&x.layoutFacadeVerticalRangeArray.length&&(x.layoutFacadeVerticalRangeBuffer=c.createVertexBuffer(x.layoutFacadeVerticalRangeArray,FWe.members)),x.entranceBloom.layoutVertexArray.length&&(x.entranceBloom.layoutVertexBuffer=c.createVertexBuffer(x.entranceBloom.layoutVertexArray,X_e.members),x.entranceBloom.layoutAttenuationBuffer=c.createVertexBuffer(x.entranceBloom.layoutAttenuationArray,zWe.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,x=!0){let _=!1;const C=x?h:0,T=0|(x?-1:~h);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const L of c){const z=this.footprints[L],q=z.hiddenFlags&T|C;z.hiddenFlags!==q&&(z.hiddenFlags=q,_=!0,this.groundEffect.updateHiddenByLandmarkRange(z.groundEffectVertexOffset,z.groundEffectVertexLength,z.hiddenFlags!==0))}return _&&(this.indexArrayForConflationUploaded=!1),_}uploadUpdatedIndexBuffer(c){if(this.groundEffect.uploadHiddenByLandmark(c),this.indexArrayForConflationUploaded)return;const h=_=>{_.indexArray.length!==0&&(_.indexArrayForConflation.resize(_.indexArray.length),_.indexArrayForConflation.uint16.set(_.indexArray.uint16),_.entranceBloom.indexArrayForConflation.resize(_.entranceBloom.indexArray.length),_.entranceBloom.indexArrayForConflation.uint16.set(_.entranceBloom.indexArray.uint16))};h(this.buildingWithoutFacade),h(this.buildingWithFacade);for(const _ of this.footprints){const C=_.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,T=_.indicesOffset+_.indicesLength;if(_.hiddenFlags!==0){for(let z=_.indicesOffset;z{_.indexArray.length!==0&&(_.indexBuffer?_.indexBuffer.updateData(_.indexArrayForConflation):_.indexBuffer=c.createIndexBuffer(_.indexArrayForConflation,!0),_.entranceBloom.indexBuffer?_.entranceBloom.indexBuffer.updateData(_.entranceBloom.indexArrayForConflation):_.entranceBloom.indexBuffer=c.createIndexBuffer(_.entranceBloom.indexArrayForConflation,!0))};x(this.buildingWithoutFacade),x(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(c){const h=x=>{x.layoutColorBuffer?x.layoutColorBuffer.updateData(x.layoutColorArray):x.layoutColorBuffer=c.createVertexBuffer(x.layoutColorArray,Q_e.members,!0),x.layoutFacadePaintArray&&(x.layoutFacadePaintBuffer?x.layoutFacadePaintBuffer.updateData(x.layoutFacadePaintArray):x.layoutFacadePaintBuffer=c.createVertexBuffer(x.layoutFacadePaintArray,DWe.members,!0)),x.entranceBloom.layoutColorBuffer?x.entranceBloom.layoutColorBuffer.updateData(x.entranceBloom.layoutColorArray):x.entranceBloom.layoutColorBuffer=c.createVertexBuffer(x.entranceBloom.layoutColorArray,Q_e.members,!0)};h(this.buildingWithoutFacade),h(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(c,h){const x=c.paint.get("building-ambient-occlusion-intensity");for(const _ of this.footprints){if(4&_.hiddenFlags)continue;const C=h[_.promoteId],T=_.feature;T.properties["building-part"]="roof";const L=c.paint.get("building-color").evaluate(T,C,this.canonical).toPremultipliedRenderColor(this.lut),z=c.paint.get("building-emissive-strength").evaluate(T,C,this.canonical);T.properties["building-part"]="wall";const q=c.paint.get("building-color").evaluate(T,C,this.canonical).toPremultipliedRenderColor(this.lut),K=c.paint.get("building-emissive-strength").evaluate(T,C,this.canonical);T.properties["building-part"]="window";const Y=c.paint.get("building-color").evaluate(T,C,this.canonical).toPremultipliedRenderColor(this.lut),ee=c.paint.get("building-emissive-strength").evaluate(T,C,this.canonical);T.properties["building-part"]="door";const re=c.paint.get("building-color").evaluate(T,C,this.canonical).toPremultipliedRenderColor(this.lut),ie=c.paint.get("building-emissive-strength").evaluate(T,C,this.canonical),ge=_.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const Ne of _.parts){let Fe,Be=L;Ne.part===1?(Be=L,Fe=z):Ne.part===0?(Be=q,Fe=K):Ne.part===2?(Be=Y,Fe=ee):Ne.part===3&&(Be=re,Fe=ie),Fe=ye(Fe,0,1);for(let Ze=0;ZeT.max.x||z.max.xT.max.y||z.max.yL.max.x||L.min.x>c||h>L.max.y||L.min.y>h||L.height<=x||qWe(T,this.footprintsVertices.float32.subarray(2*L.footprintVertexOffset,2*(L.footprintVertexOffset+L.footprintVertexLength)),this.footprintsIndices.uint16.subarray(L.footprintIndexOffset,L.footprintIndexOffset+L.footprintIndexLength))&&(x=L.height,this.footprintLookup[C]=L,_=L.hiddenFlags!==0);if(x!==Number.NEGATIVE_INFINITY)return{height:x,hidden:_};this.footprintLookup[C]=void 0}}function qWe(p,c,h){for(let x=0;x1&&(z=c[++L]);const K=Math.abs(q-z.left),Y=Math.abs(q-z.right),ee=Math.min(K,Y);let re;const ie=C/x*(_+1);if(z.isDash){const ge=_-Math.abs(ie);re=Math.sqrt(ee*ee+ge*ge)}else re=_-Math.sqrt(ee*ee+ie*ie);this.image.data[T+q]=Math.max(0,Math.min(255,re+128))}}}addRegularDash(c,h){for(let z=c.length-1;z>=0;--z){const q=c[z],K=c[z+1];q.zeroLength?c.splice(z,1):K&&K.isDash===q.isDash&&(K.left=q.left,c.splice(z,1))}const x=c[0],_=c[c.length-1];x.isDash===_.isDash&&(x.left=_.left-this.width,_.right=x.right+this.width);const C=this.width*this.nextRow;let T=0,L=c[T];for(let z=0;z1&&(L=c[++T]);const q=Math.abs(z-L.left),K=Math.abs(z-L.right),Y=Math.min(q,K);this.image.data[C+z]=Math.max(0,Math.min(255,(L.isDash?Y:-Y)+h+128))}}addDash(c,h){const x=this.getKey(c,h);if(this.positions[x])return this.positions[x];const _=h==="round",C=_?7:0,T=2*C+1;if(this.nextRow+T>this.height)return es("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 VN,this.layoutVertexArray2=new Bu,this.patternVertexArray=new Bu,this.indexArray=new el,this.programConfigurations=new tm(c.layers,{zoom:c.zoom,lut:c.lut}),this.segments=new Yi,this.maxLineLength=0,this.zOffsetVertexArray=new Bu,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.tessellationStep=c.tessellationStep?c.tessellationStep:Rr/64,this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,h){}updateAppearances(c,h,x,_){}populate(c,h,x,_){this.hasPattern=Poe("line",this.layers,this.pixelRatio,h);const C=this.layers[0].layout.get("line-sort-key");this.tileToMeter=De(x);const T=this.layers[0].layout.get("line-elevation-reference");if(T==="hd-road-markup")this.elevationType="road";else{const ee=this.layers[0].layout.get("line-z-offset"),re=ee.isConstant()&&!ee.constantOr(0);this.elevationType=T!=="sea"&&T!=="ground"&&re?"none":"offset",this.elevationType==="offset"&&T==="none"&&es(`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 z=[];for(const{feature:ee,id:re,index:ie,sourceLayerIndex:ge}of c){const Ce=this.layers[0]._featureFilter.needGeometry,Ne=Bt(ee,Ce);if(!this.layers[0]._featureFilter.filter(new gi(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),Ne,x))continue;const Fe=C?C.evaluate(Ne,{},x):void 0,Be={id:re,properties:ee.properties,type:ee.type,sourceLayerIndex:ge,index:ie,geometry:Ce?Ne.geometry:Tt(ee,x,_),patterns:{},sortKey:Fe};z.push(Be)}C&&z.sort((ee,re)=>ee.sortKey-re.sortKey);const{lineAtlas:q,featureIndex:K}=h,Y=this.addConstantDashes(q);for(const ee of z){const{geometry:re,index:ie,sourceLayerIndex:ge}=ee;if(Y&&this.addFeatureDashes(ee,q),this.hasPattern){const Ce=Loe("line",this.layers,ee,this.zoom,this.pixelRatio,h);this.patternFeatures.push(Ce)}else this.addFeature(ee,re,ie,x,q.positions,h.availableImages,h.brightness,h.elevationFeatures);K.insert(c[ie].feature,re,ie,ge,this.index)}}addConstantDashes(c){let h=!1;for(const x of this.layers){const _=x.paint.get("line-dasharray").value,C=x.layout.get("line-cap").value;if(_.kind!=="constant"||C.kind!=="constant")h=!0;else{const T=C.value,L=_.value;if(!L)continue;c.addDash(L,T)}}return h}addFeatureDashes(c,h){const x=this.zoom;for(const _ of this.layers){const C=_.paint.get("line-dasharray").value,T=_.layout.get("line-cap").value;if(C.kind==="constant"&&T.kind==="constant")continue;let L,z;if(C.kind==="constant"){if(L=C.value,!L)continue}else L=C.evaluate({zoom:x},c);z=T.kind==="constant"?T.value:T.evaluate({zoom:x},c),h.addDash(L,z),c.patterns[_.id]=[h.getKey(L,z)]}}update(c,h,x,_,C,T,L,z){this.programConfigurations.updatePaintArrays(c,h,C,x,_,T,L,z)}addFeatures(c,h,x,_,C,T){for(const L of this.patternFeatures)this.addFeature(L,L.geometry,L.index,h,x,_,T,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,ZWe)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=c.createVertexBuffer(this.patternVertexArray,XWe)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=c.createVertexBuffer(this.zOffsetVertexArray,WWe.members,!0)),this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,GWe),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 x,_;if(h&&h>0?(x=`mapbox_clip_start_${h}`,_=`mapbox_clip_end_${h}`):(x="mapbox_clip_start",_="mapbox_clip_end"),c.properties&&c.properties.hasOwnProperty(x)&&c.properties.hasOwnProperty(_))return{start:+c.properties[x],end:+c.properties[_]}}addFeature(c,h,x,_,C,T,L,z){const q=this.layers[0].layout,K=q.get("line-join").evaluate(c,{}),Y=q.get("line-cap").evaluate(c,{}),ee=q.get("line-miter-limit"),re=q.get("line-round-limit");this.lineClips=this.lineFeatureClips(c),this.lineFeature=c;const ie=!(!c.properties||!c.properties.hasOwnProperty("mapbox_line_metrics"))&&c.properties.mapbox_line_metrics;this.zOffsetValue=q.get("line-z-offset").value;const ge=this.layers[0].paint.get("line-width").value;if(ge.kind!=="constant"&&ge.isLineProgressConstant===!1&&(this.variableWidthValue=ge),this.elevationType==="road"){const Ce=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(c,h,_,z,K,Y,ee,re)){const[Ne,Fe]=this.clipRuntimeLinesToTile(h,1);for(let Be=0;Be0?yt.parentIndex:null)}this.fillNonElevatedRoadSegment(Ce)}}else for(let Ce=0;Ce0?Ce:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,x,C,T,_,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 rL(c,-h,-h,Rr+h,Rr+h)}clipRuntimeLinesToTile(c,h){const x=[];return[rL(c,-h,-h,Rr+h,Rr+h,x),x]}addElevatedRoadFeature(c,h,x,_,C,T,L,z){const q=[],K=La.getElevationFeature(c,_);if(K){const Y=this.clipLinesToTile(h,1),ee=this.prepareElevatedLines(Y,K,x);for(const re of ee)q.push({geometry:re,elevation:K,elevationTileID:x,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(q.length===0)return!1;for(const Y of q){const ee=this.layoutVertexArray.length;this.addLine(Y.geometry,c,x,C,T,L,z);const re=new Za(x,Y.elevationTileID);if(Y.elevation)for(let ie=ee;ie>1,this.layoutVertexArray.int16[6*ie+1]>>1),Ce=re.pointElevation(ge,Y.elevation,.05);this.updateHeightRange(Ce),this.zOffsetVertexArray.emplaceBack(Ce,0,0)}else this.fillNonElevatedRoadSegment(ee)}return!0}prepareElevatedLines(c,h,x){if(h.constantHeight!=null)return c;const _=[],C=1/De(x);for(const T of c)dWe(T,new ba(h,C),0,_);return _}fillNonElevatedRoadSegment(c){for(let h=c;h0,ee=z&&z.progress.max<1;if(this.lineClips){let Dt={min:this.lineClips.start,max:this.lineClips.end},tr=1;if(z){const mr=this.lineClips.end-this.lineClips.start;Dt=function(pr,wr,kr){return{min:Ya(pr.min,wr,kr),max:Ya(pr.max,wr,kr)}}(z.progress,{min:0,max:1},Dt),mr>0&&(tr=(Dt.max-Dt.min)/mr)}const $t=+h.properties.mapbox_clip_feature_len,or=+h.properties.mapbox_clip_seg_len;if(Number.isNaN($t)||Number.isNaN(or)){for(let pr=0;pr=2&&c[ie-1].equals(c[ie-2]);)ie--;let ge=0;for(;ge0,ir=this.overscaling<=16?15*Rr/(512*this.overscaling):0;if(tr&&$t==="round"){if(wrT&&($t="bevel"),$t==="bevel"&&(wr>2&&($t="flipbevel"),wr2*ir){const zr=Ne.sub(Ne.sub(Fe)._mult(ir/sr)._round());this.updateDistance(Fe,zr),this.addCurrentVertex(zr,Ze,0,0,Ce,Et),Fe=zr}this.updateDistance(Fe,Ne),mr._mult(wr),this.addCurrentVertex(Ne,mr,0,0,Ce,Et);const br=Ne.dist(Be);if(br>2*ir){const zr=Ne.add(Be.sub(Ne)._mult(ir/br)._round());this.updateDistance(Ne,zr),this.addCurrentVertex(zr,yt,0,0,Ce,Et),Ne=zr}}else mr._mult(wr),this.addCurrentVertex(Ne,mr,0,0,Ce,Et);else if($t==="flipbevel"){if(wr>100)mr=yt.mult(-1);else{const sr=wr*Ze.add(yt).mag()/Ze.sub(yt).mag();mr._perp()._mult(sr*(_r?-1:1))}this.addCurrentVertex(Ne,mr,0,0,Ce,Et),this.addCurrentVertex(Ne,mr.mult(-1),0,0,Ce,Et)}else if($t==="bevel"||$t==="fakeround"){Et!=null&&Fe&&this.addCurrentVertex(Ne,jt||Ze,-1,-1,Ce,Et);const sr=Ne.dist(Fe)<=2*ir&&$t!=="bevel",br=mr.mult(_r?1:-1);br._mult(wr);const zr=yt.mult(_r?-1:1),Ar=Ze.mult(_r?-1:1),Ns=this.evaluateLineProgressFeatures(this.distance);if(Et==null&&(this.addHalfVertex(Ne,br.x,br.y,!1,!_r,0,Ce,Ns),sr||this.addHalfVertex(Ne,br.x+2*Ar.x,br.y+2*Ar.y,!1,_r,0,Ce,Ns)),$t==="fakeround"){const Jr=Math.round(180*kr/Math.PI/20);this.addHalfVertex(Ne,Ar.x,Ar.y,!1,_r,0,Ce,Ns);for(let as=0;as1){this.lineSoFar=c.w;const ge=(h.x-c.x)/Y,Ce=(h.y-c.y)/Y,Ne=(h.z-c.z)/Y,Fe=(h.w-c.w)/Y;for(let Be=1;Be=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,K),z.primitiveLength++),T?this.e2=K:this.e1=K,q!=null&&this.zOffsetVertexArray.emplaceBack(q.zOffset,q.variableWidth,q.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 lle(p,c,h){return p.xh||p.yh}let nbe,abe;function ibe(p,c,h){return c*(Rr/(p.tileSize*Math.pow(2,h-p.tileID.overscaledZ)))}hs(ole,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const obe=(p,c,h)=>(1-h)*p+h*c;function lbe(p,c){return 1/ibe(p,1,c.tileZoom)}function cbe(p,c,h,x){return p.translatePosMatrix(x||c.tileID.projMatrix,c,h.paint.get("line-translate"),h.paint.get("line-translate-anchor"))}const dbe=p=>{const c=[];ube(p)&&c.push("RENDER_LINE_DASH"),p.paint.get("line-gradient")&&c.push("RENDER_LINE_GRADIENT");const h=p.paint.get("line-trim-offset");h[0]===0&&h[1]===0||c.push("RENDER_LINE_TRIM_OFFSET"),p.paint.get("line-border-width").constantOr(1)!==0&&c.push("RENDER_LINE_BORDER");const x=p.layout.get("line-join").constantOr("miter")==="none",_=!!p.paint.get("line-pattern").constantOr(1);return x&&_&&c.push("LINE_JOIN_NONE"),c};function ube(p){const c=p.paint.get("line-dasharray").value;return c.kind!=="constant"||c.value}let cle;const hbe=()=>cle||(cle={layout:nbe||(nbe=new lo({"line-cap":new Wr(Vt.layout_line["line-cap"]),"line-join":new Wr(Vt.layout_line["line-join"]),"line-miter-limit":new Pr(Vt.layout_line["line-miter-limit"]),"line-round-limit":new Pr(Vt.layout_line["line-round-limit"]),"line-sort-key":new Wr(Vt.layout_line["line-sort-key"]),"line-z-offset":new Wr(Vt.layout_line["line-z-offset"]),"line-elevation-reference":new Pr(Vt.layout_line["line-elevation-reference"]),"line-cross-slope":new Pr(Vt.layout_line["line-cross-slope"]),visibility:new Pr(Vt.layout_line.visibility),"line-width-unit":new Pr(Vt.layout_line["line-width-unit"])})),paint:abe||(abe=new lo({"line-opacity":new Wr(Vt.paint_line["line-opacity"]),"line-color":new Wr(Vt.paint_line["line-color"]),"line-translate":new Pr(Vt.paint_line["line-translate"]),"line-translate-anchor":new Pr(Vt.paint_line["line-translate-anchor"]),"line-width":new Wr(Vt.paint_line["line-width"]),"line-gap-width":new Wr(Vt.paint_line["line-gap-width"]),"line-offset":new Wr(Vt.paint_line["line-offset"]),"line-blur":new Wr(Vt.paint_line["line-blur"]),"line-dasharray":new Wr(Vt.paint_line["line-dasharray"]),"line-pattern":new Wr(Vt.paint_line["line-pattern"]),"line-pattern-cross-fade":new Pr(Vt.paint_line["line-pattern-cross-fade"]),"line-gradient":new Tx(Vt.paint_line["line-gradient"]),"line-trim-offset":new Pr(Vt.paint_line["line-trim-offset"]),"line-trim-fade-range":new Pr(Vt.paint_line["line-trim-fade-range"]),"line-trim-color":new Pr(Vt.paint_line["line-trim-color"]),"line-emissive-strength":new Wr(Vt.paint_line["line-emissive-strength"]),"line-border-width":new Wr(Vt.paint_line["line-border-width"]),"line-border-color":new Wr(Vt.paint_line["line-border-color"]),"line-occlusion-opacity":new Pr(Vt.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Wr({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Wr({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Wr({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Wr({type:"string",default:"default","property-type":"data-driven"})}))},cle);class tGe extends Wr{possiblyEvaluate(c,h){return h=new gi(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,transition:h.transition,worldview:h.worldview}),super.possiblyEvaluate(c,h)}evaluate(c,h,x,_){return h=Object.assign({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(c,h,x,_)}}let DM;function mbe(p,c){return c>0?c+2*p:p}const rGe=Kn([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),sGe=Kn([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),nGe=Kn([{name:"a_projected_pos",components:4,type:"Float32"}],4);Kn([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const aGe=Kn([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),iGe=Kn([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),oGe=Kn([{name:"a_texb",components:2,type:"Uint16"}]),lGe=Kn([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),cGe=Kn([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);Kn([{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 pbe=Kn([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),dGe=Kn([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Kn([{name:"triangle",components:3,type:"Uint16"}]),Kn([{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"}]),Kn([{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"}]),Kn([{type:"Float32",name:"offsetX"}]),Kn([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var kl=24;function uGe(p,c,h){return p.sections.forEach(x=>{x.text=function(_,C,T){const L=C.layout.get("text-transform").evaluate(T,{});return L==="uppercase"?_=_.toLocaleUpperCase():L==="lowercase"&&(_=_.toLocaleLowerCase()),Hp.applyArabicShaping&&(_=Hp.applyArabicShaping(_)),_}(x.text,c,h)}),p}const RM={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function hGe(p){return p==="︶"||p==="﹈"||p==="︸"||p==="﹄"||p==="﹂"||p==="︾"||p==="︼"||p==="︺"||p==="︘"||p==="﹀"||p==="︐"||p==="︓"||p==="︔"||p==="`"||p===" ̄"||p==="︑"||p==="︒"}function mGe(p){return p==="︵"||p==="﹇"||p==="︷"||p==="﹃"||p==="﹁"||p==="︽"||p==="︻"||p==="︹"||p==="︗"||p==="︿"}const dle=4294967296,fbe=1/dle,gbe=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let mL=class{constructor(p=new Uint8Array(16)){this.buf=ArrayBuffer.isView(p)?p:new Uint8Array(p),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(p,c,h=this.length){for(;this.pos>3,C=this.pos;this.type=7&x,p(_,c,this),this.pos===C&&this.skip(x)}return c}readMessage(p,c){return this.readFields(p,c,this.readVarint()+this.pos)}readFixed32(){const p=this.dataView.getUint32(this.pos,!0);return this.pos+=4,p}readSFixed32(){const p=this.dataView.getInt32(this.pos,!0);return this.pos+=4,p}readFixed64(){const p=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*dle;return this.pos+=8,p}readSFixed64(){const p=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*dle;return this.pos+=8,p}readFloat(){const p=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,p}readDouble(){const p=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,p}readVarint(p){const c=this.buf;let h,x;return x=c[this.pos++],h=127&x,x<128?h:(x=c[this.pos++],h|=(127&x)<<7,x<128?h:(x=c[this.pos++],h|=(127&x)<<14,x<128?h:(x=c[this.pos++],h|=(127&x)<<21,x<128?h:(x=c[this.pos],h|=(15&x)<<28,function(_,C,T){const L=T.buf;let z,q;if(q=L[T.pos++],z=(112&q)>>4,q<128||(q=L[T.pos++],z|=(127&q)<<3,q<128)||(q=L[T.pos++],z|=(127&q)<<10,q<128)||(q=L[T.pos++],z|=(127&q)<<17,q<128)||(q=L[T.pos++],z|=(127&q)<<24,q<128)||(q=L[T.pos++],z|=(1&q)<<31,q<128))return g4(_,z,C);throw new Error("Expected varint not more than 10 bytes")}(h,p,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const p=this.readVarint();return p%2==1?(p+1)/-2:p/2}readBoolean(){return!!this.readVarint()}readString(){const p=this.readVarint()+this.pos,c=this.pos;return this.pos=p,p-c>=12&&gbe?gbe.decode(this.buf.subarray(c,p)):function(h,x,_){let C="",T=x;for(;T<_;){const L=h[T];let z,q,K,Y=null,ee=L>239?4:L>223?3:L>191?2:1;if(T+ee>_)break;ee===1?L<128&&(Y=L):ee===2?(z=h[T+1],(192&z)==128&&(Y=(31&L)<<6|63&z,Y<=127&&(Y=null))):ee===3?(z=h[T+1],q=h[T+2],(192&z)==128&&(192&q)==128&&(Y=(15&L)<<12|(63&z)<<6|63&q,(Y<=2047||Y>=55296&&Y<=57343)&&(Y=null))):ee===4&&(z=h[T+1],q=h[T+2],K=h[T+3],(192&z)==128&&(192&q)==128&&(192&K)==128&&(Y=(15&L)<<18|(63&z)<<12|(63&q)<<6|63&K,(Y<=65535||Y>=1114112)&&(Y=null))),Y===null?(Y=65533,ee=1):Y>65535&&(Y-=65536,C+=String.fromCharCode(Y>>>10&1023|55296),Y=56320|1023&Y),C+=String.fromCharCode(Y),T+=ee}return C}(this.buf,c,p)}readBytes(){const p=this.readVarint()+this.pos,c=this.buf.subarray(this.pos,p);return this.pos=p,c}readPackedVarint(p=[],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(p,c){this.writeVarint(p<<3|c)}realloc(p){let c=this.length||16;for(;c268435455||p<0?function(c,h){let x,_;if(c>=0?(x=c%4294967296|0,_=c/4294967296|0):(x=~(-c%4294967296),_=~(-c/4294967296),4294967295^x?x=x+1|0:(x=0,_=_+1|0)),c>=18446744073709552e3||c<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");h.realloc(10),function(C,T,L){L.buf[L.pos++]=127&C|128,C>>>=7,L.buf[L.pos++]=127&C|128,C>>>=7,L.buf[L.pos++]=127&C|128,C>>>=7,L.buf[L.pos++]=127&C|128,L.buf[L.pos]=127&(C>>>=7)}(x,0,h),function(C,T){const L=(7&C)<<4;T.buf[T.pos++]|=L|((C>>>=3)?128:0),C&&(T.buf[T.pos++]=127&C|((C>>>=7)?128:0),C&&(T.buf[T.pos++]=127&C|((C>>>=7)?128:0),C&&(T.buf[T.pos++]=127&C|((C>>>=7)?128:0),C&&(T.buf[T.pos++]=127&C|((C>>>=7)?128:0),C&&(T.buf[T.pos++]=127&C)))))}(_,h)}(p,this):(this.realloc(4),this.buf[this.pos++]=127&p|(p>127?128:0),p<=127||(this.buf[this.pos++]=127&(p>>>=7)|(p>127?128:0),p<=127||(this.buf[this.pos++]=127&(p>>>=7)|(p>127?128:0),p<=127||(this.buf[this.pos++]=p>>>7&127))))}writeSVarint(p){this.writeVarint(p<0?2*-p-1:2*p)}writeBoolean(p){this.writeVarint(+p)}writeString(p){p=String(p),this.realloc(4*p.length),this.pos++;const c=this.pos;this.pos=function(x,_,C){for(let T,L,z=0;z<_.length;z++){if(T=_.charCodeAt(z),T>55295&&T<57344){if(!L){T>56319||z+1===_.length?(x[C++]=239,x[C++]=191,x[C++]=189):L=T;continue}if(T<56320){x[C++]=239,x[C++]=191,x[C++]=189,L=T;continue}T=L-55296<<10|T-56320|65536,L=null}else L&&(x[C++]=239,x[C++]=191,x[C++]=189,L=null);T<128?x[C++]=T:(T<2048?x[C++]=T>>6|192:(T<65536?x[C++]=T>>12|224:(x[C++]=T>>18|240,x[C++]=T>>12&63|128),x[C++]=T>>6&63|128),x[C++]=63&T|128)}return C}(this.buf,p,this.pos);const h=this.pos-c;h>=128&&xbe(c,h,this),this.pos=c-1,this.writeVarint(h),this.pos+=h}writeFloat(p){this.realloc(4),this.dataView.setFloat32(this.pos,p,!0),this.pos+=4}writeDouble(p){this.realloc(8),this.dataView.setFloat64(this.pos,p,!0),this.pos+=8}writeBytes(p){const c=p.length;this.writeVarint(c),this.realloc(c);for(let h=0;h=128&&xbe(h,x,this),this.pos=h-1,this.writeVarint(x),this.pos+=x}writeMessage(p,c,h){this.writeTag(p,2),this.writeRawMessage(c,h)}writePackedVarint(p,c){c.length&&this.writeMessage(p,pGe,c)}writePackedSVarint(p,c){c.length&&this.writeMessage(p,fGe,c)}writePackedBoolean(p,c){c.length&&this.writeMessage(p,yGe,c)}writePackedFloat(p,c){c.length&&this.writeMessage(p,gGe,c)}writePackedDouble(p,c){c.length&&this.writeMessage(p,xGe,c)}writePackedFixed32(p,c){c.length&&this.writeMessage(p,vGe,c)}writePackedSFixed32(p,c){c.length&&this.writeMessage(p,_Ge,c)}writePackedFixed64(p,c){c.length&&this.writeMessage(p,bGe,c)}writePackedSFixed64(p,c){c.length&&this.writeMessage(p,wGe,c)}writeBytesField(p,c){this.writeTag(p,2),this.writeBytes(c)}writeFixed32Field(p,c){this.writeTag(p,5),this.writeFixed32(c)}writeSFixed32Field(p,c){this.writeTag(p,5),this.writeSFixed32(c)}writeFixed64Field(p,c){this.writeTag(p,1),this.writeFixed64(c)}writeSFixed64Field(p,c){this.writeTag(p,1),this.writeSFixed64(c)}writeVarintField(p,c){this.writeTag(p,0),this.writeVarint(c)}writeSVarintField(p,c){this.writeTag(p,0),this.writeSVarint(c)}writeStringField(p,c){this.writeTag(p,2),this.writeString(c)}writeFloatField(p,c){this.writeTag(p,5),this.writeFloat(c)}writeDoubleField(p,c){this.writeTag(p,1),this.writeDouble(c)}writeBooleanField(p,c){this.writeVarintField(p,+c)}};function g4(p,c,h){return h?4294967296*c+(p>>>0):4294967296*(c>>>0)+(p>>>0)}function xbe(p,c,h){const x=c<=16383?1:c<=2097151?2:c<=268435455?3:Math.floor(Math.log(c)/(7*Math.LN2));h.realloc(x);for(let _=h.pos-1;_>=p;_--)h.buf[_+x]=h.buf[_]}function pGe(p,c){for(let h=0;h=0&&x>=c&&pL[this.text.charCodeAt(x)];x--)h--;this.text=this.text.substring(c,h),this.sectionIndex=this.sectionIndex.slice(c,h)}substring(c,h){const x=new x4;return x.text=this.text.substring(c,h),x.sectionIndex=this.sectionIndex.slice(c,h),x.sections=this.sections,x}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(FM.forText(c.scale,c.fontStack||h));const x=this.sections.length-1;for(let _=0;_=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function hle(p,c,h,x,_,C,T,L,z,q,K,Y,ee,re,ie,ge=1){const Ce=x4.fromFeature(p,_,ge);Y===Vu.vertical&&Ce.verticalizePunctuation(ee);let Ne=[];const Fe=function(jt,Et,Dt,tr,$t,or){if(!jt)return[];const mr=[],pr=function(_r,ir,sr,br,zr,Ar){let Ns=0;for(let Jr=0;Jr<_r.length();Jr++){const as=_r.getSection(Jr);Ns+=vbe(_r.getCodePoint(Jr),as,br,zr,ir,Ar)}return Ns/Math.max(1,Math.ceil(Ns/sr))}(jt,Et,Dt,tr,$t,or),wr=jt.text.indexOf("​")>=0;let kr=0;for(let _r=0;_r0&&ja>_n&&(_n=ja)}else{const xa=Dt[jr.fontStack];if(!xa)continue;xa[Yr]&&(gn=xa[Yr]);const wa=Et[jr.fontStack];if(!wa)continue;const ja=wa.glyphs[Yr];if(!ja)continue;if(Es=ja.metrics,Tn=Yr!==8203?kl:0,Ar){const qa=wa.ascender!==void 0?Math.abs(wa.ascender):0,ai=wa.descender!==void 0?Math.abs(wa.descender):0,Qa=(qa+ai)*Cs;Xa-h/2;){if(T--,T<0)return!1;L-=p[T].dist(C),C=p[T]}L+=p[T].dist(p[T+1]),T++;const z=[];let q=0;for(;Lx;)q-=z.shift().angleDelta;if(q>_)return!1;T++,L+=K.dist(Y)}return!0}function Mbe(p){let c=0;for(let h=0;hq){const ie=(q-z)/re,ge=Hs(Y.x,ee.x,ie),Ce=Hs(Y.y,ee.y,ie),Ne=new Rx(ge,Ce,0,ee.angleTo(Y),K);return!T||Cbe(p,Ne,L,T,c)?Ne:void 0}z+=re}}function TGe(p,c,h,x,_,C,T,L,z){const q=Tbe(x,C,T),K=Abe(x,_),Y=K*T,ee=p[0].x===0||p[0].x===z||p[0].y===0||p[0].y===z;return c-Y=0&&Ze=0&&yt=0&&ee+q<=K){const ht=new Rx(Ze,yt,0,Fe,ie);x&&!Cbe(p,ht,C,x,_)||re.push(ht)}}Y+=Ne}return L||re.length||T||(re=Ebe(p,Y/2,h,x,_,C,T,!0,z)),re}function Ibe(p){let c=0,h=0;for(const T of p)c+=T.w*T.h,h=Math.max(h,T.w);p.sort((T,L)=>L.h-T.h);const x=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(c/.95)),h),h:1/0}];let _=0,C=0;for(const T of p)for(let L=x.length-1;L>=0;L--){const z=x[L];if(!(T.w>z.w||T.h>z.h)){if(T.x=z.x,T.y=z.y,C=Math.max(C,T.y+T.h),_=Math.max(_,T.x+T.w),T.w===z.w&&T.h===z.h){const q=x.pop();q&&L1?ie-1:ie,Hc.copy(Y.data,q,{x:0,y:0},{x:ge,y:Ce},Y.data,x),Hc.copy(Y.data,q,{x:0,y:Fe-ie},{x:ge,y:Ce-ie},{width:Ne,height:ie},x),Hc.copy(Y.data,q,{x:0,y:0},{x:ge,y:Ce+Fe},{width:Ne,height:ie},x),Hc.copy(Y.data,q,{x:Ne-ie,y:0},{x:ge-ie,y:Ce},{width:ie,height:Fe},x),Hc.copy(Y.data,q,{x:0,y:0},{x:ge+Ne,y:Ce},{width:ie,height:Fe},x),Hc.copy(Y.data,q,{x:Ne-ie,y:Fe-ie},{x:ge-ie,y:Ce-ie},{width:ie,height:ie},x),Hc.copy(Y.data,q,{x:0,y:Fe-ie},{x:ge+Ne,y:Ce-ie},{width:ie,height:ie},x),Hc.copy(Y.data,q,{x:0,y:0},{x:ge+Ne,y:Ce+Fe},{width:ie,height:ie},x),Hc.copy(Y.data,q,{x:Ne-ie,y:0},{x:ge-ie,y:Ce+Fe},{width:ie,height:ie},x)}this.lut=x,this.image=q,this.iconPositions=_,this.patternPositions=C}addImages(c,h,x,_){for(const[C,T]of c.entries()){const{bin:L,imagePosition:z,imageVariant:q}=xle(C,T,x);h.set(C,z),_.push(L),T.hasRenderCallback&&this.haveRenderCallbacks.push(q.id)}}patchUpdatedImages(c,h,x){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(_=>c.hasImage(_,x)),c.dispatchRenderCallbacks(this.haveRenderCallbacks,x);for(const _ of c.getUpdatedImages(x)){for(const C of this.iconPositions.keys()){const T=Fp.parse(C);if(Ca.isEqual(T.id,_)){const L=c.getImage(_,x);this.patchUpdatedImage(this.iconPositions.get(C),L,h,null)}}for(const C of this.patternPositions.keys()){const T=Fp.parse(C);if(Ca.isEqual(T.id,_)){const L=c.getImage(_,x);this.patchUpdatedImage(this.patternPositions.get(C),L,h,this.lut)}}}}patchUpdatedImage(c,h,x,_=null){if(!c||!h||c.version===h.version)return;c.version=h.version;const[C,T]=c.tl,L=c.sdf;if(this.lut||L){const z={width:h.data.width,height:h.data.height},q=new Hc(z);Hc.copy(h.data,q,{x:0,y:0},{x:0,y:0},z,_,L),x.update(q,{position:{x:C,y:T}})}else x.update(h.data,{position:{x:C,y:T}})}}hs(zM,"ImagePosition"),hs(Pbe,"ImageAtlas");const BM=1e20;function Lbe(p,c,h,x,_,C,T,L,z){for(let q=c;q-1);z++,C[z]=L,T[z]=q,T[z+1]=BM}for(let L=0,z=0;L{let z=this.entries[C];z||(z=this.entries[C]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let q=z.glyphs[T];if(q!==void 0)return void L(null,{stack:C,id:T,glyph:q});if(q=this._tinySDF(z,C,T),q)return z.glyphs[T]=q,void L(null,{stack:C,id:T,glyph:q});const K=Math.floor(T/256);if(256*K>65535)return es("glyphs > 65535 not supported"),void L(null,{stack:C,id:T,glyph:q});if(z.ranges[K])return void L(null,{stack:C,id:T,glyph:q});let Y=z.requests[K];Y||(Y=z.requests[K]=[],_4.loadGlyphRange(C,K,_,this.requestManager,(ee,re)=>{if(re){z.ascender=re.ascender,z.descender=re.descender;for(const ie in re.glyphs)this._doesCharSupportLocalGlyph(+ie)||(z.glyphs[+ie]=re.glyphs[+ie]);z.ranges[K]=!0}for(const ie of Y)ie(ee,re);delete z.requests[K]})),Y.push((ee,re)=>{ee?L(ee):re&&L(null,{stack:C,id:T,glyph:re.glyphs[T]||null})})},(C,T)=>{if(C)h(C);else if(T){const L={};for(const{stack:z,id:q,glyph:K}of T)L[z]===void 0&&(L[z]={}),L[z].glyphs===void 0&&(L[z].glyphs={}),L[z].glyphs[q]=K&&{id:K.id,bitmap:K.bitmap.clone(),metrics:K.metrics},L[z].ascender=this.entries[z].ascender,L[z].descender=this.entries[z].descender;h(null,L)}})}_doesCharSupportLocalGlyph(c){return this.localGlyphMode!==yle.none&&(this.localGlyphMode===yle.all?!!this.localFontFamily:!!this.localFontFamily&&(Ds["CJK Unified Ideographs"](c)||Ds["Hangul Syllables"](c)||Ds.Hiragana(c)||Ds.Katakana(c)||Ds["CJK Symbols and Punctuation"](c)||Ds["CJK Unified Ideographs Extension A"](c)||Ds["CJK Unified Ideographs Extension B"](c)||Ds.Osage(c)))}_tinySDF(c,h,x){const _=this.localFontFamily;if(!_||!this._doesCharSupportLocalGlyph(x))return;let C=c.tinySDF;if(!C){let ge="400";/bold/i.test(h)?ge="900":/medium/i.test(h)?ge="500":/light/i.test(h)&&(ge="200"),C=c.tinySDF=new _4.TinySDF({fontFamily:_,fontWeight:ge,fontSize:24*rf,buffer:3*rf,radius:8*rf}),C.fontWeight=ge}if(this.localGlyphs[C.fontWeight][x])return this.localGlyphs[C.fontWeight][x];const T=String.fromCodePoint(x),{data:L,width:z,height:q,glyphWidth:K,glyphHeight:Y,glyphLeft:ee,glyphTop:re,glyphAdvance:ie}=C.draw(T);return this.localGlyphs[C.fontWeight][x]={id:x,bitmap:new I0({width:z,height:q},L),metrics:{width:K/rf,height:Y/rf,left:ee/rf,top:re/rf-27,advance:ie/rf,localGlyph:!0}}}}_4.loadGlyphRange=function(p,c,h,x,_){const C=256*c,T=C+255,L=x.transformRequest(x.normalizeGlyphsURL(h).replace("{fontstack}",p).replace("{range}",`${C}-${T}`),Rp.Glyphs);Ru(L,(z,q)=>{if(z)_(z);else if(q){const K={},Y=function(ee){return new mL(ee).readFields(jGe,{})}(q);for(const ee of Y.glyphs)K[ee.id]=ee;_(null,{glyphs:K,ascender:Y.ascender,descender:Y.descender})}})},_4.TinySDF=class{constructor({fontSize:p=24,buffer:c=3,radius:h=8,cutoff:x=.25,fontFamily:_="sans-serif",fontWeight:C="normal",fontStyle:T="normal",lang:L=null}={}){this.buffer=c,this.cutoff=x,this.radius=h,this.lang=L;const z=this.size=p+4*c,q=this._createCanvas(z),K=this.ctx=q.getContext("2d",{willReadFrequently:!0});K.font=`${T} ${C} ${p}px ${_}`,K.textBaseline="alphabetic",K.textAlign="left",K.fillStyle="black",this.gridOuter=new Float64Array(z*z),this.gridInner=new Float64Array(z*z),this.f=new Float64Array(z),this.z=new Float64Array(z+1),this.v=new Uint16Array(z)}_createCanvas(p){const c=document.createElement("canvas");return c.width=c.height=p,c}draw(p){const{width:c,actualBoundingBoxAscent:h,actualBoundingBoxDescent:x,actualBoundingBoxLeft:_,actualBoundingBoxRight:C}=this.ctx.measureText(p),T=Math.ceil(h),L=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(C-_))),z=Math.min(this.size-this.buffer,T+Math.ceil(x)),q=L+2*this.buffer,K=z+2*this.buffer,Y=Math.max(q*K,0),ee=new Uint8ClampedArray(Y),re={data:ee,width:q,height:K,glyphWidth:L,glyphHeight:z,glyphTop:T,glyphLeft:0,glyphAdvance:c};if(L===0||z===0)return re;const{ctx:ie,buffer:ge,gridInner:Ce,gridOuter:Ne}=this;this.lang&&(ie.lang=this.lang),ie.clearRect(ge,ge,L,z),ie.fillText(p,ge,ge+T);const Fe=ie.getImageData(ge,ge,L,z);Ne.fill(BM,0,Y),Ce.fill(0,0,Y);for(let Be=0;Be0?jt*jt:0,Ce[ht]=jt<0?jt*jt:0}}Lbe(Ne,0,0,q,K,q,this.f,this.v,this.z),Lbe(Ce,ge,ge,L,z,q,this.f,this.v,this.z);for(let Be=0;Be{const wr=xL($t.stretch-Fe,Be,K,p.left*_),kr=yL($t.fixed-ht,jt,$t.stretch,ie),xr=xL(or.stretch-Ze,yt,Y,p.top*_),_r=yL(or.fixed-Et,Dt,or.stretch,ge),ir=xL(mr.stretch-Fe,Be,K,p.left*_),sr=yL(mr.fixed-ht,jt,mr.stretch,ie),br=xL(pr.stretch-Ze,yt,Y,p.top*_),zr=yL(pr.fixed-Et,Dt,pr.stretch,ge),Ar=new dr(wr,xr),Ns=new dr(ir,xr),Jr=new dr(ir,br),as=new dr(wr,br),xs=new dr(kr/L,_r/L),In=new dr(sr/L,zr/L),Er=c*Math.PI/180;if(Er){const Xa=Math.sin(Er),pt=Math.cos(Er),vt=[pt,-Xa,Xa,pt];Ar._matMult(vt),Ns._matMult(vt),as._matMult(vt),Jr._matMult(vt)}const ys=$t.stretch+$t.fixed,tn=mr.stretch+mr.fixed,ra=or.stretch+or.fixed,oa=pr.stretch+pr.fixed,_n=p.imageSecondary;return{tl:Ar,tr:Ns,bl:as,br:Jr,texPrimary:{x:T.paddedRect.x+bg+ys,y:T.paddedRect.y+bg+ra,w:tn-ys,h:oa-ra},texSecondary:_n?{x:_n.paddedRect.x+bg+ys,y:_n.paddedRect.y+bg+ra,w:tn-ys,h:oa-ra}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:xs,pixelOffsetBR:In,minFontScaleX:jt/L/K,minFontScaleY:Dt/L/Y,isSDF:h}};if(x&&(T.stretchX||T.stretchY)){const $t=Rbe(ee,Ce,ie),or=Rbe(re,Ne,ge);for(let mr=0;mr<$t.length-1;mr++){const pr=$t[mr],wr=$t[mr+1];for(let kr=0;krC)&&(C=ie.x),(!re||ie.y>T)&&(T=ie.y)}const z=Math.min(C-x,T-_);let q=z/2;const K=new dN([],PGe);if(z===0)return new dr(x,_);for(let re=x;reY.d||!Y.d)&&(Y=re,h&&console.log("found best %d after %d probes",Math.round(1e4*re.d)/1e4,ee)),re.max-Y.d<=c||(q=re.h/2,K.push(new b4(re.p.x-q,re.p.y-q,q,p)),K.push(new b4(re.p.x+q,re.p.y-q,q,p)),K.push(new b4(re.p.x-q,re.p.y+q,q,p)),K.push(new b4(re.p.x+q,re.p.y+q,q,p)),ee+=4)}return h&&(console.log(`num probes: ${ee}`),console.log(`best distance: ${Y.d}`)),Y.p}function PGe(p,c){return c.max-p.max}class b4{constructor(c,h,x,_){this.p=new dr(c,h),this.h=x,this.d=function(C,T){let L=!1,z=1/0;for(let q=0;qC.y!=ge.y>C.y&&C.x<(ge.x-ie.x)*(C.y-ie.y)/(ge.y-ie.y)+ie.x&&(L=!L),z=Math.min(z,vo(C,ie,ge))}}return(L?1:-1)*Math.sqrt(z)}(this.p,_),this.max=this.d+this.h*Math.SQRT2}}const LGe=Object.keys,_le=Number.POSITIVE_INFINITY,OGe=Math.sqrt(2);function L0(p,c,h,x,_){const C=ple(p)&&p.collisionPadding?p.collisionPadding:[0,0,0,0],T={top:p.top-C[1],bottom:p.bottom+C[3],left:p.left-C[0],right:p.right+C[2],scaled:!1};return x!==void 0&&function(L,z){L.top*=z,L.bottom*=z,L.left*=z,L.right*=z,L.scaled=!0}(T,x),h&&function(L,z){if(!z)return;const q=Ys(z),K=new dr(L.left,L.top),Y=new dr(L.right,L.top),ee=new dr(L.left,L.bottom),re=new dr(L.right,L.bottom),ie=new dr(0,0);K._rotateAround(q,ie),Y._rotateAround(q,ie),ee._rotateAround(q,ie),re._rotateAround(q,ie),L.left=Math.min(K.x,Y.x,ee.x,re.x),L.right=Math.max(K.x,Y.x,ee.x,re.x),L.top=Math.min(K.y,Y.y,ee.y,re.y),L.bottom=Math.max(K.y,Y.y,ee.y,re.y)}(T,h),_&&(T.left+=_[0],T.right+=_[0],T.top+=_[1],T.bottom+=_[1]),c?{top:Math.min(c.top,T.top),bottom:Math.max(c.bottom,T.bottom),left:Math.min(c.left,T.left),right:Math.max(c.right,T.right),scaled:c.scaled||T.scaled}:T}function zbe(p,[c,h]){let x=0,_=0;if(h===_le){c<0&&(c=0);const C=c/OGe;switch(p){case"top-right":case"top-left":_=C-7;break;case"bottom-right":case"bottom-left":_=7-C;break;case"bottom":_=7-c;break;case"top":_=c-7}switch(p){case"top-right":case"bottom-right":x=-C;break;case"top-left":case"bottom-left":x=C;break;case"left":x=c;break;case"right":x=-c}}else{switch(c=Math.abs(c),h=Math.abs(h),p){case"top-right":case"top-left":case"top":_=h-7;break;case"bottom-right":case"bottom-left":case"bottom":_=7-h}switch(p){case"top-right":case"bottom-right":case"right":x=-c;break;case"top-left":case"bottom-left":case"left":x=c}}return[x,_]}function DGe(p,c,h,x,_,C,T,L,z,q,K,Y,ee,re){const ie=p.layers[0],ge=ie.appearances;if(ge.length===0)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const Ce={iconBBox:null,iconVerticalBBox:null},Ne={textBBox:null,textVerticalBBox:null},{baseIconRotate:Fe,baseTextRotate:Be,iconScaleFactor:Ze}=function(ht,jt,Et){const Dt=ht.get("icon-rotate").evaluate(jt,{},Et),tr=ht.get("text-rotate").evaluate(jt,{},Et),[$t,or]=ht.get("icon-size-scale-range");return{baseIconRotate:Dt,baseTextRotate:tr,iconScaleFactor:ye(1,$t,or)}}(x,_,C);c&&(Ce.iconBBox=L0(c,Ce.iconBBox,Fe,T),h)&&(Ce.iconVerticalBBox=L0(h,Ce.iconVerticalBBox,Fe+90,T));const yt=_L(Y.horizontal);yt&&(Ne.textBBox=L0(yt,Ne.textBBox,Be,1,re)),Y.vertical&&(Ne.textVerticalBBox=L0(Y.vertical,Ne.textVerticalBBox,Be+90,1,re));for(const ht of ge)ht.hasIconProperties()&&RGe(Ce,p,ie,ht,_,C,L,Fe,T,z,c,q,Ze,K),ht.hasTextProperties()&&FGe(Ne,ie,ht,_,C,re,Be,ee,yt,Y.vertical);return{iconBBox:Ce.iconBBox,iconVerticalBBox:Ce.iconVerticalBBox,textBBox:Ne.textBBox,textVerticalBBox:Ne.textVerticalBBox}}function RGe(p,c,h,x,_,C,T,L,z,q,K,Y,ee,re){const{appearanceIconOffset:ie,appearanceIconRotate:ge,appearanceIconSize:Ce}=function(Ze,yt,ht,jt,Et,Dt,tr,$t){const or=Ze.hasProperty("icon-offset")?yt.getAppearanceValueAndResolveTokens(Ze,"icon-offset",ht,jt,[]):null,mr=or&&Array.isArray(or)?or:Et,pr=Ze.hasProperty("icon-rotate")?yt.getAppearanceValueAndResolveTokens(Ze,"icon-rotate",ht,jt,[]):null,wr=typeof pr=="number"?pr:Dt,kr=Ze.hasProperty("icon-size")?yt.getAppearanceValueAndResolveTokens(Ze,"icon-size",ht,jt,[]):null;return{appearanceIconOffset:mr,appearanceIconRotate:wr,appearanceIconSize:typeof kr=="number"?kr*$t.iconScaleFactor:tr}}(x,h,_,C,T,L,z,q);let Ne=null,Fe=null,Be=null;x.hasProperty("icon-image")?Be=function(Ze,yt,ht,jt,Et,Dt,tr){let $t=null;const or=yt.getAppearanceValueAndResolveTokens(ht,"icon-image",jt,Et,[]);if(or){const mr=Ze.getResolvedImageFromTokens(or),pr=ht.getUnevaluatedProperty("icon-size"),wr=$M(mr,y4(Ze.zoom,pr,Ze.worldview),pr,Et,Ze.zoom,jt,Ze.pixelRatio,tr,Ze.worldview);$t=Dt.get(wr.iconPrimary.toString())}return $t}(c,h,x,_,C,Y,ee):K&&(Be=K.imagePrimary),Be&&(Ne=fL(Be,null,ie,re),c.allowVerticalPlacement&&(Fe=fL(Be,null,ie,re))),Ne&&(p.iconBBox=L0(Ne,p.iconBBox,ge,Ce)),Fe&&(p.iconVerticalBBox=L0(Fe,p.iconVerticalBBox,ge+90,Ce))}function FGe(p,c,h,x,_,C,T,L,z,q){const{appearanceTextOffset:K,appearanceTextRotate:Y,appearanceTextSize:ee}=function(ie,ge,Ce,Ne,Fe,Be,Ze){const yt=ie.hasProperty("text-offset")?ge.getAppearanceValueAndResolveTokens(ie,"text-offset",Ce,Ne,[]):null,ht=yt&&Array.isArray(yt)?[yt[0]*kl,yt[1]*kl]:Fe,jt=ie.hasProperty("text-rotate")?ge.getAppearanceValueAndResolveTokens(ie,"text-rotate",Ce,Ne,[]):null,Et=typeof jt=="number"?jt:Be,Dt=ie.hasProperty("text-size")?ge.getAppearanceValueAndResolveTokens(ie,"text-size",Ce,Ne,[]):null;return{appearanceTextOffset:ht,appearanceTextRotate:Et,appearanceTextSize:typeof Dt=="number"?Dt:Ze}}(h,c,x,_,C,T,L),re=ee/L;z&&(p.textBBox=L0(z,p.textBBox,Y,re,K)),q&&(p.textVerticalBBox=L0(q,p.textVerticalBBox,Y+90,re,K))}function vL(p,c,h,x,_,C,T,L,z){if(!c||!c.usvg)return;const q=Sbe(x),K=Sbe(_),Y=C!=="both"&&C!=="width"||!kbe(x)?1:K.width/q.width,ee=C!=="both"&&C!=="height"||!Nbe(x)?1:K.height/q.height;h.scaleSelf(Y,ee);const re=h.toString();T.set(re,h),L.set(re,c);const{imagePosition:ie}=xle(re,c,C_);z.set(re,ie)}function Bbe(p,c,h,x,_,C,T,L,z){if(!p)return;const q=function(K,Y,ee,re,ie,ge){if(K.kind==="camera")return K.maxSize;if(K.kind==="composite"){const Ce=Y.possiblyEvaluate(new gi(K.maxZoom,{worldview:ge}),ee).evaluate(ie,{},ee),Ne=Y.possiblyEvaluate(new gi(K.minZoom,{worldview:ge}),ee).evaluate(ie,{},ee);return Math.max(Ce,Ne)}return Y.possiblyEvaluate(new gi(re,{worldview:ge})).evaluate(ie,{},ee)}(c,h,x,_,C,z);return p.scaleSelf(q*L*T)}function $M(p,c,h,x,_,C,T,L,z){return{iconPrimary:Bbe(p.getPrimary(),c,h,x,_,C,T,L,z),iconSecondary:Bbe(p.getSecondary(),c,h,x,_,C,T,L,z)}}function zGe(p,c,h){if(!c)return;const x=h.get(p.toString()),_=h.get(c.toString());x&&_&&(x.paddedRect.w===_.paddedRect.w&&x.paddedRect.h===_.paddedRect.h||es(`Mismatch in icon variant sizes: ${p.toString()} and ${c.toString()}`),x.usvg!==_.usvg&&es(`Mismatch in icon variant image types: ${p.id} and ${c.id}`))}function $be(p,c,h,x){if(!p)return;const _=c.get(h.toString());if(p.imagePrimary=_,x){const C=c.get(x.toString());p.imageSecondary=C}}function BGe(p,c){for(const h in p.horizontal)Ube(p.horizontal[h],c);Ube(p.vertical,c)}function Ube(p,c){if(p){for(const h of p.positionedLines)for(const x of h.positionedGlyphs)if(x.image!==null){const _=x.image.toString();x.rect=c.get(_).paddedRect}}}function ble(p){switch(p){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function $Ge(p,c,h,x,_,C,T,L,z){const q=_L(C.horizontal)||C.vertical,K=h.get("icon-text-fit-padding").evaluate(x,{},_);let Y,ee=c;return c&&z!=="none"&&(p.allowVerticalPlacement&&C.vertical&&(Y=fle(c,C.vertical,z,K,L,T)),q&&(ee=fle(c,q,z,K,L,T))),{defaultShapedIcon:ee,verticallyShapedIcon:Y}}function UGe(p,c,h,x,_,C,T,L,z,q,K,Y,ee,re,ie,ge,Ce,Ne,Fe,Be,Ze,yt,ht,jt){let Et=T.textMaxSize.evaluate(c,{},ee);Et===void 0?Et=L*T.textScaleFactor:Et*=T.textScaleFactor;const Dt=p.layers[0].layout,tr=kl,$t=L*T.textScaleFactor/tr,or=_L(h.horizontal)||h.vertical;if(Ce!=="none"&&p.appearanceFeatureData&&c.index18&&br>2&&(br>>=1),Math.max(Rr/(512*br),1)*Dt.get("symbol-spacing")),kr=Dt.get("text-padding")*p.tilePixelRatio,xr=Dt.get("icon-padding")*p.tilePixelRatio,_r=Ys(Dt.get("text-max-angle")),ir=Dt.get("icon-rotation-alignment")==="map"&&Be!=="point",sr=wr/2;var br;p.hasAnyIconTextFit===!1&&Ce!=="none"&&(p.hasAnyIconTextFit=!0);const zr=c.properties?+c.properties[nr]:null,Ar=zr&&p.elevationFeatureIdToIndex?p.elevationFeatureIdToIndex.get(zr):65535,Ns=(Jr,as,xs)=>{if(as.x<0||as.x>=Rr||as.y<0||as.y>=Rr)return;let In=null;if(mr){const{x:Er,y:ys,z:tn}=re.projectTilePoint(as.x,as.y,xs);In={anchor:new Rx(Er,ys,tn,0,void 0),up:re.upVector(xs,as.x,as.y)}}(function(Er,ys,tn,ra,oa,_n,Xa,pt,vt,lr,jr,Zr,Yr,Cs,Es,gn,kn,Tn,Zn,Bs,Qs,xa,wa,ja,qa,ai,Qa,Aa,Da,Nn,ia,Ui,Fs){const Yn=Er.addToLineVertexArray(ys,ra);let ti,di,xi,No,mi,zs,Ji,Va=0,Pi=0,sl=0,Nl=0,Vo=-1,Ho=-1;const pl={};let Qd=vr("");const pi=tn?tn.anchor:ys,_o=Aa!=="none";let So=0,mu=0;if(vt._unevaluatedLayout.getValue("text-radial-offset")===void 0){const bc=vt.layout.get("text-offset").evaluate(Qs,{},qa);So=bc[0]*kl,mu=bc[1]*kl}else So=vt.layout.get("text-radial-offset").evaluate(Qs,{},qa)*kl,mu=_le;if(Er.allowVerticalPlacement&&oa.vertical){const bc=oa.vertical;if(Es)zs=wle(bc),pt&&(Ji=wle(pt));else{const Ed=vt.layout.get("text-rotate").evaluate(Qs,{},qa)+90;xi=bL(lr,pi,ys,jr,Zr,Yr,bc,Cs,Ed,gn,Ui),pt&&(No=bL(lr,pi,ys,jr,Zr,Yr,pt,Tn,Ed,null,ia))}}if(_n){const bc=Er.iconSizeData,Ed=vt.layout.get("icon-rotate").evaluate(Qs,{},qa),Hu=vle(_n,Ed,wa,_o,xa.iconScaleFactor),R0=pt?vle(pt,Ed,wa,_o,xa.iconScaleFactor):void 0;di=bL(lr,pi,ys,jr,Zr,Yr,_n,Tn,Ed,null,Nn);const M4=function(of,aT,owe,eZe,lwe,cwe,tZe,rZe){const dwe=of.layers[0],uwe=dwe.appearances;let T4=aT.length;if(owe&&(T4=Math.max(T4,owe.length)),uwe.length===0)return T4;const[sZe,nZe]=eZe.get("icon-size-scale-range"),aZe=ye(1,sZe,nZe);for(const hwe of uwe){const mwe=hwe.getUnevaluatedProperties();if(mwe._values["icon-image"].value!==void 0){const pwe=dwe.getAppearanceValueAndResolveTokens(hwe,"icon-image",lwe,cwe,[]);if(pwe){const fwe=of.getResolvedImageFromTokens(pwe);if(fwe){const gwe=mwe._values["icon-size"],iZe=$M(fwe,y4(of.zoom,gwe,of.worldview),gwe,cwe,of.zoom,lwe,of.pixelRatio,aZe,of.worldview),oZe=tZe.get(iZe.iconPrimary.toString());T4=Math.max(T4,AGe(oZe,rZe))}}}}return T4}(Er,Hu,R0,vt.layout,Qs,qa,Er.iconAtlasPositions,_o);Va=4*M4;let af=null;bc.kind==="source"?(af=[tf*vt.layout.get("icon-size").evaluate(Qs,{},qa)*xa.iconScaleFactor],af[0]>Fx&&es(`${Er.layerIds[0]}: Value for "icon-size" is >= ${UM}. Reduce your "icon-size".`)):bc.kind==="composite"&&(af=[tf*xa.compositeIconSizes[0].evaluate(Qs,{},qa)*xa.iconScaleFactor,tf*xa.compositeIconSizes[1].evaluate(Qs,{},qa)*xa.iconScaleFactor],(af[0]>Fx||af[1]>Fx)&&es(`${Er.layerIds[0]}: Value for "icon-size" is >= ${UM}. Reduce your "icon-size".`)),Er.addSymbols(Er.icon,Hu,af,Bs,Zn,Qs,void 0,tn,ys,Yn.lineStartIndex,Yn.lineLength,-1,ja,qa,ai,Qa,Er.symbolInstances.length,M4),Vo=Er.icon.placedSymbolArray.length-1,R0&&(Pi=4*M4,Er.addSymbols(Er.icon,R0,af,Bs,Zn,Qs,Vu.vertical,tn,ys,Yn.lineStartIndex,Yn.lineLength,-1,ja,qa,ai,Qa,Er.symbolInstances.length,M4),Ho=Er.icon.placedSymbolArray.length-1)}for(const bc in oa.horizontal){const Ed=bc,Hu=oa.horizontal[Ed];ti||(Qd=vr(Hu.text),Es?mi=wle(Hu):ti=bL(lr,pi,ys,jr,Zr,Yr,Hu,Cs,vt.layout.get("text-rotate").evaluate(Qs,{},qa),gn,Ui));const R0=Hu.positionedLines.length===1;if(sl+=qbe(Er,tn,ys,Hu,Xa,vt,Es,Qs,gn,Yn,oa.vertical?Vu.horizontal:Vu.horizontalOnly,R0?LGe(oa.horizontal):[Ed],pl,Vo,xa,ja,qa,Er.symbolInstances.length,ai),R0)break}oa.vertical&&(Nl+=qbe(Er,tn,ys,oa.vertical,Xa,vt,Es,Qs,gn,Yn,Vu.vertical,["vertical"],pl,Ho,xa,ja,qa,Er.symbolInstances.length,ai));let nl=-1;const Zm=(bc,Ed)=>bc?Math.max(bc,Ed):Ed;nl=Zm(mi,nl),nl=Zm(zs,nl),nl=Zm(Ji,nl);const wg=nl>-1?1:0;Er.glyphOffsetArray.length>=65535&&es("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Qs.sortKey!==void 0&&Er.addToSortKeyRanges(Er.symbolInstances.length,Qs.sortKey),Er.symbolInstances.emplaceBack(ys.x,ys.y,pi.x,pi.y,pi.z,pl.right>=0?pl.right:-1,pl.center>=0?pl.center:-1,pl.left>=0?pl.left:-1,pl.vertical>=0?pl.vertical:-1,Vo,Ho,Qd,ti!==void 0?ti:Er.collisionBoxArray.length,ti!==void 0?ti+1:Er.collisionBoxArray.length,xi!==void 0?xi:Er.collisionBoxArray.length,xi!==void 0?xi+1:Er.collisionBoxArray.length,di!==void 0?di:Er.collisionBoxArray.length,di!==void 0?di+1:Er.collisionBoxArray.length,No||Er.collisionBoxArray.length,No?No+1:Er.collisionBoxArray.length,jr,sl,Nl,Va,Pi,wg,0,So,mu,nl,0,_o?1:0,Da)})(p,as,In,Jr,h,x,C,_,p.layers[0],p.collisionBoxArray,c.index,c.sourceLayerIndex,p.index,kr,Fe,q,0,xr,ir,Ne,c,T,K,Y,ee,ie,ge,Ce,Ar,Ze,yt,ht)};if(Be==="line")for(const Jr of rL(c.geometry,0,0,Rr,Rr)){const as=TGe(Jr,wr,_r,h.vertical||or,x,tr,pr,p.overscaling,Rr);for(const xs of as)or&&qGe(p,or.text,sr,xs)||Ns(Jr,xs,ee)}else if(Be==="line-center"){for(const Jr of c.geometry)if(Jr.length>1){const as=MGe(Jr,_r,h.vertical||or,x,tr,pr);as&&Ns(Jr,as,ee)}}else if(c.type==="Polygon")for(const Jr of kM(c.geometry,0)){const as=IGe(Jr,16);Ns(Jr[0],new Rx(as.x,as.y,0,0,void 0),ee)}else if(c.type==="LineString")for(const Jr of c.geometry)Ns(Jr,new Rx(Jr[0].x,Jr[0].y,0,0,void 0),ee);else if(c.type==="Point")for(const Jr of c.geometry)for(const as of Jr)Ns([as],new Rx(as.x,as.y,0,0,void 0),ee)}const UM=255,Fx=UM*tf;function qbe(p,c,h,x,_,C,T,L,z,q,K,Y,ee,re,ie,ge,Ce,Ne,Fe){const Be=function(ht,jt,Et,Dt,tr,$t,or,mr){const pr=[];if(jt.positionedLines.length===0)return pr;const wr=Dt.layout.get("text-rotate").evaluate($t,{})*Math.PI/180,kr=function(br){const zr=br[0],Ar=br[1],Ns=zr*Ar;return Ns>0?[zr,-Ar]:Ns<0?[-zr,Ar]:zr===0?[Ar,zr]:[Ar,-zr]}(Et);let xr=Math.abs(jt.top-jt.bottom);for(const br of jt.positionedLines)xr-=br.lineOffset;const _r=jt.positionedLines.length,ir=xr/_r;let sr=jt.top-Et[1];for(let br=0;br<_r;++br){const zr=jt.positionedLines[br];sr=EGe(jt,ir,sr,br);for(const Ar of zr.positionedGlyphs){if(!Ar.rect)continue;const Ns=Ar.rect||{};let Jr=ybe+1,as=!0,xs=1,In=0;if(Ar.image){const kn=or.get(Ar.image.toString());if(!kn)continue;if(kn.sdf){es("SDF images are not supported in formatted text and will be ignored.");continue}as=!1,xs=kn.pixelRatio,Jr=C_/xs}const Er=(tr||mr)&&Ar.vertical,ys=Ar.metrics.advance*Ar.scale/2,tn=Ar.metrics,ra=Ar.rect;if(ra===null)continue;mr&&jt.verticalizable&&(In=Ar.image?ys-Ar.metrics.width*Ar.scale/2:0);const oa=tr?[Ar.x+ys,Ar.y]:[0,0];let _n=[0,0],Xa=[0,0],pt=!1;tr||(Er?(Xa=[Ar.x+ys+kr[0],Ar.y+kr[1]-In],pt=!0):_n=[Ar.x+ys+Et[0],Ar.y+Et[1]-In]);const vt=ra.w*Ar.scale/(xs*(Ar.localGlyph?rf:1)),lr=ra.h*Ar.scale/(xs*(Ar.localGlyph?rf:1));let jr,Zr,Yr,Cs;if(Er){const kn=Ar.y-sr,Tn=new dr(-ys,ys-kn),Zn=-Math.PI/2,Bs=new dr(...Xa);jr=new dr(-ys+_n[0],_n[1]),jr._rotateAround(Zn,Tn)._add(Bs),jr.x+=-kn+ys,jr.y-=(tn.left-Jr)*Ar.scale;const Qs=Ar.image?tn.advance*Ar.scale:kl*Ar.scale,xa=String.fromCodePoint(Ar.glyph);hGe(xa)?jr.x+=(1-Jr)*Ar.scale:mGe(xa)?jr.x+=Qs-tn.height*Ar.scale+(-Jr-1)*Ar.scale:jr.x+=Ar.image||tn.width+2*Jr===ra.w&&tn.height+2*Jr===ra.h?(Qs-lr)/2:(Qs-(tn.height+2*Jr)*Ar.scale)/2,Zr=new dr(jr.x,jr.y-vt),Yr=new dr(jr.x+lr,jr.y),Cs=new dr(jr.x+lr,jr.y-vt)}else{const kn=(tn.left-Jr)*Ar.scale-ys+_n[0],Tn=(-tn.top-Jr)*Ar.scale+_n[1],Zn=kn+vt,Bs=Tn+lr;jr=new dr(kn,Tn),Zr=new dr(Zn,Tn),Yr=new dr(kn,Bs),Cs=new dr(Zn,Bs)}if(wr){let kn;kn=tr?new dr(0,0):pt?new dr(kr[0],kr[1]):new dr(Et[0],Et[1]),jr._rotateAround(wr,kn),Zr._rotateAround(wr,kn),Yr._rotateAround(wr,kn),Cs._rotateAround(wr,kn)}const Es=new dr(0,0),gn=new dr(0,0);pr.push({tl:jr,tr:Zr,bl:Yr,br:Cs,texPrimary:Ns,texSecondary:void 0,writingMode:jt.writingMode,glyphOffset:oa,sectionIndex:Ar.sectionIndex,isSDF:as,pixelOffsetTL:Es,pixelOffsetBR:gn,minFontScaleX:0,minFontScaleY:0})}}return pr}(0,x,z,C,T,L,_,p.allowVerticalPlacement),Ze=p.textSizeData;let yt=null;Ze.kind==="source"?(yt=[tf*C.layout.get("text-size").evaluate(L,{},Ce)*ie.textScaleFactor],yt[0]>Fx&&es(`${p.layerIds[0]}: Value for "text-size" is >= ${UM}. Reduce your "text-size".`)):Ze.kind==="composite"&&(yt=[tf*ie.compositeTextSizes[0].evaluate(L,{},Ce)*ie.textScaleFactor,tf*ie.compositeTextSizes[1].evaluate(L,{},Ce)*ie.textScaleFactor],(yt[0]>Fx||yt[1]>Fx)&&es(`${p.layerIds[0]}: Value for "text-size" is >= ${UM}. Reduce your "text-size".`)),p.addSymbols(p.text,Be,yt,z,T,L,K,c,h,q.lineStartIndex,q.lineLength,re,ge,Ce,Fe,!1,Ne,Be.length);for(const ht of Y)ee[ht]=p.text.placedSymbolArray.length-1;return 4*Be.length}function _L(p){for(const c in p)return p[c];return null}function bL(p,c,h,x,_,C,T,L,z,q,K){let Y,ee,re,ie;if(Y=K?K.top:T.top,ee=K?K.bottom:T.bottom,re=K?K.left:T.left,ie=K?K.right:T.right,ple(T)&&T.collisionPadding){const ge=T.collisionPadding;re-=ge[0],Y-=ge[1],ie+=ge[2],ee+=ge[3]}if(z){const ge=new dr(re,Y),Ce=new dr(ie,Y),Ne=new dr(re,ee),Fe=new dr(ie,ee),Be=Ys(z);let Ze=new dr(0,0);q&&(Ze=new dr(q[0],q[1])),ge._rotateAround(Be,Ze),Ce._rotateAround(Be,Ze),Ne._rotateAround(Be,Ze),Fe._rotateAround(Be,Ze),re=Math.min(ge.x,Ce.x,Ne.x,Fe.x),ie=Math.max(ge.x,Ce.x,Ne.x,Fe.x),Y=Math.min(ge.y,Ce.y,Ne.y,Fe.y),ee=Math.max(ge.y,Ce.y,Ne.y,Fe.y)}return p.emplaceBack(c.x,c.y,c.z,h.x,h.y,re,Y,ie,ee,L,x,_,C),p.length-1}function wle(p){ple(p)&&p.collisionPadding&&(p.top-=p.collisionPadding[1],p.bottom+=p.collisionPadding[3]);const c=p.bottom-p.top;return c>0?Math.max(10,c):null}function qGe(p,c,h,x){const _=p.compareText;if(c in _){const C=_[c];for(let T=C.length-1;T>=0;T--)if(x.dist(C[T])Be&&(Ze(ht,pr,Et,Dt,or,mr),Ze(pr,jt,or,mr,tr,$t))}Ze(Y,ee,x,C,_,C),Ze(ee,re,_,C,_,T),Ze(re,ie,_,T,x,T),Ze(ie,Y,x,T,x,C),ge-=Be,Ce-=Be,Ne+=Be,Fe+=Be;const yt=1/Math.max(Ne-ge,Fe-Ce);return{scale:yt,x:ge*yt,y:Ce*yt,x2:Ne*yt,y2:Fe*yt,projection:c}}function Hbe(p,{x:c,y:h},x=0){return new dr(((c-x)*p.scale-p.x)*Rr,(h*p.scale-p.y)*Rr)}const VGe=S(new Float32Array(16));class O0{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 f(0,0)}projectTilePoint(c,h,x){return{x:c,y:h,z:0}}locationPoint(c,h,x,_=!0){return c._coordinatePoint(c.locationCoordinate(h,x),_)}pixelsPerMeter(c,h){return J(1,c)*h}pixelSpaceConversion(c,h,x){return 1}farthestPixelDistance(c){return Vbe(c,c.pixelsPerMeter)}pointCoordinate(c,h,x,_){const C=c.horizonLineFromTop(!1),T=new dr(h,Math.max(C,x));return c.rayIntersectionCoordinate(c.pointRayIntersection(T,_))}pointCoordinate3D(c,h,x){const _=new dr(h,x);if(c.elevation)return c.elevation.pointCoordinate(_);{const C=this.pointCoordinate(c,_.x,_.y,0);return[C.x,C.y,C.z]}}isPointAboveHorizon(c,h){if(c.elevation&&c.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(c,h.x,h.y);const x=c.horizonLineFromTop();return h.y0?h<-w4+x&&(h=-w4+x):h>w4-x&&(h=w4-x);const T=C/Math.pow(jL(h),_);let L=T*Math.sin(_*c),z=C-T*Math.cos(_*c);return L=.5*(L/Math.PI+.5),z=.5*(z/Math.PI+.5),{x:L,y:this.southernCenter?z:1-z,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:x,f:_}=this,C=_-h,T=Math.sign(C),L=Math.sign(x)*Math.sqrt(c*c+C*C);let z=Math.atan2(c,Math.abs(C))*T;C*x<0&&(z-=Math.PI*Math.sign(c)*T);const q=ye(ro(z/x)+this.center[0],-180,180),K=ye(ro(2*Math.atan(Math.pow(_/L,1/x))-w4),-pe,pe);return new f(q,this.southernCenter?-K:K)}}class Wbe extends O0{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:U(c),y:G(h),z:0}}unproject(c,h){const x=te(c),_=me(h);return new f(x,_)}}const Gbe=Ys(pe);class ZGe extends O0{project(c,h){const x=(h=Ys(h))*h,_=x*x;return{x:.5*((c=Ys(c))*(.8707-.131979*x+_*(_*(.003971*x-.001529*_)-.013791))/Math.PI+.5),y:1-.5*(h*(1.007226+x*(.015085+_*(.028874*x-.044475-.005916*_)))/Math.PI+1),z:0}}unproject(c,h){c=(2*c-.5)*Math.PI;let x=h=(2*(1-h)-1)*Math.PI,_=25,C=0,T=x*x;do{T=x*x;const q=T*T;C=(x*(1.007226+T*(.015085+q*(.028874*T-.044475-.005916*q)))-h)/(1.007226+T*(.045255+q*(.259866*T-.311325-.005916*11*q))),x=ye(x-C,-Gbe,Gbe)}while(Math.abs(C)>1e-6&&--_>0);T=x*x;const L=ye(ro(c/(.8707+T*(T*(T*T*T*(.003971-.001529*T)-.013791)-.131979))),-180,180),z=ro(x);return new f(L,z)}}const Kbe=Ys(pe);class YGe extends O0{project(c,h){h=Ys(h),c=Ys(c);const x=Math.cos(h),_=2/Math.PI,C=Math.acos(x*Math.cos(c/2)),T=Math.sin(C)/C,L=.5*(c*_+2*x*Math.sin(c/2)/T)||0,z=.5*(h+Math.sin(h)/T)||0;return{x:.5*(L/Math.PI+.5),y:1-.5*(z/Math.PI+1),z:0}}unproject(c,h){let x=c=(2*c-.5)*Math.PI,_=h=(2*(1-h)-1)*Math.PI,C=25;const T=1e-6;let L=0,z=0;do{const q=Math.cos(_),K=Math.sin(_),Y=2*K*q,ee=K*K,re=q*q,ie=Math.cos(x/2),ge=Math.sin(x/2),Ce=2*ie*ge,Ne=ge*ge,Fe=1-re*ie*ie,Be=Fe?1/Fe:0,Ze=Fe?Math.acos(q*ie)*Math.sqrt(1/Fe):0,yt=.5*(2*Ze*q*ge+2*x/Math.PI)-c,ht=.5*(Ze*K+_)-h,jt=.5*Be*(re*Ne+Ze*q*ie*ee)+1/Math.PI,Et=Be*(Ce*Y/4-Ze*K*ge),Dt=.125*Be*(Y*ge-Ze*K*re*Ce),tr=.5*Be*(ee*ie+Ze*Ne*q)+.5,$t=Et*Dt-tr*jt;L=(ht*Et-yt*tr)/$t,z=(yt*Dt-ht*jt)/$t,x=ye(x-L,-Math.PI,Math.PI),_=ye(_-z,-Kbe,Kbe)}while((Math.abs(L)>T||Math.abs(z)>T)&&--C>0);return new f(ro(x),ro(_))}}class Zbe extends O0{constructor(c){super(c),this.center=c.center||[0,0],this.parallels=c.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Ys(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:x,cosPhi:_}=this;return{x:Ys(c)*_*x+.5,y:-Math.sin(Ys(h))/_*x+.5,z:0}}unproject(c,h){const{scale:x,cosPhi:_}=this,C=-(h-.5)/x,T=ye(ro((c-.5)/x)/_,-180,180),L=Math.asin(ye(C*_,-1,1)),z=ye(ro(L),-pe,pe);return new f(T,z)}}class XGe extends Wbe{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,x){const _=yM(c,h,x);return at(_,_,G6(sm(x))),{x:_[0],y:_[1],z:_[2]}}locationPoint(c,h,x){const _=M0(h.lat,h.lng),C=Ie([],_),T=x?c._centerAltitude+x:c.elevation?c.elevation.getAtPointOrZero(c.locationCoordinate(h),c._centerAltitude):c._centerAltitude;tt(_,_,C,J(1,0)*Rr*T);const L=S(new Float64Array(16));return M(L,c.pixelMatrix,c.globeMatrix),at(_,_,L),new dr(_[0],_[1])}pixelsPerMeter(c,h){return J(1,0)*h}pixelSpaceConversion(c,h,x){const _=J(1,c)*h,C=Hs(J(1,45)*h,_,x);return this.pixelsPerMeter(c,h)/C}createTileMatrix(c,h,x){const _=Coe(sm(x.canonical));return M(new Float64Array(16),c.globeMatrix,_)}createInversionMatrix(c,h){const{center:x}=c,_=G6(sm(h));return B(_,_,Ys(x.lng)),O(_,_,Ys(x.lat)),F(_,_,[c._pixelsPerMercatorPixel,c._pixelsPerMercatorPixel,1]),Float32Array.from(_)}pointCoordinate(c,h,x,_){return A0(c,h,x,!0)||new He(0,0)}pointCoordinate3D(c,h,x){const _=this.pointCoordinate(c,h,x,0);return[_.x,_.y,_.z]}isPointAboveHorizon(c,h){return!A0(c,h.x,h.y,!1)}farthestPixelDistance(c){const h=function(_,C){const T=_.cameraToCenterDistance,L=_._centerAltitude*C,z=_._camera,q=_._camera.forward(),K=ue([],ve([],q,-T),[0,0,L]),Y=_.worldSize/(2*Math.PI),ee=[0,0,-Y],re=_.width/_.height,ie=Math.tan(_.fovAboveCenter),ge=ve([],z.up(),ie),Ce=ve([],z.right(),ie*re),Ne=Ie([],ue([],ue([],q,ge),Ce)),Fe=[];let Be;if(new ps(K,Ne).closestPointOnSphere(ee,Y,Fe)){const Ze=ue([],Fe,ee),yt=je([],Ze,K);Be=Math.cos(_.fovAboveCenter)*fe(yt)}else{const Ze=je([],K,ee),yt=je([],ee,K);Ie(yt,yt);const ht=fe(Ze)-Y;Be=Math.sqrt(ht*(ht+2*Y));const jt=Math.acos(Be/(Y+ht))-Math.acos(et(q,yt));Be*=Math.cos(jt)}return 1.01*Be}(c,this.pixelsPerMeter(c.center.lat,c.worldSize)),x=E0(c.zoom);if(x>0){const _=Vbe(c,J(1,c.center.lat)*c.worldSize),C=c.worldSize/(2*Math.PI),T=Math.max(c.width,c.height)/c.worldSize*Math.PI;return Hs(h,_+C*(1-Math.cos(T)),Math.pow(x,10))}return h}upVector(c,h,x){return yM(h,x,c,1)}upVectorScale(c){return{metersToTile:Gm(W6(sm(c)))}}}function Ybe(p){const c=p.parallels,h=!!c&&Math.abs(c[0]+c[1])<.01;switch(p.name){case"mercator":return new Wbe(p);case"equirectangular":return new GGe(p);case"naturalEarth":return new ZGe(p);case"equalEarth":return new WGe(p);case"winkelTripel":return new YGe(p);case"albers":return h?new Zbe(p):new HGe(p);case"lambertConformalConic":return h?new Zbe(p):new KGe(p);case"globe":return new XGe(p)}throw new Error(`Invalid projection name: ${p.name}`)}const QGe=zt.types,JGe=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function KM(p,c,h,x,_,C,T,L,z,q,K,Y,ee){const re=L?Math.min(Fx,Math.round(L[0])):0,ie=L?Math.min(Fx,Math.round(L[1])):0;p.emplaceBack(c,h,Math.round(32*x),Math.round(32*_),C,T,(re<<1)+(z?1:0),0+(ie<<1),16*q,16*K,256*Y,256*ee)}function ZM(p,c,h){p.emplaceBack(c,h)}function YM(p,c,h,x,_,C,T){p.emplaceBack(c,h,x,_,C,T)}const kL=(p,c,h,x)=>{for(let _=0;_0&&(this.iconTransitioningVertexBuffer=c.createVertexBuffer(this.iconTransitioningVertexArray,oGe.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=c.createVertexBuffer(this.globeExtVertexArray,sGe.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||C)&&(this.zOffsetVertexBuffer=c.createVertexBuffer(this.zOffsetVertexArray,aGe.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=c.createVertexBuffer(this.orientationVertexArray,iGe.members,!0)),this.opacityVertexBuffer.itemSize=1),(x||_)&&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())}}hs(jle,"SymbolBuffers");class kle{constructor(c,h,x){this.layoutVertexArray=new c,this.layoutAttributes=h,this.indexArray=new x,this.segments=new Yi,this.collisionVertexArray=new sM,this.collisionVertexArrayExt=new gg}upload(c){this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=c.createVertexBuffer(this.collisionVertexArray,lGe.members,!0),this.collisionVertexBufferExt=c.createVertexBuffer(this.collisionVertexArrayExt,cGe.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}hs(kle,"CollisionBuffers");class NL{constructor(c){this.collisionBoxArray=c.collisionBoxArray,this.zoom=c.zoom,this.overscaling=c.overscaling,this.layers=c.layers,this.layerIds=this.layers.map(T=>T.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=S([]),this.placementViewportMatrix=S([]);const h=this.layers[0]._unevaluatedLayout._values;this.worldview=c.worldview,this.localizable=c.localizable,this.textSizeData=y4(this.zoom,h["text-size"],this.worldview),this.iconSizeData=y4(this.zoom,h["icon-size"],this.worldview);const x=this.layers[0].layout,_=x.get("symbol-sort-key"),C=x.get("symbol-z-order");this.lut=c.lut,this.canOverlap=x.get("text-allow-overlap")||x.get("icon-allow-overlap")||x.get("text-ignore-placement")||x.get("icon-ignore-placement"),this.sortFeaturesByKey=C!=="viewport-y"&&_.constantOr(1)!==void 0,this.sortFeaturesByY=(C==="viewport-y"||C==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=x.get("text-writing-mode").map(T=>Vu[T]),this.stateDependentLayerIds=this.layers.filter(T=>T.isStateDependent()).map(T=>T.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(x=>x.getProperty(c)!=null)}createArrays(){this.text=new jle(new tm(this.layers,{zoom:this.zoom,lut:this.lut},c=>c.startsWith("text")||c.startsWith("symbol"))),this.icon=new jle(new tm(this.layers,{zoom:this.zoom,lut:this.lut},c=>c.startsWith("icon")||c.startsWith("symbol"))),this.glyphOffsetArray=new e4,this.lineVertexArray=new $6,this.symbolInstances=new dM}calculateGlyphDependencies(c,h,x,_,C){for(const T of c){const L=T.codePointAt(0);if(L===void 0)break;if(h[L]=!0,_&&C&&L<=65535){const z=RM[T];z&&(h[z.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(c,h,x,_,C,T){let L=1;const z=c.getUnevaluatedProperties()._values["icon-size"],q=y4(this.zoom,z,this.worldview),K=v4(q,h);if(q.kind!=="constant"&&q.kind!=="camera"||(L=K.uSize),q.kind==="composite"){const{minZoom:Y,maxZoom:ee}=q,re=z.possiblyEvaluate(new gi(Y,{worldview:this.worldview}),_),ie=z.possiblyEvaluate(new gi(ee,{worldview:this.worldview}),_),ge=re.evaluate(x,{},_,C);L=ge+(ie.evaluate(x,{},_,C)-ge)*K.uSizeT}return q.kind==="source"&&(L=z.possiblyEvaluate(new gi(this.zoom,{worldview:this.worldview}),_).evaluate(x,{},_,C)),L*T}updateFootprints(c,h){}updateReplacement(c,h){if(h.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=h.updateTime;const x=h.getReplacementRegionsForTile(c.toUnwrapped(),!0);return!J6(this.activeReplacements,x)&&(this.activeReplacements=x,!0)}getResolvedImageFromTokens(c){return typeof c=="string"?Sd.build(c):c}populate(c,h,x,_){const C=this.layers[0],T=C.layout,L=this.projection.name==="globe",z=T.get("text-font"),q=T.get("text-field"),K=T.get("icon-image"),[Y,ee]=T.get("icon-size-scale-range"),re=ye(h.scaleFactor||1,Y,ee),ie=(q.value.kind!=="constant"||q.value.value instanceof Nd&&!q.value.value.isEmpty()||q.value.value.toString().length>0)&&(z.value.kind!=="constant"||z.value.value.length>0),ge=K.value.kind!=="constant"||!!K.value.value||Object.keys(K.parameters).length>0,Ce=this.hasAnyAppearanceProperty("icon-image"),Ne=T.get("symbol-sort-key");if(this.features=[],this.appearanceFeatureData=[],!ie&&!ge&&!Ce)return;const Fe=h.iconDependencies,Be=h.glyphDependencies,Ze=h.availableImages,yt=new gi(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),ht=jt=>{const Et=jt.id.toString();Fe.has(Et)?Fe.get(Et).push(jt):Fe.set(Et,[jt])};for(const jt of c){const{feature:Et,id:Dt,index:tr,sourceLayerIndex:$t}=jt,or=C._featureFilter.needGeometry,mr=Bt(Et,or);if(!C._featureFilter.filter(yt,mr,x))continue;if(or||(mr.geometry=Tt(Et,x,_)),L&&Et.type!==1&&x.z<=5){const br=mr.geometry,zr=.98078528056,Ar=(Ns,Jr)=>et(yM(Ns.x,Ns.y,x,1),yM(Jr.x,Jr.y,x,1)){if(!br.getProperty("icon-image"))return;const zr=this.getCombinedIconPrimary(br,kr,mr,x,Ze,ir,re);zr&&ht(zr)}),pr){const br=z.evaluate(mr,{},x).join(","),zr=T.get("text-rotation-alignment")==="map"&&T.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Vu.vertical)>=0;for(const Ar of pr.sections)if(Ar.image){const Ns=Ar.image.getPrimary().scaleSelf(this.pixelRatio),Jr=Ns.id.toString(),as=Fe.get(Jr)||[];as.push(Ns),Fe.set(Jr,as)}else{const Ns=l_(pr.toString()),Jr=Ar.fontStack||br,as=Be[Jr]=Be[Jr]||{};this.calculateGlyphDependencies(Ar.text,as,zr,this.allowVerticalPlacement,Ns)}}}if(T.get("symbol-placement")==="line"&&(this.features=function(jt){const Et={},Dt={},tr=[];let $t=0;function or(kr){tr.push(jt[kr]),$t++}function mr(kr,xr,_r){const ir=Dt[kr];return delete Dt[kr],Dt[xr]=ir,tr[ir].geometry[0].pop(),tr[ir].geometry[0]=tr[ir].geometry[0].concat(_r[0]),ir}function pr(kr,xr,_r){const ir=Et[xr];return delete Et[xr],Et[kr]=ir,tr[ir].geometry[0].shift(),tr[ir].geometry[0]=_r[0].concat(tr[ir].geometry[0]),ir}function wr(kr,xr,_r){const ir=_r?xr[0][xr[0].length-1]:xr[0][0];return`${kr}:${ir.x}:${ir.y}`}for(let kr=0;krkr.geometry)}(this.features)),T.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 jt of h.elevationFeatures)this.elevationFeatureIdToIndex.set(jt.id,this.elevationFeatures.length),this.elevationFeatures.push(jt)}}else T.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((jt,Et)=>jt.sortKey-Et.sortKey)}getCombinedIconPrimary(c,h,x,_,C,T,L){let z,q;const K=c.getUnevaluatedProperties();if(K._values["icon-image"].value!==void 0){const Y=h.getAppearanceValueAndResolveTokens(c,"icon-image",x,_,C);z=this.getResolvedImageFromTokens(Y)}else{const Y=h.getValueAndResolveTokens("icon-image",x,_,C);z=this.getResolvedImageFromTokens(Y)}if(z){const Y=K._values["icon-size"]||h._unevaluatedLayout._values["icon-size"];q=$M(z,y4(this.zoom,Y,this.worldview),Y,_,this.zoom,T,this.pixelRatio,L,this.worldview).iconPrimary}return q}updateAppearanceBasedIconTextures(c,h,x,_){if(!this.appearanceFeatureData||!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)return!1;const C=this.layers[0];let T=!1,L=0;const z=C.layout,[q,K]=z.get("icon-size-scale-range"),Y=ye(1,q,K);for(let ee=0;ee=0){const Ce=ge.id,Ne=h&&Ce!==void 0?h[String(Ce)]:void 0,Fe={type:"Point",id:ge.id,properties:ge.properties,geometry:[]},Be=this.layers[0].appearances&&this.layers[0].appearances.find(Ze=>Ze.isActive({globals:_,feature:Fe,canonical:c,featureState:Ne}));if(ge.activeAppearance===Be){L+=re.numIconVertices;continue}if(Be){ge.activeAppearance=Be;const Ze=this.getCombinedIconPrimary(Be,C,Fe,c,x,{sortKey:void 0,text:void 0,icon:null,index:re.featureIndex,sourceLayerIndex:re.featureIndex,geometry:[],properties:ge.properties,type:"Point",id:ge.id},Y);if(!Ze)continue;const yt=Ze.toString(),ht=this.iconAtlasPositions&&this.iconAtlasPositions.get(yt);if(ht){const jt=C.getAppearanceValueAndResolveTokens(Be,"icon-offset",Fe,c,x),Et=jt&&Array.isArray(jt)?jt:[0,0];let Dt=fL(ht,void 0,Et,C.layout.get("icon-anchor").evaluate(Fe,{},c));const tr=C.getAppearanceValueAndResolveTokens(Be,"icon-rotate",Fe,c,x),$t=typeof tr=="number"?tr:0,or=ht.sdf,mr=C.layout.get("icon-text-fit").constantOr("none");mr!=="none"&&ge.textShaping&&ge.iconTextFitPadding&&ge.fontScale&&(Dt=fle(Dt,ge.textShaping,mr,ge.iconTextFitPadding,Et,ge.fontScale));const pr=this.calculateEffectiveAppearanceIconSize(Be,_.zoom,Fe,c,x,Y),wr=0,kr=1+(Math.min(Fx,Math.round(pr*tf))<<1),xr=vle(Dt,$t,or,mr!=="none",Y);ge.isUsingAppearanceVertexData||(ge.isUsingAppearanceVertexData=!0,ge.layoutBasedVertexData=this.icon.getIconVertexData(L,re.numIconVertices));for(let ir=0;ir0&&(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),T=!0),L+=re.numIconVertices,ge.activeAppearance=null;else if(ge.isUsingAppearanceVertexData){const yt=ge.layoutBasedVertexData.length/12;for(let ht=0;ht0||ee>0,Ce=re>0,Ne=this.elevationFeatures[z.elevationFeatureIndex];if(Ne){const Fe=new dr(z.tileAnchorX,z.tileAnchorY),Be=.075+Ne.pointElevation(Fe);z.zOffset!==Be&&(h=!0,z.zOffset=Be),Be!==0&&(this.hasAnyZOffset=!0);const Ze=Ne.computeSlopeNormal(Fe,_),yt=Mr(mt(),oe(0,0,1),Ze);$e(q,q,yt),$e(K,K,yt),q[2]*=x,K[2]*=x,q[0]===1&&q[1]===0&&q[2]===0&&K[0]===0&&K[1]===1&&K[2]===0||(C=C||ge,T=T||Ce)}if(ge&&(kL(this.text.orientationVertexArray,Y,q,K),kL(this.text.orientationVertexArray,ee,q,K)),Ce){const{placedIconSymbolIndex:Fe,verticalPlacedIconSymbolIndex:Be}=z;Fe>=0&&kL(this.icon.orientationVertexArray,re,q,K),Be>=0&&kL(this.icon.orientationVertexArray,ie,q,K)}}C||(this.text.orientationVertexArray=void 0),T||(this.icon.orientationVertexArray=void 0),h&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const c=(C,T,L)=>{x+=T,x>C.length&&C.resize(x);for(let z=-T;z<0;z++)C.emplace(z+x,L)},h=(C,T,L)=>{_+=T,_>C.length&&C.resize(_);for(let z=-T;z<0;z++)C.emplace(z+_,L)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let x=0,_=0;for(let C=0;C0;if((L>0||z>0)&&(c(this.text.zOffsetVertexArray,L,K),c(this.text.zOffsetVertexArray,z,K)),Y){const{placedIconSymbolIndex:ee,verticalPlacedIconSymbolIndex:re}=T;ee>=0&&h(this.icon.zOffsetVertexArray,q,K),re>=0&&h(this.icon.zOffsetVertexArray,T.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,x,_,C){!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(T=>T.appearances&&T.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,x,_){return!!(c&&h&&x)&&!(!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)&&!!this.icon.layoutVertexArray.arrayBuffer&&void(this.updateAppearanceBasedIconTextures(c,h,x,_)&&this.icon.layoutVertexBuffer&&this.icon.layoutVertexArray.arrayBuffer!==null&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray))}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Ybe(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(c,h){const x=this.lineVertexArray.length;if(c.segment!==void 0)for(const{x:_,y:C}of h)this.lineVertexArray.emplaceBack(_,C);return{lineStartIndex:x,lineLength:this.lineVertexArray.length-x}}addSymbols(c,h,x,_,C,T,L,z,q,K,Y,ee,re,ie,ge,Ce,Ne,Fe){const Be=c.indexArray,Ze=c.layoutVertexArray,yt=c.globeExtVertexArray,ht=c.segments.prepareSegment(4*Fe,Ze,Be,this.canOverlap?T.sortKey:void 0),jt=this.glyphOffsetArray.length,Et=ht.vertexLength,Dt=this.allowVerticalPlacement&&L===Vu.vertical?Math.PI/2:0,tr=T.text&&T.text.sections;for(let mr=0;mr=0?h.rightJustifiedTextSymbolIndex:h.centerJustifiedTextSymbolIndex>=0?h.centerJustifiedTextSymbolIndex:h.leftJustifiedTextSymbolIndex>=0?h.leftJustifiedTextSymbolIndex:h.verticalPlacedTextSymbolIndex>=0?h.verticalPlacedTextSymbolIndex:_),T=gle(this.textSizeData,c,C)/kl;return this.tilePixelRatio*T}getSymbolInstanceIconSize(c,h,x){const _=this.icon.placedSymbolArray.get(x),C=gle(this.iconSizeData,c,_);return this.tilePixelRatio*C}_commitDebugCollisionVertexUpdate(c,h,x,_){c.emplaceBack(h,-x,-x,_),c.emplaceBack(h,x,-x,_),c.emplaceBack(h,x,x,_),c.emplaceBack(h,-x,x,_)}_updateTextDebugCollisionBoxes(c,h,x,_,C,T,L){for(let z=_;z0}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 x=c.placedSymbolArray.get(h),_=x.vertexStartIndex+4*x.numGlyphs;for(let C=x.vertexStartIndex;C<_;C+=4)c.indexArray.emplaceBack(C,C+1,C+2),c.indexArray.emplaceBack(C+1,C+2,C+3)}getSortedSymbolIndexes(c){if(this.sortedAngle===c&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const h=Math.sin(c),x=Math.cos(c),_=[],C=[],T=[];for(let L=0;L_[L]-_[z]||C[z]-C[L]),T}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 x=this.sortKeyRanges[this.sortKeyRanges.length-1];x&&x.sortKey===h?x.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 x=this.symbolInstances.get(h);this.featureSortOrder.push(x.featureIndex);const{rightJustifiedTextSymbolIndex:_,centerJustifiedTextSymbolIndex:C,leftJustifiedTextSymbolIndex:T,verticalPlacedTextSymbolIndex:L,placedIconSymbolIndex:z,verticalPlacedIconSymbolIndex:q}=x;_>=0&&this.addIndicesForPlacedSymbol(this.text,_),C>=0&&C!==_&&this.addIndicesForPlacedSymbol(this.text,C),T>=0&&T!==C&&T!==_&&this.addIndicesForPlacedSymbol(this.text,T),L>=0&&this.addIndicesForPlacedSymbol(this.text,L),z>=0&&this.addIndicesForPlacedSymbol(this.icon,z),q>=0&&this.addIndicesForPlacedSymbol(this.icon,q)}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 x;return this.elevationFeatures&&hx in p?String(p[x]):"")}let Qbe,Jbe,Nle;hs(NL,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),NL.addDynamicAttributes=j4;class e2e{constructor(c){this.type=c.property.overrides?c.property.overrides.runtimeType:Yh,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}}hs(e2e,"FormatSectionOverride",{omit:["defaultValue"]});const Sle=()=>Nle||(Nle={layout:Qbe||(Qbe=new lo({"symbol-placement":new Pr(Vt.layout_symbol["symbol-placement"]),"symbol-spacing":new Pr(Vt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Pr(Vt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Wr(Vt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Pr(Vt.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new Pr(Vt.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new Pr(Vt.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new Pr(Vt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Pr(Vt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Pr(Vt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Pr(Vt.layout_symbol["icon-rotation-alignment"]),"icon-size":new Wr(Vt.layout_symbol["icon-size"]),"icon-size-scale-range":new Pr(Vt.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Wr(Vt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Wr(Vt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Wr(Vt.layout_symbol["icon-image"]),"icon-image-use-theme":new Pr({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new Wr(Vt.layout_symbol["icon-rotate"]),"icon-padding":new Pr(Vt.layout_symbol["icon-padding"]),"icon-keep-upright":new Pr(Vt.layout_symbol["icon-keep-upright"]),"icon-offset":new Wr(Vt.layout_symbol["icon-offset"]),"icon-anchor":new Wr(Vt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Pr(Vt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Pr(Vt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Pr(Vt.layout_symbol["text-rotation-alignment"]),"text-field":new Wr(Vt.layout_symbol["text-field"]),"text-font":new Wr(Vt.layout_symbol["text-font"]),"text-size":new Wr(Vt.layout_symbol["text-size"]),"text-size-scale-range":new Pr(Vt.layout_symbol["text-size-scale-range"]),"text-max-width":new Wr(Vt.layout_symbol["text-max-width"]),"text-line-height":new Wr(Vt.layout_symbol["text-line-height"]),"text-letter-spacing":new Wr(Vt.layout_symbol["text-letter-spacing"]),"text-justify":new Wr(Vt.layout_symbol["text-justify"]),"text-radial-offset":new Wr(Vt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Pr(Vt.layout_symbol["text-variable-anchor"]),"text-anchor":new Wr(Vt.layout_symbol["text-anchor"]),"text-max-angle":new Pr(Vt.layout_symbol["text-max-angle"]),"text-writing-mode":new Pr(Vt.layout_symbol["text-writing-mode"]),"text-rotate":new Wr(Vt.layout_symbol["text-rotate"]),"text-padding":new Pr(Vt.layout_symbol["text-padding"]),"text-keep-upright":new Pr(Vt.layout_symbol["text-keep-upright"]),"text-transform":new Wr(Vt.layout_symbol["text-transform"]),"text-offset":new Wr(Vt.layout_symbol["text-offset"]),"text-allow-overlap":new Pr(Vt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Pr(Vt.layout_symbol["text-ignore-placement"]),"text-optional":new Pr(Vt.layout_symbol["text-optional"]),visibility:new Pr(Vt.layout_symbol.visibility)})),paint:Jbe||(Jbe=new lo({"icon-opacity":new Wr(Vt.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Wr(Vt.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Wr(Vt.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Wr(Vt.paint_symbol["text-emissive-strength"]),"icon-color":new Wr(Vt.paint_symbol["icon-color"]),"icon-halo-color":new Wr(Vt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Wr(Vt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Wr(Vt.paint_symbol["icon-halo-blur"]),"icon-translate":new Pr(Vt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Pr(Vt.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new Pr(Vt.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Wr(Vt.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Wr(Vt.paint_symbol["text-occlusion-opacity"]),"text-color":new Wr(Vt.paint_symbol["text-color"],{runtimeType:Kd,getOverride:p=>p.textColor,hasOverride:p=>!!p.textColor}),"text-halo-color":new Wr(Vt.paint_symbol["text-halo-color"]),"text-halo-width":new Wr(Vt.paint_symbol["text-halo-width"]),"text-halo-blur":new Wr(Vt.paint_symbol["text-halo-blur"]),"text-translate":new Pr(Vt.paint_symbol["text-translate"]),"text-translate-anchor":new Pr(Vt.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new Pr(Vt.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new Pr(Vt.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new Pr(Vt.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new Pr(Vt.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Wr(Vt.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Wr({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Wr({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Wr({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Wr({type:"string",default:"default","property-type":"data-driven"})}))},Nle);class SL extends Td{constructor(c,h,x,_){super(c,Sle(),h,x,_,c.layout?c.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=S([]),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(_=>{_.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 x=this.layout.get("text-writing-mode");if(x){const _=[];for(const C of x)_.indexOf(C)<0&&_.push(C);this.layout._values["text-writing-mode"]=_}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(c,h,x,_){return this._saturation===c&&this._contrast===h&&this._brightnessMin===x&&this._brightnessMax===_||(this._colorAdjustmentMatrix=function(C,T,L,z){C=zi(C),T=la(T);const q=N(),K=C/3,Y=1-2*K,ee=[Y,K,K,0,K,Y,K,0,K,K,Y,0,0,0,0,1],re=.5-.5*T,ie=z-L;return M(q,[ie,0,0,0,0,ie,0,0,0,0,ie,0,L,L,L,1],[T,0,0,0,0,T,0,0,0,0,T,0,re,re,re,1]),M(q,q,ee),q}(c,h,x,_),this._saturation=c,this._contrast=h,this._brightnessMin=x,this._brightnessMax=_),this._colorAdjustmentMatrix}getValueAndResolveTokens(c,h,x,_){const C=this.layout.get(c).evaluate(h,{},x,_),T=this._unevaluatedLayout._values[c];return T.isDataDriven()||i_(T.value)||!C?C:Xbe(h.properties,C)}getAppearanceValueAndResolveTokens(c,h,x,_,C){const T=c.getProperty(h);if(!T)return;const L=T.evaluate(x,{},_,C),z=c.getUnevaluatedProperties()._values[h];return z.isDataDriven()||i_(z.value)||!L||typeof L!="string"?L:Xbe(x.properties,L)}createBucket(c){return new NL(c)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const c of Sle().paint.overridableProperties){if(!SL.hasPaintOverride(this.layout,c))continue;const h=this.paint.get(c),x=new e2e(h),_=new AN(x,h.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let C=null;C=h.value.kind==="constant"||h.value.kind==="source"?new v0("source",_):new Nx("composite",_,h.value.zoomStops,h.value.interpolationType),this.paint._values[c]=new Cx(h.property,C,h.parameters)}}_handleOverridablePaintPropertyUpdate(c,h,x){return!(!this.layout||h.isDataDriven()||x.isDataDriven())&&SL.hasPaintOverride(this.layout,c)}static hasPaintOverride(c,h){const x=c.get("text-field"),_=Sle().paint.properties[h];let C=!1;const T=L=>{for(const z of L)if(_.overrides&&_.overrides.hasOverride(z))return void(C=!0)};if(x.value.kind==="constant"&&x.value.value instanceof Nd)T(x.value.value.sections);else if(x.value.kind==="source"){const L=q=>{C||(q instanceof zp&&jl(q.value)===Hv?T(q.value.sections):q instanceof zm?T(q.sections):q.eachChild(L))},z=x.value;z._styleExpression&&L(z._styleExpression.expression)}return C}getProgramIds(){return["symbol"]}getDefaultProgramParams(c,h,x){return{config:new yg(this,{zoom:h,lut:x}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let t2e,r2e,s2e,n2e;var Cle=Kn([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function CL(p,c,h,x,_,C,T,L){const z=[p,c,1,h,x,1,_,C,1],q=[T,L,1],K=v([],z),[Y,ee,re]=ce(q,q,K);return b(z,z,[Y,0,0,0,ee,0,0,0,re])}function a2e(p,c,h,x,_,C,T,L){const z=function(q,K,Y,ee,re,ie,ge,Ce){const Ne=CL(0,0,1,0,1,1,0,1),Fe=CL(q,K,Y,ee,re,ie,ge,Ce);return b(Fe,Fe,v([],Ne))}(p,c,h,x,_,C,T,L);return[z[2]/z[8]/Rr,z[5]/z[8]/Rr]}function ML(p){return[p[0],Math.min(Math.max(p[1],-pe),pe)]}class i2e extends Vn{constructor(c,h,x,_){super(),this.id=c,this.dispatcher=x,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(_),this.options=h,this._dirty=!1}load(c,h){if(this._loaded=h||!1,this.fire(new Vr("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return c&&(this.coordinates=c),this._loaded=!0,void this._finishLoading();this._imageRequest=n0(this.map._requestManager.transformRequest(this.url,Rp.Image),(x,_)=>{this._imageRequest=null,this._loaded=!0,x?this.fire(new pn(x)):_&&(this.image=_ instanceof HTMLImageElement?Jo.getImageData(_):_,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 LM(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 Vr("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 LM||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],x=c[0][1];for(const C of c)C[1]>x&&(x=C[1]),C[1]pe?this.onNorthPole=!0:_<-pe&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const C=c.map(He.fromLngLat);this.tileID=function(T){let L=1/0,z=1/0,q=-1/0,K=-1/0;for(const ge of T)L=Math.min(L,ge.x),z=Math.min(z,ge.y),q=Math.max(q,ge.x),K=Math.max(K,ge.y);const Y=Math.max(q-L,K-z),ee=Math.max(0,Math.floor(-Math.log2(Y))),re=Math.pow(2,ee);let ie=Math.floor((L+q)/2*re);return ie>1&&(ie-=1),new ni(ee,ie,Math.floor((z+K)/2*re))}(C),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Vr("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof LM||(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=qM(new ni(0,0,0),this.map.transform.projection),x=[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,Be=Ne[1].y-Ne[0].y,Ze=Ne[2].x-Ne[1].x,yt=Ne[2].y-Ne[1].y,ht=Ne[3].x-Ne[2].x,jt=Ne[3].y-Ne[2].y,Et=Ne[0].x-Ne[3].x,Dt=Ne[0].y-Ne[3].y,tr=Fe*yt-Ze*Be,$t=Ze*jt-ht*yt,or=ht*Dt-Et*jt,mr=Et*Be-Fe*Dt;return tr>0&&$t>0&&or>0&&mr>0||tr<0&&$t<0&&or<0&&mr<0}(x))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const _=qM(this.tileID,this.map.transform.projection),[C,T,L,z]=this.coordinates.map(Ne=>{const Fe=_.projection.project(Ne[0],Ne[1]);return Hbe(_,Fe)._round()});this.perspectiveTransform=a2e(C.x,C.y,T.x,T.y,L.x,L.y,z.x,z.y);const q=this._boundsArray=new j0;q.emplaceBack(C.x,C.y,0,0),q.emplaceBack(T.x,T.y,Rr,0),q.emplaceBack(z.x,z.y,0,Rr),q.emplaceBack(L.x,L.y,Rr,Rr),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=c.createVertexBuffer(q,Cle.members),this.boundsSegments=Yi.simpleSegment(0,0,4,2);const K=[],Y=[ML((ee=this.coordinates)[0]),ML(ee[1]),ML(ee[2]),ML(ee[3])];var ee;const[re,ie,ge,Ce]=function(Ne){let Fe=Ne[0][0],Be=Fe,Ze=Ne[0][1],yt=Ze;for(let ht=1;htBe&&(Be=Ne[ht][0]),Ne[ht][1]yt&&(yt=Ne[ht][1]);return[Fe,Ze,Be-Fe,yt-Ze]}(Y);{const Ne=new j0,[Fe,Be,Ze,yt]=function(xr){let _r=xr[0].x,ir=_r,sr=xr[0].y,br=sr;for(let zr=1;zrir&&(ir=xr[zr].x),xr[zr].ybr&&(br=xr[zr].y);return[_r,sr,ir-_r,br-sr]}(x),ht=xr=>[(xr.x-Fe)/Ze,(xr.y-Be)/yt],[jt,Et,Dt,tr]=x.map(ht),$t=function(xr,_r,ir,sr,br,zr,Ar,Ns){const Jr=CL(0,0,1,0,1,1,0,1);return b(Jr,Jr,v([],CL(xr,_r,ir,sr,br,zr,Ar,Ns)))}(jt[0],jt[1],Et[0],Et[1],Dt[0],Dt[1],tr[0],tr[1]);this.elevatedGlobePerspectiveTransform=a2e(jt[0],jt[1],Et[0],Et[1],Dt[0],Dt[1],tr[0],tr[1]);const or=(xr,_r)=>{K.push(xr.lng);const ir=Math.round((xr.lng-re)/ge*Rr),sr=Math.round((xr.lat-ie)/Ce*Rr),br=ht(_r),zr=ce([],[br[0],br[1],1],$t),Ar=Math.round(zr[0]/zr[2]*Rr),Ns=Math.round(zr[1]/zr[2]*Rr);Ne.emplaceBack(ir,sr,Ar,Ns)},mr=x[3].x-x[0].x,pr=x[3].y-x[0].y,wr=x[2].x-x[1].x,kr=x[2].y-x[1].y;for(let xr=0;xr<65;xr++){const _r=xr/64,ir=[x[0].x+_r*mr,x[0].y+_r*pr],sr=[x[1].x+_r*wr,x[1].y+_r*kr],br=sr[0]-ir[0],zr=sr[1]-ir[1];for(let Ar=0;Ar<65;Ar++){const Ns=Ar/64,Jr={x:ir[0]+br*Ns,y:ir[1]+zr*Ns};or(h.projection.unproject(Jr.x,Jr.y),Jr)}}this.elevatedGlobeVertexBuffer=c.createVertexBuffer(Ne,Cle.members)}{this.maxLongitudeTriangleSize=0;let Ne=[],Fe=new el;const Be=(Ze,yt,ht)=>{Fe.emplaceBack(Ze,yt,ht);const jt=K[Ze],Et=K[yt],Dt=K[ht],tr=Math.min(Math.min(jt,Et),Dt),$t=Math.max(Math.max(jt,Et),Dt)-tr;$t>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=$t),Ne.push(tr+$t/2)};for(let Ze=0;Ze<64;Ze++)for(let yt=0;yt<64;yt++){const ht=65*Ze+yt,jt=ht+1,Et=ht+65,Dt=Et+1;Be(ht,Et,jt),Be(jt,Et,Dt)}[Ne,Fe]=function(Ze,yt){const ht=Array.from({length:Ze.length},(Dt,tr)=>tr);ht.sort((Dt,tr)=>Ze[Dt]-Ze[tr]);const jt=[],Et=new el;for(let Dt=0;Dt{T.segments.push({vertexOffset:0,primitiveOffset:Y,vertexLength:h.segments[0].vertexLength,primitiveLength:ee,sortKey:void 0,vaos:{}})},z=.51*this.maxLongitudeTriangleSize;if(Math.abs(x[0]-_)<=z){const Y=Fi(x,0,x.length,_+z);return Y===x.length||L(Y,Io(x,Y+1,x.length,_+360-z)-Y),T}_Rr?_-Rr:_,new dr(Math.trunc(_),Math.trunc(x[h+1]))}translationForInstance(c){const h=16*c,x=this.instancedDataArray.float32;return[x[h+4],x[h+5],x[h+6]]}rotationScaleForInstance(c){const h=16*c,x=this.instancedDataArray.float32;return[x[h+7],x[h+8],x[h+9],x[h+10],x[h+11],x[h+12],x[h+13],x[h+14],x[h+15]]}transformForInstance(c){const h=16*c,x=this.instancedDataArray.float32;return[x[h+7],x[h+8],x[h+9],x[h+4],x[h+10],x[h+11],x[h+12],x[h+5],x[h+13],x[h+14],x[h+15],x[h+6],0,0,0,1]}}class Ale{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,x,_){}populate(c,h,x,_){this.tileToMeter=De(x);const C=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:T,id:L,index:z,sourceLayerIndex:q}of c){const K=L??(T.properties&&T.properties.hasOwnProperty("id")?T.properties.id:void 0),Y=Bt(T,C);if(!this.layers[0]._featureFilter.filter(new gi(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),Y,x))continue;const ee={id:K,sourceLayerIndex:q,index:z,geometry:C?Y.geometry:Tt(T,x,_),properties:T.properties,type:T.type,patterns:{}},re=this.addFeature(ee,ee.geometry,Y);re&&h.featureIndex.insert(T,ee.geometry,z,q,this.index,this.instancesPerModel[re].instancedDataArray.length,Rr/32)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const c=this.layers[0].modelManager,h=this.layers[0].scope;let x=0;for(const _ of this.modelUris){const C=c.getModel(_,h);if(!C)continue;const T=this.instancesPerModel[_];if(T){const L=.5*Ae(C.aabb.max,C.aabb.min)*T.maxScale+T.maxXYTranslationDistance,z=Math.min(Rr,Math.max(L/this.tileToMeter,Rr/32));x=Math.max(z,x)}}return x}update(c,h,x,_){for(const C in this.instancesPerModel){const T=this.instancesPerModel[C];for(const L in c)T.idToFeaturesIndex.hasOwnProperty(L)&&(this.evaluate(T.features[T.idToFeaturesIndex[L]],c[L],T,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let c=!1;for(const h in this.instancesPerModel){const x=this.instancesPerModel[h];for(const _ of x.features){const C=this.layers[0],T=_.feature,L=this.canonical,z=C.paint.get("model-rotation").evaluate(T,{},L),q=C.paint.get("model-scale").evaluate(T,{},L),K=C.paint.get("model-translation").evaluate(T,{},L);rt(_.rotation,z)&&rt(_.scale,q)&&rt(_.translation,K)||(this.evaluate(_,_.featureStates,x,!0),c=!0)}}return c}updateReplacement(c,h,x,_){if(h.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=h.updateTime;const C=h.getReplacementRegionsForTile(c.toUnwrapped(),!0);if(J6(this.activeReplacements,C))return!1;this.activeReplacements=C;let T=!1;for(const L in this.instancesPerModel){const z=this.instancesPerModel[L],q=z.instancedDataArray;for(const K of z.features){const Y=K.instancedDataOffset,ee=K.instancedDataCount;for(let re=0;reRr;ge=Ce?ge-Rr:ge;const Ne=Math.floor(ge),Fe=Math.floor(q.float32[ie+1]);let Be=!1;for(const Ze of this.activeReplacements)if(!r_e(Ze,x,p2e.Model,_)&&!(Ze.min.x>Ne||Ne>Ze.max.x||Ze.min.y>Fe||Fe>Ze.max.y)&&(Be=o_e(i_e(Ne,Fe,c.canonical,Ze.footprintTileId.canonical),Ze.footprint),Be))break;q.float32[ie]=Be?ge+Rr:ge,T=T||Be!==Ce}}}return T}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 x=this.instancesPerModel[h];x.instancedDataArray.length<0||x.instancedDataArray.length===0||(x.instancedDataBuffer?x.instancedDataBuffer.updateData(x.instancedDataArray):x.instancedDataBuffer=c.createVertexBuffer(x.instancedDataArray,NWe.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(c){for(const x in this.instancesPerModel){const _=this.instancesPerModel[x];_.instancedDataArray.length!==0&&_.instancedDataBuffer&&_.instancedDataBuffer.destroy()}const h=this.layers[0].modelManager;if(c&&h&&this.modelUris&&this.modelsRequested)for(const x of this.modelUris)h.removeModel(x,"",!0)}addFeature(c,h,x){const _=this.layers[0],C=_.layout.get("model-id").evaluate(x,{},this.canonical);if(!C)return es(`modelId is not evaluated for layer ${_.id} and it is not going to get rendered.`),C;(Tle(C,!1)||this.styleDefinedModelURLs[C]!==void 0)&&(this.modelUris.includes(C)||this.modelUris.push(C)),this.instancesPerModel[C]||(this.instancesPerModel[C]=new g2e);const T=this.instancesPerModel[C],L=T.instancedDataArray,z=new f2e(x,L.length);for(const q of h)for(const K of q){if(K.x<0||K.x>=Rr||K.y<0||K.y>=Rr)continue;if(this.lookupDim!==0){const ee=(this.lookupDim-1)/Rr,re=this.lookupDim*(K.y*ee|0)+K.x*ee|0;if(this.lookup){if(this.lookup[re]!==0)continue;this.lookup[re]=1}}this.instanceCount++;const Y=L.length;L.resize(Y+1),T.instancesEvaluatedElevation.push(0),L.float32[16*Y]=K.x,L.float32[16*Y+1]=K.y}return z.instancedDataCount=T.instancedDataArray.length-z.instancedDataOffset,z.instancedDataCount>0&&(c.id&&(T.idToFeaturesIndex[c.id]=T.features.length),T.features.push(z),this.evaluate(z,{},T,!1)),C}getModelUris(){return this.modelUris}evaluate(c,h,x,_){const C=this.layers[0],T=c.feature,L=this.canonical,z=c.rotation=C.paint.get("model-rotation").evaluate(T,h,L),q=c.scale=C.paint.get("model-scale").evaluate(T,h,L),K=c.translation=C.paint.get("model-translation").evaluate(T,h,L),Y=Object.assign({},C.paint.get("model-color").evaluate(T,h,L));Y.a=C.paint.get("model-color-mix-intensity").evaluate(T,h,L);const ee=[];this.maxVerticalOffset0?Math.sqrt(re):0;x.maxScale=Math.max(Math.max(x.maxScale,q[0]),Math.max(q[1],q[2])),x.maxXYTranslationDistance=Math.max(x.maxXYTranslationDistance,ie),this.maxScale=Math.max(Math.max(this.maxScale,q[0]),Math.max(q[1],q[2])),G_e(ee,z,q);const ge=Math.round(100*Y.a)+Y.b/1.05;for(let Ce=0;Ce10?this.tileToMeter:De(L,yt)),Be[Fe+4]=K[0],Be[Fe+5]=K[1],Be[Fe+6]=K[2]+Ze,Be[Fe+7]=ee[0],Be[Fe+8]=ee[1],Be[Fe+9]=ee[2],Be[Fe+10]=ee[4],Be[Fe+11]=ee[5],Be[Fe+12]=ee[6],Be[Fe+13]=ee[8],Be[Fe+14]=ee[9],Be[Fe+15]=ee[10],x.instancesEvaluatedElevation[Ne]=K[2]}}}let x2e,y2e;hs(Ale,"ModelBucket",{omit:["layers"]}),hs(g2e,"PerModelAttributes"),hs(f2e,"ModelFeature");class k4{constructor(c,h,x){this._demTile=c,this._dem=this._demTile.dem,this._scale=h,this._offset=x}static create(c,h,x){const _=x||c.findDEMTileFor(h);if(!_||!_.dem)return;const C=_.dem,T=_.tileID,L=1<q.fqid),this.stateDependentLayerIds=this.layers.filter(q=>q.isStateDependent()).map(q=>q.id),this.modelTraits|=f4.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,_&&(this.modelTraits|=f4.HasMapboxMeshFeatures),C&&(this.modelTraits|=f4.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=T,this.worldview=z,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const q of h)this.nodesInfo.push(new w2e(q)),_2e(q,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 x of this.getNodesInfo()){const _=x.node;_.footprint&&h.push({footprint:_.footprint,id:c})}}updateAppearances(c,h,x,_){}update(c){const h=Object.keys(c).length!==0;if(h&&!this.stateDependentLayers.length)return;const x=h?this.stateDependentLayers:this.layers;if(!Fa(c,this.states))for(const _ of x)this.evaluate(_,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 x of h){const _=x.node;this.uploaded?this.updatePbrBuffer(_):tle(_,c,!0)}for(const x of h)uL(x.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(c){let h=!1;if(!c.meshes)return h;for(const x of c.meshes)x.pbrBuffer&&(x.pbrBuffer.updateData(x.featureArray),h=!0);return h}needsReEvaluation(c,h,x){const _=c.transform.projectionOptions,C=c.style.getBrightness(),T=this.brightness!==C;if(!this.uploaded||this.dirty||_.name!==this.projection.name||XM(x.paint.get("model-color").value,T)||XM(x.paint.get("model-color-mix-intensity").value,T)||XM(x.paint.get("model-roughness").value,T)||XM(x.paint.get("model-emissive-strength").value,T)||XM(x.paint.get("model-height-based-emissive-strength-multiplier").value,T)){this.projection=_,this.brightness=C;const L=this.getNodesInfo();for(const z of L)z.state=null;return!0}return!1}evaluateTransform(c,h){if(c.transform.zoom===this.zoom)return;this.zoom=c.transform.zoom;const x=this.getNodesInfo(),_=this.id.canonical;for(const C of x){const T=C.feature;C.evaluatedTranslation=h.paint.get("model-translation").evaluate(T,{},_),C.evaluatedScale=h.paint.get("model-scale").evaluate(T,{},_)}}evaluate(c,h){const x=this.getNodesInfo();for(const _ of x){if(!_.node.meshes)continue;const C=_.feature,T=h&&h[C.id];if(Fa(T,_.state))continue;_.state=structuredClone(T);const L=_.node.meshes&&_.node.meshes[0].featureData,z=_.evaluatedColor[2],q=_.evaluatedRMEA[2],K=this.id.canonical;if(_.hasTranslucentParts=!1,L){for(let Y=0;Y=ht)continue;const xr=Ele[kr],_r=Math.abs(xr);_r>$t&&(tr=xr,$t=_r,or=wr,mr=pr)}if($t>.1){const pr=1-(ht+.5*Math.abs(or*mr))/ie;let wr=h._dem.get(Et,jt)+tr*pr;const kr=h._dem.get(Et+or,jt+mr),xr=h._dem.get(Et-or,jt-mr,!0);(wr-kr)*(wr-xr)>0&&(wr=(kr+xr)/2),Ele[Dt]=h._dem.set(Et,jt,wr),M_[Dt]=ht}}}}}L&&(h._demTile.needsDEMTextureUpload=!0,h._dem._timestamp=Jo.now())}setFilter(c){this.filter=c?zN(c):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(c=>this.filter.filter(new gi(this.id.overscaledZ,{worldview:this.worldview}),c.feature,this.id.canonical)):this.nodesInfo}destroy(){const c=this.getNodesInfo();for(const h of c)uL(h.node),rle(h.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(c,h){if(h.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=h.updateTime;const x=h.getReplacementRegionsForTile(c.toUnwrapped());for(const _ of this.getNodesInfo()){const C=_.node.footprint;_.hiddenByReplacement=!!C&&!x.find(T=>T.footprint===C)}}getHeightAtTileCoord(c,h){const x=[],_=[0,0,0],C=S([]);for(const T of this.getNodesInfo()){const L=T.node.meshes[0],z=L.transformedAabb;if(cz.max[0]||h>z.max[1])continue;if(T.node.hidden===!0)return{height:1/0,maxHeight:T.feature.properties.height,hidden:!1,verticalScale:T.evaluatedScale[2]};A(C,T.node.globalMatrix),_[0]=c,_[1]=h,at(_,_,C);const q=(_[0]-L.aabb.min[0])/(L.aabb.max[0]-L.aabb.min[0])*N_|0,K=Math.min(63,(_[1]-L.aabb.min[1])/(L.aabb.max[1]-L.aabb.min[1])*N_|0)*N_+Math.min(63,q),Y=L.heightmap[K];if(!(Y<0&&T.node.footprint))return T.hiddenByReplacement?void 0:{height:Y,maxHeight:T.feature.properties.height,hidden:!1,verticalScale:T.evaluatedScale[2]};if(T.node.footprint.grid.query(new dr(c,h),new dr(c,h),x),x.length>0)return{height:void 0,maxHeight:T.feature.properties.height,hidden:T.hiddenByReplacement,verticalScale:T.evaluatedScale[2]}}}}function XM(p,c){return p instanceof v0&&!p.isLightConstant&&c}function sKe(p,c,h,x,_,C,T,L){let z=(61440&c|(61440&c)>>4)>>8,q=(3840&c|(3840&c)>>4)>>4,K=240&c|(240&c)>>4;h[3]>0&&(z=Hs(z,255*h[0],h[3]),q=Hs(q,255*h[1],h[3]),K=Hs(K,255*h[2],h[3]));const Y=z<<8|q,ee=K<<8|Math.floor(255*x[3]),re=function(ht){const jt=ye(ht,0,2);return Math.min(Math.round(.5*jt*255),255)}(x[2])<<8|15*x[0]<<4|15*x[1],ie=ye(_[0],0,1),ge=ye(_[1],0,1),Ce=ye(_[2],0,1),Ne=ye(_[3],0,1);let Fe,Be,Ze,yt;if(ie!==ge&&T!==C&&ge!==ie){const ht=T-C;Be=1/(ht*(ge-ie)),Ze=-(C+ht*ie)/(ht*(ge-ie));const jt=ye(_[4],-1,1);yt=Math.pow(10,jt),Fe=255*Ce<<8|255*Ne}else Fe=65535,Be=0,Ze=1,yt=1;if(p.emplaceBack(Y,ee,re,Fe,Be,Ze,yt),L){const ht=L.length;L.clear();for(let jt=0;jt>16&65535,K=C?z>>16&65535:65535&z,Y=(15&K)<8?15&K:0,ee=p.evaluatedRMEA[Y],re=p.evaluatedColor[Y],ie=p.emissionHeightBasedParams[Y];let ge;if(L&&Y===2&&x.lights&&(ge=new YN,ge.resize(10*x.lights.length)),sKe(T.featureArray,q,re,ee,ie,T.aabb.min[2],T.aabb.max[2],ge),ge&&L){L=!1;const Ce=x.meshes[x.lightMeshIndex];Ce.featureArray=ge,Ce.featureArray._trim()}}T.featureArray._trim(),_++}}hs(AL,"Tiled3dModelBucket",{omit:["layers"]}),hs(w2e,"Tiled3dModelFeature");const aKe=["id","tile","layer","source","sourceLayer","state"];class T_{constructor(c,h,x,_,C){this.type="Feature",this._vectorTileFeature=c,this._z=h,this._x=x,this._y=_,this.properties=c?c.properties:{},this.id=C}clone(){const c=new T_(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(c.state=Object.assign({},this.state)),this.layer&&(c.layer=Object.assign({},this.layer)),this.source&&(c.source=this.source),this.sourceLayer&&(c.sourceLayer=this.sourceLayer),c}get geometry(){return this._geometry===void 0&&this._vectorTileFeature&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(c){this._geometry=c}toJSON(){const c={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const h of aKe)this[h]!==void 0&&(c[h]=this[h]);return c}}class A_ extends Vn{constructor(c,h,x,_){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 x=this._options.models[h],_=this._modelsInfo.get(h);if(_){const C=_.model;C.position=x.position!=null?new f(x.position[0],x.position[1]):new f(0,0),C.orientation=x.orientation!=null?x.orientation:[0,0,0],_.modelSpec=x,A_.applyModelSpecification(C,x),C.computeBoundsAndApplyParent(),this.models.push(C)}else{const C=q_e(this.map._requestManager.transformRequest(x.uri,Rp.Model).url).then(T=>{if(!T)return;const L=nle(T),z=new K_e(h,x.uri,x.position,x.orientation,L);A_.applyModelSpecification(z,x),z.computeBoundsAndApplyParent(),this.models.push(z),this._modelsInfo.set(h,{modelSpec:x,model:z})}).catch(T=>{this.fire(new pn(new Error(`Could not load model ${h} from ${x.uri}: ${T.message}`)))});c.push(C)}}Promise.allSettled(c).then(()=>{this._loaded=!0,this.fire(new Vr("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(h=>{this._loaded=!0,this.fire(new pn(new Error(`Could not load models: ${h.message}`)))})}static applyModelSpecification(c,h){h.nodeOverrides&&A_.convertNodeOverrides(c,h.nodeOverrides),h.materialOverrides&&A_.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(x=>typeof x=="string")){c.nodeOverrideNames=[];for(const x of h)c.nodeOverrideNames.push(x)}else Object.entries(h).forEach(([x,_])=>{const C={orientation:[0,0,0]};if(_.hasOwnProperty("orientation")){const T=_.orientation;T&&(C.orientation=T)}c.nodeOverrides.set(x,C)})}static convertMaterialOverrides(c,h){if(Array.isArray(h)&&h.every(x=>typeof x=="string")){c.materialOverrideNames=[];for(const x of h)c.materialOverrideNames.push(x)}else Object.entries(h).forEach(([x,_])=>{const C={color:new Ma(1,1,1),colorMix:0,emissionStrength:0,opacity:1},T=_["model-color"];T!==void 0&&(C.color.r=T[0],C.color.g=T[1],C.color.b=T[2]);const L=_["model-color-mix-intensity"];L!==void 0&&(C.colorMix=L);const z=_["model-emissive-strength"];z!==void 0&&(C.emissionStrength=z);const q=_["model-opacity"];q!==void 0&&(C.opacity=q),c.materialOverrides.set(x,C)})}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=em(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 x in c){const _=c[x];if(this._modelsInfo.has(x)){const C=this._modelsInfo.get(x);C&&C.modelSpec.uri===_.uri&&h.set(x,C)}}this._modelsInfo=h,this._options.models=c,this._loaded=!1,this.load()}}function Ile(p,c,h,x){const _=1<Ze.polygon).flat());const Ce=re?L:null,[Ne,Fe]=E_e(C,x,Y,K,q,T,Ce,ee,ie,C.center.lat,p.tileID.canonical),Be=p.queryGeometry;return A_e(Ne,Fe,Be.isPointQuery()?Be.screenBounds:Be.screenGeometry)}},building:class extends Td{constructor(p,c,h,x){super(p,{layout:tbe||(tbe=new lo({visibility:new Pr(Vt.layout_building.visibility),"building-facade":new Wr(Vt.layout_building["building-facade"]),"building-facade-floors":new Wr(Vt.layout_building["building-facade-floors"]),"building-facade-unit-width":new Wr(Vt.layout_building["building-facade-unit-width"]),"building-facade-window":new Wr(Vt.layout_building["building-facade-window"]),"building-roof-shape":new Wr(Vt.layout_building["building-roof-shape"]),"building-height":new Wr(Vt.layout_building["building-height"]),"building-base":new Wr(Vt.layout_building["building-base"]),"building-flood-light-wall-radius":new Wr(Vt.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new Wr(Vt.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new Wr(Vt.layout_building["building-flip-roof-orientation"])})),paint:rbe||(rbe=new lo({"building-opacity":new Pr(Vt.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new Pr(Vt.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new Pr(Vt.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new Pr(Vt.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new Pr(Vt.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new Pr(Vt.paint_building["building-vertical-scale"]),"building-cast-shadows":new Pr(Vt.paint_building["building-cast-shadows"]),"building-color":new Wr(Vt.paint_building["building-color"]),"building-emissive-strength":new Wr(Vt.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new Pr(Vt.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new Pr(Vt.paint_building["building-cutoff-fade-range"]),"building-flood-light-color":new Pr(Vt.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new Pr(Vt.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new Pr(Vt.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new Wr({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new Wr({type:"string",default:"default","property-type":"data-driven"})}))},c,h,x),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(p){return new ebe(p)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(p){return!0}queryRadius(p){return 0}queryIntersectsFeature(p,c,h,x,_,C,T,L,z){let q=this.layout.get("building-height").evaluate(c,h);const K=this.layout.get("building-base").evaluate(c,h),Y=p.tile.getBucket(this).getFootprint(c);if(Y){if(Y.hiddenFlags!==0)return!1;q=Y.height}const[ee,re]=E_e(C,x,K,q,new dr(0,0),T,null,[0,0],1,C.center.lat,p.tileID.canonical),ie=p.queryGeometry;return A_e(ee,re,ie.isPointQuery()?ie.screenBounds:ie.screenGeometry)}},line:class extends Td{constructor(p,c,h,x){const _=hbe();super(p,_,c,h,x),_.layout&&(this.layout=new Mx(_.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(p){if(p==="line-gradient"){const c=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=c._styleExpression&&c._styleExpression.expression instanceof e_,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(p,c){super.recalculate(p,c),this.paint._values["line-floorwidth"]=(()=>{if(DM)return DM;const h=hbe();return DM=new tGe(h.paint.properties["line-width"].specification),DM.useIntegerZoom=!0,DM})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,p)}createBucket(p){return new ole(p)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(p,c,h){const x=dbe(this);return{config:new yg(this,{zoom:c,lut:h}),defines:x,overrideFog:!1}}queryRadius(p){const c=p,h=mbe(Vc("line-width",this,c),Vc("line-gap-width",this,c)),x=Vc("line-offset",this,c);return h/2+Math.abs(x)+Ql(this.paint.get("line-translate"))}queryIntersectsFeature(p,c,h,x,_,C){if(p.queryGeometry.isAboveHorizon)return!1;const T=Uu(p.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),C.angle,p.pixelToTileUnitsFactor),L=p.pixelToTileUnitsFactor/2*mbe(this.paint.get("line-width").evaluate(c,h),this.paint.get("line-gap-width").evaluate(c,h)),z=this.paint.get("line-offset").evaluate(c,h);return z&&(x=function(q,K){const Y=[],ee=new dr(0,0);for(let re=0;re=3){for(let ie=0;ie>16&255)/255,(p>>8&255)/255,(255&p)/255,1)}function _Ke(p,c,h){p===1?(c.rgb_color=LL(h.readVarint()),c.paint="rgb_color"):p===2?(c.linear_gradient_idx=h.readVarint(),c.paint="linear_gradient_idx"):p===3?(c.radial_gradient_idx=h.readVarint(),c.paint="radial_gradient_idx"):p===5?h.readPackedFloat(c.dasharray):p===6?c.dashoffset=h.readFloat():p===7?c.miterlimit=h.readFloat():p===8?c.opacity=h.readVarint():p===9?c.width=h.readFloat():p===10?c.linecap=h.readVarint():p===11&&(c.linejoin=h.readVarint())}function bKe(p,c,h){p===1?c.transform=PL(h,h.readVarint()+h.pos):p===2?c.spread_method=h.readVarint():p===3?c.stops.push(S2e(h,h.readVarint()+h.pos)):p===4?c.x1=h.readFloat():p===5?c.y1=h.readFloat():p===6?c.x2=h.readFloat():p===7&&(c.y2=h.readFloat())}function S2e(p,c){return p.readFields(wKe,{offset:0,opacity:255,rgb_color:Ple},c)}function wKe(p,c,h){p===1?c.offset=h.readFloat():p===2?c.opacity=h.readVarint():p===3&&(c.rgb_color=LL(h.readVarint()))}function jKe(p,c,h){p===1?c.transform=PL(h,h.readVarint()+h.pos):p===2?c.spread_method=h.readVarint():p===3?c.stops.push(S2e(h,h.readVarint()+h.pos)):p===4?c.cx=h.readFloat():p===5?c.cy=h.readFloat():p===6?c.r=h.readFloat():p===7?c.fx=h.readFloat():p===8?c.fy=h.readFloat():p===9&&(c.fr=h.readFloat())}function kKe(p,c,h){p===1?c.transform=PL(h,h.readVarint()+h.pos):p===2?c.clip_path_idx=h.readVarint():p===3&&c.children.push(IL(h,h.readVarint()+h.pos))}function NKe(p,c,h){p===1?c.left=c.top=h.readFloat():p===2?c.width=c.height=h.readFloat():p===3?c.top=h.readFloat():p===4?c.height=h.readFloat():p===5?c.mask_type=h.readVarint():p===6?c.mask_idx=h.readVarint():p===7&&c.children.push(IL(h,h.readVarint()+h.pos))}class SKe{static calculate(c={},h=[]){const x=new Map,_=new Map;if(Object.keys(c).length===0)return x;h.forEach(C=>{_.set(C.name,C.rgb_color||new Ma(0,0,0))});for(const[C,T]of Object.entries(c))_.has(C)?x.set(_.get(C).toString(),T):console.warn(`Ignoring unknown image variable "${C}"`);return x}}function N4(p,c=255,h){const x=c/255,_=p.toString(),C=h.has(_)?h.get(_).clone():p.clone();return C.a*=x,C.toString()}function JM(p,c){if(!fh()){const h=document.createElement("canvas");return h.width=p,h.height=c,h}return new OffscreenCanvas(p,c)}let Dle,eT=null;function Rle(p,c,h,x,_){for(const C of x.children)C2e(p,c,h,C,_)}function C2e(p,c,h,x,_){x.group?(p.save(),function(C,T,L,z,q){const K=z.mask_idx!=null?L.masks[z.mask_idx]:null,Y=z.clip_path_idx!=null?L.clip_paths[z.clip_path_idx]:null;if(z.transform&&(T=S4(z.transform).preMultiplySelf(T)),!function(ie,ge,Ce){return ie.opacity!==255||ge||Ce}(z,Y!=null,K!=null))return void Rle(C,T,L,z,q);const ee=JM(C.canvas.width,C.canvas.height),re=ee.getContext("2d");Rle(re,T,L,z,q),Y&&L2e(re,T,L,Y),K&&O2e(re,T,L,K,q),C.globalAlpha=z.opacity/255,C.drawImage(ee,0,0)}(p,c,h,x.group,_),p.restore()):x.path&&(p.save(),function(C,T,L,z,q){C.setTransform(T),z.paint_order===lKe.PAINT_ORDER_FILL_AND_STROKE?(M2e(C,L,z,q),A2e(C,L,z,q)):(A2e(C,L,z,q),M2e(C,L,z,q))}(p,c,h,x.path,_),p.restore())}function M2e(p,c,h,x){const _=h.fill;if(!_)return;const C=_.opacity/255;switch(p.save(),p.beginPath(),D2e(h,p),_.paint){case"rgb_color":p.fillStyle=N4(_.rgb_color,_.opacity,x);break;case"linear_gradient_idx":{const T=c.linear_gradients[_.linear_gradient_idx];T.transform&&p.setTransform(S4(T.transform).preMultiplySelf(p.getTransform())),p.fillStyle=E2e(p,T,C,x);break}case"radial_gradient_idx":{const T=c.radial_gradients[_.radial_gradient_idx];T.transform&&p.setTransform(S4(T.transform).preMultiplySelf(p.getTransform())),p.fillStyle=I2e(p,T,C,x)}}p.fill(T2e(h)),p.restore()}function T2e(p){return p.rule===Lle.PATH_RULE_NON_ZERO?"nonzero":p.rule===Lle.PATH_RULE_EVEN_ODD?"evenodd":void 0}function A2e(p,c,h,x){const _=h.stroke;if(!_)return;const C=R2e(h);p.lineWidth=_.width,p.miterLimit=_.miterlimit,p.setLineDash(_.dasharray),p.lineDashOffset=_.dashoffset;const T=_.opacity/255;switch(_.paint){case"rgb_color":p.strokeStyle=N4(_.rgb_color,_.opacity,x);break;case"linear_gradient_idx":p.strokeStyle=E2e(p,c.linear_gradients[_.linear_gradient_idx],T,x,!0);break;case"radial_gradient_idx":p.strokeStyle=I2e(p,c.radial_gradients[_.radial_gradient_idx],T,x,!0)}switch(_.linejoin){case EL.LINE_JOIN_MITER_CLIP:case EL.LINE_JOIN_MITER:p.lineJoin="miter";break;case EL.LINE_JOIN_ROUND:p.lineJoin="round";break;case EL.LINE_JOIN_BEVEL:p.lineJoin="bevel"}switch(_.linecap){case Ole.LINE_CAP_BUTT:p.lineCap="butt";break;case Ole.LINE_CAP_ROUND:p.lineCap="round";break;case Ole.LINE_CAP_SQUARE:p.lineCap="square"}p.stroke(C)}function E2e(p,c,h,x,_=!1){if(c.stops.length===1){const ee=c.stops[0];return N4(ee.rgb_color,ee.opacity*h,x)}const{x1:C,y1:T,x2:L,y2:z}=c;let q=new DOMPoint(C,T),K=new DOMPoint(L,z);if(_){const ee=S4(c.transform);q=ee.transformPoint(q),K=ee.transformPoint(K)}const Y=p.createLinearGradient(q.x,q.y,K.x,K.y);for(const ee of c.stops)Y.addColorStop(ee.offset,N4(ee.rgb_color,ee.opacity*h,x));return Y}function I2e(p,c,h,x,_=!1){if(c.stops.length===1){const Ne=c.stops[0];return N4(Ne.rgb_color,Ne.opacity*h,x)}const C=S4(c.transform),{fx:T,fy:L,fr:z,cx:q,cy:K,r:Y}=c;let ee=new DOMPoint(T,L),re=new DOMPoint(q,K),ie=z,ge=Y;if(_){ee=C.transformPoint(ee),re=C.transformPoint(re);const Ne=(C.a+C.d)/2;ie=z*Ne,ge=c.r*Ne}const Ce=p.createRadialGradient(ee.x,ee.y,ie,re.x,re.y,ge);for(const Ne of c.stops)Ce.addColorStop(Ne.offset,N4(Ne.rgb_color,Ne.opacity*h,x));return Ce}function P2e(p,c,h,x){const _=x.transform?S4(x.transform).preMultiplySelf(c):c,C=JM(p.canvas.width,p.canvas.height),T=C.getContext("2d");for(const z of x.children)if(z.group)P2e(T,_,h,z.group);else if(z.path){const q=z.path,K=new Path2D;K.addPath(R2e(q),_),T.fill(K,T2e(q))}const L=x.clip_path_idx!=null?h.clip_paths[x.clip_path_idx]:null;L&&L2e(T,_,h,L),p.globalCompositeOperation="source-over",p.drawImage(C,0,0)}function L2e(p,c,h,x){const _=JM(p.canvas.width,p.canvas.height);P2e(_.getContext("2d"),c,h,x),p.globalCompositeOperation="destination-in",p.drawImage(_,0,0)}function O2e(p,c,h,x,_){if(x.children.length===0)return;const C=x.mask_idx!=null?h.masks[x.mask_idx]:null;C&&O2e(p,c,h,C,_);const T=p.canvas.width,L=p.canvas.height,z=JM(T,L),q=z.getContext("2d"),K=x.width,Y=x.height,ee=x.left,re=x.top,ie=new Path2D,ge=new Path2D;ge.rect(ee,re,K,Y),ie.addPath(ge,c),q.clip(ie);for(const Fe of x.children)C2e(q,c,h,Fe,_);const Ce=q.getImageData(0,0,T,L),Ne=Ce.data;if(x.mask_type===j2e.MASK_TYPE_LUMINANCE)for(let Fe=0;Fec[T])return null}else{const L=1/x[T];let z=(p[T]-h[T])*L,q=(c[T]-h[T])*L;if(z>q){const K=z;z=q,q=K}if(z>_&&(_=z),qC)return null}return _}function B2e(p,c,h,x,_,C,T,L,z,q,K){const Y=x-p,ee=_-c,re=C-h,ie=T-p,ge=L-c,Ce=z-h,Ne=K[1]*Ce-K[2]*ge,Fe=K[2]*ie-K[0]*Ce,Be=K[0]*ge-K[1]*ie,Ze=Y*Ne+ee*Fe+re*Be;if(Math.abs(Ze)<1e-15)return null;const yt=1/Ze,ht=q[0]-p,jt=q[1]-c,Et=q[2]-h,Dt=(ht*Ne+jt*Fe+Et*Be)*yt;if(Dt<0||Dt>1)return null;const tr=jt*re-Et*ee,$t=Et*Y-ht*re,or=ht*ee-jt*Y,mr=(K[0]*tr+K[1]*$t+K[2]*or)*yt;return mr<0||Dt+mr>1?null:(ie*tr+ge*$t+Ce*or)*yt}function $2e(p,c,h){return(p-c)/(h-c)}function U2e(p,c,h,x,_,C,T,L,z){const q=1<{const Fe=Ce?1:0,Be=(re+1)*ge-Fe,Ze=ie*ge,yt=(ie+1)*ge-Fe;Ne[0]=re*ge,Ne[1]=Ze,Ne[2]=Be,Ne[3]=yt};let Y=new F2e(z);const ee=[];for(let re=0;re=1;z/=2){const re=L[L.length-1];Y=new F2e(z);for(let ie=0;ie0;){const{idx:ie,t:ge,nodex:Ce,nodey:Ne,depth:Fe}=re.pop();if(this.leaves[ie]){U2e(Ce,Ne,Fe,c,h,x,_,Y,ee);const Ze=1<=kr[2])return ge}continue}let Be=0;for(let Ze=0;Ze=q[K[Et]]&&(K.splice(Et,0,Ze),jt=!0);jt||(K[Be]=Ze),Be++}}for(let Ze=0;Ze=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 x=[0,0,0,0],_=DL.getUnpackVector(h);let C=Math.floor((c+_[3])/_[2]);return x[2]=C%256,C=Math.floor(C/256),x[1]=C%256,C=Math.floor(C/256),x[0]=C,x}getPixels(){return new Fve({width:this.stride,height:this.stride},this.pixels)}backfillBorder(c,h,x){if(this.dim!==c.dim)throw new Error("dem dimension mismatch");let _=h*this.dim,C=h*this.dim+this.dim,T=x*this.dim,L=x*this.dim+this.dim;switch(h){case-1:_=C-1;break;case 1:C=_+1}switch(x){case-1:T=L-1;break;case 1:L=T+1}const z=-h*this.dim,q=-x*this.dim;for(let K=T;K=1;x--){const _=x===1?1:0,C=x===2?1:0;for(let T=0;T>>1^-(1&p[c]);return p}function BKe(p,c){switch(c){case"uint32":return p;case"uint16":for(let h=0;h>4|(61440&x)>>8|(240&_)<<4|61440&_,p[h+1]=15&x|(3840&x)>>4|(15&_)<<8|(3840&_)<<4}return p;case"uint8":for(let h=0;h>6|(192&_)>>4|(192&C)>>2|192&T,p[h+1]=(48&x)>>4|(48&_)>>2|48&C|(48&T)<<2,p[h+2]=(12&x)>>2|12&_|(12&C)<<2|(12&T)<<4,p[h+3]=3&x|(3&_)<<2|(3&C)<<4|(3&T)<<6}return p;default:throw new Error(`Invalid pixel format, "${c}"`)}}hs(DL,"DEMData"),hs(q2e,"DemMinMaxQuadTree",{omit:["dem"]});var nm=Uint8Array,tT=Uint16Array,$Ke=Int32Array,H2e=new nm([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]),W2e=new nm([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]),UKe=new nm([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),G2e=function(p,c){for(var h=new tT(31),x=0;x<31;++x)h[x]=c+=1<>1|(21845&ml)<<1;Y2e[ml]=((65280&(C4=(61680&(C4=(52428&C4)>>2|(13107&C4)<<2))>>4|(3855&C4)<<4))>>8|(255&C4)<<8)>>1}var rT=function(p,c,h){for(var x=p.length,_=0,C=new tT(c);_>z]=q;return T},sT=new nm(288);for(ml=0;ml<144;++ml)sT[ml]=8;for(ml=144;ml<256;++ml)sT[ml]=9;for(ml=256;ml<280;++ml)sT[ml]=7;for(ml=280;ml<288;++ml)sT[ml]=8;var X2e=new nm(32);for(ml=0;ml<32;++ml)X2e[ml]=5;var HKe=rT(sT,9),WKe=rT(X2e,5),zle=function(p){for(var c=p[0],h=1;hc&&(c=p[h]);return c},sf=function(p,c,h){var x=c/8|0;return(p[x]|p[x+1]<<8)>>(7&c)&h},Ble=function(p,c){var h=c/8|0;return(p[h]|p[h+1]<<8|p[h+2]<<16)>>(7&c)},GKe=["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"],nf=function(p,c,h){var x=new Error(c||GKe[p]);if(x.code=p,Error.captureStackTrace&&Error.captureStackTrace(x,nf),!h)throw x;return x},KKe=new nm(0),ZKe=typeof TextDecoder<"u"&&new TextDecoder;try{ZKe.decode(KKe,{stream:!0})}catch{}const YKe={gzip_data:"gzip"};class Km extends Error{constructor(c){super(c),this.name="MRTError"}}const XKe={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},Q2e={uint32:1,uint16:2,uint8:4},QKe={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let $le;class RL{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 Km(`Layer '${c}' not found`);return h}getHeaderLength(c){const h=new Uint8Array(c),x=new DataView(c);if(h[0]!==13)throw new Km("File is not a valid MRT.");return x.getUint32(1,!0)}parseHeader(c){const h=new Uint8Array(c),x=this.getHeaderLength(c);if(h.length= ${x} but got buffer of length ${h.length}`);const _=new $le(h.subarray(0,x)).readFields(AKe,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==_.x||this.y!==_.y||this.z!==_.z))throw new Km(`Invalid attempt to parse header ${_.z}/${_.x}/${_.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=_.x,this.y=_.y,this.z=_.z;for(const C of _.layers)this.layers[C.name]=new J2e(C,{cacheSize:this._cacheSize});return this}createDecodingTask(c){const h=[],x=this.getLayer(c.layerName);for(let _ of c.blockIndices){const C=x.dataIndex[_],T=C.firstByte-c.firstByte,L=C.lastByte-c.firstByte;if(x._blocksInProgress.has(_))continue;const z={layerName:x.name,firstByte:T,lastByte:L,pixelFormat:x.pixelFormat,blockIndex:_,blockShape:[C.bands.length].concat(x.bandShape),buffer:x.buffer,codec:C.codec.codec,filters:C.filters.map(q=>q.filter)};x._blocksInProgress.add(_),h.push(z)}return new ewe(h,()=>{h.forEach(_=>x._blocksInProgress.delete(_.blockIndex))},(_,C)=>{if(h.forEach(T=>x._blocksInProgress.delete(T.blockIndex)),_)throw _;C.forEach(T=>{this.getLayer(T.layerName).processDecodedData(T)})})}}class J2e{constructor({version:c,name:h,units:x,tileSize:_,pixelFormat:C,buffer:T,dataIndex:L},z){if(this.version=c,this.version!==1)throw new Km(`Cannot parse raster layer encoded with MRT version ${c}`);this.name=h,this.units=x,this.tileSize=_,this.buffer=T,this.pixelFormat=XKe[C],this.dataIndex=L,this.bandShape=[_+2*T,_+2*T,Q2e[this.pixelFormat]],this._decodedBlocks=new OL(z?z.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return Q2e[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[x,_]of this.dataIndex.entries()){for(const[C,T]of _.bands.entries())if(T===c)return{bandIndex:h+C,blockIndex:x,blockBandIndex:C};h+=_.bands.length}break;case"number":for(const[x,_]of this.dataIndex.entries()){if(c>=h&&cthis.cacheSize)throw new Km(`Number of blocks to decode (${C.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:h,lastByte:x,blockIndices:_}}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:x}=this.getBlockForBand(c);if(h<0)throw new Km(`Band not found: ${JSON.stringify(c)}`);const _=this._decodedBlocks.get(h.toString());if(!_)throw new Km(`Data for band ${JSON.stringify(c)} of layer "${this.name}" not decoded.`);const C=this.dataIndex[h],T=this.bandShape.reduce((q,K)=>q*K,1),L=x*T,z=_.subarray(L,L+T);return{data:z,bytes:new Uint8Array(z.buffer).subarray(z.byteOffset,z.byteOffset+z.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:C.offset,scale:C.scale}}}RL.setPbf=function(p){$le=p};class ewe{constructor(c,h,x){this.tasks=c,this._onCancel=h,this._onComplete=x,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(c,h){this._finalized||(this._onComplete(c,h),this._finalized=!0)}}RL.performDecoding=function(p,c){const h=new Uint8Array(p);return Promise.all(c.tasks.map(x=>{const{layerName:_,firstByte:C,lastByte:T,pixelFormat:L,blockShape:z,blockIndex:q,filters:K,codec:Y}=x,ee=h.subarray(C,T+1),re=new Uint32Array(z[0]*z[1]*z[2]);let ie;if(Y!=="gzip_data")throw new Km(`Unhandled codec: ${Y}`);return ie=function(ge,Ce){if(!globalThis.DecompressionStream&&Ce==="gzip_data")return Promise.resolve(((Ze=function(jt){jt[0]==31&&jt[1]==139&&jt[2]==8||nf(6,"invalid gzip data");var Et=jt[3],Dt=10;4&Et&&(Dt+=2+(jt[10]|jt[11]<<8));for(var tr=(Et>>3&1)+(Et>>4&1);tr>0;tr-=!jt[Dt++]);return Dt+(2&Et)}(Be=ge))+8>Be.length&&nf(6,"invalid gzip data"),function(jt,Et,Dt,tr){var $t=jt.length;if(!$t||Et.f&&!Et.l)return Dt||new nm(0);var or=!Dt,mr=or||Et.i!=2,pr=Et.i;or&&(Dt=new nm(3*$t));var wr,kr,xr=function(Qa){var Aa=Dt.length;if(Qa>Aa){var Da=new nm(Math.max(2*Aa,Qa));Da.set(Dt),Dt=Da}},_r=Et.f||0,ir=Et.p||0,sr=Et.b||0,br=Et.l,zr=Et.d,Ar=Et.m,Ns=Et.n,Jr=8*$t;do{if(!br){_r=sf(jt,ir,1);var as=sf(jt,ir+1,3);if(ir+=3,!as){var xs=jt[(lr=4+((ir+7)/8|0))-4]|jt[lr-3]<<8,In=lr+xs;if(In>$t){pr&&nf(0);break}mr&&xr(sr+xs),Dt.set(jt.subarray(lr,In),sr),Et.b=sr+=xs,Et.p=ir=8*In,Et.f=_r;continue}if(as==1)br=HKe,zr=WKe,Ar=9,Ns=5;else if(as==2){var Er=sf(jt,ir,31)+257,ys=sf(jt,ir+10,15)+4,tn=Er+sf(jt,ir+5,31)+1;ir+=14;for(var ra=new nm(tn),oa=new nm(19),_n=0;_n>4)<16)ra[_n++]=lr;else{var Zr=0,Yr=0;for(lr==16?(Yr=3+sf(jt,ir,3),ir+=2,Zr=ra[_n-1]):lr==17?(Yr=3+sf(jt,ir,7),ir+=3):lr==18&&(Yr=11+sf(jt,ir,127),ir+=7);Yr--;)ra[_n++]=Zr}}var Cs=ra.subarray(0,Er),Es=ra.subarray(Er);Ar=zle(Cs),Ns=zle(Es),br=rT(Cs,Ar),zr=rT(Es,Ns)}else nf(1);if(ir>Jr){pr&&nf(0);break}}mr&&xr(sr+131072);for(var gn=(1<>4;if((ir+=15&Zr)>Jr){pr&&nf(0);break}if(Zr||nf(2),Zn<256)Dt[sr++]=Zn;else{if(Zn==256){Tn=ir,br=null;break}var Bs=Zn-254;Zn>264&&(Bs=sf(jt,ir,(1<<(wa=H2e[_n=Zn-257]))-1)+Z2e[_n],ir+=wa);var Qs=zr[Ble(jt,ir)&kn],xa=Qs>>4;if(Qs||nf(3),ir+=15&Qs,Es=VKe[xa],xa>3){var wa=W2e[xa];Es+=Ble(jt,ir)&(1<Jr){pr&&nf(0);break}mr&&xr(sr+131072);var ja=sr+Bs;if(srwr.length)&&(kr=wr.length),new nm(wr.subarray(0,kr))):Dt.subarray(0,sr)}(Be.subarray(Ze,-8),{i:2},new nm(((Ne=Be)[(Fe=Ne.length)-4]|Ne[Fe-3]<<8|Ne[Fe-2]<<16|Ne[Fe-1]<<24)>>>0))));var Ne,Fe,Be,Ze;const yt=YKe[Ce];if(!yt)throw new Error(`Unhandled codec: ${Ce}`);const ht=new globalThis.DecompressionStream(yt);return new Response(new Blob([ge]).stream().pipeThrough(ht)).arrayBuffer().then(jt=>new Uint8Array(jt))}(ee,Y).then(ge=>(function(Ce,Ne){Ce.readFields(DKe,Ne)}(new $le(ge),re),new QKe[L](re.buffer))),ie.then(ge=>{for(let Ce=K.length-1;Ce>=0;Ce--)switch(K[Ce]){case"delta_filter":FKe(ge,z);break;case"zigzag_filter":zKe(ge);break;case"bitshuffle_filter":BKe(ge,L);break;default:throw new Km(`Unhandled filter "${K[Ce]}"`)}return{layerName:_,blockIndex:q,data:ge}}).catch(ge=>{throw ge})}))},hs(ewe,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),hs(RL,"MapboxRasterTile"),hs(J2e,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class twe{constructor(c){this._stringToNumber={},this._numberToString=[];for(let h=0;h=0&&ee[3]>=0&&q.insert(z,ee[0],ee[1],ee[2],ee[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Kt(new mL(this.rawTileData)).layers,this.sourceLayerCoder=new twe(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:x,transform:_,tileTransform:C,pixelPosMatrix:T,availableImages:L,worldview:z}=h;this.loadVTLayers(),this.serializedLayersCache.clear();const q=h.queryRadius?h.queryRadius:0,K=x.bufferedTilespaceBounds,Y=this.grid.query(K.min.x,K.min.y,K.max.x,K.max.y,(ge,Ce,Ne,Fe)=>Ad(x.bufferedTilespaceGeometry,ge-q,Ce-q,Ne+q,Fe+q));Y.sort(JKe);let ee=null;_.elevation&&Y.length>0&&(ee=k4.create(_.elevation,this.tileID));const re={};let ie;for(let ge=0;ge(Fe||(Fe=Tt(Be,this.tileID.canonical,C)),Ze.queryIntersectsFeature(x,Be,yt,Fe,this.z,_,T,ee,ht)))}return re}loadMatchingFeature(c,h,x,_,C,T){const{featureIndex:L,bucketIndex:z,sourceLayerIndex:q,layoutVertexArrayOffset:K}=h,Y=this.bucketLayerIDs[z],ee=x.layers,re=Object.keys(ee);if(re.length&&!ss(re,Y))return;const ie=x.sourceCache,ge=this.sourceLayerCoder.decode(q),Ce=this.vtLayers[ge].feature(L),Ne=this.getId(Ce,ge);for(let Fe=0;Fe`${L.key}: ${L.message}`).join(", ");return void es(`Failed to create expression for promoteId: ${T}`)}this.promoteIdExpression=C.value}x=this.promoteIdExpression.evaluate({zoom:0},c)}else x=c.properties[_];typeof x=="boolean"&&(x=Number(x))}return x}}function swe(p,c,h,x,_){return Yt(p,(C,T)=>{const L=c instanceof Mx?c.get(T):null;return L&&L.evaluate?L.evaluate(h,x,void 0,_):L})}function JKe(p,c){return c-p}hs(rwe,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const nwe=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Ule{static from(c){if(!(c instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[h,x]=new Uint8Array(c,0,2);if(h!==219)throw new Error("Data does not appear to be in a KDBush format.");const _=x>>4;if(_!==1)throw new Error(`Got v${_} data when expected v1.`);const C=nwe[15&x];if(!C)throw new Error("Unrecognized array type.");const[T]=new Uint16Array(c,2,1),[L]=new Uint32Array(c,4,1);return new Ule(L,T,C,c)}constructor(c,h=64,x=Float64Array,_){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=x,this.IndexArrayType=c<65536?Uint16Array:Uint32Array;const C=nwe.indexOf(this.ArrayType),T=2*c*this.ArrayType.BYTES_PER_ELEMENT,L=c*this.IndexArrayType.BYTES_PER_ELEMENT,z=(8-L%8)%8;if(C<0)throw new Error(`Unexpected typed array class: ${x}.`);_&&_ instanceof ArrayBuffer?(this.data=_,this.ids=new this.IndexArrayType(this.data,8,c),this.coords=new this.ArrayType(this.data,8+L+z,2*c),this._pos=2*c,this._finished=!0):(this.data=new ArrayBuffer(8+T+L+z),this.ids=new this.IndexArrayType(this.data,8,c),this.coords=new this.ArrayType(this.data,8+L+z,2*c),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+C]),new Uint16Array(this.data,2,1)[0]=h,new Uint32Array(this.data,4,1)[0]=c)}add(c,h){const x=this._pos>>1;return this.ids[x]=x,this.coords[this._pos++]=c,this.coords[this._pos++]=h,x}finish(){const c=this._pos>>1;if(c!==this.numItems)throw new Error(`Added ${c} items when expected ${this.numItems}.`);return qle(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(c,h,x,_){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:C,coords:T,nodeSize:L}=this,z=[0,C.length-1,0],q=[];for(;z.length;){const K=z.pop()||0,Y=z.pop()||0,ee=z.pop()||0;if(Y-ee<=L){for(let Ce=ee;Ce<=Y;Ce++){const Ne=T[2*Ce],Fe=T[2*Ce+1];Ne>=c&&Ne<=x&&Fe>=h&&Fe<=_&&q.push(C[Ce])}continue}const re=ee+Y>>1,ie=T[2*re],ge=T[2*re+1];ie>=c&&ie<=x&&ge>=h&&ge<=_&&q.push(C[re]),(K===0?c<=ie:h<=ge)&&(z.push(ee),z.push(re-1),z.push(1-K)),(K===0?x>=ie:_>=ge)&&(z.push(re+1),z.push(Y),z.push(1-K))}return q}within(c,h,x){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:_,coords:C,nodeSize:T}=this,L=[0,_.length-1,0],z=[],q=x*x;for(;L.length;){const K=L.pop()||0,Y=L.pop()||0,ee=L.pop()||0;if(Y-ee<=T){for(let Ce=ee;Ce<=Y;Ce++)iwe(C[2*Ce],C[2*Ce+1],c,h)<=q&&z.push(_[Ce]);continue}const re=ee+Y>>1,ie=C[2*re],ge=C[2*re+1];iwe(ie,ge,c,h)<=q&&z.push(_[re]),(K===0?c-x<=ie:h-x<=ge)&&(L.push(ee),L.push(re-1),L.push(1-K)),(K===0?c+x>=ie:h+x>=ge)&&(L.push(re+1),L.push(Y),L.push(1-K))}return z}}function qle(p,c,h,x,_,C){if(_-x<=h)return;const T=x+_>>1;awe(p,c,T,x,_,C),qle(p,c,h,x,T-1,1-C),qle(p,c,h,T+1,_,1-C)}function awe(p,c,h,x,_,C){for(;_>x;){if(_-x>600){const q=_-x+1,K=h-x+1,Y=Math.log(q),ee=.5*Math.exp(2*Y/3),re=.5*Math.sqrt(Y*ee*(q-ee)/q)*(K-q/2<0?-1:1);awe(p,c,h,Math.max(x,Math.floor(h-K*ee/q+re)),Math.min(_,Math.floor(h+(q-K)*ee/q+re)),C)}const T=c[2*h+C];let L=x,z=_;for(nT(p,c,x,h),c[2*_+C]>T&&nT(p,c,x,_);LT;)z--}c[2*x+C]===T?nT(p,c,x,z):(z++,nT(p,c,z,_)),z<=h&&(x=z+1),h<=z&&(_=z-1)}}function nT(p,c,h,x){Vle(p,h,x),Vle(c,2*h,2*x),Vle(c,2*h+1,2*x+1)}function Vle(p,c,h){const x=p[c];p[c]=p[h],p[h]=x}function iwe(p,c,h,x){const _=p-h,C=c-x;return _*_+C*C}i.$=nN,i.A=Fp,i.B=em,i.C=2,i.D=u4,i.E=Vn,i.F=zM,i.G=Ibe,i.H=sN,i.I=Ca,i.J=T6,i.K=ks,i.L=o0,i.M=MN,i.N=a_,i.O=g6,i.P=dr,i.Q=i_,i.R=Rp,i.S=FN,i.T=Qoe,i.U=mg,i.V=TL,i.W=W5,i.X=h0,i.Y=u0,i.Z=Jv,i._=Cd,i.a=function(p){return qn.API_CDN_URL_REGEX.test(p)},i.a$=me,i.a0=Xs,i.a1=Dl,i.a2=qm,i.a3=class extends TL{},i.a4=TN,i.a5=f6,i.a6=Vt,i.a7=function(p){const c=p.value;return c?Xs(c)?Tle(c,!0)?[]:[new TL(p.key,c,`invalid url "${c}"`)]:[new TL(p.key,c,`string expected, "${ks(c)}" found`)]:[]},i.a8=N6,i.a9=lo,i.aA=ye,i.aB=M,i.aC=ot,i.aD=Uc,i.aE=si,i.aF=U,i.aG=We,i.aH=function(p,c){const h={};for(let x=0;x{x(C,T)},c):x(C,T),()=>{}}return _.callbacks.push(x),_.cancel||(_.cancel=h((C,T)=>{_.result=[C,T];for(const L of _.callbacks)this.scheduler?this.scheduler.add(()=>{L(C,T)},c):L(C,T);setTimeout(()=>delete this.entries[p],3e3)})),()=>{_.result||(_.callbacks=_.callbacks.filter(C=>C!==x),_.callbacks.length||(_.cancel(),delete this.entries[p]))}}},i.aL=function(p,c,h){const x=JSON.stringify(p.request);return p.data&&(this.deduped.entries[x]={result:[null,p.data]}),this.deduped.request(x,{type:"parseTile",isSymbolTile:p.isSymbolTile,zoom:p.tileZoom},_=>{const C=Ru(p.request,(T,L,z)=>{T?_(T):L&&_(null,{rawData:L,vectorTile:h?void 0:new Kt(new mL(L)),responseHeaders:new Map(z.entries())})});return()=>{C.cancel(),_()}},c)},i.aM=function(p){return p?{cacheControl:p.get("Cache-Control"),expires:p.get("Expires")}:{cacheControl:void 0,expires:void 0}},i.aN=kd,i.aO=function(p){od++,od>t0&&(p.getActor().send("enforceCacheSizeLimit",e0),od=0)},i.aP=function(p){return p<=1?1:Math.pow(2,Math.floor(Math.log2(p)))},i.aQ=no,i.aR=o2e,i.aS=m2e,i.aT=f,i.aU=i2e,i.aV=function(p,c){const h=document.createElement("video");h.muted=!0,h.onloadstart=function(){c(null,h)};for(let x=0;x{}}},i.aW=LM,i.aX=A_,i.aY=Ft,i.aZ=qM,i.a_=te,i.aa=Pr,i.ab=class{constructor(p){this.specification=p}possiblyEvaluate(p,c){return un(p.expression.evaluate(c))}interpolate(p,c,h){return{x:Hs(p.x,c.x,h),y:Hs(p.y,c.y,h),z:Hs(p.z,c.z,h),azimuthal:Hs(p.azimuthal,c.azimuthal,h),polar:Hs(p.polar,c.polar,h)}}},i.ac=gi,i.ad=Nx,i.ae=He,i.af=at,i.ag=fe,i.ah=Oe,i.ai=Mx,i.aj=E0,i.ak=Hs,i.al=Rr,i.am=f5,i.an=Ys,i.ao=Ma,i.ap=class{constructor(p){this.specification=p}possiblyEvaluate(p,c){return function([h,x]){const _=un([1,h,x]);return{x:_.x,y:_.y,z:_.z}}(p.expression.evaluate(c))}interpolate(p,c,h){return{x:Hs(p.x,c.x,h),y:Hs(p.y,c.y,h),z:Hs(p.z,c.z,h)}}},i.aq=function(p,c,h=0,x=!0){const _=new dr(h,h),C=p.sub(_),T=c.add(_),L=[C,new dr(T.x,C.y),T,new dr(C.x,T.y)];return x&&L.push(C.clone()),L},i.ar=function(p,c){const h=[];for(let x=0;x1)return!1;const h=c.getSource().maxzoom,x=1<1)return c;const _=x.getSource().maxzoom,C=1<<_,T=Math.floor(p.x),L=p.x-T,z=new no(_,T,_,Math.floor(L*C),Math.floor(p.y*C)),q=this.findDEMTileFor(z);if(!q||!q.dem)return c;const K=q.dem,Y=1<{const L=this.getAtTileOffset(p,_,C,T),z=x.upVector(p.canonical,_.x,_.y);return ve(z,z,L*x.upVectorScale(p.canonical,c,h).metersToTile),z}}getForTilePoints(p,c,h,x){if(this.isUsingMockSource())return!1;const _=k4.create(this,p,x);return!!_&&(c.forEach(C=>{C[2]=this.exaggeration()*_.getElevationAt(C[0],C[1],h)}),!0)}getMinMaxForTile(p){if(this.isUsingMockSource())return null;const c=this.findDEMTileFor(p);if(!c||!c.dem)return null;const h=c.dem.tree,x=c.tileID,_=1<0&&(x+=(p[_]-0)*(p[_]-0)),c[_]<0&&(x+=(0-c[_])*(0-c[_]));return x},i.c0=o_e,i.c1=mle,i.c2=zbe,i.c3=ble,i.c4=Ule,i.c5=ve,i.c6=Me,i.c7=ft,i.c8=function(p,c,h){h*=.5;var x=c[0],_=c[1],C=c[2],T=c[3],L=Math.sin(h),z=Math.cos(h);return p[0]=x*z+_*L,p[1]=_*z-x*L,p[2]=C*z+T*L,p[3]=T*z-C*L,p},i.c9=ct,i.cA=le,i.cB=Ta,i.cC=H_e,i.cD=ni,i.cE=wve,i.cF=function(p,c,h,x,_,C,T,L,z){if(z.name==="globe")return wve(p,c,new ni(h,x,_),!1);const q=qM({z:h,x,y:_},z);return new js([(C+q.x/q.scale)*c,c*(q.y/q.scale),T],[(C+q.x2/q.scale)*c,c*(q.y2/q.scale),L])},i.cG=function(p,c,h){return p[0]=Math.min(c[0],h[0]),p[1]=Math.min(c[1],h[1]),p[2]=Math.min(c[2],h[2]),p[3]=Math.min(c[3],h[3]),p},i.cH=function(p,c,h){return p[0]=Math.max(c[0],h[0]),p[1]=Math.max(c[1],h[1]),p[2]=Math.max(c[2],h[2]),p[3]=Math.max(c[3],h[3]),p},i.cI=function(p){const c=Math.round((p+45+360)%360/90)%4;return gc[c]},i.cJ=pe,i.cK=Xe,i.cL=l4,i.cM=function(p){const c=S(new Float64Array(16));M(c,p.pixelMatrix,p.globeMatrix);const h=[0,bh,0],x=[0,wh,0];return at(h,h,c),at(x,x,c),[h[0]>0&&h[0]<=p.width&&h[1]>0&&h[1]<=p.height&&!Toe(p,new f(p.center.lat,90)),x[0]>0&&x[0]<=p.width&&x[1]>0&&x[1]<=p.height&&!Toe(p,new f(p.center.lat,-90))]},i.cN=function(p,c){const{scale:h}=p.tileTransform,x=h*Rr/(p.tileSize*Math.pow(2,c.zoom-p.tileID.overscaledZ+p.tileID.canonical.z));return function(_,C,T){var L=C[1],z=C[2],q=C[3],K=T[0],Y=T[1];return _[0]=C[0]*K,_[1]=L*K,_[2]=z*Y,_[3]=q*Y,_}(new Float32Array(4),c.inverseAdjustmentMatrix,[x,x])},i.cO=oL,i.cP=ae,i.cQ=V_e,i.cR=function(p){const c=V_e(p,!0);return g([],[c[0],c[1],c[4],c[5]])},i.cS=F,i.cT=Qr,i.cU=O,i.cV=function(p){const{x:c,y:h}=p.point,{lng:x,lat:_}=p._center;return Nve(c,h,p.worldSize,x,_)},i.cW=Te,i.cX=ro,i.cY=Qi,i.cZ=_c,i.c_=_h,i.ca=Sa,i.cb=function(p,c){return p[0]=-c[0],p[1]=-c[1],p[2]=-c[2],p[3]=c[3],p},i.cc=se,i.cd=function(p,c,h,x,_){var C=1/Math.tan(c/2);if(p[0]=C/h,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=C,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[11]=-1,p[12]=0,p[13]=0,p[15]=0,_!=null&&_!==1/0){var T=1/(x-_);p[10]=(_+x)*T,p[14]=2*_*x*T}else p[10]=-1,p[14]=-2*x;return p},i.ce=function(p,c,h,x,_,C,T){var L=1/(c-h),z=1/(x-_),q=1/(C-T);return p[0]=-2*L,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=-2*z,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[10]=2*q,p[11]=0,p[12]=(c+h)*L,p[13]=(_+x)*z,p[14]=(T+C)*q,p[15]=1,p},i.cf=J,i.cg=function(p,c,h){p[4*c+0]=h[0],p[4*c+1]=h[1],p[4*c+2]=h[2],p[4*c+3]=h[3]},i.ch=n4,i.ci=f_,i.cj=tl,i.ck=Wm,i.cl=x_,i.cm=Ybe,i.cn=function(){var p=new m(4);return m!=Float32Array&&(p[1]=0,p[2]=0),p[0]=1,p[3]=1,p},i.co=function(p,c,h){var x=c[0],_=c[1],C=c[2],T=c[3],L=Math.sin(h),z=Math.cos(h);return p[0]=x*z+C*L,p[1]=_*z+T*L,p[2]=x*-L+C*z,p[3]=_*-L+T*z,p},i.cp=function(p,c){return p[0]===c[0]&&p[1]===c[1]&&p[2]===c[2]&&p[3]===c[3]},i.cq=rt,i.cr=function(p){var c=p[0],h=p[1],x=p[2],_=p[3];return Math.sqrt(c*c+h*h+x*x+_*_)},i.cs=cr,i.ct=$e,i.cu=Po,i.cv=3,i.cw=2,i.cx=7,i.cy=6,i.cz=Pe,i.d=function(p){return qn.API_TILEJSON_REGEX.test(p)},i.d$=class{constructor(p,c,h,x){this.context=p,this.format=x,this.size=h,this.texture=p.gl.createTexture();const[_,C,T]=this.size,{gl:L}=p;L.bindTexture(L.TEXTURE_3D,this.texture),p.pixelStoreUnpackFlipY.set(!1),p.pixelStoreUnpack.set(1),p.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in c&&c.data&&L.texImage3D(L.TEXTURE_3D,0,this.format,_,C,T,0,Yoe(this.format),Xoe(this.format),c.data)}bind(p,c){const{context:h}=this,{gl:x}=h;x.bindTexture(x.TEXTURE_3D,this.texture),p!==this.minFilter&&(x.texParameteri(x.TEXTURE_3D,x.TEXTURE_MAG_FILTER,p),x.texParameteri(x.TEXTURE_3D,x.TEXTURE_MIN_FILTER,p),this.minFilter=p),c!==this.wrapS&&(x.texParameteri(x.TEXTURE_3D,x.TEXTURE_WRAP_S,c),x.texParameteri(x.TEXTURE_3D,x.TEXTURE_WRAP_T,c),this.wrapS=c)}destroy(){const{gl:p}=this.context;p.deleteTexture(this.texture),this.texture=null}},i.d0=function(p){return p*p*p*p*p},i.d1=R,i.d2=45,i.d3=a4,i.d4=function(p,c,h){const x=Math.sqrt(p*p+c*c+h*h),_=x>0?Math.acos(h/x)*Ti:0;let C=p!==0||c!==0?Math.atan2(-c,-p)*Ti+90:0;return C<0&&(C+=360),[x,C,_]},i.d5=oe,i.d6=un,i.d7=De,i.d8=ue,i.d9=js,i.dA=function(p){return p({pluginStatus:Md,pluginURL:Vp}),DN.on("pluginStateChange",p),p},i.dB=g_,i.dC=class extends Gp{constructor(p){super(p),this.current=i4}set(p,c,h){if(this.fetchUniformLocation(p,c)){for(let x=0;x<9;x++)if(h[x]!==this.current[x]){this.current=h,this.gl.uniformMatrix3fv(this.location,!1,h);break}}}},i.dD=jo,i.dE=function(p,c,h){const x=E0(h.zoom),_=p.style.map._antialias,C=p.terrain&&p.terrain.exaggeration()>0;return x===0&&!_&&!C},i.dF=function(p){const c=p.pixelsPerMeter,h=c/J(1,p.center.lat),x=S(new Float64Array(16));return I(x,x,[p.point.x,p.point.y,0]),F(x,x,[h,h,c]),Float32Array.from(x)},i.dG=H6,i.dH=function(p){const c=pe-5;p=ye(p,-c,c)/c*90;const h=Math.pow(Math.abs(Math.sin(Ys(p))),3);return Math.round(h*(xM.length-1))},i.dI=function(p,c,h,x){const _=c.getNorth(),C=c.getSouth(),T=c.getWest(),L=c.getEast(),z=1<0){const ie=180/x;b(re,re,[ie/q+1,0,0,0,ie/K+1,0,-.5*ie/Y,.5*ie/ee,1])}return re[2]=z,re[5]=p.x,re[8]=p.y,re},i.dJ=sm,i.dK=function(p,c,h){const x=S(new Float64Array(16)),_=(c/(1<({u_matrix:new x_(p),u_texsize:new Wm(p),u_pixels_to_tile_units:new o4(p),u_device_pixel_ratio:new tl(p),u_width_scale:new tl(p),u_floor_width_scale:new tl(p),u_image:new n4(p),u_units_to_pixels:new Wm(p),u_tile_units_to_pixels:new tl(p),u_alpha_discard_threshold:new tl(p),u_trim_offset:new Wm(p),u_trim_fade_range:new Wm(p),u_trim_color:new a4(p),u_zbias_factor:new tl(p),u_tile_to_meter:new tl(p),u_ground_shadow_factor:new f_(p),u_pattern_transition:new tl(p)}),i.dX=p=>({u_matrix:new x_(p),u_pixels_to_tile_units:new o4(p),u_device_pixel_ratio:new tl(p),u_width_scale:new tl(p),u_floor_width_scale:new tl(p),u_units_to_pixels:new Wm(p),u_dash_image:new n4(p),u_gradient_image:new n4(p),u_image_height:new tl(p),u_texsize:new Wm(p),u_tile_units_to_pixels:new tl(p),u_alpha_discard_threshold:new tl(p),u_trim_offset:new Wm(p),u_trim_fade_range:new Wm(p),u_trim_color:new a4(p),u_zbias_factor:new tl(p),u_tile_to_meter:new tl(p),u_ground_shadow_factor:new f_(p)}),i.dY=p=>({u_camera_to_center_distance:new tl(p),u_extrude_scale:new o4(p),u_device_pixel_ratio:new tl(p),u_matrix:new x_(p),u_inv_rot_matrix:new x_(p),u_merc_center:new Wm(p),u_tile_id:new f_(p),u_zoom_transition:new tl(p),u_up_dir:new f_(p),u_emissive_strength:new tl(p)}),i.dZ=ZN,i.d_=dGe,i.da=xe,i.db=function(p){return[Math.pow(p[0],1/2.2),Math.pow(p[1],1/2.2),Math.pow(p[2],1/2.2)]},i.dc=q_e,i.dd=nle,i.de=K_e,i.df=Tle,i.dg=function(p,c){return p.readFields(cKe,{icons:[]},c)},i.dh=sL,i.di=_4,i.dj=yle,i.dk=s0,i.dl=c_,i.dm=rg,i.dn=vr,i.dp=hr,i.dq=function(p){const c=p.indexOf(Ex);return c>=0?p.slice(0,c):p},i.dr=function(p){return p.indexOf(Ex)>=0},i.ds=function(p){const c=p.lastIndexOf(Ex);return c>=0?p.slice(c+1):""},i.dt=function(p){const c=[],h=p.id;return h===void 0&&c.push({message:`layers.${h}: missing required property "id"`}),p.render===void 0&&c.push({message:`layers.${h}: missing required method "render"`}),p.renderingMode&&p.renderingMode!=="2d"&&p.renderingMode!=="3d"&&c.push({message:`layers.${h}: property "renderingMode" must be either "2d" or "3d"`}),c},i.du=function(p,c,h,x){return p.type==="custom"?new rKe(p,c):new oKe[p.type](p,c,h,x)},i.dv=yr,i.dw=function(p){const c=p.indexOf(Ex);return c>=0?p.slice(c+1):""},i.dx=class extends T_{constructor(p,c){super(p._vectorTileFeature,p._z,p._x,p._y,p.id),p.state&&(this.state=Object.assign({},p.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=p.source,this.sourceLayer=p.sourceLayer,this.layer=p.layer)}toJSON(){const p=super.toJSON();return p.target=this.target,p.namespace=this.namespace,p}},i.dy=DN,i.dz=Dm,i.e=qn,i.e$=de,i.e0=Mve,i.e1=(p,c,h,x,_,C)=>{const T=p.transform,L=T.projection.name==="globe";let z;if(C.paint.get("circle-pitch-alignment")==="map")if(L){const K=kve(T.zoom,c.canonical)*T._pixelsPerMercatorPixel;z=Float32Array.from([K,0,0,K])}else z=T.calculatePixelsToTileUnitsMatrix(h);else z=new Float32Array([T.pixelsToGLUnits[0],0,0,T.pixelsToGLUnits[1]]);const q={u_camera_to_center_distance:p.transform.getCameraToCenterDistance(T.projection),u_matrix:p.translatePosMatrix(c.projMatrix,h,C.paint.get("circle-translate"),C.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Jo.devicePixelRatio,u_extrude_scale:z,u_inv_rot_matrix:SHe,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:C.paint.get("circle-emissive-strength")};if(L){q.u_inv_rot_matrix=x,q.u_merc_center=_,q.u_tile_id=[c.canonical.x,c.canonical.y,1<{const K=p.transform,Y=K.pitch<15?obe(.07,.7,ye((14-K.zoom)/5,0,1)):.07,ee=h.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:cbe(p,c,h,x),u_texsize:c.imageAtlasTexture?c.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:K.calculatePixelsToTileUnitsMatrix(c),u_device_pixel_ratio:_,u_width_scale:C,u_floor_width_scale:T,u_image:0,u_tile_units_to_pixels:lbe(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(ee?null:h.lut).toArray01(),u_zbias_factor:Y,u_tile_to_meter:De(c.tileID.canonical,0),u_ground_shadow_factor:z,u_pattern_transition:q}},i.e5=(p,c,h,x,_,C,T,L,z,q)=>{const K=p.transform,Y=K.calculatePixelsToTileUnitsMatrix(c),ee=h.paint.get("line-trim-color-use-theme").constantOr("default")==="none",re=K.pitch<15?obe(.07,.7,ye((14-K.zoom)/5,0,1)):.07;return{u_matrix:cbe(p,c,h,x),u_pixels_to_tile_units:Y,u_device_pixel_ratio:C,u_width_scale:T,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:_,u_texsize:ube(h)&&c.lineAtlasTexture?c.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:lbe(c,p.transform),u_alpha_discard_threshold:0,u_trim_offset:z,u_trim_fade_range:h.paint.get("line-trim-fade-range"),u_trim_color:h.paint.get("line-trim-color").toPremultipliedRenderColor(ee?null:h.lut).toArray01(),u_zbias_factor:re,u_tile_to_meter:De(c.tileID.canonical,0),u_ground_shadow_factor:q}},i.e6=Gt,i.e7=vM,i.e8=he,i.e9=kh,i.eA=function(p,c){var h=2*Math.acos(c[3]),x=Math.sin(h/2);return x>d?(p[0]=c[0]/x,p[1]=c[1]/x,p[2]=c[2]/x):(p[0]=1,p[1]=0,p[2]=0),h},i.eB=Ile,i.eC=dL,i.eD=cL,i.eE=[1,1,1],i.eF=k4,i.eG=Je,i.eH=function(p,c,h,x){var _=c[0],C=c[1],T=c[2],L=c[3];return p[0]=_+x*(h[0]-_),p[1]=C+x*(h[1]-C),p[2]=T+x*(h[2]-T),p[3]=L+x*(h[3]-L),p},i.eI=f4,i.eJ=$u,i.eK=Hm,i.eL=function(p,c,h,x,_,C,T,L,z,q,K,Y,ee,re,ie,ge){var Ce=new m(16);return Ce[0]=p,Ce[1]=c,Ce[2]=h,Ce[3]=x,Ce[4]=_,Ce[5]=C,Ce[6]=T,Ce[7]=L,Ce[8]=z,Ce[9]=q,Ce[10]=K,Ce[11]=Y,Ce[12]=ee,Ce[13]=re,Ce[14]=ie,Ce[15]=ge,Ce},i.eM=w,i.eN=N0,i.eO=oM,i.eP=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new dr(1/0,1/0),max:new dr(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(p,c=!1){const h=n_e(new dr(0,0),new dr(Rr,Rr),p),x=[];if(c&&!Foe(h,this._globalClipBounds))return x;for(const _ of this._activeRegions){if(_.hiddenByOverlap||!Foe(h,_))continue;const C=tWe(_.min,_.max,p);x.push({min:C.min,max:C.max,sourceId:this._sourceIds[_.priority],footprint:_.footprint,footprintTileId:_.tileId,order:_.order,clipMask:_.clipMask,clipScope:_.clipScope})}return x}setSources(p){this._setSources(p.map(c=>({getSourceId:()=>c.cache.id,getFootprints:()=>{const h=[];for(const x of c.cache.getVisibleCoordinates()){const _=c.cache.getTile(x).buckets[c.layer];_&&_.updateFootprints(x.toUnwrapped(),h)}return h},getOrder:()=>c.order,getClipMask:()=>c.clipMask,getClipScope:()=>c.clipScope})))}_addSource(p){const c=p.getFootprints();if(c.length===0)return;const h=p.getOrder(),x=p.getClipMask(),_=p.getClipScope();for(const C of c){if(!C.footprint)continue;const T=n_e(C.footprint.min,C.footprint.max,C.id);this._activeRegions.push({min:T.min,max:T.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:C.id,footprint:C.footprint,order:h,clipMask:x,clipScope:_})}this._sourceIds.push(p.getSourceId())}_computeReplacement(){this._activeRegions.sort((c,h)=>c.priority-h.priority||Q6(c.min,h.min)||Q6(c.max,h.max)||c.order-h.order||c.clipMask-h.clipMask||function(x,_){const C=(T,L)=>T+L;return x.length-_.length||x.reduce(C,"").localeCompare(_.reduce(C,""))}(c.clipScope,h.clipScope));let p=this._activeRegions.length!==this._prevRegions.length;if(!p){let c=0;for(;!p&&c!==this._activeRegions.length;){const h=this._activeRegions[c],x=this._prevRegions[c];p=h.priority!==x.priority||!s_e(h,x)||h.order!==x.order||h.clipMask!==x.clipMask||!Fa(h.clipScope,x.clipScope),this._activeRegions[c].hiddenByOverlap=x.hiddenByOverlap,++c}}if(p){++this._updateTime;for(const h of this._activeRegions)h.order!==NM&&(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 x=this._activeRegions;if(h>=x.length)return h;const _=x[h].priority;for(;h1){let h=0,x=c(h);for(;h!==x;){let _=h;const C=h;for(;_!==x;){const T=this._activeRegions[_];T.hiddenByOverlap=!1;for(let L=0;L=0;c--)this._addSource(p[c]);this._computeReplacement()}},i.eQ=NM,i.eR=class{constructor(p){this._createGrid(p),this._createPoles(p)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const p of this._poleSegments)p.destroy();for(const p of this._gridSegments)p.withSkirts.destroy(),p.withoutSkirts.destroy()}_fillGridMeshWithLods(p,c){const h=new fg,x=new el,_=[],C=p+1+2,T=c[0]+1,L=c[0]+1+(1+c.length),z=(q,K,Y)=>{let ee=q===C-1?q-2:q===0?q:q-1;return ee+=Y?24575:0,[ee,K]};for(let q=0;q0?(Ce=2*Math.sqrt(ge+1),p[3]=.25*Ce,p[0]=(Y-re)/Ce,p[1]=(ee-z)/Ce,p[2]=(L-q)/Ce):T>K&&T>ie?(Ce=2*Math.sqrt(1+T-K-ie),p[3]=(Y-re)/Ce,p[0]=.25*Ce,p[1]=(L+q)/Ce,p[2]=(ee+z)/Ce):K>ie?(Ce=2*Math.sqrt(1+K-T-ie),p[3]=(ee-z)/Ce,p[0]=(L+q)/Ce,p[1]=.25*Ce,p[2]=(Y+re)/Ce):(Ce=2*Math.sqrt(1+ie-T-K),p[3]=(L-q)/Ce,p[0]=(ee+z)/Ce,p[1]=(Y+re)/Ce,p[2]=.25*Ce),p},i.f=function(p){return btoa(encodeURIComponent(p).replace(/%([0-9A-F]{2})/g,(c,h)=>String.fromCharCode(+("0x"+h))))},i.f0=function([p,c,h]){const x=Math.hypot(p,c,h),_=Math.atan2(p,h),C=.5*Math.PI-Math.acos(-c/x);return new f(ro(_),ro(C))},i.f1=Ve,i.f2=Joe,i.f3=function(p){const c=p.navigator?p.navigator.userAgent:null;return!!function(h){if(Mo==null){const x=h.navigator?h.navigator.userAgent:null;Mo=!!h.safari||!(!x||!(/\b(iPad|iPhone|iPod)\b/.test(x)||x.match("Safari")&&!x.match("Chrome")))}return Mo}(p)&&!(!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(p,c){e0=p,t0=c},i.f5=Toe,i.f6=Sve,i.f7=function(p){const c=[0,0,0],h=S(new Float64Array(16));return M(h,p.pixelMatrix,p.globeMatrix),at(c,c,h),new dr(c[0],c[1])},i.f8=function(){const p=EM;p&&(p.isPreloaded()&&p.numActive()===1?(p.release(Voe),EM=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(){sL().acquire(Voe)},i.fA=DL,i.fB=zt,i.fC=function(p){let c=0;if(new Uint32Array(p,0,1)[0]!==F_e){const h=new Uint32Array(p,0,7),[,,x,_,C,T]=h;c=h.byteLength+_+C+T+C,(x!==p.byteLength||c>=p.byteLength)&&es("Invalid b3dm header information.")}return U_e(p,c)},i.fD=function(p,c){const h=nle(p);for(const x of h){for(const _ of x.meshes)IWe(_);x.lights&&(x.lightMeshIndex=x.meshes.length,x.meshes.push(PWe(x.lights,c)))}return h},i.fE=AL,i.fF=ea,i.fG=P_e,i.fH=Hp,i.fI=hu,i.fJ=function(p){vc(),Ou!=null&&Ou.then(c=>{c.keys().then(h=>{for(let x=0;xes(_.message))}).catch(h=>es(h.message))}).catch(c=>es(c.message))},i.fa=d_,i.fb=function(p,c,h=!1){if(Md===hu.deferred||Md===hu.loading||Md===hu.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");Vp=Jo.resolveURL(p),Md=hu.deferred,Y5=c,ON(),h||k6()},i.fc=function(p){h4=Jo.resolveURL(p),m4||(m4=new u4(sL(),new Vn)),m4.broadcast("setMeshoptUrl",h4)},i.fd=D_e,i.fe=function(p){Goe=Jo.resolveURL(p),m4||(m4=new u4(sL(),new Vn)),m4.broadcast("setDracoUrl",Goe)},i.ff=O_e,i.fg=AM,i.fh=function(p){const c=du();if(!c)return;const h=c.delete(Jy);p&&h.then(()=>p()).catch(p)},i.fi=k_,i.fj=hs,i.fk=I0,i.fl=rf,i.fm=twe,i.fn=rwe,i.fo=sbe,i.fp=nr,i.fq="hd_road_elevation",i.fr=La,i.fs=Yt,i.ft=Ox,i.fu=xle,i.fv=C_,i.fw=function(p,c,h,x,_,C,T,L=1,z,q,K){p.createArrays(),p.tilePixelRatio=Rr/(512*p.overscaling),p.compareText={},p.iconsNeedLinear=!1;const Y=p.layers[0].layout,ee=p.layers[0]._unevaluatedLayout._values,re={};re.scaleFactor=L,re.textSizeScaleRange=Y.get("text-size-scale-range"),re.iconSizeScaleRange=Y.get("icon-size-scale-range");const[ie,ge]=re.textSizeScaleRange,[Ce,Ne]=re.iconSizeScaleRange;re.textScaleFactor=ye(re.scaleFactor,ie,ge),re.iconScaleFactor=ye(re.scaleFactor,Ce,Ne);const Fe=ee["text-size"],Be=ee["icon-size"];if(p.textSizeData.kind==="composite"){const{minZoom:Dt,maxZoom:tr}=p.textSizeData;re.compositeTextSizes=[Fe.possiblyEvaluate(new gi(Dt,{worldview:K}),C),Fe.possiblyEvaluate(new gi(tr,{worldview:K}),C)]}if(p.iconSizeData.kind==="composite"){const{minZoom:Dt,maxZoom:tr}=p.iconSizeData;re.compositeIconSizes=[Be.possiblyEvaluate(new gi(Dt,{worldview:K}),C),Be.possiblyEvaluate(new gi(tr,{worldview:K}),C)]}re.layoutTextSize=Fe.possiblyEvaluate(new gi(T+1,{worldview:K}),C),re.layoutIconSize=Be.possiblyEvaluate(new gi(T+1,{worldview:K}),C),re.textMaxSize=Fe.possiblyEvaluate(new gi(18,{worldview:K}),C);const Ze=Y.get("symbol-placement"),yt=Y.get("text-rotation-alignment")==="map"&&Ze!=="point",ht=Y.get("text-size");let jt=!1;const Et=[];for(const Dt of p.features){const tr=Y.get("text-font").evaluate(Dt,{},C).join(","),$t=ht.evaluate(Dt,{},C)*re.textScaleFactor,or=re.layoutTextSize.evaluate(Dt,{},C)*re.textScaleFactor,mr=re.layoutIconSize.evaluate(Dt,{},C)*re.iconScaleFactor,pr={horizontal:{},vertical:void 0},wr=Dt.text;let kr,xr=[0,0];if(wr){const _n=wr.toString(),Xa=Y.get("text-letter-spacing").evaluate(Dt,{},C)*kl,pt=Y.get("text-line-height").evaluate(Dt,{},C)*kl,vt=K5(_n)?Xa:0,lr=Y.get("text-anchor").evaluate(Dt,{},C),jr=Y.get("text-variable-anchor");if(!jr){const gn=Y.get("text-radial-offset").evaluate(Dt,{},C);if(gn)xr=zbe(lr,[gn*kl,_le]);else{const kn=Y.get("text-offset").evaluate(Dt,{},C);xr=[kn[0]*kl,kn[1]*kl]}}let Zr=yt?"center":Y.get("text-justify").evaluate(Dt,{},C);const Yr=Ze==="point",Cs=Yr?Y.get("text-max-width").evaluate(Dt,{},C)*kl:1/0,Es=gn=>{p.allowVerticalPlacement&&l_(_n)&&(pr.vertical=hle(wr,c,h,_,tr,Cs,pt,lr,gn,vt,xr,Vu.vertical,!0,or,$t,z))};if(!yt&&jr){const gn=Zr==="auto"?jr.map(Tn=>ble(Tn)):[Zr];let kn=!1;for(let Tn=0;Tn=0||!l_(_n)){const gn=hle(wr,c,h,_,tr,Cs,pt,lr,Zr,vt,xr,Vu.horizontal,!1,or,$t,z);gn&&(pr.horizontal[Zr]=gn)}Es(Yr?"left":Zr)}}let _r,ir,sr,br,zr,Ar,Ns=!1;const Jr=Y.get("icon-text-fit").evaluate(Dt,{},C);if(Dt.icon&&Dt.icon.hasPrimary()){const _n=$M(Dt.icon,p.iconSizeData,ee["icon-size"],C,p.zoom,Dt,z,re.iconScaleFactor,K);_r=_n.iconPrimary,sr=_n.iconSecondary;const Xa=_r.toString();if(ir=x.get(Xa),ir&&(zr=Y.get("icon-offset").evaluate(Dt,{},C),Ar=Y.get("icon-anchor").evaluate(Dt,{},C),kr=fL(_.get(Xa),sr?_.get(sr.toString()):void 0,zr,Ar),Ns=ir.sdf,p.sdfIcons===void 0?p.sdfIcons=ir.sdf:p.sdfIcons!==ir.sdf&&es("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ir.pixelRatio!==p.pixelRatio||Y.get("icon-rotate").constantOr(1)!==0)&&(p.iconsNeedLinear=!0)),sr){const pt=sr.toString();br=x.get(pt)}}jt=jt||!(!Dt.icon||!Dt.icon.hasSecondary());const as=_L(pr.horizontal)||pr.vertical;p.iconsInText||(p.iconsInText=!!as&&as.iconsInText);const xs=or*re.textScaleFactor/kl,{defaultShapedIcon:In,verticallyShapedIcon:Er}=$Ge(p,kr,Y,Dt,C,pr,xs,zr,Jr);Jr!=="none"&&kr&&(kbe(kr)||Nbe(kr))&&(vL(0,ir,_r,kr,In,Jr,q,x,_),vL(0,br,sr,kr,In,Jr,q,x,_),Er&&(vL(0,ir,_r,kr,Er,Jr,q,x,_),vL(0,br,sr,kr,Er,Jr,q,x,_))),kr=In;const{iconBBox:ys,iconVerticalBBox:tn,textBBox:ra,textVerticalBBox:oa}=DGe(p,kr,Er,Y,Dt,C,mr,zr,re,_,Ar,pr,or,xr);Et.push({feature:Dt,shapedTextOrientations:pr,shapedText:as,shapedIcon:kr,iconPrimary:_r,iconSecondary:sr,iconOffset:zr,iconAnchor:Ar,verticallyShapedIcon:Er,layoutTextSize:or,layoutIconSize:mr,textOffset:xr,isSDFIcon:Ns,iconTextFit:Jr,iconCollisionBounds:ys,iconVerticalCollisionBounds:tn,textCollisionBounds:ra,textVerticalCollisionBounds:oa})}return{featureData:Et,sizes:re,hasAnySecondaryIcon:jt,textAlongLine:yt,symbolPlacement:Ze}},i.fx=Pbe,i.fy=function(p,c,h,x,_,C,T,L,z,q){p.iconAtlasPositions=q.iconPositions;const{featureData:K,hasAnySecondaryIcon:Y,sizes:ee,textAlongLine:re,symbolPlacement:ie}=c;for(const ge of K){const{shapedIcon:Ce,verticallyShapedIcon:Ne,feature:Fe,shapedTextOrientations:Be,shapedText:Ze,layoutTextSize:yt,textOffset:ht,isSDFIcon:jt,iconPrimary:Et,iconSecondary:Dt,iconTextFit:tr,iconOffset:$t,iconCollisionBounds:or,iconVerticalCollisionBounds:mr,textCollisionBounds:pr}=ge;$be(Ce,q.iconPositions,Et,Dt),$be(Ne,q.iconPositions,Et,Dt),BGe(Be,q.iconPositions),zGe(Et,Dt,q.iconPositions),(Ze||Ce)&&UGe(p,Fe,Be,Ce,Ne,z,ee,yt,0,ht,jt,x,_,T,L,Y,tr,$t,re,ie,or,mr,pr)}h&&p.generateCollisionDebugBuffers(C,p.collisionBoxArray,ee.textScaleFactor)},i.fz=Kt,i.g=function(p,c){return Dm(Object.assign(p,{method:"GET"}),c)},i.h=function(p){return p.indexOf("mapbox:")===0},i.i=function(p){return qn.API_STYLE_REGEX.test(p)&&!wl(p)},i.j=Bi,i.k=Go,i.l=function(p){return decodeURIComponent(atob(p).split("").map(c=>"%"+("00"+c.charCodeAt(0).toString(16)).slice(-2)).join(""))},i.m=function(p,c){return Dm(Object.assign(p,{type:"json"}),c)},i.n=n0,i.o=Jo,i.p=function(p,c){return Dm(Object.assign(p,{method:"POST"}),c)},i.q=Hc,i.r=fh,i.s=function(p){try{const c=self[p];return c.setItem("_mapbox_test_",1),c.removeItem("_mapbox_test_"),!0}catch{return!1}},i.t=function(){return Hoe||(Hoe=new k_("ImageRasterizer")),Hoe},i.u=function(){return function p(c){return c?(c^Math.random()*(16>>c/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,p)}()},i.v=function(p){return!!p&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(p)},i.w=es,i.x=Fle,i.y=pn,i.z=Vr}),o(["./shared"],function(i){function d(st){const ye=st?st.url.toString():void 0;return ye?performance.getEntriesByName(ye):[]}function m(st){if(typeof st=="number"||typeof st=="boolean"||typeof st=="string"||st==null)return JSON.stringify(st);if(Array.isArray(st)){let Oe="[";for(const Ke of st)Oe+=`${m(Ke)},`;return`${Oe}]`}let ye="{";for(const Oe of Object.keys(st).sort())ye+=`${Oe}:${m(st[Oe])},`;return`${ye}}`}function g(st){let ye="";for(const Oe of i.bx)ye+=`/${m(st[Oe])}`;return ye}class y{constructor(ye){this.keyCache={},this._layers={},this._layerConfigs={},ye&&this.replace(ye)}replace(ye,Oe){this._layerConfigs={},this._layers={},this.update(ye,[],Oe)}update(ye,Oe,Ke){this._options=Ke;for(const wt of ye)this._layerConfigs[wt.id]=wt,(this._layers[wt.id]=i.du(wt,this.scope,null,this._options)).compileFilter(Ke),this.keyCache[wt.id]&&delete this.keyCache[wt.id];for(const wt of Oe)delete this.keyCache[wt],delete this._layerConfigs[wt],delete this._layers[wt];this.familiesBySource={};const St=function(wt,Lt){const Gt={};for(let Yt=0;Ytthis._layers[ss.id]),Gt=Lt[0];if(Gt.visibility==="none")continue;const Ft=Gt.source||"";let Yt=this.familiesBySource[Ft];Yt||(Yt=this.familiesBySource[Ft]={});const yr=Gt.sourceLayer||"_geojsonTileLayer";let hr=Yt[yr];hr||(hr=Yt[yr]=[]),hr.push(Lt)}}}const v=1*i.fl;class b{constructor(ye){const Oe={},Ke=[];for(const Gt in ye){const Ft=ye[Gt],Yt=Oe[Gt]={};for(const yr in Ft.glyphs){const hr=Ft.glyphs[+yr];if(!hr||hr.bitmap.width===0||hr.bitmap.height===0)continue;const ss=hr.metrics.localGlyph?v:1,Is={x:0,y:0,w:hr.bitmap.width+2*ss,h:hr.bitmap.height+2*ss};Ke.push(Is),Yt[yr]=Is}}const{w:St,h:wt}=i.G(Ke),Lt=new i.fk({width:St||1,height:wt||1});for(const Gt in ye){const Ft=ye[Gt];for(const Yt in Ft.glyphs){const yr=Ft.glyphs[+Yt];if(!yr||yr.bitmap.width===0||yr.bitmap.height===0)continue;const hr=Oe[Gt][Yt],ss=yr.metrics.localGlyph?v:1;i.fk.copy(yr.bitmap,Lt,{x:0,y:0},{x:hr.x+ss,y:hr.y+ss},yr.bitmap)}}this.image=Lt,this.positions=Oe}}function N(st,ye,Oe){st[ye]?Oe&&(st[ye].center=Oe):st[ye]={floorIds:new Set,center:Oe||[0,0],floors:{}}}function j(st,ye,Oe,Ke){for(const St of ye)N(st,St),st[St].floors[Oe]=Ke,st[St].floorIds.add(Oe)}function S(st){return{id:st.properties.id.toString(),center:st.properties.center.toString().split(";").map(Number)}}function A(st){return{id:st.properties.id.toString(),isDefault:!!st.properties.is_default&&st.properties.is_default,connections:st.properties.connected_floor_ids?new Set(st.properties.connected_floor_ids.toString().split(";")):new Set,conflicts:st.properties.conflicted_floor_ids?new Set(st.properties.conflicted_floor_ids.toString().split(";")):new Set,buildings:st.properties.building_ids?new Set(st.properties.building_ids.toString().split(";")):new Set,name:st.properties.name.toString(),zIndex:st.properties.z_index}}function M(st,ye){return ye.every(Oe=>st.properties&&st.properties[Oe]!=null)}function I(st){return M(st,["type","id","name"])&&st.properties.type==="building"}function F(st){return M(st,["type","id","name","z_index"])&&st.properties.type==="floor"}i.fj(b,"GlyphAtlas");class O{constructor(ye){this.tileID=new i.aQ(ye.tileID.overscaledZ,ye.tileID.wrap,ye.tileID.canonical.z,ye.tileID.canonical.x,ye.tileID.canonical.y),this.tileZoom=ye.tileZoom,this.uid=ye.uid,this.zoom=ye.zoom,this.lut=ye.lut,this.canonical=ye.tileID.canonical,this.pixelRatio=ye.pixelRatio,this.tileSize=ye.tileSize,this.source=ye.source,this.scope=ye.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=ye.showCollisionBoxes,this.collectResourceTiming=!!ye.request&&ye.request.collectResourceTiming,this.promoteId=ye.promoteId,this.isSymbolTile=ye.isSymbolTile,this.tileTransform=i.aZ(ye.tileID.canonical,ye.projection),this.projection=ye.projection,this.worldview=ye.worldview,this.localizableLayerIds=ye.localizableLayerIds,this.brightness=ye.brightness,this.extraShadowCaster=!!ye.extraShadowCaster,this.tessellationStep=ye.tessellationStep,this.scaleFactor=ye.scaleFactor,this.worldview=ye.worldview,this.indoor=ye.indoor}parse(ye,Oe,Ke,St,wt,Lt){this.status="parsing",this.data=ye,this.collisionBoxArray=new i.b3;const Gt=new i.fm(Object.keys(ye.layers).sort()),Ft=new i.fn(this.tileID,this.promoteId);Ft.bucketLayerIDs=[];const Yt={},yr=new i.fo(256,256),hr={featureIndex:Ft,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:yr,availableImages:Ke,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};if(this.indoor){const yn=this.indoor.indoorState.activeFloorsVisible,vn=function(un,ea,Zi){const Mo=function(Fi,la){if(!Fi)return i.w("No source layers defined in indoor specification"),la;if(Fi.size===0)return la;const zi=Fi.difference(la);for(const Ya of zi)i.w(`Missing source layer required in indoor specification: ${Ya}`);return la.intersection(la)}(ea.sourceLayers,new Set(Object.keys(un.layers))),Sa=ea.indoorState,Io=function(Fi,la,zi,Ya){const qn=new Set,Bi=new Set,wl=new Set,Ol=new Map,ad={},Om=Qo=>{const Wd=Ol.get(Qo)||new Set;for(const yc of qn)if((Ol.get(yc)||new Set).has(Qo)||Wd.has(yc))return!0;return!1};for(const Qo of la){const Wd=Fi.layers[Qo];if(Wd)for(let yc=0;yc=zi.maxzoom||zi.visibility==="none")continue;B(la,this.zoom,hr.brightness,Ke,this.worldview);const Ya=Yt[zi.id]=zi.createBucket({index:Ft.bucketLayerIDs.length,layers:la,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Mo,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:St,worldview:this.worldview,localizable:Io});Ft.bucketLayerIDs.push(la.map(Bi=>i.B(Bi.id,Bi.scope)));let qn=Ya.prepare?Ya.prepare():null;qn!=null?(qn=qn.then(()=>Ya.populate(Sa,hr,this.tileID.canonical,this.tileTransform)),ss.push(qn)):Ya.populate(Sa,hr,this.tileID.canonical,this.tileTransform)}}const es=()=>{let yn,vn,un,ea,Zi,Mo;yr.trim();const Sa={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},Io=()=>{if(yn)return this.status="done",Lt(yn);if(this.extraShadowCaster)this.status="done",Lt(null,{buckets:Object.values(Yt).filter(la=>!la.isEmpty()),featureIndex:Ft,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:hr.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(vn&&un&&ea){const la=new b(vn),zi=new Map;for(const[Bi,wl]of un.entries()){const{imagePosition:Ol}=i.fu(Bi,wl,i.fv);zi.set(Bi,Ol)}const Ya={};for(const Bi in Yt){const wl=Yt[Bi];wl instanceof i.b4&&(B(wl.layers,this.zoom,hr.brightness,Ke,this.worldview),Ya[Bi]=i.fw(wl,vn,la.positions,un,zi,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,Zi,this.worldview))}const qn={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(wt,un,Zi,()=>{qn.iconsPending=!1,Fi(Ya,la,qn)}),this.rasterizeIfNeeded(wt,ea,Mo,()=>{qn.patternsPending=!1,Fi(Ya,la,qn)})}},Fi=(la,zi,Ya,qn)=>{if(Ya.iconsPending||Ya.patternsPending)return;const Bi=new i.fx(un,ea,this.lut);for(const wl in Yt){const Ol=Yt[wl];if(wl in la)i.fy(Ol,la[wl],this.showCollisionBoxes,Ke,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,un,Bi);else if(Ol.hasPattern&&(Ol instanceof i.ba||Ol instanceof i.bb||Ol instanceof i.ea)){B(Ol.layers,this.zoom,hr.brightness,Ke,this.worldview);const ad=Object.fromEntries(Bi.patternPositions);Ol.addFeatures(hr,this.tileID.canonical,ad,Ke,this.tileTransform,this.brightness)}}this.status="done",Lt(null,{buckets:Object.values(Yt).filter(wl=>!wl.isEmpty()),featureIndex:Ft,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:zi.image,lineAtlas:yr,imageAtlas:Bi,brightness:hr.brightness})};if(!this.extraShadowCaster){const la=i.fs(hr.glyphDependencies,qn=>Object.keys(qn).map(Number));Object.keys(la).length?wt.send("getGlyphs",{uid:this.uid,stacks:la},(qn,Bi)=>{yn||(yn=qn,vn=Bi,Io())},void 0,!1,Sa):vn={};const zi=Array.from(hr.iconDependencies.keys()).map(qn=>i.I.parse(qn));zi.length?wt.send("getImages",{images:zi,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(qn,Bi)=>{yn||(yn=qn,un=new Map,Zi=this.updateImageMapAndGetImageTaskQueue(un,Bi,hr.iconDependencies),Io())},void 0,!1,Sa):(un=new Map,Zi=new Map);const Ya=Array.from(hr.patternDependencies.keys()).map(qn=>i.I.parse(qn));Ya.length?wt.send("getImages",{images:Ya,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(qn,Bi)=>{yn||(yn=qn,ea=new Map,Mo=this.updateImageMapAndGetImageTaskQueue(ea,Bi,hr.patternDependencies),Io())},void 0,!1,Sa):(ea=new Map,Mo=new Map)}if(hr.elevationFeatures&&hr.elevationFeatures.length>0){const la=[];for(const Ya of Object.values(Yt))if(Ya instanceof i.bb){const qn=Ya.getUnevaluatedPortalGraph();qn&&la.push(qn)}const zi=i.ft.evaluate(la);for(const Ya of Object.values(Yt))if(Ya instanceof i.bb){const qn=ye.layers[Gt.decode(Ya.sourceLayerIndex)];Ya.setEvaluatedPortalGraph(zi,qn,this.tileID.canonical,hr.availableImages,hr.brightness)}}Io()};ss.length>0?Promise.allSettled(ss).then(es).catch(Lt):es()}updateParameters(ye){this.scaleFactor=ye.scaleFactor,this.showCollisionBoxes=ye.showCollisionBoxes,this.projection=ye.projection,this.brightness=ye.brightness,this.tileTransform=i.aZ(ye.tileID.canonical,ye.projection),this.extraShadowCaster=ye.extraShadowCaster,this.lut=ye.lut,this.worldview=ye.worldview,this.indoor=ye.indoor}rasterizeIfNeeded(ye,Oe,Ke,St){Array.from(Oe.values()).some(wt=>wt.usvg)?this.rasterize(ye,Oe,Ke,St):St()}updateImageMapAndGetImageTaskQueue(ye,Oe,Ke){const St=new Map;for(const wt of Oe.keys()){const Lt=Ke.get(wt)||[];for(const Gt of Lt){const Ft=Gt.toString(),Yt=Oe.get(Gt.id.toString());Yt.usvg?St.has(Ft)||(St.set(Ft,Gt),ye.set(Ft,Object.assign({},Yt))):ye.set(Ft,Yt)}}return St}rasterize(ye,Oe,Ke,St){this.rasterizeTask=ye.send("rasterizeImages",{scope:this.scope,tasks:Ke},(wt,Lt)=>{if(!wt)for(const[Gt,Ft]of Lt.entries()){const Yt=Object.assign(Oe.get(Gt),{data:Ft});Oe.set(Gt,Yt)}St()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function B(st,ye,Oe,Ke,St){const wt=new i.ac(ye,{brightness:Oe,worldview:St});for(const Lt of st)Lt.recalculate(wt,Ke)}class $ extends i.E{constructor(ye,Oe,Ke,St,wt,Lt,Gt){super(),this.actor=ye,this.layerIndex=Oe,this.availableImages=Ke,this.availableModels=St,this.loadVectorData=Lt||i.aL,this.loading={},this.loaded={},this.deduped=new i.aK(ye.scheduler),this.isSpriteLoaded=wt,this.scheduler=ye.scheduler,this.brightness=Gt}loadTile(ye,Oe){const Ke=ye.uid,St=ye&&ye.request,wt=St&&St.collectResourceTiming,Lt=this.loading[Ke]=new O(ye);Lt.abort=this.loadVectorData(ye,(Gt,Ft)=>{const Yt=!this.loading[Ke];if(delete this.loading[Ke],Lt.cancelRasterize(),Yt||Gt||!Ft)return Lt.status="done",Yt||(this.loaded[Ke]=Lt),Oe(Gt);const yr=Ft.rawData,hr={},ss=i.aM(Ft.responseHeaders);ss&&ss.expires&&(hr.expires=ss.expires),ss&&ss.cacheControl&&(hr.cacheControl=ss.cacheControl),Lt.vectorTile=Ft.vectorTile||new i.fz(new i.bt(yr));const Is=()=>{Lt.parse(Lt.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(es,yn)=>{if(es||!yn)return Oe(es);const vn={};if(wt){const un=d(St);un.length>0&&(vn.resourceTiming=JSON.parse(JSON.stringify(un)))}Oe(null,Object.assign({rawTileData:yr.slice(0),responseHeaders:Ft.responseHeaders},yn,hr,vn))})};this.isSpriteLoaded?Is():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(Is,{type:"parseTile",isSymbolTile:ye.isSymbolTile,zoom:ye.tileZoom}):Is()}),this.loaded=this.loaded||{},this.loaded[Ke]=Lt})}reloadTile(ye,Oe){const Ke=this.loaded,St=ye.uid;if(Ke&&Ke[St]){const wt=Ke[St];wt.updateParameters(ye);const Lt=(Gt,Ft)=>{const Yt=wt.reloadCallback;Yt&&(delete wt.reloadCallback,wt.parse(wt.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Yt)),Oe(Gt,Ft)};wt.status==="parsing"?wt.reloadCallback=Lt:wt.status==="done"&&(wt.vectorTile?wt.parse(wt.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Lt):Lt())}else Oe(null,void 0)}abortTile(ye,Oe){const Ke=ye.uid,St=this.loading[Ke];St&&(St.abort&&St.abort(),delete this.loading[Ke]),Oe()}removeTile(ye,Oe){const Ke=this.loaded,St=ye.uid;Ke&&Ke[St]&&delete Ke[St],Oe()}}class H{loadTile(ye,Oe){const{uid:Ke,encoding:St,rawImageData:wt,padding:Lt}=ye,Gt=ImageBitmap&&wt instanceof ImageBitmap?this.getImageData(wt,Lt):wt;Oe(null,new i.fA(Ke,Gt,St,Lt<1))}reloadTile(ye,Oe){Oe(null,null)}abortTile(ye,Oe){Oe()}removeTile(ye,Oe){Oe()}getImageData(ye,Oe){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(ye.width,ye.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=ye.width,this.offscreenCanvas.height=ye.height,this.offscreenCanvasContext.drawImage(ye,0,0,ye.width,ye.height);const Ke=this.offscreenCanvasContext.getImageData(-Oe,-Oe,ye.width+2*Oe,ye.height+2*Oe);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),Ke}}i.bs.setPbf(i.bt);class W{constructor(ye){this._mrt=new i.bs(ye.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=ye.uid,this.tileID=ye.tileID,this.source=ye.source}parse(ye,Oe){const Ke=this._mrt;this.status="parsing",this._entireBuffer=ye;try{Ke.parseHeader(ye),this._isHeaderLoaded=!0;const St=[];for(const wt in Ke.layers){const Lt=Ke.getLayer(wt),Gt=Lt.getDataRange(Lt.getBandList()),Ft=Ke.createDecodingTask(Gt),Yt=ye.slice(Gt.firstByte,Gt.lastByte+1),yr=i.bs.performDecoding(Yt,Ft).then(hr=>Ft.complete(null,hr)).catch(hr=>Ft.complete(hr,null));St.push(yr)}Promise.allSettled(St).then(()=>Oe(null,Ke)).catch(wt=>Oe(wt))}catch(St){Oe(St)}}}class X{constructor(ye){this.actor=ye,this.loading={},this.loaded={}}loadTile(ye,Oe){const Ke=ye.uid,St=ye.request,wt=this.loading[Ke]=new W(ye),{cancel:Lt}=i.bu(St,(Gt,Ft,Yt)=>{const yr=!this.loading[Ke];if(delete this.loading[Ke],yr||Gt||!Ft)return wt.status="done",yr||(this.loaded[Ke]=wt),Oe(Gt);wt.parse(Ft,(hr,ss)=>{if(hr||!ss)return Oe(hr);Oe(null,ss,Yt)}),this.loaded[Ke]=wt});wt.abort=Lt}reloadTile(ye,Oe){Oe(null,void 0)}abortTile(ye,Oe){const Ke=ye.uid,St=this.loading[Ke];St&&(St.abort&&St.abort(),delete this.loading[Ke]),Oe()}removeTile(ye,Oe){const Ke=ye.uid;this.loaded[Ke]&&delete this.loaded[Ke],Oe()}decodeRasterArray(ye,Oe){i.bs.performDecoding(ye.buffer,ye.task).then(Ke=>Oe(null,Ke)).catch(Ke=>Oe(Ke))}}const se=i.fB.prototype.toGeoJSON;class ae{constructor(ye){this._feature=ye,this.extent=i.al,this.type=ye.type,this.properties=ye.tags,"id"in ye&&!isNaN(ye.id)&&(this.id=parseInt(ye.id,10))}loadGeometry(){if(this._feature.type===1){const ye=[];for(const Oe of this._feature.geometry)ye.push([new i.P(Oe[0],Oe[1])]);return ye}{const ye=[];for(const Oe of this._feature.geometry){const Ke=[];for(const St of Oe)Ke.push(new i.P(St[0],St[1]));ye.push(Ke)}return ye}}toGeoJSON(ye,Oe,Ke){return se.call(this,ye,Oe,Ke)}}class le{constructor(ye,Oe){this.name=ye,this.extent=i.al,this.length=Oe.length,this._jsonFeatures=Oe}feature(ye){return new ae(this._jsonFeatures[ye])}}class ne{constructor(ye){this.layers={},this.extent=i.al;for(const Oe of Object.keys(ye))this.layers[Oe]=new le(Oe,ye[Oe])}}const fe=64/4096,oe=128;class de{constructor(){this.features=new Map}clear(){this.features.clear()}load(ye=[],Oe){for(const Ke of ye){const St=Ke.id;if(St==null)continue;let wt=this.features.get(St);wt&&this.updateCache(wt,Oe),Ke.geometry?(wt=xe(Ke),this.updateCache(wt,Oe),this.features.set(St,wt)):this.features.delete(St),this.updateCache(wt,Oe)}}updateCache(ye,Oe){for(const{canonical:Ke,uid:St}of Object.values(Oe)){const{z:wt,x:Lt,y:Gt}=Ke;ue(ye,Math.pow(2,wt),Lt,Gt)&&delete Oe[St]}}getTile(ye,Oe,Ke){const St=Math.pow(2,ye),wt=[];for(const Lt of this.features.values())ue(Lt,St,Oe,Ke)&&wt.push(ve(Lt,St,Oe,Ke));return{features:wt}}getFeatures(){return[...this.features.values()]}}function ue({minX:st,minY:ye,maxX:Oe,maxY:Ke},St,wt,Lt){return st<(wt+1+fe)/St&&ye<(Lt+1+fe)/St&&Oe>(wt-fe)/St&&Ke>(Lt-fe)/St}function xe(st){const{id:ye,geometry:Oe,properties:Ke}=st;if(!Oe)return;if(Oe.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:St,coordinates:wt}=Oe,Lt={id:ye,type:1,geometry:[],tags:Ke,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},Gt=Lt.geometry;if(St==="Point")Te(wt,Gt,Lt);else if(St==="MultiPoint")for(const Ft of wt)Te(Ft,Gt,Lt);else if(St==="LineString")Lt.type=2,be(wt,Gt,Lt);else if(St==="MultiLineString")Lt.type=2,we(wt,Gt,Lt);else if(St==="Polygon")Lt.type=3,we(wt,Gt,Lt,!0);else{if(St!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");Lt.type=3;for(const Ft of wt)we(Ft,Gt,Lt,!0)}return Lt}function Te([st,ye],Oe,Ke){const St=i.aF(st);let wt=i.aJ(ye);wt=wt<0?0:wt>1?1:wt,Oe.push(St,wt),Ke.minX=Math.min(Ke.minX,St),Ke.minY=Math.min(Ke.minY,wt),Ke.maxX=Math.max(Ke.maxX,St),Ke.maxY=Math.max(Ke.maxY,wt)}function be(st,ye,Oe,Ke=!1,St=!1){const wt=[];for(const Lt of st)Te(Lt,wt,Oe);ye.push(wt),Ke&&function(Lt,Gt){let Ft=0;for(let Yt=0,yr=Lt.length,hr=yr-2;Yt0===Gt)for(let Yt=0,yr=Lt.length;Yt=Lt&&hr>=Lt||(Yt>=Lt?(yr+=Math.round(es*((Lt-Yt)/Is)),Yt=Lt):hr>=Lt&&(ss=yr+Math.round(es*((Lt-Yt)/Is)),hr=Lt),yr>=Lt&&ss>=Lt||(yr>=Lt?(Yt+=Math.round(Is*((Lt-yr)/es)),yr=Lt):ss>=Lt&&(hr=Yt+Math.round(Is*((Lt-yr)/es)),ss=Lt),Gt&&Yt===Gt[Gt.length-1][0]&&yr===Gt[Gt.length-1][1]||(Gt=[[Yt,yr]],St.push(Gt)),Gt.push([hr,ss])))))}}function Ae(st,ye,Oe,Ke,St){const wt=(Oe-fe)/ye,Lt=(Ke-fe)/ye,Gt=(Oe+1+fe)/ye,Ft=(Ke+1+fe)/ye;function Yt(ss,Is){let es=0;return ssGt&&(es|=2),IsFt&&(es|=8),es}let yr=[];for(let ss=1;ss<=8;ss*=2){let Is=st[st.length-2],es=st[st.length-1],yn=!(Yt(Is,es)&ss);for(let vn=0;vn>31}function It(st,ye){const{geometry:Oe,type:Ke}=st;let St=0,wt=0;if(Ke===1){ye.writeVarint(Ie(1,Oe.length));for(const Lt of Oe){const Gt=Lt[0]-St,Ft=Lt[1]-wt;ye.writeVarint(et(Gt)),ye.writeVarint(et(Ft)),St+=Gt,wt+=Ft}}else for(const Lt of Oe){ye.writeVarint(Ie(1,1));const Gt=Lt.length-(Ke===3?1:0);for(let Ft=0;Ftst},ce=Math.fround||($e=new Float32Array(1),st=>($e[0]=+st,$e[0]));var $e;const Ge=3,rt=5,je=6;class it{constructor(ye){this.options=Object.assign(Object.create(at),ye),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(ye){const{log:Oe,minZoom:Ke,maxZoom:St}=this.options;Oe&&console.time("total time");const wt=`prepare ${ye.length} points`;Oe&&console.time(wt),this.points=ye;const Lt=[];for(let Ft=0;Ft=Ke;Ft--){const Yt=+Date.now();Gt=this.trees[Ft]=this._createTree(this._cluster(Gt,Ft)),Oe&&console.log("z%d: %d clusters in %dms",Ft,Gt.numItems,+Date.now()-Yt)}return Oe&&console.timeEnd("total time"),this}getClusters(ye,Oe){let Ke=((ye[0]+180)%360+360)%360-180;const St=Math.max(-90,Math.min(90,ye[1]));let wt=ye[2]===180?180:((ye[2]+180)%360+360)%360-180;const Lt=Math.max(-90,Math.min(90,ye[3]));if(ye[2]-ye[0]>=360)Ke=-180,wt=180;else if(Ke>wt){const hr=this.getClusters([Ke,St,180,Lt],Oe),ss=this.getClusters([-180,St,wt,Lt],Oe);return hr.concat(ss)}const Gt=this.trees[this._limitZoom(Oe)],Ft=Gt.range(Xe(Ke),Ve(Lt),Xe(wt),Ve(St)),Yt=Gt.data,yr=[];for(const hr of Ft){const ss=this.stride*hr;yr.push(Yt[ss+rt]>1?Me(Yt,ss,this.clusterProps):this.points[Yt[ss+Ge]])}return yr}getChildren(ye){const Oe=this._getOriginId(ye),Ke=this._getOriginZoom(ye),St="No cluster with the specified id.",wt=this.trees[Ke];if(!wt)throw new Error(St);const Lt=wt.data;if(Oe*this.stride>=Lt.length)throw new Error(St);const Gt=this.options.radius/(this.options.extent*Math.pow(2,Ke-1)),Ft=wt.within(Lt[Oe*this.stride],Lt[Oe*this.stride+1],Gt),Yt=[];for(const yr of Ft){const hr=yr*this.stride;Lt[hr+4]===ye&&Yt.push(Lt[hr+rt]>1?Me(Lt,hr,this.clusterProps):this.points[Lt[hr+Ge]])}if(Yt.length===0)throw new Error(St);return Yt}getLeaves(ye,Oe,Ke){const St=[];return this._appendLeaves(St,ye,Oe=Oe||10,Ke=Ke||0,0),St}getTile(ye,Oe,Ke){const St=this.trees[this._limitZoom(ye)],wt=Math.pow(2,ye),{extent:Lt,radius:Gt}=this.options,Ft=Gt/Lt,Yt=(Ke-Ft)/wt,yr=(Ke+1+Ft)/wt,hr={features:[]};return this._addTileFeatures(St.range((Oe-Ft)/wt,Yt,(Oe+1+Ft)/wt,yr),St.data,Oe,Ke,wt,hr),Oe===0&&this._addTileFeatures(St.range(1-Ft/wt,Yt,1,yr),St.data,wt,Ke,wt,hr),Oe===wt-1&&this._addTileFeatures(St.range(0,Yt,Ft/wt,yr),St.data,-1,Ke,wt,hr),hr.features.length?hr:null}getClusterExpansionZoom(ye){let Oe=this._getOriginZoom(ye)-1;for(;Oe<=this.options.maxZoom;){const Ke=this.getChildren(ye);if(Oe++,Ke.length!==1)break;ye=Ke[0].properties.cluster_id}return Oe}_appendLeaves(ye,Oe,Ke,St,wt){const Lt=this.getChildren(Oe);for(const Gt of Lt){const Ft=Gt.properties;if(Ft&&Ft.cluster?wt+Ft.point_count<=St?wt+=Ft.point_count:wt=this._appendLeaves(ye,Ft.cluster_id,Ke,St,wt):wt1;let yr,hr,ss;if(Yt)yr=Je(Oe,Ft,this.clusterProps),hr=Oe[Ft],ss=Oe[Ft+1];else{const yn=this.points[Oe[Ft+Ge]];yr=yn.properties;const[vn,un]=yn.geometry.coordinates;hr=Xe(vn),ss=Ve(un)}const Is={type:1,geometry:[[Math.round(this.options.extent*(hr*wt-Ke)),Math.round(this.options.extent*(ss*wt-St))]],tags:yr};let es;es=Yt||this.options.generateId?Oe[Ft+Ge]:this.points[Oe[Ft+Ge]].id,es!==void 0&&(Is.id=es),Lt.features.push(Is)}}_limitZoom(ye){return Math.max(this.options.minZoom,Math.min(Math.floor(+ye),this.options.maxZoom+1))}_cluster(ye,Oe){const{radius:Ke,extent:St,reduce:wt,minPoints:Lt}=this.options,Gt=Ke/(St*Math.pow(2,Oe)),Ft=ye.data,Yt=[],yr=this.stride;for(let hr=0;hrOe&&(vn+=Ft[ea+rt])}if(vn>yn&&vn>=Lt){let un,ea=ss*yn,Zi=Is*yn,Mo=-1;const Sa=(hr/yr<<5)+(Oe+1)+this.points.length;for(const Io of es){const Fi=Io*yr;if(Ft[Fi+2]<=Oe)continue;Ft[Fi+2]=Oe;const la=Ft[Fi+rt];ea+=Ft[Fi]*la,Zi+=Ft[Fi+1]*la,Ft[Fi+4]=Sa,wt&&(un||(un=this._map(Ft,hr,!0),Mo=this.clusterProps.length,this.clusterProps.push(un)),wt(un,this._map(Ft,Fi)))}Ft[hr+4]=Sa,Yt.push(ea/vn,Zi/vn,1/0,Sa,-1,vn),wt&&Yt.push(Mo)}else{for(let un=0;un1)for(const un of es){const ea=un*yr;if(!(Ft[ea+2]<=Oe)){Ft[ea+2]=Oe;for(let Zi=0;Zi>5}_getOriginZoom(ye){return(ye-this.points.length)%32}_map(ye,Oe,Ke){if(ye[Oe+rt]>1){const Lt=this.clusterProps[ye[Oe+je]];return Ke?Object.assign({},Lt):Lt}const St=this.points[ye[Oe+Ge]].properties,wt=this.options.map(St);return Ke&&wt===St?Object.assign({},wt):wt}}function Me(st,ye,Oe){return{type:"Feature",id:st[ye+Ge],properties:Je(st,ye,Oe),geometry:{type:"Point",coordinates:[(Ke=st[ye],360*(Ke-.5)),ot(st[ye+1])]}};var Ke}function Je(st,ye,Oe){const Ke=st[ye+rt],St=Ke>=1e4?`${Math.round(Ke/1e3)}k`:Ke>=1e3?Math.round(Ke/100)/10+"k":Ke,wt=st[ye+je],Lt=wt===-1?{}:Object.assign({},Oe[wt]);return Object.assign(Lt,{cluster:!0,cluster_id:st[ye+Ge],point_count:Ke,point_count_abbreviated:St})}function Xe(st){return st/360+.5}function Ve(st){const ye=Math.sin(st*Math.PI/180),Oe=.5-.25*Math.log((1+ye)/(1-ye))/Math.PI;return Oe<0?0:Oe>1?1:Oe}function ot(st){const ye=(180-360*st)*Math.PI/180;return 360*Math.atan(Math.exp(ye))/Math.PI-90}function mt(st,ye,Oe,Ke){let St=Ke;const wt=ye+(Oe-ye>>1);let Lt,Gt=Oe-ye;const Ft=st[ye],Yt=st[ye+1],yr=st[Oe],hr=st[Oe+1];for(let ss=ye+3;ssSt)Lt=ss,St=Is;else if(Is===St){const es=Math.abs(ss-wt);esKe&&(Lt-ye>3&&mt(st,ye,Lt,Ke),st[Lt+2]=St,Oe-Lt>3&&mt(st,Lt,Oe,Ke))}function ft(st,ye,Oe,Ke,St,wt){let Lt=St-Oe,Gt=wt-Ke;if(Lt!==0||Gt!==0){const Ft=((st-Oe)*Lt+(ye-Ke)*Gt)/(Lt*Lt+Gt*Gt);Ft>1?(Oe=St,Ke=wt):Ft>0&&(Oe+=Lt*Ft,Ke+=Gt*Ft)}return Lt=st-Oe,Gt=ye-Ke,Lt*Lt+Gt*Gt}function ct(st,ye,Oe,Ke){const St={id:st??null,type:ye,geometry:Oe,tags:Ke,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(ye==="Point"||ye==="MultiPoint"||ye==="LineString")Mt(St,Oe);else if(ye==="Polygon")Mt(St,Oe[0]);else if(ye==="MultiLineString")for(const wt of Oe)Mt(St,wt);else if(ye==="MultiPolygon")for(const wt of Oe)Mt(St,wt[0]);return St}function Mt(st,ye){for(let Oe=0;Oe0&&(Lt+=Ke?(St*yr-Yt*wt)/2:Math.sqrt(Math.pow(Yt-St,2)+Math.pow(yr-wt,2))),St=Yt,wt=yr}const Gt=ye.length-3;ye[2]=1,mt(ye,0,Gt,Oe),ye[Gt+2]=1,ye.size=Math.abs(Lt),ye.start=0,ye.end=ye.size}function cr(st,ye,Oe,Ke){for(let St=0;St1?1:Oe}function At(st,ye,Oe,Ke,St,wt,Lt,Gt){if(Ke/=ye,wt>=(Oe/=ye)&&Lt=Ke)return null;const Ft=[];for(const Yt of st){const yr=Yt.geometry;let hr=Yt.type;const ss=St===0?Yt.minX:Yt.minY,Is=St===0?Yt.maxX:Yt.maxY;if(ss>=Oe&&Is=Ke)continue;let es=[];if(hr==="Point"||hr==="MultiPoint")Rt(yr,es,Oe,Ke,St);else if(hr==="LineString")Cr(yr,es,Oe,Ke,St,!1,Gt.lineMetrics);else if(hr==="MultiLineString")Vs(yr,es,Oe,Ke,St,!1);else if(hr==="Polygon")Vs(yr,es,Oe,Ke,St,!0);else if(hr==="MultiPolygon")for(const yn of yr){const vn=[];Vs(yn,vn,Oe,Ke,St,!0),vn.length&&es.push(vn)}if(es.length){if(Gt.lineMetrics&&hr==="LineString"){for(const yn of es)Ft.push(ct(Yt.id,hr,yn,Yt.tags));continue}hr!=="LineString"&&hr!=="MultiLineString"||(es.length===1?(hr="LineString",es=es[0]):hr="MultiLineString"),hr!=="Point"&&hr!=="MultiPoint"||(hr=es.length===3?"Point":"MultiPoint"),Ft.push(ct(Yt.id,hr,es,Yt.tags))}}return Ft.length?Ft:null}function Rt(st,ye,Oe,Ke,St){for(let wt=0;wt=Oe&&Lt<=Ke&&Js(ye,st[wt],st[wt+1],st[wt+2])}}function Cr(st,ye,Oe,Ke,St,wt,Lt){let Gt=fs(st);const Ft=St===0?hi:Ia;let Yt,yr,hr=st.start;for(let vn=0;vnOe&&(yr=Ft(Gt,un,ea,Mo,Sa,Oe),Lt&&(Gt.start=hr+Yt*yr)):Io>Ke?Fi=Oe&&(yr=Ft(Gt,un,ea,Mo,Sa,Oe),la=!0),Fi>Ke&&Io<=Ke&&(yr=Ft(Gt,un,ea,Mo,Sa,Ke),la=!0),!wt&&la&&(Lt&&(Gt.end=hr+Yt*yr),ye.push(Gt),Gt=fs(st)),Lt&&(hr+=Yt)}let ss=st.length-3;const Is=st[ss],es=st[ss+1],yn=St===0?Is:es;yn>=Oe&&yn<=Ke&&Js(Gt,Is,es,st[ss+2]),ss=Gt.length-3,wt&&ss>=3&&(Gt[ss]!==Gt[0]||Gt[ss+1]!==Gt[1])&&Js(Gt,Gt[0],Gt[1],Gt[2]),Gt.length&&ye.push(Gt)}function fs(st){const ye=[];return ye.size=st.size,ye.start=st.start,ye.end=st.end,ye}function Vs(st,ye,Oe,Ke,St,wt){for(const Lt of st)Cr(Lt,ye,Oe,Ke,St,wt,!1)}function Js(st,ye,Oe,Ke){st.push(ye,Oe,Ke)}function hi(st,ye,Oe,Ke,St,wt){const Lt=(wt-ye)/(Ke-ye);return Js(st,wt,Oe+(St-Oe)*Lt,1),Lt}function Ia(st,ye,Oe,Ke,St,wt){const Lt=(wt-Oe)/(St-Oe);return Js(st,ye+(Ke-ye)*Lt,wt,1),Lt}function dn(st,ye){const Oe=[];for(let Ke=0;Ke0&&ye.size<(St?Lt:Ke))return void(Oe.numPoints+=ye.length/3);const Gt=[];for(let Ft=0;FtLt)&&(Oe.numSimplified++,Gt.push(ye[Ft],ye[Ft+1])),Oe.numPoints++;St&&function(Ft,Yt){let yr=0;for(let hr=0,ss=Ft.length,Is=ss-2;hr0===Yt)for(let hr=0,ss=Ft.length;hr24)throw new Error("maxZoom should be in the 0-24 range");if(Oe.promoteId&&Oe.generateId)throw new Error("promoteId and generateId cannot be used together.");let St=function(wt,Lt){const Gt=[];if(wt.type==="FeatureCollection")for(let Ft=0;Ft1&&console.time("creation"),Is=this.tiles[ss]=Gn(ye,Oe,Ke,St,Yt),this.tileCoords.push({z:Oe,x:Ke,y:St}),yr)){yr>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Oe,Ke,St,Is.numFeatures,Is.numPoints,Is.numSimplified),console.timeEnd("creation"));const la=`z${Oe}`;this.stats[la]=(this.stats[la]||0)+1,this.total++}if(Is.source=ye,wt==null){if(Oe===Yt.indexMaxZoom||Is.numPoints<=Yt.indexMaxPoints)continue}else{if(Oe===Yt.maxZoom||Oe===wt)continue;if(wt!=null){const la=wt-Oe;if(Ke!==Lt>>la||St!==Gt>>la)continue}}if(Is.source=null,ye.length===0)continue;yr>1&&console.time("clipping");const es=.5*Yt.buffer/Yt.extent,yn=.5-es,vn=.5+es,un=1+es;let ea=null,Zi=null,Mo=null,Sa=null,Io=At(ye,hr,Ke-es,Ke+vn,0,Is.minX,Is.maxX,Yt),Fi=At(ye,hr,Ke+yn,Ke+un,0,Is.minX,Is.maxX,Yt);ye=null,Io&&(ea=At(Io,hr,St-es,St+vn,1,Is.minY,Is.maxY,Yt),Zi=At(Io,hr,St+yn,St+un,1,Is.minY,Is.maxY,Yt),Io=null),Fi&&(Mo=At(Fi,hr,St-es,St+vn,1,Is.minY,Is.maxY,Yt),Sa=At(Fi,hr,St+yn,St+un,1,Is.minY,Is.maxY,Yt),Fi=null),yr>1&&console.timeEnd("clipping"),Ft.push(ea||[],Oe+1,2*Ke,2*St),Ft.push(Zi||[],Oe+1,2*Ke,2*St+1),Ft.push(Mo||[],Oe+1,2*Ke+1,2*St),Ft.push(Sa||[],Oe+1,2*Ke+1,2*St+1)}}getTile(ye,Oe,Ke){ye=+ye,Oe=+Oe,Ke=+Ke;const St=this.options,{extent:wt,debug:Lt}=St;if(ye<0||ye>24)return null;const Gt=1<1&&console.log("drilling down to z%d-%d-%d",ye,Oe,Ke);let Yt,yr=ye,hr=Oe,ss=Ke;for(;!Yt&&yr>0;)yr--,hr>>=1,ss>>=1,Yt=this.tiles[Ti(yr,hr,ss)];return Yt&&Yt.source?(Lt>1&&(console.log("found parent tile z%d-%d-%d",yr,hr,ss),console.time("drilling down")),this.splitTile(Yt.source,yr,hr,ss,ye,Oe,Ke),Lt>1&&console.timeEnd("drilling down"),this.tiles[Ft]?en(this.tiles[Ft],wt):null):null}}function Ti(st,ye,Oe){return 32*((1<Yt.tags&&"3d_elevation_id"in Yt.tags&&"source"in Yt.tags&&Yt.tags.source==="elevation",wt=Ke.features.filter(Yt=>St(Yt));let Lt={_geojsonTileLayer:Ke.features};wt.length>0&&(Lt={_geojsonTileLayer:Ke.features.filter(Yt=>!St(Yt)),hd_road_elevation:wt});const Gt=new ne(Lt),Ft=function(Yt){const yr=new i.bt;for(const hr of Object.keys(Yt))yr.writeMessage(3,Le,{name:hr,features:Yt[hr]});return yr.finish()}(Lt).buffer;ye(null,{vectorTile:Gt,rawData:Ft})}class ro extends ${constructor(ye,Oe,Ke,St,wt,Lt,Gt){super(ye,Oe,Ke,St,wt,Ys,Gt),Lt&&(this.loadGeoJSON=Lt),this._dynamicIndex=new de}loadData(ye,Oe){const Ke=ye&&ye.request,St=Ke&&Ke.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(ye,(wt,Lt)=>{if(wt||!Lt)return Oe(wt);if(typeof Lt!="object")return Oe(new Error(`Input data given to '${ye.source}' is not a valid GeoJSON object.`));{try{if(ye.filter){const Ft=i.U(ye.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Ft.result==="error")throw new Error(Ft.value.map(Yt=>`${Yt.key}: ${Yt.message}`).join(", "));Lt.features=Lt.features.filter(Yt=>Ft.value.evaluate({zoom:0},Yt))}ye.dynamic?(Lt.type==="Feature"&&(Lt={type:"FeatureCollection",features:[Lt]}),ye.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(Lt.features,this.loaded),ye.cluster&&(Lt.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=ye.cluster?new it(function({superclusterOptions:Ft,clusterProperties:Yt}){if(!Yt||!Ft)return Ft;const yr={},hr={},ss={accumulated:null,zoom:0},Is={properties:null},es=Object.keys(Yt);for(const yn of es){const[vn,un]=Yt[yn],ea=i.U(un),Zi=i.U(typeof vn=="string"?[vn,["accumulated"],["get",yn]]:vn);yr[yn]=ea.value,hr[yn]=Zi.value}return Ft.map=yn=>{Is.properties=yn;const vn={};for(const un of es)vn[un]=yr[un].evaluate(ss,Is);return vn},Ft.reduce=(yn,vn)=>{Is.properties=vn;for(const un of es)ss.accumulated=yn[un],yn[un]=hr[un].evaluate(ss,Is)},Ft}(ye)).load(Lt.features):ye.dynamic?this._dynamicIndex:function(Ft,Yt){return new mo(Ft,Yt)}(Lt,ye.geojsonVtOptions)}catch(Ft){return Oe(Ft)}const Gt={};if(St){const Ft=d(Ke);Ft&&(Gt.resourceTiming={},Gt.resourceTiming[ye.source]=JSON.parse(JSON.stringify(Ft)))}Oe(null,Gt)}})}reloadTile(ye,Oe){const Ke=this.loaded;return Ke&&Ke[ye.uid]?ye.partial?Oe(null,void 0):super.reloadTile(ye,Oe):this.loadTile(ye,Oe)}loadGeoJSON(ye,Oe){if(ye.request)i.m(ye.request,Oe);else{if(typeof ye.data!="string")return Oe(new Error(`Input data given to '${ye.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return Oe(null,JSON.parse(ye.data))}catch{return Oe(new Error(`Input data given to '${ye.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(ye,Oe){try{Oe(null,this._geoJSONIndex.getClusterExpansionZoom(ye.clusterId))}catch(Ke){Oe(Ke)}}getClusterChildren(ye,Oe){try{Oe(null,this._geoJSONIndex.getChildren(ye.clusterId))}catch(Ke){Oe(Ke)}}getClusterLeaves(ye,Oe){try{Oe(null,this._geoJSONIndex.getLeaves(ye.clusterId,ye.limit,ye.offset))}catch(Ke){Oe(Ke)}}}class gc{constructor(ye,Oe,Ke){this.tileID=new i.aQ(ye.tileID.overscaledZ,ye.tileID.wrap,ye.tileID.canonical.z,ye.tileID.canonical.x,ye.tileID.canonical.y),this.tileZoom=ye.tileZoom,this.uid=ye.uid,this.zoom=ye.zoom,this.canonical=ye.tileID.canonical,this.pixelRatio=ye.pixelRatio,this.tileSize=ye.tileSize,this.source=ye.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=ye.projection,this.brightness=Oe,this.worldview=Ke}parse(ye,Oe,Ke,St){this.status="parsing";const wt=new i.aQ(Ke.tileID.overscaledZ,Ke.tileID.wrap,Ke.tileID.canonical.z,Ke.tileID.canonical.x,Ke.tileID.canonical.y),Lt=[],Gt=Oe.familiesBySource[Ke.source],Ft=new i.fn(wt,Ke.promoteId);Ft.bucketLayerIDs=[],Ft.is3DTile=!0,i.fC(ye).then(Yt=>{if(!Yt)return St(new Error("Could not parse tile"));const yr=Yt.json.extensionsUsed&&Yt.json.extensionsUsed.includes("MAPBOX_mesh_features")||Yt.json.asset.extras&&Yt.json.asset.extras.MAPBOX_mesh_features,hr=Yt.json.extensionsUsed&&Yt.json.extensionsUsed.includes("EXT_meshopt_compression"),ss=new i.ac(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const Is in Gt)for(const es of Gt[Is]){const yn=es[0];Ft.bucketLayerIDs.push(es.map(ea=>i.B(ea.id,ea.scope))),yn.recalculate(ss,[]);const vn=i.fD(Yt,1/i.d7(Ke.tileID.canonical)),un=new i.fE(es,vn,wt,yr,hr,this.brightness,Ft,this.worldview);yr||(un.needsUpload=!0),Lt.push(un),un.evaluate(yn)}this.status="done",St(null,{buckets:Lt,featureIndex:Ft,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(Yt=>St(new Error(Yt.message)))}}class jo{constructor(ye,Oe,Ke,St,wt,Lt,Gt,Ft){this.actor=ye,this.layerIndex=Oe,this.availableImages=Ke,this.availableModels=St,this.brightness=Gt,this.loading={},this.loaded={},this.worldview=Ft}loadTile(ye,Oe){const Ke=ye.uid,St=this.loading[Ke]=new gc(ye,this.brightness,this.worldview);i.bu(ye.request,(wt,Lt)=>{const Gt=!this.loading[Ke];return delete this.loading[Ke],Gt||wt?(St.status="done",Gt||(this.loaded[Ke]=St),Oe(wt)):Lt&&Lt.byteLength!==0?void St.parse(Lt,this.layerIndex,ye,(Ft,Yt)=>{St.status="done",this.loaded=this.loaded||{},this.loaded[Ke]=St,Ft||!Yt?Oe(Ft):Oe(null,Yt)}):(St.status="done",this.loaded[Ke]=St,Oe())})}reloadTile(ye,Oe){const Ke=this.loaded,St=ye.uid;if(Ke&&Ke[St]){const wt=Ke[St];wt.projection=ye.projection,wt.brightness=ye.brightness;const Lt=(Gt,Ft)=>{wt.reloadCallback&&(delete wt.reloadCallback,this.loadTile(ye,Oe)),Oe(Gt,Ft)};wt.status==="parsing"?wt.reloadCallback=Lt:wt.status==="done"&&this.loadTile(ye,Oe)}}abortTile(ye,Oe){const Ke=ye.uid;this.loading[Ke]&&delete this.loading[Ke],Oe()}removeTile(ye,Oe){const Ke=this.loaded,St=ye.uid;Ke&&Ke[St]&&delete Ke[St],Oe()}}class xc{constructor(ye){this.self=ye,this.actor=new i.fG(ye,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:$,geojson:ro,"raster-dem":H,"raster-array":X,"batched-model":jo},this.workerSources={},this.self.registerWorkerSource=(Oe,Ke)=>{if(this.workerSourceTypes[Oe])throw new Error(`Worker source with name "${Oe}" already registered.`);this.workerSourceTypes[Oe]=Ke},this.self.registerRTLTextPlugin=Oe=>{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=Oe.applyArabicShaping,i.fH.processBidirectionalText=Oe.processBidirectionalText,i.fH.processStyledBidirectionalText=Oe.processStyledBidirectionalText;for(const Ke of this.rtlPluginParsingListeners)Ke(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(ye,Oe,Ke){delete this.layerIndexes[ye],delete this.availableImages[ye],delete this.availableModels[ye],delete this.workerSources[ye],Ke()}checkIfReady(ye,Oe,Ke){Ke()}setReferrer(ye,Oe){this.referrer=Oe}spriteLoaded(ye,Oe){this.isSpriteLoaded[ye]||(this.isSpriteLoaded[ye]={});const{scope:Ke,isLoaded:St}=Oe;if(this.isSpriteLoaded[ye][Ke]=St,this.workerSources[ye]&&this.workerSources[ye][Ke])for(const wt in this.workerSources[ye][Ke]){const Lt=this.workerSources[ye][Ke][wt];for(const Gt in Lt){const Ft=Lt[Gt];Ft instanceof $&&(Ft.isSpriteLoaded=St,Ft.fire(new i.z("isSpriteLoaded")))}}}setImages(ye,Oe,Ke){this.availableImages[ye]||(this.availableImages[ye]={});const{scope:St,images:wt}=Oe;if(this.availableImages[ye][St]=wt,this.workerSources[ye]&&this.workerSources[ye][St]){for(const Lt in this.workerSources[ye][St]){const Gt=this.workerSources[ye][St][Lt];for(const Ft in Gt)Gt[Ft].availableImages=wt}Ke()}else Ke()}setModels(ye,{scope:Oe,models:Ke},St){if(this.availableModels[ye]||(this.availableModels[ye]={}),this.availableModels[ye][Oe]=Ke,this.workerSources[ye]&&this.workerSources[ye][Oe]){for(const wt in this.workerSources[ye][Oe]){const Lt=this.workerSources[ye][Oe][wt];for(const Gt in Lt)Lt[Gt].availableModels=Ke}St()}else St()}setProjection(ye,Oe){this.projections[ye]=i.cm(Oe)}setBrightness(ye,Oe,Ke){this.brightness=Oe,Ke()}setWorldview(ye,Oe,Ke){this.worldview=Oe,Ke()}setLayers(ye,Oe,Ke){this.getLayerIndex(ye,Oe.scope).replace(Oe.layers,Oe.options),Ke()}updateLayers(ye,Oe,Ke){this.getLayerIndex(ye,Oe.scope).update(Oe.layers,Oe.removedIds,Oe.options),Ke()}loadTile(ye,Oe,Ke){Oe.projection=this.projections[ye]||this.defaultProjection,this.getWorkerSource(ye,Oe.type,Oe.source,Oe.scope).loadTile(Oe,Ke)}decodeRasterArray(ye,Oe,Ke){this.getWorkerSource(ye,Oe.type,Oe.source,Oe.scope).decodeRasterArray(Oe,Ke)}reloadTile(ye,Oe,Ke){Oe.projection=this.projections[ye]||this.defaultProjection,this.getWorkerSource(ye,Oe.type,Oe.source,Oe.scope).reloadTile(Oe,Ke)}abortTile(ye,Oe,Ke){this.getWorkerSource(ye,Oe.type,Oe.source,Oe.scope).abortTile(Oe,Ke)}removeTile(ye,Oe,Ke){this.getWorkerSource(ye,Oe.type,Oe.source,Oe.scope).removeTile(Oe,Ke)}removeSource(ye,Oe,Ke){if(!(this.workerSources[ye]&&this.workerSources[ye][Oe.scope]&&this.workerSources[ye][Oe.scope][Oe.type]&&this.workerSources[ye][Oe.scope][Oe.type][Oe.source]))return;const St=this.workerSources[ye][Oe.scope][Oe.type][Oe.source];delete this.workerSources[ye][Oe.scope][Oe.type][Oe.source],St.removeSource!==void 0?St.removeSource(Oe,Ke):Ke()}loadWorkerSource(ye,Oe,Ke){try{this.self.importScripts(Oe.url),Ke()}catch(St){Ke(St)}}syncRTLPluginState(ye,Oe,Ke){if(i.fH.isParsed())Ke(null,!0);else if(i.fH.isParsing())this.rtlPluginParsingListeners.push(Ke);else try{i.fH.setState(Oe);const St=i.fH.getPluginURL();!i.fH.isLoaded()||i.fH.isParsed()||i.fH.isParsing()||St==null||(i.fH.setState({pluginStatus:i.fI.parsing,pluginURL:i.fH.getPluginURL()}),this.self.importScripts(St),i.fH.isParsed()?Ke(null,!0):this.rtlPluginParsingListeners.push(Ke))}catch(St){Ke(St)}}setDracoUrl(ye,Oe){this.dracoUrl=Oe}getAvailableImages(ye,Oe){this.availableImages[ye]||(this.availableImages[ye]={});let Ke=this.availableImages[ye][Oe];return Ke||(Ke=[]),Ke}getAvailableModels(ye,Oe){this.availableModels[ye]||(this.availableModels[ye]={});let Ke=this.availableModels[ye][Oe];return Ke||(Ke={}),Ke}getLayerIndex(ye,Oe){this.layerIndexes[ye]||(this.layerIndexes[ye]={});let Ke=this.layerIndexes[ye][Oe];return Ke||(Ke=this.layerIndexes[ye][Oe]=new y,Ke.scope=Oe),Ke}getWorkerSource(ye,Oe,Ke,St){const wt=this.workerSources;return wt[ye]||(wt[ye]={}),wt[ye][St]||(wt[ye][St]={}),wt[ye][St][Oe]||(wt[ye][St][Oe]={}),this.isSpriteLoaded[ye]||(this.isSpriteLoaded[ye]={}),wt[ye][St][Oe][Ke]||(wt[ye][St][Oe][Ke]=new this.workerSourceTypes[Oe]({send:(Lt,Gt,Ft,Yt,yr,hr)=>this.actor.send(Lt,Gt,Ft,ye,yr,hr),scheduler:this.actor.scheduler},this.getLayerIndex(ye,St),this.getAvailableImages(ye,St),this.getAvailableModels(ye,St),this.isSpriteLoaded[ye][St],void 0,this.brightness,this.worldview)),wt[ye][St][Oe][Ke]}rasterizeImagesWorker(ye,Oe,Ke){const St=new Map;for(const[wt,{image:Lt,imageVariant:Gt}]of Oe.tasks.entries()){const Ft=this.imageRasterizer.rasterize(Gt,Lt,Oe.scope,ye);St.set(wt,Ft)}Ke(void 0,St)}removeRasterizedImages(ye,Oe,Ke){this.imageRasterizer.removeImagesFromCacheByIds(Oe.imageIds,Oe.scope,ye),Ke()}enforceCacheSizeLimit(ye,Oe){i.fJ(Oe)}getWorkerPerformanceMetrics(ye,Oe,Ke){Ke(void 0,void 0)}}return i.fF(self)&&(self.worker=new xc(self)),xc}),o(["./shared"],function(i){var d="3.17.0";const m={create:"create",load:"load",fullLoad:"fullLoad"},g={mark(w){performance.mark(w)},measure(w,u,f){performance.measure(w,u,f)}};function y(w){const u=w.name.split("?")[0];return i.a(u)&&u.includes("mapbox-gl.js")?"javascript":i.a(u)&&u.includes("mapbox-gl.css")?"css":i.b(u)?"fontRange":i.c(u)?"sprite":i.i(u)?"style":i.d(u)?"tilejson":"other"}var v,b={},N=function(){if(v)return b;function w(k){return!u(k)}function u(k){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var D,R,U=new Blob([""],{type:"text/javascript"}),G=URL.createObjectURL(U);try{R=new Worker(G),D=!0}catch{D=!1}return R&&R.terminate(),URL.revokeObjectURL(G),D}()?function(){var D=document.createElement("canvas");D.width=D.height=1;var R=D.getContext("2d");if(!R)return!1;var U=R.getImageData(0,0,1,1);return U&&U.width===D.width}()?(f[P=k&&k.failIfMajorPerformanceCaveat]===void 0&&(f[P]=function(D){var R,U=function(G){var J=document.createElement("canvas"),te=Object.create(w.webGLContextAttributes);return te.failIfMajorPerformanceCaveat=G,J.getContext("webgl2",te)}(D);if(!U)return!1;try{R=U.createShader(U.VERTEX_SHADER)}catch{return!1}return!(!R||U.isContextLost())&&(U.shaderSource(R,"void main() {}"),U.compileShader(R),U.getShaderParameter(R,U.COMPILE_STATUS)===!0)}(P)),f[P]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var P}v=1,b.supported=w,b.notSupportedReason=u;var f={};return w.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},b}();function j(w,u,f){const k=document.createElement(w);return u!=null&&(k.className=u),f&&f.appendChild(k),k}function S(w,u,f){const k=document.createElementNS("http://www.w3.org/2000/svg",w);for(const P of Object.keys(u))k.setAttributeNS(null,P,String(u[P]));return f&&f.appendChild(k),k}const A=typeof document<"u"?document.documentElement&&document.documentElement.style:null,M=A&&A.userSelect!==void 0?"userSelect":"WebkitUserSelect";let I;function F(){A&&M&&(I=A[M],A[M]="none")}function O(){A&&M&&(A[M]=I)}function B(w){w.preventDefault(),w.stopPropagation(),window.removeEventListener("click",B,!0)}function $(){window.addEventListener("click",B,!0),window.setTimeout(()=>{window.removeEventListener("click",B,!0)},0)}function H(w,u){const f=w.getBoundingClientRect();return se(w,f,u)}function W(w,u){const f=w.getBoundingClientRect(),k=[];for(let P=0;Pthis._skuTokenExpiresAt}transformRequest(u,f){return this._transformRequestFn&&this._transformRequestFn(u,f)||{url:u}}normalizeStyleURL(u,f){if(!i.h(u))return u;const k=oe(u);return k.params.push(`sdk=js-${d}`),k.path=`/styles/v1${k.path}`,this._makeAPIURL(k,this._customAccessToken||f)}normalizeGlyphsURL(u,f){if(!i.h(u))return u;const k=oe(u);return k.path=`/fonts/v1${k.path}`,this._makeAPIURL(k,this._customAccessToken||f)}normalizeModelURL(u,f){if(!i.h(u))return u;const k=oe(u);return k.path=`/models/v1${k.path}`,this._makeAPIURL(k,this._customAccessToken||f)}normalizeSourceURL(u,f,k,P){if(!i.h(u))return u;const D=oe(u);return D.path=`/v4/${D.authority}.json`,D.params.push("secure"),k&&D.params.push(`language=${k}`),P&&D.params.push(`worldview=${P}`),this._makeAPIURL(D,this._customAccessToken||f)}normalizeIconsetURL(u,f){const k=oe(u);return i.h(u)?(k.path=`/styles/v1${k.path}/iconset.pbf`,this._makeAPIURL(k,this._customAccessToken||f)):de(k)}normalizeSpriteURL(u,f,k,P){const D=oe(u);return i.h(u)?(D.path=`/styles/v1${D.path}/sprite${f}${k}`,this._makeAPIURL(D,this._customAccessToken||P)):(D.path+=`${f}${k}`,de(D))}normalizeTileURL(u,f,k){if(this._isSkuTokenExpired()&&this._createSkuToken(),u&&!i.h(u))return u;const P=oe(u);P.path=P.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${f||k&&P.authority!=="raster"&&k===512?"@2x":""}${i.k.supported?".webp":"$1"}`),P.authority==="raster"?P.path=`/${i.e.RASTER_URL_PREFIX}${P.path}`:P.authority==="rasterarrays"?P.path=`/${i.e.RASTERARRAYS_URL_PREFIX}${P.path}`:P.authority==="3dtiles"?P.path=`/${i.e.TILES3D_URL_PREFIX}${P.path}`:(P.path=P.path.replace(/^.+\/v4\//,"/"),P.path=`/${i.e.TILE_URL_VERSION}${P.path}`);const D=this._customAccessToken||function(R){for(const U of R){const G=U.match(/^access_token=(.*)$/);if(G)return G[1]}return null}(P.params)||i.e.ACCESS_TOKEN;return i.e.REQUIRE_ACCESS_TOKEN&&D&&this._skuToken&&P.params.push(`sku=${this._skuToken}`),this._makeAPIURL(P,D)}canonicalizeTileURL(u,f){const k=oe(u);if(!k.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!k.path.match(/\.[\w]+$/))return u;let P="mapbox://";k.path.match(/^\/raster\/v1\//)?P+=`raster/${k.path.replace(`/${i.e.RASTER_URL_PREFIX}/`,"")}`:k.path.match(/^\/rasterarrays\/v1\//)?P+=`rasterarrays/${k.path.replace(`/${i.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:P+=`tiles/${k.path.replace(`/${i.e.TILE_URL_VERSION}/`,"")}`;let D=k.params;return f&&(D=D.filter(R=>!R.match(/^access_token=/))),D.length&&(P+=`?${D.join("&")}`),P}canonicalizeTileset(u,f){const k=!!f&&i.h(f),P=[];for(const D of u.tiles||[])i.j(D)?P.push(this.canonicalizeTileURL(D,k)):P.push(D);return P}_makeAPIURL(u,f){const k="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",P=oe(i.e.API_URL);if(u.protocol=P.protocol,u.authority=P.authority,u.protocol==="http"){const D=u.params.indexOf("secure");D>=0&&u.params.splice(D,1)}if(P.path!=="/"&&(u.path=`${P.path}${u.path}`),!i.e.REQUIRE_ACCESS_TOKEN)return de(u);if(f=f||i.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!f)throw new Error(`An API access token is required to use Mapbox GL. ${k}`);if(f[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${k}`)}return u.params=u.params.filter(D=>D.indexOf("access_token")===-1),u.params.push(`access_token=${f||""}`),de(u)}}const fe=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function oe(w){const u=w.match(fe);if(!u)throw new Error("Unable to parse URL object");return{protocol:u[1],authority:u[2],path:u[3]||"/",params:u[4]?u[4].split("&"):[]}}function de(w){const u=w.params.length?`?${w.params.join("&")}`:"";return`${w.protocol}://${w.authority}${w.path}${u}`}const ue="mapbox.eventData";function xe(w){if(!w)return null;const u=w.split(".");if(!u||u.length!==3)return null;try{return JSON.parse(i.l(u[1]))}catch{return null}}class Te{constructor(u){this.type=u,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(u){const f=xe(i.e.ACCESS_TOKEN);let k="";return k=f&&f.u?i.f(f.u):i.e.ACCESS_TOKEN||"",u?`${ue}.${u}:${k}`:`${ue}:${k}`}fetchEventData(){const u=i.s("localStorage"),f=this.getStorageKey(),k=this.getStorageKey("uuid"),P=this.getStorageKey("uuidTimestamp");if(u)try{const D=localStorage.getItem(f);D&&(this.eventData=JSON.parse(D));const R=localStorage.getItem(k);R&&(this.anonId=R);const U=localStorage.getItem(P);U&&(this.anonIdTimestamp=Number(U));const G=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp=1&&localStorage.setItem(f,JSON.stringify(this.eventData)),R&&localStorage.setItem(P,R.toString())}catch{i.w("Unable to write to LocalStorage")}}processRequests(u){}postEvent(u,f,k,P){if(!i.e.EVENTS_URL)return;const D=oe(i.e.EVENTS_URL);D.params.push(`access_token=${P||i.e.ACCESS_TOKEN||""}`);const R={event:this.type,created:new Date(u).toISOString()},U=f?Object.assign(R,f):R,G={url:de(D),headers:{"Content-Type":"text/plain"},body:JSON.stringify([U])};this.pendingRequest=i.p(G,J=>{this.pendingRequest=null,k(J),this.saveEventData(),this.processRequests(P)})}queueRequest(u,f){this.queue.push(u),this.processRequests(f)}}class be extends Te{constructor(u){super("metrics"),u&&(this.data=u)}postMetricsEvent(u){if(!i.e.EVENTS_URL||!u&&!i.e.ACCESS_TOKEN)return;this.anonId||this.fetchEventData(),i.v(this.anonId)||this.refreshUUID();const f=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:f},u)}processRequests(u){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:f,payload:k}=this.queue.shift();this.postEvent(f,k,()=>{},u)}}const we=new class extends Te{constructor(w){super("appUserTurnstile"),this._customAccessToken=w}postTurnstileEvent(w,u){i.e.EVENTS_URL&&i.e.ACCESS_TOKEN&&Array.isArray(w)&&w.some(f=>i.h(f)||i.j(f))&&this.queueRequest(Date.now(),u)}processRequests(w){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const u=xe(i.e.ACCESS_TOKEN),f=u?u.u:i.e.ACCESS_TOKEN;let k=f!==this.eventData.tokenU;i.v(this.anonId)||(this.refreshUUID(),k=!0);const P=this.queue.shift();if(this.eventData.lastSuccess){const D=new Date(this.eventData.lastSuccess),R=new Date(P),U=(P-this.eventData.lastSuccess)/864e5;k=k||U>=1||U<-1||D.getDate()!==R.getDate()}else k=!0;k?this.postEvent(P,{sdkIdentifier:"mapbox-gl-js",sdkVersion:d,skuId:ae,"enabled.telemetry":!1,userId:this.anonId},D=>{D||(this.eventData.lastSuccess=P,this.eventData.tokenU=f)},w):this.processRequests()}},ve=we.postTurnstileEvent.bind(we),tt=new class extends Te{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(w,u,f,k){this.skuToken=u,this.errorCb=k,i.e.EVENTS_URL&&(f||i.e.ACCESS_TOKEN?this.queueRequest({id:w,timestamp:Date.now()},f):this.errorCb(new Error(le)))}processRequests(w){if(this.pendingRequest||this.queue.length===0)return;const{id:u,timestamp:f}=this.queue.shift();u&&this.success[u]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),i.v(this.anonId)||this.refreshUUID(),this.postEvent(f,{sdkIdentifier:"mapbox-gl-js",sdkVersion:d,skuId:ae,skuToken:this.skuToken,userId:this.anonId},k=>{k?this.errorCb(k):u&&(this.success[u]=!0)},w))}remove(){this.errorCb=null}},Ae=tt.postMapLoadEvent.bind(tt),Le=new class extends Te{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(w){let u=this.mapInstanceIdMap.get(w);return u||(u=i.u(),this.mapInstanceIdMap.set(w,u)),u}getEventId(w){const u=this.eventIdPerMapInstanceMap.get(w)||0;return this.eventIdPerMapInstanceMap.set(w,u+1),u}postStyleLoadEvent(w,u){const{map:f,style:k,importedStyles:P}=u;if(!i.e.EVENTS_URL||!w&&!i.e.ACCESS_TOKEN)return;const D=this.getMapInstanceId(f),R={mapInstanceId:D,eventId:this.getEventId(D),style:k};P.length&&(R.importedStyles=P),this.queueRequest({timestamp:Date.now(),payload:R},w)}processRequests(w){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:u,payload:f}=this.queue.shift();this.postEvent(u,f,()=>{},w)}},Ue=Le.postStyleLoadEvent.bind(Le),Ye=new be({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),Ie=Ye.postMetricsEvent.bind(Ye),et=new be({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),It=et.postMetricsEvent.bind(et),Pe=new class extends Te{constructor(){super("gljs.performance")}postPerformanceEvent(w,u){i.e.EVENTS_URL&&(w||i.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:u},w)}processRequests(w){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:u,performanceData:f}=this.queue.shift(),k=function(P){const D=performance.getEntriesByType("resource"),R=performance.getEntriesByType("mark"),U=function(pe){const ke={};if(pe){for(const _e in pe)if(_e!=="other")for(const Re of pe[_e]){const De=`${_e}ResolveRangeMin`,He=`${_e}ResolveRangeMax`,nt=`${_e}RequestCount`,We=`${_e}RequestCachedCount`;ke[De]=Math.min(ke[De]||1/0,Re.startTime),ke[He]=Math.max(ke[He]||-1/0,Re.responseEnd);const kt=xt=>{ke[xt]===void 0&&(ke[xt]=0),++ke[xt]};Re.transferSize!==void 0&&Re.transferSize===0&&kt(We),kt(nt)}}return ke}(function(pe,ke){const _e={};if(pe)for(const Re of pe){const De=ke(Re);_e[De]===void 0&&(_e[De]=[]),_e[De].push(Re)}return _e}(D,y)),G=window.devicePixelRatio,J=navigator.connection||navigator.mozConnection||navigator.webkitConnection,te=J?J.effectiveType:void 0,me={counters:[],metadata:[],attributes:[]},he=(pe,ke,_e)=>{_e!=null&&pe.push({name:ke,value:_e.toString()})};for(const pe in U)he(me.counters,pe,U[pe]);if(P.interactionRange[0]!==1/0&&P.interactionRange[1]!==-1/0&&(he(me.counters,"interactionRangeMin",P.interactionRange[0]),he(me.counters,"interactionRangeMax",P.interactionRange[1])),R)for(const pe of Object.values(m)){const ke=R.find(_e=>_e.name===pe);ke&&he(me.counters,pe,ke.startTime)}return he(me.counters,"visibilityHidden",P.visibilityHidden),he(me.attributes,"style",function(pe){if(pe)for(const ke of pe){const _e=ke.name.split("?")[0];if(i.i(_e)){const Re=_e.split("/").slice(-2);if(Re.length===2)return`mapbox://styles/${Re[0]}/${Re[1]}`}}}(D)),he(me.attributes,"terrainEnabled",P.terrainEnabled?"true":"false"),he(me.attributes,"fogEnabled",P.fogEnabled?"true":"false"),he(me.attributes,"projection",P.projection),he(me.attributes,"zoom",P.zoom),he(me.metadata,"devicePixelRatio",G),he(me.metadata,"connectionEffectiveType",te),he(me.metadata,"navigatorUserAgent",navigator.userAgent),he(me.metadata,"screenWidth",window.screen.width),he(me.metadata,"screenHeight",window.screen.height),he(me.metadata,"windowWidth",window.innerWidth),he(me.metadata,"windowHeight",window.innerHeight),he(me.metadata,"mapWidth",P.width/G),he(me.metadata,"mapHeight",P.height/G),he(me.metadata,"webglRenderer",P.renderer),he(me.metadata,"webglVendor",P.vendor),he(me.metadata,"sdkVersion",d),he(me.metadata,"sdkIdentifier","mapbox-gl-js"),me}(f);for(const P of k.metadata);for(const P of k.counters);for(const P of k.attributes);this.postEvent(u,k,()=>{},w)}},at=Pe.postPerformanceEvent.bind(Pe),ce=new class extends Te{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(w,u,f,k){if(!i.e.API_URL||!i.e.SESSION_PATH)return;const P=oe(i.e.API_URL+i.e.SESSION_PATH);P.params.push(`sku=${u||""}`),P.params.push(`access_token=${k||i.e.ACCESS_TOKEN||""}`);const D={url:de(P),headers:{"Content-Type":"text/plain"}};this.pendingRequest=i.g(D,R=>{this.pendingRequest=null,f(R),this.saveEventData(),this.processRequests(k)})}getSessionAPI(w,u,f,k){this.skuToken=u,this.errorCb=k,i.e.SESSION_PATH&&i.e.API_URL&&(f||i.e.ACCESS_TOKEN?this.queueRequest({id:w,timestamp:Date.now()},f):this.errorCb(new Error(le)))}processRequests(w){if(this.pendingRequest||this.queue.length===0)return;const{id:u,timestamp:f}=this.queue.shift();u&&this.success[u]||this.getSession(f,this.skuToken,k=>{k?this.errorCb(k):u&&(this.success[u]=!0)},w)}remove(){this.errorCb=null}},$e=ce.getSessionAPI.bind(ce),Ge=new Set;function rt(w,u){u?Ge.add(w):Ge.delete(w)}class je{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(u,f){this._updatedSourceCaches[u]=f,this.setDirty()}discardSourceCacheUpdate(u){delete this._updatedSourceCaches[u]}updateLayer(u){const f=u.scope;this._updatedLayers[f]=this._updatedLayers[f]||new Set,this._updatedLayers[f].add(u.id),this.setDirty()}removeLayer(u){const f=u.scope;this._removedLayers[f]=this._removedLayers[f]||{},this._updatedLayers[f]=this._updatedLayers[f]||new Set,this._removedLayers[f][u.id]=u,this._updatedLayers[f].delete(u.id),this._updatedPaintProps.delete(u.fqid),this.setDirty()}getRemovedLayer(u){return this._removedLayers[u.scope]?this._removedLayers[u.scope][u.id]:null}discardLayerRemoval(u){this._removedLayers[u.scope]&&delete this._removedLayers[u.scope][u.id]}getLayerUpdatesByScope(){const u={};for(const f in this._updatedLayers)u[f]=u[f]||{},u[f].updatedIds=Array.from(this._updatedLayers[f].values());for(const f in this._removedLayers)u[f]=u[f]||{},u[f].removedIds=Object.keys(this._removedLayers[f]);return u}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(u){this._updatedPaintProps.add(u.fqid),this.setDirty()}getUpdatedImages(u){return this._updatedImages[u]?Array.from(this._updatedImages[u].values()):[]}updateImage(u,f){this._updatedImages[f]=this._updatedImages[f]||new Set,this._updatedImages[f].add(i.I.toString(u)),this.setDirty()}resetUpdatedImages(u){this._updatedImages[u]&&this._updatedImages[u].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function it(w){const{userImage:u}=w;return!!(u&&u.render&&u.render())&&(w.data.replace(new Uint8Array(u.data.buffer)),!0)}class Me extends i.E{constructor(u){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=u,u!=="raster"&&i.r()&&(this.imageRasterizerDispatcher=new i.D(i.t(),this,"Image Rasterizer Worker",1))}addScope(u){this.loaded.set(u,!1),this.imageProviders.set(u,new Map),this.images.set(u,new Map),this.updatedImages.set(u,new Set),this.callbackDispatchedThisFrame.set(u,new Set),this.patterns.set(u,new Map),this.atlasImage.set(u,new i.q({width:1,height:1}))}removeScope(u){this.loaded.delete(u),this.imageProviders.delete(u),this.images.delete(u),this.updatedImages.delete(u),this.callbackDispatchedThisFrame.delete(u),this.patterns.delete(u),this.atlasImage.delete(u);const f=this.atlasTexture.get(u);f&&(f.destroy(),this.atlasTexture.delete(u))}addImageProvider(u,f){this.imageProviders.has(f)||this.imageProviders.set(f,new Map),this.imageProviders.get(f).set(u.id,u)}removeImageProvider(u,f){this.imageProviders.has(f)&&this.imageProviders.get(f).delete(u)}getPendingImageProviders(){const u=[];for(const f of this.imageProviders.values())for(const k of f.values())k.hasPendingRequests()&&u.push(k);return u}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new i.x),this._imageRasterizer}isLoaded(){for(const u of this.loaded.keys())if(!this.loaded.get(u))return!1;return!0}setLoaded(u,f){if(this.loaded.get(f)!==u&&(this.loaded.set(f,u),u)){for(const{ids:k,callback:P}of this.requestors)this._notify(k,f,P);this.requestors=[]}}hasImage(u,f){return!!this.getImage(u,f)}getImage(u,f){return this.images.get(f).get(u.toString())}addImage(u,f,k){this._validate(u,k)&&this.images.get(f).set(u.toString(),k)}_validate(u,f){let k=!0;return this._validateStretch(f.stretchX,f.data&&f.data.width)||(this.fire(new i.y(new Error(`Image "${u.name}" has invalid "stretchX" value`))),k=!1),this._validateStretch(f.stretchY,f.data&&f.data.height)||(this.fire(new i.y(new Error(`Image "${u.name}" has invalid "stretchY" value`))),k=!1),this._validateContent(f.content,f)||(this.fire(new i.y(new Error(`Image "${u.name}" has invalid "content" value`))),k=!1),k}_validateStretch(u,f){if(!u)return!0;let k=0;for(const P of u){if(P[0]i.I.from(f))}getImages(u,f,k){const P=[],D=[],R=this.imageProviders.get(f);for(const te of u){if(!te.iconsetId){P.push(te);continue}const me=R.get(te.iconsetId);me&&(this.getImage(te,f)?D.push(te):me.addPendingRequest(te))}if(P.length===0)return void this._notify(D,f,k);let U=!0;const G=!!this.loaded.get(f),J=this.images.get(f);if(!G)for(const te of P)J.has(te.toString())||(U=!1);G||U?this._notify(P,f,k):this.requestors.push({ids:P,scope:f,callback:k})}rasterizeImages(u,f){const k=new Map,{tasks:P,scope:D}=u;for(const[R,U]of P.entries()){const G=this.getImage(U.id,D);G&&k.set(R,{image:G,imageVariant:U})}this._rasterizeImages(D,k,f)}_rasterizeImages(u,f,k){if(i.r())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:f,scope:u},k);else{const P=new Map;for(const[D,{image:R,imageVariant:U}]of f.entries())P.set(D,this.imageRasterizer.rasterize(U,R,u,0));k(void 0,P)}}getUpdatedImages(u){return this.updatedImages.get(u)||new Set}_notify(u,f,k){const P=this.images.get(f),D=new Map;for(const R of u){if(!P.get(R.toString())){if(R.iconsetId)continue;this.fire(new i.z("styleimagemissing",{id:R.name}))}const U=P.get(R.toString());if(!U){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 G={data:U.usvg?null:U.data.clone(),pixelRatio:U.pixelRatio,sdf:U.sdf,usvg:U.usvg,version:U.version,stretchX:U.stretchX,stretchY:U.stretchY,content:U.content,hasRenderCallback:!!(U.userImage&&U.userImage.render)};U.usvg&&Object.assign(G,{width:U.icon.usvg_tree.width,height:U.icon.usvg_tree.height}),D.set(i.I.toString(R),G)}k(null,D)}getPixelSize(u){const{width:f,height:k}=this.atlasImage.get(u);return{width:f,height:k}}getPattern(u,f,k){const P=u.toString(),D=this.patterns.get(f),R=D.get(P),U=this.getImage(u,f);if(!U)return null;if(R){if(R.position.version===U.version)return R.position;R.position.version=U.version}else{if(U.usvg&&!U.data){const G=this.getPatternInFlightId(P,f);if(this.patternsInFlight.has(G))return null;this.patternsInFlight.add(G);const J=new i.A(u).scaleSelf(i.o.devicePixelRatio),te=new Map([[J.toString(),{image:U,imageVariant:J}]]);return this._rasterizeImages(f,te,(me,he)=>this.storePatternImage(J,f,U,k,he)),null}this.storePattern(u,f,U)}return this._updatePatternAtlas(f,k),D.get(P).position}getPatternInFlightId(u,f){return i.B(u,f)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(u,f,k,P,D){const R=u.toString(),U=D?D.get(R):void 0;U&&(k.data=U,this.storePattern(u.id,f,k),this._updatePatternAtlas(f,P),this.patternsInFlight.delete(this.getPatternInFlightId(u.id.toString(),f)))}storePattern(u,f,k){const P={w:k.data.width+2*i.C,h:k.data.height+2*i.C,x:0,y:0},D=new i.F(P,k,i.C);this.patterns.get(f).set(u.toString(),{bin:P,position:D})}destroyAtlasTextures(){for(const u of this.atlasTexture.values())u&&u.destroy();this.atlasTexture.clear()}bind(u,f){const k=u.gl;let P=this.atlasTexture.get(f);P?this.dirty&&(P.update(this.atlasImage.get(f)),this.dirty=!1):(P=new i.T(u,this.atlasImage.get(f),k.RGBA8),this.atlasTexture.set(f,P)),P.bind(k.LINEAR,k.CLAMP_TO_EDGE)}_updatePatternAtlas(u,f){const k=this.patterns.get(u),P=Array.from(k.values()).map(({bin:J})=>J),{w:D,h:R}=i.G(P),U=this.atlasImage.get(u);U.resize({width:D||1,height:R||1});const G=this.images.get(u);for(const[J,{bin:te,position:me}]of k.entries()){let he=me.padding;const pe=te.x+he,ke=te.y+he,_e=G.get(J).data,Re=_e.width,De=_e.height;he=he>1?he-1:he,i.q.copy(_e,U,{x:0,y:0},{x:pe,y:ke},{width:Re,height:De},f),i.q.copy(_e,U,{x:0,y:De-he},{x:pe,y:ke-he},{width:Re,height:he},f),i.q.copy(_e,U,{x:0,y:0},{x:pe,y:ke+De},{width:Re,height:he},f),i.q.copy(_e,U,{x:Re-he,y:0},{x:pe-he,y:ke},{width:he,height:De},f),i.q.copy(_e,U,{x:0,y:0},{x:pe+Re,y:ke},{width:he,height:De},f),i.q.copy(_e,U,{x:Re-he,y:De-he},{x:pe-he,y:ke-he},{width:he,height:he},f),i.q.copy(_e,U,{x:0,y:De-he},{x:pe+Re,y:ke-he},{width:he,height:he},f),i.q.copy(_e,U,{x:0,y:0},{x:pe+Re,y:ke+De},{width:he,height:he},f),i.q.copy(_e,U,{x:Re-he,y:0},{x:pe-he,y:ke+De},{width:he,height:he},f)}this.dirty=!0}beginFrame(){for(const u of this.images.keys())this.callbackDispatchedThisFrame.set(u,new Set)}dispatchRenderCallbacks(u,f){const k=this.images.get(f);for(const P of u){if(this.callbackDispatchedThisFrame.get(f).has(P.toString()))continue;this.callbackDispatchedThisFrame.get(f).add(P.toString());const D=k.get(P.toString());it(D)&&this.updateImage(P,f,D)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function Je(w){const u=w.value,f=w.valueSpec,k=w.style,P=w.styleSpec,D=w.key,R=w.arrayElementValidator||dn;if(!Array.isArray(u))return[new i.V(D,u,`array expected, ${i.K(u)} found`)];if(f.length&&u.length!==f.length)return[new i.V(D,u,`array length ${f.length} expected, length ${u.length} found`)];if(f["min-length"]&&u.lengthP)return[new i.V(u,f,`${f} is greater than the maximum value ${P}`)]}return[]}function Ve(w){const u=w.key,f=w.value;if(!i.H(f))return[new i.V(u,f,`object expected, ${i.K(f)} found`)];const k=w.valueSpec,P=i.J(f.type);let D,R,U,G={};const J=P!=="categorical"&&f.property===void 0,te=!J,me=function(_e){const Re=_e.stops;return Array.isArray(Re)&&Array.isArray(Re[0])&&i.H(Re[0][0])}(f),he=na({key:w.key,value:w.value,valueSpec:w.styleSpec.function,style:w.style,styleSpec:w.styleSpec,objectElementValidators:{stops:function(_e){if(P==="identity")return[new i.V(_e.key,_e.value,'identity function may not have a "stops" property')];let Re=[];const De=_e.value;return Re=Re.concat(Je({key:_e.key,value:De,valueSpec:_e.valueSpec,style:_e.style,styleSpec:_e.styleSpec,arrayElementValidator:pe})),Array.isArray(De)&&De.length===0&&Re.push(new i.V(_e.key,De,"array must have at least one stop")),Re},default:function(_e){return dn({key:_e.key,value:_e.value,valueSpec:k,style:_e.style,styleSpec:_e.styleSpec})}}});return P==="identity"&&J&&he.push(new i.V(w.key,w.value,'missing required property "property"')),P==="identity"||f.stops||he.push(new i.V(w.key,w.value,'missing required property "stops"')),P==="exponential"&&k.expression&&!i.M(k)&&he.push(new i.V(w.key,w.value,"exponential functions not supported")),w.styleSpec.$version>=8&&(te&&!i.N(k)?he.push(new i.V(w.key,w.value,"property functions not supported")):J&&!i.O(k)&&he.push(new i.V(w.key,w.value,"zoom functions not supported"))),P!=="categorical"&&!me||f.property!==void 0||he.push(new i.V(w.key,w.value,'"property" property is required')),he;function pe(_e){let Re=[];const De=_e.value,He=_e.key;if(!Array.isArray(De))return[new i.V(He,De,`array expected, ${i.K(De)} found`)];if(De.length!==2)return[new i.V(He,De,`array length 2 expected, length ${De.length} found`)];if(me){if(!i.H(De[0]))return[new i.V(He,De,`object expected, ${i.K(De[0])} found`)];const nt=De[0];if(nt.zoom===void 0)return[new i.V(He,De,"object stop key must have zoom")];if(nt.value===void 0)return[new i.V(He,De,"object stop key must have value")];const We=i.J(nt.zoom);if(typeof We!="number")return[new i.V(He,nt.zoom,"stop zoom values must be numbers")];if(U&&U>We)return[new i.V(He,nt.zoom,"stop zoom values must appear in ascending order")];We!==U&&(U=We,R=void 0,G={}),Re=Re.concat(na({key:`${He}[0]`,value:De[0],valueSpec:{zoom:{}},style:_e.style,styleSpec:_e.styleSpec,objectElementValidators:{zoom:Xe,value:ke}}))}else Re=Re.concat(ke({key:`${He}[0]`,value:De[0],style:_e.style,styleSpec:_e.styleSpec},De));return i.Q(i.S(De[1]))?Re.concat([new i.V(`${He}[1]`,De[1],"expressions are not allowed in function stops.")]):Re.concat(dn({key:`${He}[1]`,value:De[1],valueSpec:k,style:_e.style,styleSpec:_e.styleSpec}))}function ke(_e,Re){const De=i.K(_e.value),He=i.J(_e.value),nt=_e.value!==null?_e.value:Re;if(D){if(De!==D)return[new i.V(_e.key,nt,`${De} stop domain type must match previous stop domain type ${D}`)]}else D=De;if(De!=="number"&&De!=="string"&&De!=="boolean"&&typeof He!="number"&&typeof He!="string"&&typeof He!="boolean")return[new i.V(_e.key,nt,"stop domain value must be a number, string, or boolean")];if(De!=="number"&&P!=="categorical"){let We=`number expected, ${De} found`;return i.N(k)&&P===void 0&&(We+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new i.V(_e.key,nt,We)]}return P!=="categorical"||De!=="number"||typeof He=="number"&&isFinite(He)&&Math.floor(He)===He?P!=="categorical"&&De==="number"&&typeof He=="number"&&typeof R=="number"&&R!==void 0&&Henew i.V(`${w.key}${k.key}`,w.value,k.message));const f=u.value.expression||u.value._styleExpression.expression;if(w.expressionContext==="property"&&w.propertyKey==="text-font"&&!f.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(f))return[new i.V(w.key,w.value,'"feature-state" data expressions are not supported with layout properties.')];if(w.expressionContext==="filter")return mt(f,w);if(w.expressionContext==="appearance")return ft(f,w);if(w.expressionContext&&w.expressionContext.indexOf("cluster")===0){if(!i.X(f,["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(f))return[new i.V(w.key,w.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function mt(w,u){const f=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(u.valueSpec&&u.valueSpec.expression)for(const P of u.valueSpec.expression.parameters)f.delete(P);if(f.size===0)return[];const k=[];return w instanceof i._&&f.has(w.name)?[new i.V(u.key,u.value,`["${w.name}"] expression is not supported in a filter for a ${u.object.type} layer with id: ${u.object.id}`)]:(w.eachChild(P=>{k.push(...mt(P,u))}),k)}function ft(w,u){const f=new Set;if(u.valueSpec&&u.valueSpec.expression)for(const P of u.valueSpec.expression.parameters)f.add(P);if(f.size===0)return[];const k=[];return w instanceof i._&&!f.has(w.name)?[new i.V(u.key,u.value,`["${w.name}"] is not an allowed parameter`)]:(w.eachChild(P=>{k.push(...ft(P,u))}),k)}function ct(w){const u=w.key,f=w.value,k=w.valueSpec,P=[];return Array.isArray(k.values)?k.values.indexOf(i.J(f))===-1&&P.push(new i.V(u,f,`expected one of [${k.values.join(", ")}], ${JSON.stringify(f)} found`)):Object.keys(k.values).indexOf(i.J(f))===-1&&P.push(new i.V(u,f,`expected one of [${Object.keys(k.values).join(", ")}], ${JSON.stringify(f)} found`)),P}function Mt(w){return i.a2(i.S(w.value))?ot(Object.assign({},w,{expressionContext:"filter",valueSpec:w.styleSpec[`filter_${w.layerType||"fill"}`]})):Ot(w)}function Ot(w){const u=w.value,f=w.key;if(!Array.isArray(u))return[new i.V(f,u,`array expected, ${i.K(u)} found`)];if(u.length<1)return[new i.V(f,u,"filter array must have at least 1 element")];const k=w.styleSpec;let P=ct({key:`${f}[0]`,value:u[0],valueSpec:k.filter_operator});const D=()=>{u.length>=2&&(i.a0(u[1])||P.push(new i.V(`${f}[1]`,u[1],`string expected, ${i.K(u[1])} found`)));for(let R=2;R":case">=":u.length>=2&&i.J(u[1])==="$type"&&P.push(new i.V(f,u,`"$type" cannot be use with operator "${u[0]}"`)),u.length!==3&&P.push(new i.V(f,u,`filter array for operator "${u[0]}" must have 3 elements`)),D();break;case"==":case"!=":u.length!==3&&P.push(new i.V(f,u,`filter array for operator "${u[0]}" must have 3 elements`)),D();break;case"in":case"!in":D();break;case"any":case"all":case"none":for(let R=1;R{J in f&&u.push(new i.V(k,f[J],`"${J}" is prohibited for ref layers`))}),P.layers.forEach(J=>{i.J(J.id)===U&&(G=J)}),G?G.ref?u.push(new i.V(k,f.ref,"ref cannot reference another ref layer")):R=i.J(G.type):typeof U=="string"&&u.push(new i.V(k,f.ref,`ref layer "${U}" not found`))}else if(R!=="background"&&R!=="sky"&&R!=="slot")if(f.source)if(i.a0(f.source)){const G=P.sources&&P.sources[f.source],J=G&&i.J(G.type);G?J==="vector"&&R==="raster"?u.push(new i.V(k,f.source,`layer "${f.id}" requires a raster source`)):J==="raster"&&R!=="raster"?u.push(new i.V(k,f.source,`layer "${f.id}" requires a vector source`)):J!=="vector"||f["source-layer"]?J==="raster-dem"&&R!=="hillshade"?u.push(new i.V(k,f.source,"raster-dem source can only be used with layer type 'hillshade'.")):J!=="raster-array"||["raster","raster-particle"].includes(R)?R==="line"&&f.paint&&(f.paint["line-gradient"]||f.paint["line-trim-offset"])&&J==="geojson"&&!G.lineMetrics?u.push(new i.V(k,f,`layer "${f.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):R==="raster-particle"&&J!=="raster-array"&&u.push(new i.V(k,f.source,`layer "${f.id}" requires a 'raster-array' source.`)):u.push(new i.V(k,f.source,"raster-array source can only be used with layer type 'raster'.")):u.push(new i.V(k,f,`layer "${f.id}" must specify a "source-layer"`)):u.push(new i.V(k,f.source,`source "${f.source}" not found`))}else u.push(new i.V(`${k}.source`,f.source,'"source" must be a string'));else u.push(new i.V(k,f,'missing required property "source"'));return u=u.concat(na({key:k,value:f,valueSpec:D.layer,style:w.style,styleSpec:w.styleSpec,objectElementValidators:{"*":()=>[],type:()=>dn({key:`${k}.type`,value:f.type,valueSpec:D.layer.type,style:w.style,styleSpec:w.styleSpec,object:f,objectKey:"type"}),filter:G=>Mt(Object.assign({layerType:R},G)),layout:G=>na({layer:f,key:G.key,value:G.value,valueSpec:{},style:G.style,styleSpec:G.styleSpec,objectElementValidators:{"*":J=>cr(Object.assign({layerType:R},J))}}),paint:G=>na({layer:f,key:G.key,value:G.value,valueSpec:{},style:G.style,styleSpec:G.styleSpec,objectElementValidators:{"*":J=>Ir(Object.assign({layerType:R,layer:f},J))}}),appearances(G){const J=Je({key:G.key,value:G.value,valueSpec:G.valueSpec,style:G.style,styleSpec:G.styleSpec,arrayElementValidator:he=>function(pe){const{key:ke,layer:_e,layerType:Re}=pe,De=i.J(pe.value),He=i.J(De.name),nt=i.J(De.condition),We=na({key:ke,value:De,valueSpec:pe.styleSpec.appearance,style:pe.style,styleSpec:pe.styleSpec,objectElementValidators:{condition:kt=>function(xt){const _t=[];return _t.push(...ot({key:xt.key,value:xt.object.condition,valueSpec:i.a6.appearance.condition,expressionContext:"appearance"})),_t}(Object.assign({layer:_e,layerType:Re},kt)),properties:kt=>function(xt){const _t=[],{styleSpec:gt,layer:ut,layerType:Tt}=xt,Bt=gt[`paint_${Tt}`],zt=gt[`layout_${Tt}`],Qt=xt.object[xt.objectKey];for(const er in Qt){const ur=er in Bt?"paint":er in zt?"layout":void 0;if(!ur){_t.push(new i.V(xt.key,er,`unknown property "${er}" for layer type "${Tt}"`));continue}const Sr=Object.assign({},xt,{key:`${xt.key}.${er}`,object:Qt,objectKey:er,layer:ut,layerType:Tt,value:Qt[er],valueSpec:ur==="paint"?Bt[er]:zt[er]});_t.push(...rr(Sr,ur))}return _t}(Object.assign({layer:_e,layerType:Re},kt))}});return He!=="hidden"&&nt===void 0&&We.push(new i.V(pe.key,"name",'Appearance with name different than "hidden" must have a condition')),We}(Object.assign({layerType:R,layer:f},he))}),te=Array.isArray(G.value)?G.value:[],me=new Set;return te.forEach((he,pe)=>{const ke=i.J(he.name);if(ke)if(me.has(ke)){const _e=i.J(f.id);J.push(new i.V(G.key,ke,`Duplicated appearance name "${ke}" for layer "${_e}"`))}else me.add(ke)}),J}}})),u}function As({key:w,value:u}){return i.a0(u)?[]:[new i.V(w,u,`string expected, ${i.K(u)} found`)]}const At={promoteId:function w({key:u,value:f}){if(i.a0(f))return As({key:u,value:f});if(Array.isArray(f)){const P=[],D=i.S(f),R=i.U(D);return R.result==="error"&&R.value.forEach(U=>{P.push(new i.V(`${u}${U.key}`,null,`${U.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"])||P.push(new i.V(`${u}`,null,"promoteId expression should be only feature dependent")),P}if(!i.H(f))return[new i.V(u,f,`string, expression or object expected, "${i.K(f)}" found`)];const k=[];for(const P in f)k.push(...w({key:`${u}.${P}`,value:f[P]}));return k}};function Rt(w){const u=w.value,f=w.key,k=w.styleSpec,P=w.style;if(!i.H(u))return[new i.V(f,u,`object expected, ${i.K(u)} found`)];if(!("type"in u))return[new i.V(f,u,'"type" is required')];const D=i.J(u.type);let R=[];switch(["vector","raster","raster-dem","raster-array"].includes(D)&&("url"in u||"tiles"in u||R.push(new i.a3(f,u,'Either "url" or "tiles" is required.'))),D){case"vector":case"raster":case"raster-dem":case"raster-array":return R=R.concat(na({key:f,value:u,valueSpec:k[`source_${D.replace("-","_")}`],style:w.style,styleSpec:k,objectElementValidators:At})),R;case"geojson":if(R=na({key:f,value:u,valueSpec:k.source_geojson,style:P,styleSpec:k,objectElementValidators:At}),"cluster"in u&&"clusterProperties"in u){if(!i.H(u.clusterProperties))return[new i.V(`${f}.clusterProperties`,u,`object expected, ${i.K(u)} found`)];for(const U in u.clusterProperties){const G=u.clusterProperties[U];if(!Array.isArray(G))return[new i.V(`${f}.clusterProperties.${U}`,G,"array expected")];const[J,te]=G,me=typeof J=="string"?[J,["accumulated"],["get",U]]:J;R.push(...ot({key:`${f}.${U}.map`,value:te,expressionContext:"cluster-map"})),R.push(...ot({key:`${f}.${U}.reduce`,value:me,expressionContext:"cluster-reduce"}))}}return R;case"video":return na({key:f,value:u,valueSpec:k.source_video,style:P,styleSpec:k});case"image":return na({key:f,value:u,valueSpec:k.source_image,style:P,styleSpec:k});case"canvas":return[new i.V(f,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ct({key:`${f}.type`,value:u.type,valueSpec:{values:Cr(k)}})}}function Cr(w){return w.source.reduce((u,f)=>{const k=w[f];return k.type.type==="enum"&&(u=u.concat(Object.keys(k.type.values||{}))),u},[])}function fs(w){const u=w.value,f=w.styleSpec,k=f.light,P=w.style;if(u===void 0)return[];if(!i.H(u))return[new i.V("light",u,`object expected, ${i.K(u)} found`)];let D=[];for(const R in u){const U=R.match(/^(.*)-transition$/),G=R.match(/^(.*)-use-theme$/);D=D.concat(G&&k[G[1]]?dn({key:R,value:u[R],valueSpec:{type:"string"},style:P,styleSpec:f}):U&&k[U[1]]&&k[U[1]].transition?dn({key:R,value:u[R],valueSpec:f.transition,style:P,styleSpec:f}):k[R]?dn({key:R,value:u[R],valueSpec:k[R],style:P,styleSpec:f}):[new i.V(R,u[R],`unknown property "${R}"`)])}return D}function Vs(w){const u=w.value;if(!u)return[];const f=w.key;if(!i.H(u))return[new i.V(f,u,`object expected, ${i.K(u)} found`)];let k=[];const P=w.styleSpec,D=P["light-3d"],R=w.style,U=w.style.lights;for(const te of["type","id"])if(!(te in u))return k=k.concat([new i.V(f,u,`missing property "${te}"`)]),k;if(!i.a0(u.type))return k=k.concat([new i.V(`${f}.type`,u.type,"string expected")]),k;if(U)for(let te=0;te[],array:Je,boolean:function(w){const u=w.value,f=w.key;return i.$(u)?[]:[new i.V(f,u,`boolean expected, ${i.K(u)} found`)]},number:Xe,color:function({key:w,value:u}){return i.a0(u)?i.a1.parseCSSColor(u)===null?[new i.V(w,u,`color expected, "${u}" found`)]:[]:[new i.V(w,u,`color expected, ${i.K(u)} found`)]},enum:ct,filter:Mt,function:Ve,layer:Mr,object:na,source:Rt,model:i.a7,light:fs,"light-3d":Vs,terrain:Js,fog:hi,string:As,formatted:function(w){return As(w).length===0?[]:ot(w)},resolvedImage:function(w){return As(w).length===0?[]:ot(w)},projection:function(w){const u=w.value,f=w.styleSpec,k=f.projection,P=w.style;if(i.H(u)){let D=[];for(const R in u)D=D.concat(dn({key:R,value:u[R],valueSpec:k[R],style:P,styleSpec:f}));return D}return i.a0(u)?[]:[new i.V("projection",u,`object or string expected, ${i.K(u)} found`)]},import:function(w){const u=w.key,{value:f,styleSpec:k}=w;if(!i.H(f))return[new i.V(u,f,"import must be an object")];const{data:P,...D}=f;Object.defineProperty(D,"__line__",{value:f.__line__,enumerable:!1});let R=na(Object.assign({},w,{value:D,valueSpec:k.import}));return i.J(D.id)===""&&R.push(new i.V(`${w.key}.id`,D,"import id can't be an empty string")),P&&(R=R.concat(Un(P,k,{key:`${w.key}.data`}))),R},iconset:function(w){const u=w.value,f=w.key,k=w.styleSpec,P=w.style;if(!i.H(u))return[new i.V(f,u,"object expected")];if(!u.type)return[new i.V(f,u,'"type" is required')];const D=i.J(u.type);let R=[];if(R=R.concat(na({key:f,value:u,valueSpec:k[`iconset_${D}`],style:P,styleSpec:k})),function(U,G){return!(U!=="source"||!G.source)}(D,u)){const U=P.sources&&P.sources[u.source],G=U&&i.J(U.type);U?G!=="raster-array"&&R.push(new i.V(f,u.source,`iconset cannot be used with a source of type ${String(G)}, it only be used with a "raster-array" source type`)):R.push(new i.V(f,u.source,`source "${u.source}" not found`))}return R}};function dn(w,u=!1){const f=w.value,k=w.valueSpec,P=w.styleSpec;if(k.expression){if(i.a4(i.J(f)))return Ve(w);if(i.Q(i.S(f)))return ot(w)}if(k.type&&Ia[k.type]){const D=Ia[k.type](w);return u===!0&&D.length>0&&Array.isArray(w.value)?ot(w):D}return na(Object.assign({},w,{valueSpec:k.type?P[k.type]:k}))}function na(w){const u=w.key,f=w.value,k=w.valueSpec||{},P=w.objectElementValidators||{},D=w.style,R=w.styleSpec;if(!i.H(f))return[new i.V(u,f,`object expected, ${i.K(f)} found`)];let U=[];for(const G in f){const J=G.split(".")[0];let te;P[J]?te=P[J]:k[J]?te=dn:P["*"]?te=P["*"]:k["*"]&&(te=dn),te?U=U.concat(te({key:(u&&`${u}.`)+G,value:f[G],valueSpec:k[J]||k["*"],style:D,styleSpec:R,object:f,objectKey:G},f)):U.push(new i.a3(u,f[G],`unknown property "${G}"`))}for(const G in k){if(P[G])continue;const J=k[G];J.required&&J.default===void 0&&f[G]===void 0&&U.push(new i.V(u,f,`missing required property "${G}"`))}return U}function en({key:w,value:u}){const f=As({key:w,value:u});if(f.length)return f;const k=u;return k.indexOf("{fontstack}")===-1&&f.push(new i.V(w,u,'"glyphs" url must include a "{fontstack}" token')),k.indexOf("{range}")===-1&&f.push(new i.V(w,u,'"glyphs" url must include a "{range}" token')),f}function Un(w,u=i.a6,f={}){return na({key:f.key||"",value:w,valueSpec:Object.assign(u.$root,{"*":{type:"*"}}),styleSpec:u,style:w,objectElementValidators:{glyphs:en}})}function Gn(w,u=i.a6){return Oe(Un(w,u))}const Ai=w=>Oe(Rt(w)),dr=w=>Oe(fs(w)),Fa=w=>Oe(Vs(w)),mo=w=>Oe(Js(w)),Ti=w=>Oe(hi(w)),Ys=w=>Oe(function(u){const f=u.value,k=u.style,P=u.styleSpec,D=P.snow;if(f===void 0)return[];if(!i.H(f))return[new i.V("snow",f,`object expected, ${i.K(f)} found`)];let R=[];for(const U in f){const G=U.match(/^(.*)-transition$/);R=R.concat(G&&D[G[1]]&&D[G[1]].transition?dn({key:U,value:f[U],valueSpec:P.transition,style:k,styleSpec:P}):D[U]?dn({key:U,value:f[U],valueSpec:D[U],style:k,styleSpec:P}):[new i.a3(U,f[U],`unknown property "${U}"`)])}return R}(w)),ro=w=>Oe(function(u){const f=u.value,k=u.style,P=u.styleSpec,D=P.rain;if(f===void 0)return[];if(!i.H(f))return[new i.V("rain",f,`object expected, ${i.K(f)} found`)];let R=[];for(const U in f){const G=U.match(/^(.*)-transition$/);R=R.concat(G&&D[G[1]]&&D[G[1]].transition?dn({key:U,value:f[U],valueSpec:P.transition,style:k,styleSpec:P}):D[U]?dn({key:U,value:f[U],valueSpec:D[U],style:k,styleSpec:P}):[new i.a3(U,f[U],`unknown property "${U}"`)])}return R}(w)),gc=w=>Oe(Mr(w)),jo=w=>Oe(Mt(w)),xc=w=>Oe(Ir(w)),st=w=>Oe(cr(w)),ye=w=>Oe(i.a7(w));function Oe(w){return w.slice().sort((u,f)=>u.line&&f.line?u.line-f.line:0)}function Ke(w,u){let f=!1;if(u&&u.length)for(const k of u)k instanceof i.a3?i.w(k.message):(w.fire(new i.y(new Error(k.message))),f=!0);return f}const St=i.a6.light;let wt;class Lt extends i.E{constructor(u,f="flat"){super(),this._transitionable=new i.a8(wt||(wt=new i.a9({anchor:new i.aa(St.anchor),position:new i.ab(St.position),color:new i.aa(St.color),intensity:new i.aa(St.intensity)}))),this.setLight(u,f),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(u,f,k={}){this._validate(dr,u,k)||(this._transitionable.setTransitionOrValue(u),this.id=f)}updateTransitions(u){this._transitioning=this._transitionable.transitioned(u,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(u){this.properties=this._transitioning.possiblyEvaluate(u)}_validate(u,f,k){return(!k||k.validate!==!1)&&Ke(this,u.call(Gn,Object.assign({value:f,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}}const Gt=i.a6.terrain;let Ft=class extends i.E{constructor(w,u,f,k,P){super(),this.scope=f,this._transitionable=new i.a8(new i.a9({source:new i.aa(Gt.source),exaggeration:new i.aa(Gt.exaggeration)}),f,k),this._transitionable.setTransitionOrValue(w,k),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=u,this.worldview=P}get(){return this._transitionable.serialize()}set(w,u){this._transitionable.setTransitionOrValue(w,u)}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 u=w.value.expression;if(!u)return null;let f=-1,k=-1,P=1;for(const D of u.zoomStops)P=u.evaluate(new i.ac(D,{worldview:this.worldview})),P>.01?(f=D,k=-1):k=D;return P<.01&&f>0&&k>f?[f,k]: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 Yt=45,yr=65,hr=.05;function ss(w,u,f,k){const P=i.ah(Yt,yr,f),[D,R]=Is(w,k);let U=1-Math.min(1,Math.exp((u-D)/(R-D)*-6));return U*=U*U,U=Math.min(1,1.00747*U),U*P*w.alpha}function Is(w,u){const f=.5/Math.tan(.5*u);return[w.range[0]+f,w.range[1]+f]}function es(w,u,f,k,P){const D=i.af([],[u,f,k],P.mercatorFogMatrix);return ss(w,i.ag(D),P.pitch,P._fov)}function yn(w,u,f,k,P,D,R){const U=[[f,k,0],[P,k,0],[P,D,0],[f,D,0]];let G=Number.MAX_VALUE,J=-Number.MAX_VALUE;for(const te of U){const me=i.af([],te,u),he=i.ag(me);G=Math.min(G,he),J=Math.max(J,he)}return[ss(w,G,R.pitch,R._fov),ss(w,J,R.pitch,R._fov)]}const vn=i.a6.fog;class un extends i.E{constructor(u,f,k,P){super();const D=new i.a9({range:new i.aa(vn.range),color:new i.aa(vn.color),"color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"high-color":new i.aa(vn["high-color"]),"high-color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"space-color":new i.aa(vn["space-color"]),"space-color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new i.aa(vn["horizon-blend"]),"star-intensity":new i.aa(vn["star-intensity"]),"vertical-range":new i.aa(vn["vertical-range"])});this._transitionable=new i.a8(D,k,new Map(P)),this.set(u,P),this._transitioning=this._transitionable.untransitioned(),this._transform=f,this.properties=new i.ai(D),this.scope=k}get state(){const u=this._transform,f=u.projection.name==="globe",k=i.aj(u.zoom),P=this.properties.get("range"),D=[.5,3];return{range:f?[i.ak(D[0],P[0],k),i.ak(D[1],P[1],k)]:P,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(u,f,k={}){if(this._validate(Ti,u,k))return;const P=Object.assign({},u);for(const D of Object.keys(vn))P[D]===void 0&&(P[D]=vn[D].default);this._options=P,this._transitionable.setTransitionOrValue(this._options,f)}getOpacity(u){if(!this._transform.projection.supportsFog)return 0;const f=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:i.ah(Yt,yr,u))*f.a}getOpacityAtLatLng(u,f){return this._transform.projection.supportsFog?function(k,P,D){const R=i.ae.fromLngLat(P),U=D.elevation?D.elevation.getAtPointOrZero(R):0;return es(k,R.x,R.y,U,D)}(this.state,u,f):0}getOpacityForTile(u){if(!this._transform.projection.supportsFog)return[1,1];const f=this._transform.calculateFogTileMatrix(u.toUnwrapped());return yn(this.state,f,0,0,i.al,i.al,this._transform)}getOpacityForBounds(u,f,k,P,D){return this._transform.projection.supportsFog?yn(this.state,u,f,k,P,D,this._transform):[1,1]}getFovAdjustedRange(u){return this._transform.projection.supportsFog?Is(this.state,u):[0,1]}isVisibleOnFrustum(u){if(!this._transform.projection.supportsFog)return!1;const f=[4,5,6,7];for(const k of f){const P=u.points[k];let D;if(P[2]>=0)D=P;else{const R=u.points[k-4];D=i.am(R,P,R[2]/(R[2]-P[2]))}if(es(this.state,D[0],D[1],0,this._transform)>=hr)return!0}return!1}updateConfig(u){this._transitionable.setTransitionOrValue(this._options,new Map(u))}updateTransitions(u){this._transitioning=this._transitionable.transitioned(u,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(u){this.properties=this._transitioning.possiblyEvaluate(u)}_validate(u,f,k){return(!k||k.validate!==!1)&&Ke(this,u.call(Gn,Object.assign({value:f,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}}let ea,Zi,Mo,Sa,Io=class extends i.E{constructor(w,u,f,k){super();const P=ea||(ea=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(P,f,new Map(k)),this.set(w,k),this._transitioning=this._transitionable.untransitioned(),this.properties=new i.ai(P),this.scope=f}get state(){const w=this.properties.get("opacity"),u=this.properties.get("color"),f=this.properties.get("direction"),k=i.an(f[0]),P=-Math.max(i.an(f[1]),.01),D=[Math.cos(k)*Math.cos(P),Math.sin(k)*Math.cos(P),Math.sin(P)],R=this.properties.get("vignette"),U=this.properties.get("vignette-color");return U.a=R,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new i.ao(u.r,u.g,u.b,u.a*w),direction:D,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:U}}get(){return this._transitionable.serialize()}set(w,u,f={}){if(this._validate(Ys,w,f))return;const k=Object.assign({},w),P=i.a6.snow;for(const D of Object.keys(P))k[D]===void 0&&(k[D]=P[D].default);this._options=k,this._transitionable.setTransitionOrValue(this._options,u)}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,u,f){return(!f||f.validate!==!1)&&Ke(this,w.call(Gn,Object.assign({value:u,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}},Fi=class extends i.E{constructor(w,u,f,k){super();const P=Zi||(Zi=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(P,f,new Map(k)),this.set(w,k),this._transitioning=this._transitionable.untransitioned(),this.properties=new i.ai(P),this.scope=f}get state(){const w=this.properties.get("opacity"),u=this.properties.get("color"),f=this.properties.get("direction"),k=i.an(f[0]),P=-Math.max(i.an(f[1]),.01),D=[Math.cos(k)*Math.cos(P),Math.sin(k)*Math.cos(P),Math.sin(P)],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(u.r,u.g,u.b,u.a*w),direction:D,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,u,f={}){if(this._validate(ro,w,f))return;const k=Object.assign({},w),P=i.a6.rain;for(const D of Object.keys(P))k[D]===void 0&&(k[D]=P[D].default);this._options=k,this._transitionable.setTransitionOrValue(this._options,u)}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,u,f){return(!f||f.validate!==!1)&&Ke(this,w.call(Gn,Object.assign({value:u,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}};class la extends i.E{constructor(u,f,k,P){super(),this.scope=k,this._options=u,this.properties=new i.ai(f),this._transitionable=new i.a8(f,k,new Map(P)),this._transitionable.setTransitionOrValue(u.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(u){this._transitionable.setTransitionOrValue(this._options.properties,new Map(u))}updateTransitions(u){this._transitioning=this._transitionable.transitioned(u,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(u){this.properties=this._transitioning.possiblyEvaluate(u)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(u,f){this._options=u,this._transitionable.setTransitionOrValue(u.properties,f)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}class zi{constructor(u,f,k){this.screenBounds=u,this.cameraPoint=k.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=f,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,k)}static createFromScreenPoints(u,f){let k,P;if(u instanceof i.P||typeof u[0]=="number"){const D=i.P.convert(u);k=[D],P=f.isPointAboveHorizon(D)}else{const D=i.P.convert(u[0]),R=i.P.convert(u[1]),U=D.add(R)._div(2);k=[D,R],P=i.aq(D,R).every(G=>f.isPointAboveHorizon(G))&&f.isPointAboveHorizon(U)}return new zi(k,P,f)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(u){return i.aq(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],u)}bufferedCameraGeometry(u){const f=this.screenBounds[0],k=this.screenBounds.length===1?this.screenBounds[0].add(new i.P(1,1)):this.screenBounds[1],P=i.aq(f,k,0,!1);return this.cameraPoint.y>k.y&&(this.cameraPoint.x>f.x&&this.cameraPoint.x=k.x?P[2]=this.cameraPoint:this.cameraPoint.x<=f.x&&(P[3]=this.cameraPoint)),i.ar(P,u)}bufferedCameraGeometryGlobe(u){const f=this.screenBounds[0],k=this.screenBounds.length===1?this.screenBounds[0].add(new i.P(1,1)):this.screenBounds[1],P=i.aq(f,k,u),D=this.cameraPoint.clone();switch(3*((D.y>f.y)+(D.y>k.y))+((D.x>f.x)+(D.x>k.x))){case 0:P[0]=D,P[4]=D.clone();break;case 1:P.splice(1,0,D);break;case 2:P[1]=D;break;case 3:P.splice(4,0,D);break;case 5:P.splice(2,0,D);break;case 6:P[3]=D;break;case 7:P.splice(3,0,D);break;case 8:P[2]=D}return P}containsTile(u,f,k,P=0){const D=Math.max(u.queryPadding,u.evaluateQueryRenderedFeaturePadding())/f._pixelsPerMercatorPixel+1,R=k?this._bufferedCameraMercator(D,f):this._bufferedScreenMercator(D,f);let U=u.tileID.wrap+(R.unwrapped?P:0);const G=R.polygon.map(Re=>i.as(u.tileTransform,Re,U));if(!i.at(G,0,0,i.al,i.al))return;U=u.tileID.wrap+(this.screenGeometryMercator.unwrapped?P:0);const J=this.screenGeometryMercator.polygon.map(Re=>i.au(u.tileTransform,Re,U)),te=J.map(Re=>new i.P(Re[0],Re[1])),me=f.getFreeCameraOptions().position||new i.ae(0,0,0),he=i.au(u.tileTransform,me,U),pe=J.map(Re=>{const De=i.av(Re,Re,he);return i.aw(De,De),new i.ax(he,De)}),ke=i.ay(u,1,f.zoom)*f._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:te,tilespaceRays:pe,bufferedTilespaceGeometry:G,bufferedTilespaceBounds:(_e=i.az(G),_e.min.x=i.aA(_e.min.x,0,i.al),_e.min.y=i.aA(_e.min.y,0,i.al),_e.max.x=i.aA(_e.max.x,0,i.al),_e.max.y=i.aA(_e.max.y,0,i.al),_e),tile:u,tileID:u.tileID,pixelToTileUnitsFactor:ke};var _e}_bufferedScreenMercator(u,f){const k=Bi(u);if(this._screenRaycastCache[k])return this._screenRaycastCache[k];{let P;return P=f.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(u),f):{polygon:this.bufferedScreenGeometry(u).map(D=>f.pointCoordinate3D(D)),unwrapped:!0},this._screenRaycastCache[k]=P,P}}_bufferedCameraMercator(u,f){const k=Bi(u);if(this._cameraRaycastCache[k])return this._cameraRaycastCache[k];{let P;return P=f.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(u),f):{polygon:this.bufferedCameraGeometry(u).map(D=>f.pointCoordinate3D(D)),unwrapped:!0},this._cameraRaycastCache[k]=P,P}}_projectAndResample(u,f){const k=function(D,R){const U=i.aB([],R.pixelMatrix,R.globeMatrix),G=[0,-i.aD,0,1],J=[0,i.aD,0,1],te=[0,0,0,1];i.aC(G,G,U),i.aC(J,J,U),i.aC(te,te,U);const me=new i.P(G[0]/G[3],G[1]/G[3]),he=new i.P(J[0]/J[3],J[1]/J[3]),pe=i.aE(D,me)&&G[3]1?Ya(D.slice(0,Re),R):[],nt=Renew i.P(qn(_t.x),_t.y)),nt=nt.map(_t=>new i.P(qn(_t.x),_t.y));const We=[...He];We.length===0&&We.push(nt[nt.length-1]);const kt=i.ak(We[We.length-1].y,(nt.length===0?He[0]:nt[0]).y,De);let xt;return xt=pe?[new i.P(0,kt),new i.P(0,0),new i.P(1,0),new i.P(1,kt)]:[new i.P(1,kt),new i.P(1,1),new i.P(0,1),new i.P(0,kt)],We.push(...xt),nt.length===0?We.push(He[0]):We.push(...nt),{polygon:We.map(_t=>new i.ae(_t.x,_t.y)),unwrapped:!1}}(u,f);if(k)return k;const P=function(D,R){let U=!1,G=-1/0,J=0;for(let me=0;meG&&(G=D[me].x,J=me);for(let me=0;me.5&&(pe.x{me.x-=1}),{polygon:D,unwrapped:U}}(Ya(u,f).map(D=>new i.P(qn(D.x),D.y)),f);return{polygon:P.polygon.map(D=>new i.ae(D.x,D.y)),unwrapped:P.unwrapped}}}function Ya(w,u){return i.aG(w,f=>{const k=u.pointCoordinate3D(f);f.x=k.x,f.y=k.y},1/256)}function qn(w){return w<0?1+w%1:w%1}function Bi(w){return 100*w|0}function wl(w,u,f,k,P){const D=function(U,G){if(U)return P(U);if(G){if(w.url&&G.tiles&&w.tiles&&delete w.tiles,G.variants){if(!Array.isArray(G.variants))return P(new Error("variants must be an array"));for(const te of G.variants){if(te==null||typeof te!="object"||te.constructor!==Object)return P(new Error("variant must be an object"));if(!Array.isArray(te.capabilities))return P(new Error("capabilities must be an array"));if(te.capabilities.length===1&&te.capabilities[0]==="meshopt"){G=Object.assign(G,te);break}}}const J=i.aH(Object.assign({},G,w),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);J.tiles=u.canonicalizeTileset(J,w.url),P(null,J)}},R=function(U,G,J){if(!U)return null;if(!G&&!J)return U;J=J||U.worldview_default;const te=Object.values(U.language||{});if(te.length===0)return null;const me=Object.values(U.worldview||{});if(me.length===0)return null;const he=te.every(ke=>ke===G),pe=me.every(ke=>ke===J);return he&&pe?U:G in(U.language_options||{})||J in(U.worldview_options||{})?null:U.language_options&&U.worldview_options?U:null}(w.data,f,k);return R?i.o.frame(()=>D(null,R)):w.url?i.m(u.transformRequest(u.normalizeSourceURL(w.url,null,f,k),i.R.Source),D):i.o.frame(()=>{const{data:U,...G}=w;D(null,G)})}function Ol(w,u){const f=Math.pow(2,u.z),k=Math.floor(i.aF(w.getWest())*f),P=Math.floor(i.aJ(w.getNorth())*f),D=Math.ceil(i.aF(w.getEast())*f),R=Math.ceil(i.aJ(w.getSouth())*f);return u.x>=k&&u.x=P&&u.ythis.maxzoom||u.z{if(this._tileJSONRequest=null,this._loaded=!0,P)f&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${f}`),k&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${k}`),this.fire(new i.y(P));else if(D){if(Object.assign(this,D),this.hasWorldviews=!!D.worldview_options,D.worldview_default&&(this.worldviewDefault=D.worldview_default),D.vector_layers){this.vectorLayers=D.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const R of D.vector_layers)this.vectorLayerIds.push(R.id),D.worldview&&D.worldview[R.source]&&this.localizableLayerIds.add(R.id)}this.tileBounds=ad.fromTileJSON(D),ve(D.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"}))}u&&u(P)})}loaded(){return this._loaded}hasTile(u){return!this.tileBounds||this.tileBounds.contains(u.canonical)}onAdd(u){this.map=u,this.load()}reload(){this.cancelTileJSONRequest();const u=i.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(u))}setTiles(u){return this._options.tiles=u,this.reload(),this}setUrl(u){return this.url=u,this._options.url=u,this.reload(),this}onRemove(u){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}loadTile(u,f){const k=u.tileID.canonical.url(this.tiles,this.scheme),P=this.map._requestManager.normalizeTileURL(k),D=this.map._requestManager.transformRequest(P,i.R.Tile),R=this.map.style?this.map.style.getLut(this.scope):null,U=R?{image:R.image.clone()}:null,G={request:D,data:void 0,uid:u.uid,tileID:u.tileID,tileZoom:u.tileZoom,zoom:u.tileID.overscaledZ,maxZoom:this.maxzoom,lut:U,tileSize:this.tileSize*u.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,pixelRatio:i.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:u.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:u.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(k)&&(G.localizableLayerIds=this.localizableLayerIds),G.request.collectResourceTiming=this._collectResourceTiming,u.actor&&u.state!=="expired")u.state==="loading"?u.reloadCallback=f:u.request=u.actor.send("reloadTile",G,J.bind(this));else if(u.actor=this._tileWorkers[P]=this._tileWorkers[P]||this.dispatcher.getActor(),this.dispatcher.ready)u.request=u.actor.send("loadTile",G,J.bind(this),void 0,!0);else{const te=i.aL.call({deduped:this._deduped},G,(me,he)=>{if(me||!he)J.call(this,me);else{const pe=i.aM(he.responseHeaders);G.data={rawData:he.rawData.slice(0),expires:pe.expires,cacheControl:pe.cacheControl},u.actor&&u.actor.send("loadTile",G,J.bind(this),void 0,!0)}},!0);u.request={cancel:te}}function J(te,me){return delete u.request,u.aborted?f(null):te&&te instanceof i.aN&&te.status!==404?f(te):(me&&me.resourceTiming&&(u.resourceTiming=me.resourceTiming),this.map._refreshExpiredTiles&&me&&u.setExpiryData(me),u.loadVectorData(me,this.map.painter),i.aO(this.dispatcher),f(null,me),void(u.reloadCallback&&(this.loadTile(u,u.reloadCallback),u.reloadCallback=null)))}}abortTile(u){u.request&&(u.request.cancel(),delete u.request),u.actor&&u.actor.send("abortTile",{uid:u.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(u,f){u.actor&&u.actor.send("removeTile",{uid:u.uid,type:this.type,source:this.id,scope:this.scope}),u.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Qo extends i.E{constructor(u,f,k,P){super(),this.id=u,this.dispatcher=k,this.setEventedParent(P),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"},f),Object.assign(this,i.aH(f,["url","scheme","tileSize"]))}load(u){this._loaded=!1,this.fire(new i.z("dataloading",{dataType:"source"}));const f=this.map.getWorldview();this._tileJSONRequest=wl(this._options,this.map._requestManager,null,f,(k,P)=>{this._tileJSONRequest=null,this._loaded=!0,k?this.fire(new i.y(k)):P&&(Object.assign(this,P),P.raster_layers&&(this.rasterLayers=P.raster_layers,this.rasterLayerIds=this.rasterLayers.map(D=>D.id)),this.tileBounds=ad.fromTileJSON(P),ve(P.tiles),this.fire(new i.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.z("data",{dataType:"source",sourceDataType:"content"}))),u&&u(k)})}loaded(){return this._loaded}onAdd(u){this.map=u,this.load()}reload(){this.cancelTileJSONRequest();const u=i.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(u))}setTiles(u){return this._options.tiles=u,this.reload(),this}setUrl(u){return this.url=u,this._options.url=u,this.reload(),this}onRemove(u){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}hasTile(u){return!this.tileBounds||this.tileBounds.contains(u.canonical)}loadTile(u,f){const k=i.o.devicePixelRatio>=2,P=this.map._requestManager.normalizeTileURL(u.tileID.canonical.url(this.tiles,this.scheme),k,this.tileSize);u.request=i.n(this.map._requestManager.transformRequest(P,i.R.Tile),(D,R,U)=>{if(delete u.request,u.aborted)return u.state="unloaded",f(null);if(D)return u.state="errored",f(D);if(!R)return f(null);const G=i.aM(U);this.map._refreshExpiredTiles&&u.setExpiryData(G),u.setTexture(R,this.map.painter),u.state="loaded",i.aO(this.dispatcher),f(null)})}abortTile(u,f){u.request&&(u.request.cancel(),delete u.request),f&&f()}unloadTile(u,f){u.texture&&u.texture instanceof i.T?(u.destroy(!1),u.texture&&u.texture instanceof i.T&&this.map.painter.saveTileTexture(u.texture)):u.destroy(),f&&f()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function Wd([w,u],f,k,{scaled:P=!0}={}){const{tileSize:D,buffer:R}=k,{x:U,y:G,z:J}=f;if(!isFinite(U)||!isFinite(G)||!isFinite(J))throw new Error("Invalid MRT header");const te=2**J,me=te*i.aF(w),he=te*i.aJ(u);return function([pe,ke],_e,{scaled:Re=!0}={}){if(!_e)throw new Error("bandView is undefined");const{data:De,tileSize:He,buffer:nt,offset:We,scale:kt,dimension:xt}=_e;if(pe<-nt||pe>He+nt||ke<-nt||ke>He+nt)throw new Error(`Point (${pe}, ${ke}) out of bounds for tileSize=${He}, buffer=${nt}`);const _t=(ke+nt)*(He+2*nt)+(pe+nt);if(new Uint32Array(De.buffer)[_t]===4294967295)return null;let gt=[];gt=Re?[]:new _e.data.constructor(xt);for(let ut=0;ut{if(delete u.request,u.aborted)return u.state="unloaded",f(null);if(U)return U.name==="AbortError"?void 0:(u.state="errored",f(U));if(this.map._refreshExpiredTiles&&G){const te=i.aM(J);u.setExpiryData(te)}if(this.partial&&u.state!=="expired")u.state="empty";else if(!this.partial){if(!G)return f(null);u.state="loaded",u._isHeaderLoaded=!0,u._mrt=G}f(null)};u.request=this.partial?u.fetchHeader(void 0,R.bind(this)):u.actor.send("loadTile",D,R.bind(this),void 0,!0)}abortTile(u){u.request&&(u.request.cancel(),delete u.request),u.actor&&u.actor.send("abortTile",{uid:u.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(u,f){const k=u.texturePerLayer;if(u.flushAllQueues(),k.size){u.destroy(!1);for(const P of k.values())this.map.painter.saveTileTexture(P)}else u.destroy()}prepareTile(u,f,k,P){u._isHeaderLoaded&&(u.state!=="empty"&&(u.state="reloading"),u.fetchBandForRender(f,k,P,(D,R)=>{if(D)return u.state="errored",this.fire(new i.y(D)),void this.triggerRepaint(u);R&&(u._isHeaderLoaded=!0,u.setTexturePerLayer(k,R,this.map.painter),u.state="loaded",this.triggerRepaint(u))}))}getInitialBand(u){if(!this.rasterLayers)return 0;const f=this.rasterLayers.find(({id:D})=>D===u),k=f&&f.fields,P=k&&k.bands&&k.bands;return P?P[0]:0}getTextureDescriptor(u,f,k){if(!u)return;const P=f.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!P)return;let D=null;f instanceof i.aR?D=f.paint.get("raster-array-band"):f instanceof i.aS&&(D=f.paint.get("raster-particle-array-band"));const R=D||this.getInitialBand(P);if(R==null)return;if(!u.textureDescriptorPerLayer.get(f.id))return void this.prepareTile(u,P,f.id,R);if(u.updateNeeded(f.id,R)&&!k)return;const U=u.textureDescriptorPerLayer.get(f.id);return Object.assign({},U,{texture:u.texturePerLayer.get(f.id)})}getImages(u,f){const k=new Map;for(const P of u)for(const D of f){const[R,U]=D.split("/"),G=P.getLayer(R);if(!G||!G.hasBand(U)||!G.hasDataForBand(U))continue;const{bytes:J,tileSize:te,buffer:me}=G.getBandView(U),he=te+2*me,pe={data:new i.q({width:he,height:he},J),pixelRatio:2,sdf:!1,usvg:!1,version:0};k.set(D,pe)}return k}queryRasterArrayValueByBandId(u,f,k){const P=f._mrt;return new Promise(D=>{const R={},U=new Set;for(const[G,J]of Object.entries(P.layers)){if(k.layerName&&G!==k.layerName)continue;const te={};R[G]=te;for(const{bands:me}of J.dataIndex)for(const he of me)k.bands&&!k.bands.includes(he)||(U.add(i.B(G,he)),f.fetchBand(G,null,he,pe=>{i.o.frame(()=>{te[he]=pe?null:Wd([u.lng,u.lat],P,J.getBandView(he)),U.delete(i.B(G,he)),U.size===0&&D(R)})},!1))}U.size===0&&D(R)})}_loadTileForQuery(u,f){if(this._loadTileLoaded[u.uid])return void f(null,u._mrt);if(this._loadTilePending[u.uid])return void this._loadTilePending[u.uid].push(f);this._loadTilePending[u.uid]=[f];const k=this.map._requestManager.normalizeTileURL(u.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),P=this.map._requestManager.transformRequest(k,i.R.Tile);u.actor.send("loadTile",{request:P,uid:u.uid,tileID:u.tileID,type:this.type,source:this.id,scope:this.scope,partial:!1},(D,R,U)=>{if(D)return this._loadTilePending[u.uid].forEach(G=>G(D,null)),void delete this._loadTilePending[u.uid];if(!R)return this._loadTilePending[u.uid].forEach(G=>G(null,null)),void delete this._loadTilePending[u.uid];if(this.map._refreshExpiredTiles&&R){const G=i.aM(U);u.setExpiryData(G)}u._mrt=R,u._isHeaderLoaded=!0,u.state="loaded",this._loadTilePending[u.uid].forEach(G=>G(null,R)),this._loadTileLoaded[u.uid]=!0,delete this._loadTilePending[u.uid]},void 0,!0)}queryRasterArrayValueByAllBands(u,f,k){return new Promise((P,D)=>{this._loadTileForQuery(f,(R,U)=>{R?D(R):P(U?this.queryRasterArrayValueByBandId(u,f,k):null)})})}queryRasterArrayValue(u,f){const k=i.aT.convert(u),P=this.findLoadedParent(k);return P&&P._mrt?f.bands||!this.partial?this.queryRasterArrayValueByBandId(k,P,f):this.queryRasterArrayValueByAllBands(k,P,f):Promise.resolve(null)}findLoadedParent(u){const f=i.ae.fromLngLat(u,this.map.transform.tileSize),k=this.maxzoom+1,P=1<0&&(U[new i.aQ(w.overscaledZ,P,u.z,k,u.y-1).key]={backfilled:!1},U[new i.aQ(w.overscaledZ,w.wrap,u.z,u.x,u.y-1).key]={backfilled:!1},U[new i.aQ(w.overscaledZ,R,u.z,D,u.y-1).key]={backfilled:!1}),u.y+1{if(this._loaded=!0,this._pendingLoad=null,k)this.fire(new i.y(k));else{const D={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&P&&P.resourceTiming&&P.resourceTiming[this.id]&&(D.resourceTiming=P.resourceTiming[this.id]),w&&(this._partialReload=!0),this.fire(new i.z("data",D)),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,u){const f=w.actor?"reloadTile":"loadTile";w.actor=this.actor;const k=this.map.style?this.map.style.getLut(this.scope):null,P=k?{image:k.image.clone()}:null,D=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:P,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:D,worldview:this.map.getWorldview(),indoor:this.map.indoor?this.map.indoor.getIndoorTileOptions(this.id,this.scope):null};w.request=this.actor.send(f,R,(U,G)=>D&&!G?(w.state="loaded",u(null)):(delete w.request,w.destroy(!1),w.aborted?u(null):U?u(U):(w.loadVectorData(G,this.map.painter,f==="reloadTile"),u(null))),void 0,f==="loadTile")}abortTile(w){w.request&&(w.request.cancel(),delete w.request),w.aborted=!0}unloadTile(w,u){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,u,f,k){super(w,u,f,k),this.roundZoom=!0,this.type="video",this.options=u}load(){this._loaded=!1;const w=this.options;this.urls=[];for(const u of w.urls)this.urls.push(this.map._requestManager.transformRequest(u,i.R.Source).url);i.aV(this.urls,(u,f)=>{this._loaded=!0,u?this.fire(new i.y(u)):f&&(this.video=f,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 u=this.video.seekable;wu.end(0)?this.fire(new i.y(new i.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${u.start(0)} and ${u.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,u=w.gl;this.texture?this.video.paused||(this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE),u.texSubImage2D(u.TEXTURE_2D,0,0,0,u.RGBA,u.UNSIGNED_BYTE,this.video)):(this.texture=new i.T(w,this.video,u.RGBA8),this.texture.bind(u.LINEAR,u.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,u,f,k){super(),this.type="batched-model",this.id=w,this.tileSize=512,this._options=u,this.tiles=this._options.tiles,this.maxzoom=u.maxzoom||19,this.minzoom=u.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=f,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(k)}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 u=Array.isArray(this.map._language)?this.map._language.join():this.map._language,f=this.map.getWorldview();this._tileJSONRequest=wl(this._options,this.map._requestManager,u,f,(k,P)=>{this._tileJSONRequest=null,this._loaded=!0,k?(u&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${u}`),f&&f.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${f}`),this.fire(new i.y(k))):P&&(Object.assign(this,P),P.bounds&&(this.tileBounds=new ad(P.bounds,this.minzoom,this.maxzoom)),ve(P.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(k)})}hasTransition(){return!1}hasTile(w){return!this.tileBounds||this.tileBounds.contains(w.canonical)}loaded(){return this._loaded}loadTile(w,u){const f=this.map._requestManager.normalizeTileURL(w.tileID.canonical.url(this.tiles,this.scheme)),k={request:this.map._requestManager.transformRequest(f,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=u;else{if(w.buckets){const D=Object.values(w.buckets);for(const R of D)R.dirty=!0;return void(w.state="loaded")}w.request=w.actor.send("reloadTile",k,P.bind(this))}else w.actor=this.dispatcher.getActor(),w.request=w.actor.send("loadTile",k,P.bind(this),void 0,!0);function P(D,R){return w.aborted?u(null):D&&D.status!==404?u(D):(this.map._refreshExpiredTiles&&R&&w.setExpiryData(R),w.loadModelData(R,this.map.painter),w.state="loaded",void u(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends i.aU{constructor(w,u,f,k){super(w,u,f,k),u.coordinates?Array.isArray(u.coordinates)&&u.coordinates.length===4&&!u.coordinates.some(P=>!Array.isArray(P)||P.length!==2||P.some(D=>typeof D!="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"'))),u.animate&&typeof u.animate!="boolean"&&this.fire(new i.y(new i.V(`sources.${w}`,null,'optional "animate" property must be a boolean value'))),u.canvas?typeof u.canvas=="string"||u.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=u,this.animate=u.animate===void 0||u.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 u=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(u,this.canvas,u.gl.RGBA8,{premultiply:!0}),this._prepareData(u)}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,u,f,k){super(),this.id=w,this.type="custom",this._dataType="raster",this._dispatcher=f,this._implementation=u,this.setEventedParent(k),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 ad(this._implementation.bounds,this.minzoom,this.maxzoom)),u.update=this._update.bind(this),u.clearTiles=this._clearTiles.bind(this),u.coveringTiles=this._coveringTiles.bind(this),Object.assign(this,i.aH(u,["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:u,y:f,z:k}=w.canonical;return this._implementation.hasTile({x:u,y:f,z:k})}return!this.tileBounds||this.tileBounds.contains(w.canonical)}loadTile(w,u){const{x:f,y:k,z:P}=w.tileID.canonical,D=new AbortController;w.request=Promise.resolve(this._implementation.loadTile({x:f,y:k,z:P},{signal:D.signal})).then((function(R){return delete w.request,w.aborted?(w.state="unloaded",u(null)):R===void 0?(w.state="errored",u(null)):R===null?(this.loadTileData(w,{width:this.tileSize,height:this.tileSize,data:null}),w.state="loaded",u(null)):function(U){return U instanceof ImageData||U instanceof HTMLCanvasElement||U instanceof ImageBitmap||U instanceof HTMLImageElement}(R)?(this.loadTileData(w,R),w.state="loaded",void u(null)):(w.state="errored",u(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",u(R))}),w.request.cancel=()=>D.abort()}loadTileData(w,u){w.setTexture(u,this.map.painter)}unloadTile(w,u){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:f,y:k,z:P}=w.tileID.canonical;this._implementation.unloadTile({x:f,y:k,z:P})}u&&u()}abortTile(w,u){w.request&&w.request.cancel&&(w.request.cancel(),delete w.request),u&&u()}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"}))}}},Jo=function(w,u,f,k){const P=new fh[u.type](w,u,f,k);if(P.id!==w)throw new Error(`Expected Source id to be ${w} instead of ${P.id}`);return i.aY(["load","abort","unload","serialize","prepare"],P),P};function Op(w,u,f=""){return`${f}:${u.id||""}:${u.layer.id}:${function(k){if("layerId"in k)return`layer:${k.layerId}`;{const{featuresetId:P,importId:D}=k;return`featureset:${P}${D?`:import:${D}`:""}`}}(w.target)}`}function rg(w,u,f,k=""){if(w.uniqueFeatureID){const P=Op(w,u,k);if(f.has(P))return!0;f.add(P)}return!1}function Jy(w,u,f,k,P=!1){const D=u.sourceCache.transform,R=u.sourceCache.tilesIn(w,u.has3DLayers,P);R.sort(Gh);const U=[];for(const G of R){const J=G.tile.queryRenderedFeatures(u,G,f,k,D,P);Object.keys(J).length&&U.push({wrappedTileID:G.tile.tileID.wrapped().key,queryResults:J})}for(const G in u.layers){const J=u.layers[G];if(J.styleLayer){const te=J.styleLayer.queryRenderedFeatures(w,u.sourceCache,k);Object.keys(te).length&&U.push({wrappedTileID:0,queryResults:te})}}return U.length===0?{}:function(G){const J={},te={};for(const me of G){const he=me.queryResults,pe=me.wrappedTileID,ke=te[pe]=te[pe]||{};for(const _e in he){const Re=he[_e],De=ke[_e]=ke[_e]||{},He=J[_e]=J[_e]||[];for(const nt of Re)De[nt.featureIndex]||(De[nt.featureIndex]=!0,He.push(nt))}}return J}(U)}function e0(w,u,f,k,P,D){const R={},U=k.queryRenderedSymbols(w),G=[];for(const J of Object.keys(U).map(Number))G.push(P[J]);G.sort(Gh);for(const J of G){const te=J.featureIndex.lookupSymbolFeatures(U[J.bucketInstanceId],J.bucketIndex,J.sourceLayerIndex,u,f,D);for(const me in te){const he=R[me]=R[me]||[],pe=te[me];pe.sort((ke,_e)=>{const Re=J.featureSortOrder;if(Re){const De=Re.indexOf(ke.featureIndex);return Re.indexOf(_e.featureIndex)-De}return _e.featureIndex-ke.featureIndex});for(const ke of pe)he.push(ke)}}return R}function t0(w,u){const f=w.getRenderableIds().map(D=>w.getTileByID(D)),k=[],P={};for(let D=0;Du.getLayer(D)).filter(Boolean);if(P.length!==0){k.layers=P,k.stateDependentLayerIds&&(k.stateDependentLayers=k.stateDependentLayerIds.map(D=>P.filter(R=>R.id===D)[0]));for(const D of P)f[D.fqid]=k}}return f}const id=32,du=33,vc=new Uint16Array(8184);for(let w=0;w<2046;w++){let u=w+2,f=0,k=0,P=0,D=0,R=0,U=0;for(1&u?P=D=R=id:f=k=U=id;(u>>=1)>1;){const J=f+P>>1,te=k+D>>1;1&u?(P=f,D=k,f=R,k=U):(f=P,k=D,P=R,D=U),R=J,U=te}const G=4*w;vc[G+0]=f,vc[G+1]=k,vc[G+2]=P,vc[G+3]=D}const od=new Uint16Array(2178),Go=new Uint8Array(1089),Du=new Uint16Array(1089);function Kh(w){return w===0?-.03125:w===32?.03125:0}const Gd={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 Dp{constructor(u,f,k,P,D,R){this.tileID=u,this.uid=i.b2(),this.uses=0,this.tileSize=f,this.tileZoom=k,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=D,P&&P.style&&(this._lastUpdatedBrightness=P.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",P&&P.transform&&(this.projection=P.transform.projection),this.worldview=R,this._hasAppearances=null}registerFadeDuration(u){const f=u+this.timeAdded;fk)P=!1;else if(f)if(this.expirationTimek.appearances&&k.appearances.length>0))return!0;return!1}updateBuckets(u,f){if(!this.latestFeatureIndex||!u.style)return;const k=u.style.listImages(),P=u.style.getBrightness();for(const D in this.buckets){if(!u.style.hasLayer(D))continue;const R=this.buckets[D],U=R.layers[0],G=U.sourceLayer||"_geojsonTileLayer",J=u.style.getLayerSourceCache(U);let te={};J&&(te=J._state.getState(G,void 0));const me=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},he=Object.keys(te).length>0&&!f;R.hasAppearances=R.layers.some(_e=>_e.appearances&&_e.appearances.length>0);const pe=he?R.stateDependentLayers:R.layers;if(he&&R.stateDependentLayers.length!==0||f){const _e=this.latestFeatureIndex.loadVTLayers();R.update(te,_e[G],k,me,pe,f,P)}if(he&&R.stateDependentLayers.length!==0||f||R.hasAppearances){const _e={zoom:u.transform.zoom,pitch:u.transform.pitch,brightness:u.style.getBrightness()||0,worldview:u.worldview};R.updateAppearances(this.tileID.canonical,te,k,_e)}(R instanceof i.ba||R instanceof i.bb)&&u._terrain&&u._terrain.enabled&&J&&R.uploadPending()&&u._terrain._clearRenderCacheForTile(J.id,this.tileID);const ke=u&&u.style&&u.style.getOwnLayer(D);ke&&(this.queryPadding=Math.max(this.queryPadding,ke.queryRadius(R)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil=0;Re--){const De=4*Re,He=vc[De+0],nt=vc[De+1],We=vc[De+2],kt=vc[De+3],xt=He+We>>1,_t=nt+kt>>1,gt=xt+_t-nt,ut=_t+He-xt,Tt=nt*du+He,Bt=kt*du+We,zt=_t*du+xt,Qt=Math.hypot((od[2*Tt+0]+od[2*Bt+0])/2-od[2*zt+0],(od[2*Tt+1]+od[2*Bt+1])/2-od[2*zt+1])>=16;Go[zt]=Go[zt]||(Qt?1:0),Re<1022&&(Go[zt]=Go[zt]||Go[(nt+ut>>1)*du+(He+gt>>1)]||Go[(kt+ut>>1)*du+(We+gt>>1)])}const me=new i.b1,he=new i.b0;let pe=0;function ke(Re,De){const He=De*du+Re;return Du[He]===0&&(me.emplaceBack(od[2*He+0],od[2*He+1],Re*i.al/id,De*i.al/id),Du[He]=++pe),Du[He]-1}function _e(Re,De,He,nt,We,kt){const xt=Re+He>>1,_t=De+nt>>1;if(Math.abs(Re-We)+Math.abs(De-kt)>1&&Go[_t*du+xt])_e(We,kt,Re,De,xt,_t),_e(He,nt,We,kt,xt,_t);else{const gt=ke(Re,De),ut=ke(He,nt),Tt=ke(We,kt);he.emplaceBack(gt,ut,Tt)}}return _e(0,0,id,id,id,0),_e(id,id,0,0,0,id),{vertices:me,indices:he}}(this.tileID.canonical,f);P=R.vertices,D=R.indices}else{P=new i.b1,D=new i.b0;for(const{x:U,y:G}of k)P.emplaceBack(U,G,0,0);const R=i.bh(P.int16.subarray(0,4*P.length),void 0,4);for(let U=0;U0&&(G=i.bl(new Float64Array(16),f.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(u,P,f,R,G,U),this._makeGlobeTileDebugTextBuffer(u,P,f,R,G,U)}_globePoint(u,f,k,P,D,R,U){let G=i.bm(u,f,k);if(R){const J=1<.5?pe=-1:he<-.5&&(pe=1);let ke=(u/i.al+k.x)/J+pe,_e=(f/i.al+k.y)/J;ke=(ke-te)*P._pixelsPerMercatorPixel+te,_e=(_e-me)*P._pixelsPerMercatorPixel+me;const Re=[ke*P.worldSize,_e*P.worldSize,0];i.af(Re,Re,R),G=i.bn(G,Re,U)}return i.af(G,G,D)}_makeGlobeTileDebugBorderBuffer(u,f,k,P,D,R){const U=new i.bd,G=new i.be,J=new i.bo,te=(he,pe,ke,_e,Re)=>{const De=(ke-he)/(Re-1),He=(_e-pe)/(Re-1),nt=U.length;for(let We=0;Weme*pe+ke;for(let pe=0;pe{if(D)f(D);else try{const G=k.getHeaderLength(R);if(G>u)return void(this.request=this.fetchHeader(G,f));k.parseHeader(R),this._isHeaderLoaded=!0;let J=0;for(const te of Object.values(k.layers))J=Math.max(J,te.dataIndex[te.dataIndex.length-1].lastByte);R.byteLength>=J&&(this.entireBuffer=R),f(null,this.entireBuffer||R,U)}catch(G){f(G)}}),this.request}fetchBandForRender(u,f,k,P){this.fetchBand(u,f,k,D=>{if(D)return void P(D);this.updateTextureDescriptor(u,f,k);const R=this.textureDescriptorPerLayer.get(f);P(null,R?R.img:null)})}fetchBand(u,f,k,P,D=!0){const R=this._mrt;if(!this._isHeaderLoaded||!R)return void P(new Error("Tile header is not ready"));const U=this.actor;if(!U)return void P(new Error("Can't fetch tile band without an actor"));let G;const J=i.B(String(k),i.B(this.tileID.key,u));let te=this._taskQueue.get(J);te?te.add(P):(te=new Set,te.add(P),this._taskQueue.set(J,te));const me=(_e,Re)=>{G.complete(_e,Re),_e?P(_e):(te.forEach(De=>De(null,Re)),this._taskQueue.delete(J))},he=(_e,Re)=>{if(_e)return P(_e);const De=U.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:Re,task:G},me,void 0,!0);if(f!==null){const He=this._workQueuePerLayer.get(f)||[];He.push(()=>{De&&De.cancel(),G.cancel()}),this._workQueuePerLayer.has(f)||this._workQueuePerLayer.set(f,He)}};let pe;try{pe=R.getLayer(u)}catch(_e){if(this.state==="reloading")return;throw _e}if(!pe)return void P(new Error(`Unknown sourceLayer "${u}"`));if(pe.hasDataForBand(k))return te.forEach(_e=>_e(null,null)),void this._taskQueue.delete(J);const ke=pe.getDataRange([k]);if(G=R.createDecodingTask(ke),!G||G.tasks.length)if(f!==null&&this.flushQueues(f),this.entireBuffer)he(null,this.entireBuffer.slice(ke.firstByte,ke.lastByte+1));else{const _e=Object.assign({},this.requestParams,{headers:{Range:`bytes=${ke.firstByte}-${ke.lastByte}`}}),Re=i.bu(_e,he);if(f!==null){const De=this._fetchQueuePerLayer.get(f)||[];De.push(()=>{Re.cancel(),G.cancel()}),this._fetchQueuePerLayer.has(f)||this._fetchQueuePerLayer.set(f,De)}}}updateNeeded(u,f){return(!this.textureDescriptorPerLayer.get(u)||this.textureDescriptorPerLayer.get(u).band!==f||this.refreshedUponExpiration)&&this.state!=="errored"}updateTextureDescriptor(u,f,k){if(!this._mrt)return;const P=this._mrt.getLayer(u);if(!P||!P.hasBand(k)||!P.hasDataForBand(k))return;const{bytes:D,tileSize:R,buffer:U,offset:G,scale:J}=P.getBandView(k),te=R+2*U,me=new i.q({width:te,height:te},D),he=this.texturePerLayer.get(f);he&&he instanceof i.T&&he.update(me,{premultiply:!1}),this.textureDescriptorPerLayer.set(f,{layer:u,band:k,img:me,buffer:U,offset:G,tileSize:R,format:P.pixelFormat,mix:[J,256*J,65536*J,16777216*J]})}destroy(u=!1){if(super.destroy(u),delete this._mrt,!u)for(const f of this.texturePerLayer.values())f&&f instanceof i.T&&f.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 xx{constructor(u,f){this.max=u,this.onRemove=f,this.reset()}reset(){for(const u in this.data)for(const f of this.data[u])f.timeout&&clearTimeout(f.timeout),this.onRemove(f.value);return this.data={},this.order=[],this}add(u,f,k){const P=u.wrapped().key;this.data[P]===void 0&&(this.data[P]=[]);const D={value:f,timeout:void 0};if(k!==void 0&&(D.timeout=setTimeout(()=>{this.remove(u,D)},k)),this.data[P].push(D),this.order.push(P),this.order.length>this.max){const R=this._getAndRemoveByKey(this.order[0]);R&&this.onRemove(R)}return this}has(u){return u.wrapped().key in this.data}getAndRemove(u){return this.has(u)?this._getAndRemoveByKey(u.wrapped().key):null}_getAndRemoveByKey(u){const f=this.data[u].shift();return f.timeout&&clearTimeout(f.timeout),this.data[u].length===0&&delete this.data[u],this.order.splice(this.order.indexOf(u),1),f.value}getByKey(u){const f=this.data[u];return f?f[0].value:null}get(u){return this.has(u)?this.data[u.wrapped().key][0].value:null}remove(u,f){if(!this.has(u))return this;const k=u.wrapped().key,P=f===void 0?0:this.data[k].indexOf(f),D=this.data[k][P];return this.data[k].splice(P,1),D.timeout&&clearTimeout(D.timeout),this.data[k].length===0&&delete this.data[k],this.onRemove(D.value),this.order.splice(this.order.indexOf(k),1),this}setMaxSize(u){for(this.max=u;this.order.length>this.max;){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}filter(u){const f=[];for(const k in this.data)for(const P of this.data[k])u(P.value)||f.push(P);for(const k of f)this.remove(k.value.tileID,k)}}class Rp{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(u,f,k){const P=String(f);if(this.stateChanges[u]=this.stateChanges[u]||{},this.stateChanges[u][P]=this.stateChanges[u][P]||{},Object.assign(this.stateChanges[u][P],k),this.deletedStates[u]===null){this.deletedStates[u]={};for(const D in this.state[u])D!==P&&(this.deletedStates[u][D]=null)}else if(this.deletedStates[u]&&this.deletedStates[u][P]===null){this.deletedStates[u][P]={};for(const D in this.state[u][P])k[D]||(this.deletedStates[u][P][D]=null)}else for(const D in k)this.deletedStates[u]&&this.deletedStates[u][P]&&this.deletedStates[u][P][D]===null&&delete this.deletedStates[u][P][D]}removeFeatureState(u,f,k){if(this.deletedStates[u]===null)return;const P=String(f);if(this.deletedStates[u]=this.deletedStates[u]||{},k&&f!==void 0)this.deletedStates[u][P]!==null&&(this.deletedStates[u][P]=this.deletedStates[u][P]||{},this.deletedStates[u][P][k]=null);else if(f!==void 0)if(this.stateChanges[u]&&this.stateChanges[u][P])for(k in this.deletedStates[u][P]={},this.stateChanges[u][P])this.deletedStates[u][P][k]=null;else this.deletedStates[u][P]=null;else this.deletedStates[u]=null}getState(u,f){const k=this.state[u]||{},P=this.stateChanges[u]||{},D=this.deletedStates[u];if(D===null)return{};if(f!==void 0){const U=String(f),G=Object.assign({},k[U],P[U]);if(D){const J=D[f];if(J===null)return{};for(const te in J)delete G[te]}return G}const R=Object.assign({},k,P);if(D)for(const U in D)delete R[U];return R}initializeTileState(u,f){u.refreshFeatureState(f)}coalesceChanges(u,f){const k={};for(const P in this.stateChanges){this.state[P]=this.state[P]||{};const D={};for(const R in this.stateChanges[P])this.state[P][R]||(this.state[P][R]={}),Object.assign(this.state[P][R],this.stateChanges[P][R]),D[R]=this.state[P][R];k[P]=D}for(const P in this.deletedStates){this.state[P]=this.state[P]||{};const D={};if(this.deletedStates[P]===null)for(const R in this.state[P])D[R]={},this.state[P][R]={};else for(const R in this.deletedStates[P]){if(this.deletedStates[P][R]===null)this.state[P][R]={};else if(this.state[P][R])for(const U of Object.keys(this.deletedStates[P][R]))delete this.state[P][R][U];D[R]=this.state[P][R]}k[P]=k[P]||{},Object.assign(k[P],D)}if(this.stateChanges={},this.deletedStates={},Object.keys(k).length!==0)for(const P in u)u[P].refreshFeatureState(f)}}class kd extends i.E{constructor(u,f,k){super(),this.id=u,this._onlySymbols=k,f.on("data",P=>{P.dataType==="source"&&P.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&P.dataType==="source"&&P.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),f.on("error",()=>{this._sourceErrored=!0}),this._source=f,this._tiles={},this._cache=new xx(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=f.minTileCacheSize,this._maxTileCacheSize=f.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Rp,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(u){this.map=u,this._minTileCacheSize=this._minTileCacheSize===void 0&&u?u._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&u?u._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const u in this._tiles)if(!this._tiles[u].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const u=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,u&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(u,f){return u.isSymbolTile=this._onlySymbols,u.isExtraShadowCaster=this._shadowCasterTiles[u.tileID.key],this._source.loadTile(u,f)}_unloadTile(u){if(this._source.unloadTile)return this._source.unloadTile(u)}_abortTile(u){if(this._source.abortTile)return this._source.abortTile(u)}serialize(){return this._source.serialize()}prepare(u){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const f in this._tiles){const k=this._tiles[f];k.upload(u,this.map?this.map.painter:void 0),k.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(u=>u.tileID).sort(s0).map(u=>u.key)}getRenderableIds(u,f){const k=[];for(const P in this._tiles)this._isIdRenderable(+P,u,f)&&k.push(this._tiles[P]);return u?k.sort((P,D)=>{const R=P.tileID,U=D.tileID,G=new i.P(R.canonical.x,R.canonical.y)._rotate(this.transform.angle),J=new i.P(U.canonical.x,U.canonical.y)._rotate(this.transform.angle);return R.overscaledZ-U.overscaledZ||J.y-G.y||J.x-G.x}).map(P=>P.tileID.key):k.map(P=>P.tileID).sort(s0).map(P=>P.key)}hasRenderableParent(u){const f=this.findLoadedParent(u,0);return!!f&&this._isIdRenderable(f.tileID.key)}_isIdRenderable(u,f,k){return this._tiles[u]&&this._tiles[u].hasData()&&!this._coveredTiles[u]&&(f||!this._tiles[u].holdingForFade())&&(k||!this._shadowCasterTiles[u])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const u in this._tiles)this._tiles[u].state!=="errored"&&this._reloadTile(+u,"reloading")}}_reloadTile(u,f){const k=this._tiles[u];k&&(k.state!=="loading"&&(k.state=f),this._loadTile(k,this._tileLoaded.bind(this,k,u,f)))}_tileLoaded(u,f,k,P,D){if(P){if(u.state="errored",P.status!==404)this._source.fire(new i.y(P,{tile:u}));else{if(this._source.fire(new i.z("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:u})),!(u.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const U=this.map.painter.terrain;this.update(this.transform,U.getScaledDemTileSize(),!0),U.resetTileLookupCache(this.id)}else this.update(this.transform)}return}u.timeAdded=i.o.now(),k==="expired"&&(u.refreshedUponExpiration=!0),this._setTileReloadTimer(f,u),this._source.type==="raster-dem"&&u.dem&&this._backfillDEM(u),this._state.initializeTileState(u,this.map?this.map.painter:null);let R=new Map;D&&D.responseHeaders&&(R=D.responseHeaders),this._source.fire(new i.z("data",{dataType:"source",tile:u,coord:u.tileID,sourceCacheId:this.id,responseHeaders:R}))}_backfillDEM(u){const f=this.getRenderableIds();for(let P=0;P1||(Math.abs(R)>1&&(Math.abs(R+G)===1?R+=G:Math.abs(R-G)===1&&(R-=G)),D.dem&&P.dem&&(P.dem.backfillBorder(D.dem,R,U),P.neighboringTiles&&P.neighboringTiles[J]&&(P.neighboringTiles[J].backfilled=!0)))}}getTile(u){return this.getTileByID(u.key)}getTileByID(u){return this._tiles[u]}_retainLoadedChildren(u,f,k,P){for(const D in this._tiles){let R=this._tiles[D];if(P[D]||!R.hasData()||R.tileID.overscaledZ<=f||R.tileID.overscaledZ>k)continue;let U=R.tileID;for(;R&&R.tileID.overscaledZ>f+1;){const J=R.tileID.scaledTo(R.tileID.overscaledZ-1);R=this._tiles[J.key],R&&R.hasData()&&(U=J)}let G=U;for(;G.overscaledZ>f;)if(G=G.scaledTo(G.overscaledZ-1),u[G.key]){P[U.key]=U;break}}}findLoadedParent(u,f){if(u.key in this._loadedParentTiles){const k=this._loadedParentTiles[u.key];return k&&k.tileID.overscaledZ>=f?k:null}for(let k=u.overscaledZ-1;k>=f;k--){const P=u.scaledTo(k),D=this._getLoadedTile(P);if(D)return D}}_getLoadedTile(u){const f=this._tiles[u.key];return f&&f.hasData()?f:this._cache.getByKey(this._source.reparseOverscaled?u.wrapped().key:u.canonical.key)}updateCacheSize(u,f){f=f||this._source.tileSize;const k=Math.ceil(u.width/f)+1,P=Math.ceil(u.height/f)+1,D=Math.floor(k*P*5),R=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,D):D,U=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,R):R;this._cache.setMaxSize(U)}handleWrapJump(u){const f=Math.round((u-(this._prevLng===void 0?u:this._prevLng))/360);if(this._prevLng=u,f){const k={};for(const P in this._tiles){const D=this._tiles[P];D.tileID=D.tileID.unwrapTo(D.tileID.wrap+f),k[D.tileID.key]=D}this._tiles=k;for(const P in this._timers)clearTimeout(this._timers[P]),delete this._timers[P];for(const P in this._tiles)this._setTileReloadTimer(+P,this._tiles[P])}}update(u,f,k,P,D){if(this.transform=u,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!k)return;this.updateCacheSize(u,f),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const R=this._source.type==="batched-model";let U,G=this._source.maxzoom;const J=this.map&&this.map.painter?this.map.painter._terrain:null;if(J&&J.sourceCache===this&&J.attenuationRange()){const he=J.attenuationRange()[0],pe=Math.floor(he)-Math.log2(J.getDemUpscale());G>pe&&(G=pe)}if(this.used||this.usedForTerrain){if(this._source.tileID)U=u.getVisibleUnwrappedCoordinates(this._source.tileID).map(he=>new i.aQ(he.canonical.z,he.wrap,he.canonical.z,he.canonical.x,he.canonical.y));else if(this.tileCoverLift!==0){const he=u.clone();he.tileCoverLift=this.tileCoverLift,U=he.coveringTiles({tileSize:f||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:G,roundZoom:this._source.roundZoom&&!k,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:R}),this._source.minzoom<=1&&u.projection.name==="globe"&&(U.push(new i.aQ(1,0,1,0,0)),U.push(new i.aQ(1,0,1,1,0)),U.push(new i.aQ(1,0,1,0,1)),U.push(new i.aQ(1,0,1,1,1)))}else if(U=u.coveringTiles({tileSize:f||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:G,roundZoom:this._source.roundZoom&&!k,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:R}),this._source.hasTile){const he=this._source.hasTile.bind(this._source);U=U.filter(pe=>he(pe))}}else U=[];if(U.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!Dm(this._source.type)){const he=u.coveringZoomLevel({tileSize:f||this._source.tileSize,roundZoom:this._source.roundZoom&&!k}),pe=Math.min(he,this._source.maxzoom);if(R){const ke=u.extendTileCover(U,pe);for(const _e of ke)U.push(_e)}else if(D){const ke=u.extendTileCoverToNearPlane(U,this.transform.getFrustum(pe),pe);for(const _e of ke)U.push(_e)}else if(this.castsShadows&&P){const ke=u.extendTileCover(U,pe,P,16);for(const _e of ke)this._shadowCasterTiles[_e.key]=!0,U.push(_e)}}const te=this._updateRetainedTiles(U);if(Dm(this._source.type)&&U.length!==0){const he={},pe={},ke=Object.keys(te);for(const Re of ke){const De=te[Re],He=this._tiles[Re];if(!He||He.fadeEndTime&&He.fadeEndTime<=i.o.now())continue;const nt=this.findLoadedParent(De,Math.max(De.overscaledZ-kd.maxOverzooming,this._source.minzoom));nt&&(this._addTile(nt.tileID),he[nt.tileID.key]=nt.tileID),pe[Re]=De}const _e=U[U.length-1].overscaledZ;for(const Re in this._tiles){const De=this._tiles[Re];if(te[Re]||!De.hasData())continue;let He=De.tileID;for(;He.overscaledZ>_e;){He=He.scaledTo(He.overscaledZ-1);const nt=this._tiles[He.key];if(nt&&nt.hasData()&&pe[He.key]){te[Re]=De.tileID;break}}}for(const Re in he)te[Re]||(this._coveredTiles[Re]=!0,te[Re]=he[Re])}for(const he in te)this._tiles[he].clearFadeHold();const me=i.bv(this._tiles,te);for(const he of me){const pe=this._tiles[he];pe.hasSymbolBuckets&&!pe.holdingForFade()?pe.setHoldDuration(this.map._fadeDuration):pe.hasSymbolBuckets&&!pe.symbolFadeFinished()||this._removeTile(+he)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const u in this._tiles)this._tiles[u].holdingForFade()&&this._removeTile(+u)}_updateRetainedTiles(u){const f={};if(u.length===0)return f;const k={},P=u.reduce((J,te)=>Math.min(J,te.overscaledZ),1/0),D=u[0].overscaledZ,R=Math.max(D-kd.maxOverzooming,this._source.minzoom),U=Math.max(D+kd.maxUnderzooming,this._source.minzoom),G={};for(const J of u){const te=this._addTile(J);f[J.key]=J,te.hasData()||P=this._source.maxzoom){const he=J.children(this._source.maxzoom)[0],pe=this.getTile(he);if(pe&&pe.hasData()){f[he.key]=he;continue}}else{const he=J.children(this._source.maxzoom);if(f[he[0].key]&&f[he[1].key]&&f[he[2].key]&&f[he[3].key])continue}let me=te.wasRequested();for(let he=J.overscaledZ-1;he>=R;--he){const pe=J.scaledTo(he);if(k[pe.key]||(k[pe.key]=!0,te=this.getTile(pe),!te&&me&&(te=this._addTile(pe)),te&&(f[pe.key]=pe,me=te.wasRequested(),te.hasData())))break}}return f}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const u in this._tiles){const f=[];let k,P=this._tiles[u].tileID;for(;P.overscaledZ>0;){if(P.key in this._loadedParentTiles){k=this._loadedParentTiles[P.key];break}f.push(P.key);const D=P.scaledTo(P.overscaledZ-1);if(k=this._getLoadedTile(D),k)break;P=D}for(const D of f)this._loadedParentTiles[D]=k}}_addTile(u){let f=this._tiles[u.key];if(f)return f.isExtraShadowCaster!==!0||this._shadowCasterTiles[u.key]||this._reloadTile(u.key,"reloading"),f;f=this._cache.getAndRemove(u),f&&(this._setTileReloadTimer(u.key,f),f.tileID=u,this._state.initializeTileState(f,this.map?this.map.painter:null),this._cacheTimers[u.key]&&(clearTimeout(this._cacheTimers[u.key]),delete this._cacheTimers[u.key],this._setTileReloadTimer(u.key,f)));const k=!!f;if(!k){const P=this.map?this.map.painter:null,D=this._source.tileSize*u.overscaleFactor();f=this._source.type==="raster-array"?new r0(u,D,this.transform.tileZoom,P,this._isRaster):new Dp(u,D,this.transform.tileZoom,P,this._isRaster,this._source.worldview),this._loadTile(f,this._tileLoaded.bind(this,f,u.key,f.state))}return f.uses++,this._tiles[u.key]=f,k||this._source.fire(new i.z("dataloading",{tile:f,coord:f.tileID,dataType:"source"})),f}_setTileReloadTimer(u,f){u in this._timers&&(clearTimeout(this._timers[u]),delete this._timers[u]);const k=f.getExpiryTimeout();k&&(this._timers[u]=setTimeout(()=>{this._reloadTile(u,"expired"),delete this._timers[u]},k))}_removeTile(u){const f=this._tiles[u];f&&(f.uses--,delete this._tiles[u],this._timers[u]&&(clearTimeout(this._timers[u]),delete this._timers[u]),f.uses>0||(f.hasData()&&f.state!=="reloading"||f.state==="empty"?this._cache.add(f.tileID,f,f.getExpiryTimeout()):(f.aborted=!0,this._abortTile(f),this._unloadTile(f))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const u in this._tiles)this._removeTile(+u);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(u,f,k){const P=[],D=this.transform;if(!D)return P;const R=D.projection.name==="globe",U=i.aF(D.center.lng);for(const G in this._tiles){const J=this._tiles[G];if(k&&J.clearQueryDebugViz(),J.holdingForFade())continue;let te;if(R){const me=J.tileID.canonical;if(me.z===0){const he=[Math.abs(i.aA(U,...Ru(me,-1))-U),Math.abs(i.aA(U,...Ru(me,1))-U)];te=[0,2*he.indexOf(Math.min(...he))-1]}else{const he=[Math.abs(i.aA(U,...Ru(me,-1))-U),Math.abs(i.aA(U,...Ru(me,0))-U),Math.abs(i.aA(U,...Ru(me,1))-U)];te=[he.indexOf(Math.min(...he))-1]}}else te=[0];for(const me of te){const he=u.containsTile(J,D,f,me);he&&P.push(he)}}return P}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(u){return this._getRenderableCoordinates(u)}_getRenderableCoordinates(u,f){const k=this.getRenderableIds(u,f).map(D=>this._tiles[D].tileID),P=this.transform.projection.name==="globe";for(const D of k)D.projMatrix=this.transform.calculateProjMatrix(D.toUnwrapped()),D.expandedProjMatrix=P?this.transform.calculateProjMatrix(D.toUnwrapped(),!1,!0):D.projMatrix;return k}sortCoordinatesByDistance(u){const f=u.slice(),k=this.transform._camera.position,P=this.transform._camera.forward(),D={};for(const R of f){const U=1/(1<D[R.key]-D[U.key]),f}hasTransition(){if(this._source.hasTransition())return!0;if(Dm(this._source.type))for(const u in this._tiles){const f=this._tiles[u];if(f.fadeEndTime!==void 0&&f.fadeEndTime>=i.o.now())return!0}return!1}setFeatureState(u,f,k){this._state.updateState(u=u||"_geojsonTileLayer",f,k)}removeFeatureState(u,f,k){this._state.removeFeatureState(u=u||"_geojsonTileLayer",f,k)}getFeatureState(u,f){return this._state.getState(u=u||"_geojsonTileLayer",f)}setDependencies(u,f,k){const P=this._tiles[u];P&&P.setDependencies(f,k)}reloadTilesForDependencies(u,f){for(const k in this._tiles)this._tiles[k].hasDependency(u,f)&&this._reloadTile(+k,"reloading");this._cache.filter(k=>!k.hasDependency(u,f))}_preloadTiles(u,f){if(!this._sourceLoaded){const G=()=>{this._sourceLoaded&&(this._source.off("data",G),this._preloadTiles(u,f))};return void this._source.on("data",G)}const k=new Map,P=Array.isArray(u)?u:[u],D=this.map.painter.terrain,R=this.usedForTerrain&&D?D.getScaledDemTileSize():this._source.tileSize;for(const G of P){const J=G.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 J)k.set(te.key,te);this.usedForTerrain&&G.updateElevation(!1)}const U=Array.from(k.values());i.bw(U,(G,J)=>{const te=new Dp(G,this._source.tileSize*G.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(te,me=>{this._source.type==="raster-dem"&&te.dem&&this._backfillDEM(te),J(me,te)})},f)}}function s0(w,u){const f=Math.abs(2*w.wrap)-+(w.wrap<0),k=Math.abs(2*u.wrap)-+(u.wrap<0);return w.overscaledZ-u.overscaledZ||k-f||u.canonical.y-w.canonical.y||u.canonical.x-w.canonical.x}function Dm(w){return w==="raster"||w==="image"||w==="video"||w==="custom"}function Ru(w,u){const f=1<0:k.type==="building"?P=!k.isHidden(u)&&k.paint.get("building-opacity")>0:k.type==="model"&&(P=!k.isHidden(u)&&k.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!P&&f.visible,f.visible=P}}updateZOffset(u,f){this.currentBuildingBuckets=[];for(const P of this.layers){const D=P.layer,R=this.style.getLayerSourceCache(D);let U=1;D.type==="fill-extrusion"?U=P.visible?D.paint.get("fill-extrusion-vertical-scale"):0:D.type==="building"&&(U=P.visible?D.paint.get("building-vertical-scale"):0);let G=R?R.getTile(f):null;if(!G&&R)for(const J in R._tiles){const te=R._tiles[J];if(f.canonical.isChildOf(te.tileID.canonical)){G=te;break}}this.currentBuildingBuckets.push({bucket:G?G.getBucket(D):null,tileID:G?G.tileID:f,verticalScale:U})}u.hasAnyZOffset=!1;let k=!1;for(let P=0;P{k in u&&(f[k]=u[k])}),f}function yx(w){w=w.slice();const u=Object.create(null);for(let f=0;f0?(P-R)/U:0;return this.points[D].mult(1-G).add(this.points[f].mult(G))}}class fn{constructor(u,f,k){const P=this.boxCells=[],D=this.circleCells=[];this.xCellCount=Math.ceil(u/k),this.yCellCount=Math.ceil(f/k);for(let R=0;Rthis.width||P<0||f>this.height)return!D&&[];const U=[];if(u<=0&&f<=0&&this.width<=k&&this.height<=P){if(D)return!0;for(let G=0;G0:U}_queryCircle(u,f,k,P,D){const R=u-k,U=u+k,G=f-k,J=f+k;if(U<0||R>this.width||J<0||G>this.height)return!P&&[];const te=[];return this._forEachCell(R,G,U,J,this._queryCellCircle,te,{hitTest:P,circle:{x:u,y:f,radius:k},seenUids:{box:{},circle:{}}},D),P?te.length>0:te}query(u,f,k,P,D){return this._query(u,f,k,P,!1,D)}hitTest(u,f,k,P,D){return this._query(u,f,k,P,!0,D)}hitTestCircle(u,f,k,P){return this._queryCircle(u,f,k,!0,P)}_queryCell(u,f,k,P,D,R,U,G){const J=U.seenUids,te=this.boxCells[D];if(te!==null){const he=this.bboxes;for(const pe of te)if(!J.box[pe]){J.box[pe]=!0;const ke=4*pe;if(u<=he[ke+2]&&f<=he[ke+3]&&k>=he[ke+0]&&P>=he[ke+1]&&(!G||G(this.boxKeys[pe]))){if(U.hitTest)return R.push(!0),!0;R.push({key:this.boxKeys[pe],x1:he[ke],y1:he[ke+1],x2:he[ke+2],y2:he[ke+3]})}}}const me=this.circleCells[D];if(me!==null){const he=this.circles;for(const pe of me)if(!J.circle[pe]){J.circle[pe]=!0;const ke=3*pe;if(this._circleAndRectCollide(he[ke],he[ke+1],he[ke+2],u,f,k,P)&&(!G||G(this.circleKeys[pe]))){if(U.hitTest)return R.push(!0),!0;{const _e=he[ke],Re=he[ke+1],De=he[ke+2];R.push({key:this.circleKeys[pe],x1:_e-De,y1:Re-De,x2:_e+De,y2:Re+De})}}}}}_queryCellCircle(u,f,k,P,D,R,U,G){const J=U.circle,te=U.seenUids,me=this.boxCells[D];if(me!==null){const pe=this.bboxes;for(const ke of me)if(!te.box[ke]){te.box[ke]=!0;const _e=4*ke;if(this._circleAndRectCollide(J.x,J.y,J.radius,pe[_e+0],pe[_e+1],pe[_e+2],pe[_e+3])&&(!G||G(this.boxKeys[ke])))return R.push(!0),!0}}const he=this.circleCells[D];if(he!==null){const pe=this.circles;for(const ke of he)if(!te.circle[ke]){te.circle[ke]=!0;const _e=3*ke;if(this._circlesCollide(pe[_e],pe[_e+1],pe[_e+2],J.x,J.y,J.radius)&&(!G||G(this.circleKeys[ke])))return R.push(!0),!0}}}_forEachCell(u,f,k,P,D,R,U,G){const J=this._convertToXCellCoord(u),te=this._convertToYCellCoord(f),me=this._convertToXCellCoord(k),he=this._convertToYCellCoord(P);for(let pe=J;pe<=me;pe++)for(let ke=te;ke<=he;ke++)if(D.call(this,u,f,k,P,this.xCellCount*ke+pe,R,U,G))return}_convertToXCellCoord(u){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(u*this.xScale)))}_convertToYCellCoord(u){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(u*this.yScale)))}_circlesCollide(u,f,k,P,D,R){const U=P-u,G=D-f,J=k+R;return J*J>U*U+G*G}_circleAndRectCollide(u,f,k,P,D,R,U){const G=(R-P)/2,J=Math.abs(u-(P+G));if(J>G+k)return!1;const te=(U-D)/2,me=Math.abs(f-(D+te));if(me>te+k)return!1;if(J<=G||me<=te)return!0;const he=J-G,pe=me-te;return he*he+pe*pe<=k*k}}const ca={unknown:0,flipRequired:1,flipNotRequired:2},Vn=Math.tan(85*Math.PI/180);function Ca(w,u,f,k,P,D,R){const U=i.bC();if(f)if(D.name==="globe"){const G=i.bD(P,u);i.aB(U,U,G)}else{const G=i.bE([],R);U[0]=G[0],U[1]=G[1],U[4]=G[2],U[5]=G[3],k||i.bB(U,U,P.angle)}else i.aB(U,P.labelPlaneMatrix,w);return U}function Zh(w,u,f,k,P,D,R){const U=Ca(w,u,f,k,P,D,R);return D.name==="globe"&&f||(U[2]=U[6]=U[10]=U[14]=0),U}function uu(w,u,f,k,P,D,R){if(f){if(D.name==="globe"){const U=Ca(w,u,f,k,P,D,R);return i.bl(U,U),i.aB(U,w,U),U}{const U=i.bz(w),G=i.bA([]);return G[0]=R[0],G[1]=R[1],G[4]=R[2],G[5]=R[3],i.aB(U,U,G),k||i.bB(U,U,-P.angle),U}}return P.glCoordMatrix}function Dl(w,u,f,k){const P=[w,u,f,1];f?i.aC(P,P,k):Ts(P,P,k);const D=P[3];return P[0]/=D,P[1]/=D,P[2]/=D,P}function Ma(w,u){return Math.min(.5+w/u*.5,1.5)}function Jk(w,u){const f=w[0]/w[3],k=w[1]/w[3];return f>=-u[0]&&f<=u[0]&&k>=-u[1]&&k<=u[1]}function WP(w,u,f,k,P,D,R,U,G,J,te=1){const me=f.transform,he=k?w.textSizeData:w.iconSizeData,pe=i.bK(he,f.transform.zoom,te),ke=me.projection.name==="globe",_e=[256/f.width*2+1,256/f.height*2+1],Re=k?w.text.dynamicLayoutVertexArray:w.icon.dynamicLayoutVertexArray;Re.clear();let De=null;ke&&(De=k?w.text.globeExtVertexArray:w.icon.globeExtVertexArray);const He=w.lineVertexArray,nt=k?w.text.placedSymbolArray:w.icon.placedSymbolArray,We=f.transform.width/f.transform.height;let kt,xt=!1;for(let _t=0;_tMath.abs(f)?{useVertical:!0}:w===i.bL.vertical?k>0?{needsFlipping:!0}:null:u!==ca.unknown&&function(P,D){return P===0||Math.abs(D/P)>Vn}(f,k)?u===ca.flipRequired?{needsFlipping:!0}:null:f<0?{needsFlipping:!0}:null}function f5(w,u,f,k,P,D,R,U,G,J,te,me,he,pe,ke,_e,Re,De,He,nt){const We=u/24,kt=w.lineOffsetX*We,xt=w.lineOffsetY*We,{lineStartIndex:_t,glyphStartIndex:gt,numGlyphs:ut,segment:Tt,writingMode:Bt,flipState:zt}=w,Qt=_t+w.lineLength,er=ur=>{if(te){const[nr,Xt,gr]=ur.up,$r=J.length;i.bN(te,$r+0,nr,Xt,gr),i.bN(te,$r+1,nr,Xt,gr),i.bN(te,$r+2,nr,Xt,gr),i.bN(te,$r+3,nr,Xt,gr)}const[Sr,Kt,Pt]=ur.point;i.bO(J,Sr,Kt,Pt,ur.angle)};if(ut>1){const ur=GP(We,U,kt,xt,f,me,he,w,G,D,pe,_e,!1,Re,De,He,nt);if(!ur)return{notEnoughRoom:!0};if(k&&!f){let[Sr,Kt,Pt]=ur.first.point,[nr,Xt,gr]=ur.last.point;[Sr,Kt]=Dl(Sr,Kt,Pt,R),[nr,Xt]=Dl(nr,Xt,gr,R);const $r=Hs(Bt,zt,(nr-Sr)*ke,Xt-Kt);if(w.flipState=$r&&$r.needsFlipping?ca.flipRequired:ca.flipNotRequired,$r)return $r}er(ur.first);for(let Sr=gt+1;Sr0?nr:gh(he,Pt,Sr,1,P,void 0,Re,De.canonical),gr=Hs(Bt,zt,(Xt[0]-Sr[0])*ke,Xt[1]-Sr[1]);if(w.flipState=gr&&gr.needsFlipping?ca.flipRequired:ca.flipNotRequired,gr)return gr}const ur=a0(We*U.getoffsetX(gt),kt,xt,f,me,he,Tt,_t,Qt,G,D,pe,_e,!1,!1,Re,De,He,nt);if(!ur)return{notEnoughRoom:!0};er(ur)}return{}}function Vv(w,u,f,k,P){const{x:D,y:R,z:U}=k.projectTilePoint(w.x,w.y,u);if(!P)return Dl(D,R,U,f);const[G,J,te]=P.getElevation(w,P.elevation,P.elevationFeature);return Dl(D+G,R+J,U+te,f)}function gh(w,u,f,k,P,D,R,U){const G=Vv(w.sub(u)._unit()._add(w),U,P,R,D);return i.av(G,f,G),i.aw(G,G),i.bH(G,f,G,k)}function a0(w,u,f,k,P,D,R,U,G,J,te,me,he,pe,ke,_e,Re,De,He){const nt=k?w-u:w+u;let We=nt>0?1:-1,kt=0;k&&(We*=-1,kt=Math.PI),We<0&&(kt+=Math.PI);let xt=U+R+(We>0?0:1)|0,_t=P,gt=P,ut=0,Tt=0;const Bt=Math.abs(nt),zt=[],Qt=[];let er=D,ur=er,Sr=i.bF([]);const Kt=()=>gh(ur,er,gt,Bt-ut+1,te,he,_e,Re.canonical);for(;ut+Tt<=Bt;){if(xt+=We,xt=G)return null;if(gt=_t,ur=er,zt.push(gt),pe&&Qt.push(ur),er=new i.P(J.getx(xt),J.gety(xt)),_t=me[xt],!_t){const ps=Vv(er,Re.canonical,te,_e,he);_t=ps[3]>0?me[xt]=ps:Kt()}ut+=Tt;const Tr=i.av([],_t,gt),vs=i.bG(gt,_t);if(f&&vs>0&&Tt>0&&i.bJ(Sr,Tr)/(Tt*vs)0,nt),_t=J*xt.perspectiveRatio,gt=(k.x1*f+U.x-k.padding)*_t+xt.point.x,ut=(k.y1*f+U.y-k.padding)*_t+xt.point.y,Tt=(k.x2*f+U.x+k.padding)*_t+xt.point.x,Bt=(k.y2*f+U.y+k.padding)*_t+xt.point.y,zt=xt.perspectiveRatio<=.55||xt.occluded;return!this.isInsideGrid(gt,ut,Tt,Bt)||!G&&this.grid.hitTest(gt,ut,Tt,Bt,me)||zt?{box:[],offscreen:!1,occluded:xt.occluded}:{box:[gt,ut,Tt,Bt],offscreen:this.isOffscreen(gt,ut,Tt,Bt),occluded:!1}}placeCollisionCircles(u,f,k,P,D,R,U,G,J,te,me,he,pe,ke,_e,Re){const De=[],He=this.transform.elevation,nt=u.getProjection(),We=u.elevationType==="road",kt=!!He||We,xt=i.bV.getAtTileOffsetFunc(Re,this.transform.center.lat,this.transform.worldSize,nt),_t=new i.P(k.tileAnchorX,k.tileAnchorY),gt=new i.P(k.tileAnchorX,k.tileAnchorY);let{x:ut,y:Tt,z:Bt}=nt.projectTilePoint(gt.x,gt.y,Re.canonical),zt=null;if(kt){const vs=We?u.getElevationFeatureForText(P):null;zt={getElevation:xt,elevation:He,elevationFeature:vs};const[ps,Qr,ns]=xt(_t,He,vs);ut+=ps,Tt+=Qr,Bt+=ns}const Qt=nt.name==="globe",er=this.projectAndGetPerspectiveRatio(G,ut,Tt,Bt,Re,Qt||!!He||this.transform.pitch>0,nt),{perspectiveRatio:ur}=er,Sr=(he?U/ur:U*ur)/i.bY,Kt=Dl(ut,Tt,Bt,J),Pt=k.lineOffsetX*Sr,nr=k.lineOffsetY*Sr,Xt=i.an(u.layers[0].layout.get("text-max-angle")),gr=Math.cos(Xt),$r=er.signedDistanceFromCamera>0?GP(Sr,R,Pt,nr,We&&k.flipState===1,Kt,gt,k,D,J,{},kt&&!he?zt:null,he&&kt,nt,Re,he,gr):null;let rs=!1,Or=!1,Tr=!0;if($r&&!er.occluded){const vs=.5*ke*ur+_e,ps=new i.P(-100,-100),Qr=new i.P(this.screenRightBoundary,this.screenBottomBoundary),ns=new pn,{first:Ps,last:hn}=$r,ta=Ps.path.length;let Ta=[];for(let nn=ta-1;nn>=1;nn--)Ta.push(Ps.path[nn]);for(let nn=1;nn(kt&&!Qt&&(Za=xt(Uann[3]<=0)&&(Ta=[]));let ba=[];if(Ta.length>0){let nn=1/0,La=-1/0,Za=1/0,Ua=-1/0;for(const _a of Ta)nn=Math.min(nn,_a[0]),Za=Math.min(Za,_a[1]),La=Math.max(La,_a[0]),Ua=Math.max(Ua,_a[1]);La>=ps.x&&nn<=Qr.x&&Ua>=ps.y&&Za<=Qr.y&&(ba=[Ta.map(_a=>new i.P(_a[0],_a[1]))],(nnQr.x||ZaQr.y)&&(ba=i.bW(ba,ps.x,ps.y,Qr.x,Qr.y)))}for(const nn of ba){ns.reset(nn,.25*vs);let La=0;La=ns.length<=.5*vs?1:Math.ceil(ns.paddedLength/js)+1;for(let Za=0;Za0?(i.aC(G,G,u),this.fogState&&D&&U.name!=="globe"&&(J=function(he,pe,ke,_e,Re,De){const He=De.calculateFogTileMatrix(Re),nt=[pe,ke,_e];return i.af(nt,nt,He),ss(he,i.ag(nt),De.pitch,De._fov)}(this.fogState,f,k,P,D.toUnwrapped(),this.transform)>.9)):Ts(G,G,u);const te=G[3];return{point:new i.P((G[0]/te+1)/2*this.transform.width+da,(-G[1]/te+1)/2*this.transform.height+da),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(U)/te*.5,1.5),signedDistanceFromCamera:te,occluded:R&&G[2]>te||J}}isOffscreen(u,f,k,P){return k=this.screenRightBoundary||Pthis.screenBottomBoundary}isInsideGrid(u,f,k,P){return k>=0&&u=0&&fk.collisionGroupID===f}}return this.collisionGroups[u]}}function $c(w,u,f,k,P){const{horizontalAlign:D,verticalAlign:R}=i.c1(w),U=-(D-.5)*u,G=-(R-.5)*f,J=i.c2(w,k);return new i.P(U+J[0]*P,G+J[1]*P)}function qo(w,u,f,k,P){const D=new i.P(w,u);return f&&D._rotate(k?P:-P),D}class Gie{constructor(u,f,k,P,D,R){this.transform=u.clone(),this.projection=u.projection.name,this.collisionIndex=new Ka(this.transform,D),this.buildingIndex=R,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=f,this.retainedQueryData={},this.collisionGroups=new Wv(k),this.collisionCircleArrays={},this.prevPlacement=P,P&&(P.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(u,f,k,P,D=1){const R=k.getBucket(f),U=k.latestFeatureIndex;if(!R||!U||f.fqid!==R.layerIds[0])return;const G=R.layers[0].layout,J=R.layers[0].paint,te=k.collisionBoxArray,me=Math.pow(2,this.transform.zoom-k.tileID.overscaledZ),he=k.tileSize/i.al,pe=k.tileID.toUnwrapped();this.transform.setProjection(R.projection);const ke=(_e=k.tileID,Re=R.getProjection(),De=this.transform,Re.name===this.projection?De.calculateProjMatrix(_e.toUnwrapped()):Nt(De,Re,_e));var _e,Re,De;const He=G.get("text-pitch-alignment")==="map",nt=G.get("text-rotation-alignment")==="map";f.compileFilter(f.options);const We=f.dynamicFilter(),kt=f.dynamicFilterNeedsFeature(),xt=this.transform.calculatePixelsToTileUnitsMatrix(k),_t=Zh(ke,k.tileID.canonical,He,nt,this.transform,R.getProjection(),xt);let gt=null;const ut=R.getProjection().createInversionMatrix(this.transform,k.tileID.canonical);if(He){const Pt=uu(ke,k.tileID.canonical,He,nt,this.transform,R.getProjection(),xt);gt=i.aB([],this.transform.labelPlaneMatrix,Pt)}let Tt=null;We&&k.latestFeatureIndex&&(Tt={unwrappedTileID:pe,dynamicFilter:We,dynamicFilterNeedsFeature:kt}),this.retainedQueryData[R.bucketInstanceId]=new Hv(R.bucketInstanceId,U,R.sourceLayerIndex,R.index,k.tileID);const[Bt,zt]=R.layers[0].layout.get("text-size-scale-range"),Qt=i.aA(D,Bt,zt),[er,ur]=G.get("icon-size-scale-range"),Sr=i.aA(D,er,ur),Kt={bucket:R,layout:G,paint:J,posMatrix:ke,invMatrix:ut,mercatorCenter:[i.aF(this.transform.center.lng),i.aJ(this.transform.center.lat)],textLabelPlaneMatrix:_t,labelToScreenMatrix:gt,clippingData:Tt,scale:me,textPixelRatio:he,holdingForFade:k.holdingForFade(),collisionBoxArray:te,partiallyEvaluatedTextSize:i.bK(R.textSizeData,this.transform.zoom,Qt),partiallyEvaluatedIconSize:i.bK(R.iconSizeData,this.transform.zoom,Sr),collisionGroup:this.collisionGroups.get(R.sourceID),latestFeatureIndex:k.latestFeatureIndex};if(P)for(const Pt of R.sortKeyRanges){const{sortKey:nr,symbolInstanceStart:Xt,symbolInstanceEnd:gr}=Pt;u.push({sortKey:nr,symbolInstanceStart:Xt,symbolInstanceEnd:gr,parameters:Kt})}else u.push({symbolInstanceStart:0,symbolInstanceEnd:R.symbolInstances.length,parameters:Kt})}attemptAnchorPlacement(u,f,k,P,D,R,U,G,J,te,me,he,pe,ke,_e,Re,De,He,nt,We,kt){const{textOffset0:xt,textOffset1:_t,crossTileID:gt}=_e,ut=[xt,_t],Tt=$c(u,R,U,ut,G),Bt=this.collisionIndex.placeCollisionBox(De,G,f,k,P,D,qo(Tt.x,Tt.y,J,te,this.transform.angle),ke,me,he,pe.predicate);if(nt){const zt=De.getSymbolInstanceIconSize(kt,this.transform.zoom,_e.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(De,zt,nt,k,P,D,qo(Tt.x,Tt.y,J,te,this.transform.angle),ke,me,he,pe.predicate).box.length===0)return}if(Bt.box.length>0){let zt;return this.prevPlacement&&this.prevPlacement.variableOffsets[gt]&&this.prevPlacement.placements[gt]&&this.prevPlacement.placements[gt].text&&(zt=this.prevPlacement.variableOffsets[gt].anchor),this.variableOffsets[gt]={textOffset:ut,width:R,height:U,anchor:u,textScale:G,prevAnchor:zt},this.markUsedJustification(De,u,_e,He),De.allowVerticalPlacement&&(this.markUsedOrientation(De,He,_e),this.placedOrientations[gt]=He),{shift:Tt,placedGlyphBoxes:Bt}}}placeLayerBucketPart(u,f,k,P,D=1){const{bucket:R,layout:U,paint:G,posMatrix:J,textLabelPlaneMatrix:te,labelToScreenMatrix:me,clippingData:he,textPixelRatio:pe,mercatorCenter:ke,invMatrix:_e,holdingForFade:Re,collisionBoxArray:De,partiallyEvaluatedTextSize:He,partiallyEvaluatedIconSize:nt,collisionGroup:We,latestFeatureIndex:kt}=u.parameters,xt=U.get("text-optional"),_t=U.get("icon-optional"),gt=U.get("text-allow-overlap"),ut=U.get("icon-allow-overlap"),Tt=U.get("text-rotation-alignment")==="map",Bt=U.get("icon-rotation-alignment")==="map",zt=U.get("text-pitch-alignment")==="map",Qt=G.get("symbol-z-offset"),er=U.get("symbol-elevation-reference")==="sea",ur=U.get("symbol-placement"),[Sr,Kt]=U.get("text-size-scale-range"),[Pt,nr]=U.get("icon-size-scale-range"),Xt=i.aA(D,Sr,Kt),gr=i.aA(D,Pt,nr),$r=U.get("text-variable-anchor"),rs=Tt&&ur!=="point",Or=Bt&&ur!=="point",Tr=$r&&R.hasTextData(),vs=R.hasIconTextFit()&&Tr&&R.hasIconData();this.transform.setProjection(R.projection);const ps=Tr||rs,Qr=Or||vs;let ns=gt&&(ut||!R.hasIconData()||_t),Ps=ut&&(gt||!R.hasTextData()||xt);const hn=!Qt.isConstant();!R.collisionArrays&&De&&R.deserializeCollisionBoxes(De),k&&P&&R.updateCollisionDebugBuffers(this.transform.zoom,De,Xt,gr);const ta=(js,ba,nn)=>{const{crossTileID:La,numVerticalGlyphVertices:Za}=js;let Ua=null;if(he&&he.dynamicFilterNeedsFeature||hn){const co=this.retainedQueryData[R.bucketInstanceId];Ua=kt.loadFeature({featureIndex:js.featureIndex,bucketIndex:co.bucketIndex,sourceLayerIndex:co.sourceLayerIndex,layoutVertexArrayOffset:0});const ko=Ua.properties?Ua.properties.worldview:null;if(R.localizable&&R.worldview&&typeof ko=="string")if(ko==="all")Ua.properties.$localized=!0;else{if(!ko.split(",").includes(R.worldview))return;Ua.properties.$localized=!0,Ua.properties.worldview=R.worldview}}if(he&&!(0,he.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:R.worldview},Ua,this.retainedQueryData[R.bucketInstanceId].tileID.canonical,new i.P(js.tileAnchorX,js.tileAnchorY),this.transform.calculateDistanceTileData(he.unwrappedTileID)))return this.placements[La]=new za(!1,!1,!1,!0),void f.add(La);const _a=Qt.evaluate(Ua,{});if(f.has(La))return;if(Re)return void(this.placements[La]=new za(!1,!1,!1));let wn=!1,Pa=!1,so=!0,Ii=!1,Oa=!1,ha=null,jn={box:null,offscreen:null,occluded:null},ji={box:null},vo=null,Xi=null,si=null,Ad=0,_c=0,rl=0;nn.textFeatureIndex?Ad=nn.textFeatureIndex:js.useRuntimeCollisionCircles&&(Ad=js.featureIndex),nn.verticalTextFeatureIndex&&(_c=nn.verticalTextFeatureIndex);const qc=R.elevationFeatures?R.elevationFeatures[js.elevationFeatureIndex]:void 0,Vc=co=>{co.tileID=this.retainedQueryData[R.bucketInstanceId].tileID;const ko=this.transform.elevation;co.elevation=er?_a:_a+i.bV.getAtTileOffset(co.tileID,new i.P(co.tileAnchorX,co.tileAnchorY),ko,qc),co.elevation+=js.zOffset},Ql=nn.textBox;if(Ql){Vc(Ql);const co=ni=>{let Po=i.bL.horizontal;if(R.allowVerticalPlacement&&!ni&&this.prevPlacement){const no=this.prevPlacement.placedOrientations[La];no&&(this.placedOrientations[La]=no,Po=no,this.markUsedOrientation(R,Po,js))}return Po},ko=(ni,Po)=>{if(R.allowVerticalPlacement&&Za>0&&nn.verticalTextBox){for(const no of R.writingModes)if(no===i.bL.vertical?(jn=Po(),ji=jn):jn=ni(),jn&&jn.box&&jn.box.length)break}else jn=ni()};if($r){let ni=$r;if(this.prevPlacement&&this.prevPlacement.variableOffsets[La]){const Qi=this.prevPlacement.variableOffsets[La];ni.indexOf(Qi.anchor)>0&&(ni=ni.filter(kh=>kh!==Qi.anchor),ni.unshift(Qi.anchor))}const Po=(Qi,kh,__)=>{const rm=R.getSymbolInstanceTextSize(He,js,this.transform.zoom,ba),b_=(Qi.x2-Qi.x1)*rm+2*Qi.padding,T0=(Qi.y2-Qi.y1)*rm+2*Qi.padding,Gm=js.hasIconTextFit&&!ut?kh:null;Gm&&Vc(Gm);let Xp={box:[],offscreen:!1,occluded:!1};const A0=gt?2*ni.length:ni.length;for(let vg=0;vg=ni.length,js,ba,R,__,Gm,He,nt);if(Qp&&(Xp=Qp.placedGlyphBoxes,Xp&&Xp.box&&Xp.box.length)){wn=!0,ha=Qp.shift;break}}return Xp};ko(()=>Po(Ql,nn.iconBox,i.bL.horizontal),()=>{const Qi=nn.verticalTextBox;return Qi&&Vc(Qi),R.allowVerticalPlacement&&!(jn&&jn.box&&jn.box.length)&&Za>0&&Qi?Po(Qi,nn.verticalIconBox,i.bL.vertical):{box:null,offscreen:null,occluded:null}}),jn&&(wn=jn.box,so=jn.offscreen,Ii=jn.occluded);const no=co(!(!jn||!jn.box));if(!wn&&this.prevPlacement){const Qi=this.prevPlacement.variableOffsets[La];Qi&&(this.variableOffsets[La]=Qi,this.markUsedJustification(R,Qi.anchor,js,no))}}else{const ni=(Po,no)=>{const Qi=R.getSymbolInstanceTextSize(He,js,this.transform.zoom,ba),kh=this.collisionIndex.placeCollisionBox(R,Qi,Po,ke,_e,ps,new i.P(0,0),gt,pe,J,We.predicate);return kh&&kh.box&&kh.box.length&&(this.markUsedOrientation(R,no,js),this.placedOrientations[La]=no),kh};ko(()=>ni(Ql,i.bL.horizontal),()=>{const Po=nn.verticalTextBox;return R.allowVerticalPlacement&&Za>0&&Po?(Vc(Po),ni(Po,i.bL.vertical)):{box:null,offscreen:null,occluded:null}}),co(!!(jn&&jn.box&&jn.box.length))}}if(vo=jn,wn=vo&&vo.box&&vo.box.length>0,so=vo&&vo.offscreen,Ii=vo&&vo.occluded,js.useRuntimeCollisionCircles){const co=js.centerJustifiedTextSymbolIndex>=0?js.centerJustifiedTextSymbolIndex:js.verticalPlacedTextSymbolIndex,ko=R.text.placedSymbolArray.get(co),ni=i.bM(R.textSizeData,He,ko),Po=U.get("text-padding");Xi=this.collisionIndex.placeCollisionCircles(R,gt,ko,co,R.lineVertexArray,R.glyphOffsetArray,ni,J,te,me,k,zt,We.predicate,js.collisionCircleDiameter*ni/i.bY,Po,this.retainedQueryData[R.bucketInstanceId].tileID),wn=gt||Xi.circles.length>0&&!Xi.collisionDetected,so=so&&Xi.offscreen,Ii=Xi.occluded}if(nn.iconFeatureIndex&&(rl=nn.iconFeatureIndex),nn.iconBox){const co=ko=>{Vc(ko);const ni=js.hasIconTextFit&&ha?qo(ha.x,ha.y,Tt,zt,this.transform.angle):new i.P(0,0),Po=R.getSymbolInstanceIconSize(nt,this.transform.zoom,js.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(R,Po,ko,ke,_e,Qr,ni,ut,pe,J,We.predicate)};ji&&ji.box&&ji.box.length&&nn.verticalIconBox?(si=co(nn.verticalIconBox),Pa=si.box.length>0):(si=co(nn.iconBox),Pa=si.box.length>0),so=so&&si.offscreen,Oa=si.occluded}const Uu=xt||js.numHorizontalGlyphVertices===0&&Za===0,jh=_t||js.numIconVertices===0;if(Uu||jh?jh?Uu||(Pa=Pa&&wn):wn=Pa&&wn:Pa=wn=Pa&&wn,wn&&vo&&vo.box&&this.collisionIndex.insertCollisionBox(vo.box,U.get("text-ignore-placement"),R.bucketInstanceId,ji&&ji.box&&_c?_c:Ad,We.ID),Pa&&si&&this.collisionIndex.insertCollisionBox(si.box,U.get("icon-ignore-placement"),R.bucketInstanceId,rl,We.ID),Xi&&(wn&&this.collisionIndex.insertCollisionCircles(Xi.circles,U.get("text-ignore-placement"),R.bucketInstanceId,Ad,We.ID),k)){const co=R.bucketInstanceId;let ko=this.collisionCircleArrays[co];ko===void 0&&(ko=this.collisionCircleArrays[co]=new eN);for(let ni=0;ni=0;--ba){const nn=js[ba];ta(R.symbolInstances.get(nn),nn,R.collisionArrays[nn])}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 js=R.getSortedIndexesByZOffset();for(let ba=0;ba=0&&(u.text.placedSymbolArray.get(D).crossTileID=me>=0&&D!==me?0:J),R>=0&&(u.text.placedSymbolArray.get(R).crossTileID=me>=0&&R!==me?0:J),U>=0&&(u.text.placedSymbolArray.get(U).crossTileID=me>=0&&U!==me?0:J),G>=0&&(u.text.placedSymbolArray.get(G).crossTileID=me>=0&&G!==me?0:J)}markUsedOrientation(u,f,k){const P=f===i.bL.horizontal||f===i.bL.horizontalOnly?f:0,D=f===i.bL.vertical?f:0,{leftJustifiedTextSymbolIndex:R,centerJustifiedTextSymbolIndex:U,rightJustifiedTextSymbolIndex:G,verticalPlacedTextSymbolIndex:J}=k,te=u.text.placedSymbolArray;R>=0&&(te.get(R).placedOrientation=P),U>=0&&(te.get(U).placedOrientation=P),G>=0&&(te.get(G).placedOrientation=P),J>=0&&(te.get(J).placedOrientation=D)}commit(u){this.commitTime=u,this.zoomAtLastRecencyCheck=this.transform.zoom;const f=this.prevPlacement;let k=!1;this.prevZoomAdjustment=f?f.zoomAdjustment(this.transform.zoom):0;const P=f?f.symbolFadeChange(u):1,D=f?f.opacities:{},R=f?f.variableOffsets:{},U=f?f.placedOrientations:{};for(const G in this.placements){const J=this.placements[G],te=D[G];te?(this.opacities[G]=new Fm(te,P,J.text,J.icon,null,J.clipped),k=k||J.text!==te.text.placed||J.icon!==te.icon.placed):(this.opacities[G]=new Fm(null,P,J.text,J.icon,J.skipFade,J.clipped),k=k||J.text||J.icon)}for(const G in D){const J=D[G];if(!this.opacities[G]){const te=new Fm(J,P,!1,!1);te.isHidden()||(this.opacities[G]=te,k=k||J.text.placed||J.icon.placed)}}for(const G in R)this.variableOffsets[G]||!this.opacities[G]||this.opacities[G].isHidden()||(this.variableOffsets[G]=R[G]);for(const G in U)this.placedOrientations[G]||!this.opacities[G]||this.opacities[G].isHidden()||(this.placedOrientations[G]=U[G]);k?this.lastPlacementChangeTime=u:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=f?f.lastPlacementChangeTime:u)}updateLayerOpacities(u,f,k,P){P&&(this.lastReplacementSourceUpdateTime=P.updateTime);const D=new Set;for(const R of f){const U=R.getBucket(u);U&&R.latestFeatureIndex&&u.fqid===U.layerIds[0]&&(this.updateBucketOpacities(U,D,R,R.collisionBoxArray,k,P,R.tileID,u.scope),U.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(U,R.tileID),U.elevationType==="road"&&U.updateRoadElevation(R.tileID.canonical),U.updateZOffset())}}updateBucketOpacities(u,f,k,P,D,R,U,G){u.hasTextData()&&u.text.opacityVertexArray.clear(),u.hasIconData()&&u.icon.opacityVertexArray.clear(),u.hasIconCollisionBoxData()&&u.iconCollisionBox.collisionVertexArray.clear(),u.hasTextCollisionBoxData()&&u.textCollisionBox.collisionVertexArray.clear();const J=u.layers[0].layout,te=u.layers[0].paint,me=!!u.layers[0].dynamicFilter(),he=new Fm(null,0,!1,!1,!0),pe=J.get("text-allow-overlap"),ke=J.get("icon-allow-overlap"),_e=J.get("text-variable-anchor"),Re=J.get("text-rotation-alignment")==="map",De=J.get("text-pitch-alignment")==="map",He=te.get("symbol-z-offset"),nt=J.get("symbol-elevation-reference")==="sea",We=!He.isConstant(),kt=new Fm(null,0,pe&&(ke||!u.hasIconData()||J.get("icon-optional")),ke&&(pe||!u.hasTextData()||J.get("text-optional")),!0);!u.collisionArrays&&P&&(u.hasIconCollisionBoxData()||u.hasTextCollisionBoxData())&&u.deserializeCollisionBoxes(P);const xt=(gt,ut,Tt)=>{for(let Bt=0;Bt0||Bt>0,$r=Qt>0,rs=this.placedOrientations[zt],Or=rs===i.bL.vertical,Tr=rs===i.bL.horizontal||rs===i.bL.horizontalOnly;!gr&&!$r||Xt.isHidden()||_t++;let vs=!1;if((gr||$r)&&R)for(const ps of u.activeReplacements){if(i.bZ(ps,D,i.b_.Symbol,G)||ps.min.x>er||er>ps.max.x||ps.min.y>ur||ur>ps.max.y)continue;const Qr=i.b$(er,ur,U.canonical,ps.footprintTileId.canonical);if(vs=i.c0(Qr,ps.footprint),vs)break}if(gr){const ps=vs?_x:Sd(Xt.text);xt(u.text,Tt,Or?_x:ps),xt(u.text,Bt,Tr?_x:ps);const Qr=Xt.text.isHidden(),{leftJustifiedTextSymbolIndex:ns,centerJustifiedTextSymbolIndex:Ps,rightJustifiedTextSymbolIndex:hn,verticalPlacedTextSymbolIndex:ta}=ut,Ta=u.text.placedSymbolArray,js=Qr||Or?1:0;ns>=0&&(Ta.get(ns).hidden=js),Ps>=0&&(Ta.get(Ps).hidden=js),hn>=0&&(Ta.get(hn).hidden=js),ta>=0&&(Ta.get(ta).hidden=Qr||Tr?1:0);const ba=this.variableOffsets[zt];ba&&this.markUsedJustification(u,ba.anchor,ut,rs);const nn=this.placedOrientations[zt];nn&&(this.markUsedJustification(u,"left",ut,nn),this.markUsedOrientation(u,nn,ut))}if($r){const ps=vs?_x:Sd(Xt.icon),{placedIconSymbolIndex:Qr,verticalPlacedIconSymbolIndex:ns}=ut,Ps=u.icon.placedSymbolArray,hn=Xt.icon.isHidden()?1:0;Qr>=0&&(xt(u.icon,Qt,Or?_x:ps),Ps.get(Qr).hidden=hn),ns>=0&&(xt(u.icon,ut.numVerticalIconVertices,Tr?_x:ps),Ps.get(ns).hidden=hn)}if(u.hasIconCollisionBoxData()||u.hasTextCollisionBoxData()){const ps=u.collisionArrays[gt];if(ps){let Qr=new i.P(0,0),ns=!0;if(ps.textBox||ps.verticalTextBox){if(_e){const hn=this.variableOffsets[zt];hn?(Qr=$c(hn.anchor,hn.width,hn.height,hn.textOffset,hn.textScale),Re&&Qr._rotate(De?this.transform.angle:-this.transform.angle)):ns=!1}me&&(ns=!Xt.clipped),ps.textBox&&ng(u.textCollisionBox.collisionVertexArray,Xt.text.placed,!ns||Or,Pt,nt,Qr.x,Qr.y),ps.verticalTextBox&&ng(u.textCollisionBox.collisionVertexArray,Xt.text.placed,!ns||Tr,Pt,nt,Qr.x,Qr.y)}const Ps=ns&&!!(!Tr&&ps.verticalIconBox);ps.iconBox&&ng(u.iconCollisionBox.collisionVertexArray,Xt.icon.placed,Ps,Pt,nt,ut.hasIconTextFit?Qr.x:0,ut.hasIconTextFit?Qr.y:0),ps.verticalIconBox&&ng(u.iconCollisionBox.collisionVertexArray,Xt.icon.placed,!Ps,Pt,nt,ut.hasIconTextFit?Qr.x:0,ut.hasIconTextFit?Qr.y:0)}}}if(u.fullyClipped=_t===0,u.sortFeatures(this.transform.angle),this.retainedQueryData[u.bucketInstanceId]&&(this.retainedQueryData[u.bucketInstanceId].featureSortOrder=u.featureSortOrder),u.hasTextData()&&u.text.opacityVertexBuffer&&u.text.opacityVertexBuffer.updateData(u.text.opacityVertexArray),u.hasIconData()&&u.icon.opacityVertexBuffer&&u.icon.opacityVertexBuffer.updateData(u.icon.opacityVertexArray),u.hasIconCollisionBoxData()&&u.iconCollisionBox.collisionVertexBuffer&&u.iconCollisionBox.collisionVertexBuffer.updateData(u.iconCollisionBox.collisionVertexArray),u.hasTextCollisionBoxData()&&u.textCollisionBox.collisionVertexBuffer&&u.textCollisionBox.collisionVertexBuffer.updateData(u.textCollisionBox.collisionVertexArray),u.bucketInstanceId in this.collisionCircleArrays){const gt=this.collisionCircleArrays[u.bucketInstanceId];u.placementInvProjMatrix=gt.invProjMatrix,u.placementViewportMatrix=gt.viewportMatrix,u.collisionCircleArray=gt.circles,delete this.collisionCircleArrays[u.bucketInstanceId]}}symbolFadeChange(u){return this.fadeDuration===0?1:(u-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(u){return Math.max(0,(this.transform.zoom-u)/1.5)}hasTransitions(u){return this.stale||u-this.lastPlacementChangeTimeu}isStale(){return this.stale}setStale(){this.stale=!0}}function ng(w,u,f,k,P,D,R){w.emplaceBack(u?1:0,f?1:0,D||0,R||0,k,P?1:0),w.emplaceBack(u?1:0,f?1:0,D||0,R||0,k,P?1:0),w.emplaceBack(u?1:0,f?1:0,D||0,R||0,k,P?1:0),w.emplaceBack(u?1:0,f?1:0,D||0,R||0,k,P?1:0)}const g5=Math.pow(2,25),Gv=Math.pow(2,24),tN=Math.pow(2,17),x5=Math.pow(2,16),rN=Math.pow(2,9),Nd=Math.pow(2,8),Fp=Math.pow(2,1);function Sd(w){if(w.opacity===0&&!w.placed)return 0;if(w.opacity===1&&w.placed)return 4294967295;const u=w.placed?1:0,f=Math.floor(127*w.opacity);return f*g5+u*Gv+f*tN+u*x5+f*rN+u*Nd+f*Fp+u}const _x=0;class i0{constructor(u){this._sortAcrossTiles=u.layout.get("symbol-z-order")!=="viewport-y"&&u.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(u,f,k,P,D,R){const U=this._bucketParts;for(;this._currentTileIndexG.sortKey-J.sortKey));this._currentPartIndex{const G=i.o.now()-R;return!this._forceFullPlacement&&G>2};for(;this._currentPlacementIndex>=0;){const G=f[u[this._currentPlacementIndex]],J=this.placement.collisionIndex.transform.zoom;if(G.type==="symbol"&&G.visibility!=="none"&&(!G.minzoom||G.minzoom<=J)&&(!G.maxzoom||G.maxzoom>J)){const te=G,me=te.layout.get("symbol-z-elevate"),he=te.layout.get("symbol-sort-key").constantOr(1)!==void 0,pe=te.layout.get("symbol-z-order"),ke=pe==="viewport-y"||pe==="auto"&&!(pe!=="viewport-y"&&he),_e=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=ke&&_e,De=this._inProgressLayer=this._inProgressLayer||new i0(te),He=i.B(G.source,G.scope);if(De.continuePlacement(me||Re?P[He]:k[He],this.placement,this._showCollisionBoxes,G,U,D))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(u){return this.placement.commit(u),this.placement}}const xh=512/i.al/2;class zp{constructor(u,f,k){this.tileID=u,this.bucketInstanceId=k,this.index=new i.c4(f.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const P=u.canonical.x*i.al,D=u.canonical.y*i.al;for(let R=0;RRe-De);for(const Re of _e){const De=this.crossTileIDs[Re];if(this.keys[Re]===te&&!k.has(De)){k.add(De),J.crossTileID=De;break}}}}}class hl{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class y5{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(u){const f=Math.round((u-this.lng)/360);if(f!==0)for(const k in this.indexes){const P=this.indexes[k],D={};for(const R in P){const U=P[R];U.tileID=U.tileID.unwrapTo(U.tileID.wrap+f),D[U.tileID.key]=U}this.indexes[k]=D}this.lng=u}addBucket(u,f,k){if(this.indexes[u.overscaledZ]&&this.indexes[u.overscaledZ][u.key]){if(this.indexes[u.overscaledZ][u.key].bucketInstanceId===f.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(u.overscaledZ,this.indexes[u.overscaledZ][u.key])}for(let D=0;Du.overscaledZ)for(const U in R){const G=R[U];G.tileID.isChildOf(u)&&G.findMatches(f.symbolInstances,u,P)}else{const U=R[u.scaledTo(Number(D)).key];U&&U.findMatches(f.symbolInstances,u,P)}}for(let D=0;D{f[k]=!0});for(const k in this.layerIndexes)f[k]||delete this.layerIndexes[k]}}const zm=771;class bn{constructor(u,f,k,P){this.blendFunction=u,this.blendColor=f.toNonPremultipliedRenderColor(null),this.mask=k,this.blendEquation=P}}bn.Replace=[1,0,1,0],bn.disabled=new bn(bn.Replace,i.ao.transparent,[!1,!1,!1,!1]),bn.unblended=new bn(bn.Replace,i.ao.transparent,[!0,!0,!0,!0]),bn.alphaBlended=new bn([1,zm,1,zm],i.ao.transparent,[!0,!0,!0,!0]),bn.alphaBlendedNonPremultiplied=new bn([770,zm,770,zm],i.ao.transparent,[!0,!0,!0,!0]),bn.multiply=new bn([774,0,774,0],i.ao.transparent,[!0,!0,!0,!0]),bn.additive=new bn([1,1,1,1],i.ao.transparent,[!0,!0,!0,!0]);class ks{constructor(u,f,k){this.func=u,this.mask=f,this.range=k}}ks.ReadOnly=!1,ks.ReadWrite=!0,ks.disabled=new ks(519,ks.ReadOnly,[0,1]);const sN=7680;class Xs{constructor(u,f,k,P,D,R){this.test=u,this.ref=f,this.mask=k,this.fail=P,this.depthFail=D,this.pass=R}}Xs.disabled=new Xs({func:519,mask:0},0,0,sN,sN,sN);const o0=1029,nN=2305;class Zs{constructor(u,f,k){this.enable=u,this.mode=f,this.frontFace=k}}function Bm(w,u){const f=i.ca(w,3);i.cc(w,u),i.cg(w,3,f)}function v5(w,u){const f=i.c7([]);return i.c8(f,f,-u),i.c9(f,f,-w),f}function aN(w,u){const f=[w[0],w[1],0],k=[u[0],u[1],0];if(i.ag(f)>=1e-15){const R=i.aw([],f);i.c5(k,R,i.bJ(k,R)),u[0]=k[0],u[1]=k[1]}const P=i.bI([],u,w);if(i.c6(P)<1e-15)return null;const D=Math.atan2(-P[1],P[0]);return v5(Math.atan2(Math.sqrt(w[0]*w[0]+w[1]*w[1]),-w[2]),D)}Zs.disabled=new Zs(!1,o0,nN),Zs.backCCW=new Zs(!0,o0,nN),Zs.backCW=new Zs(!0,o0,2304),Zs.frontCW=new Zs(!0,1028,2304),Zs.frontCCW=new Zs(!0,1028,nN);class Cd{constructor(u,f){this.position=u,this.orientation=f}get position(){return this._position}set position(u){if(u){const f=u instanceof i.ae?u:new i.ae(u[0],u[1],u[2]);this._renderWorldCopies&&(f.x=i.bT(f.x,0,1)),this._position=f}else this._position=null}lookAtPoint(u,f,k){if(this.orientation=null,!this.position)return;const P=this.position,D=k||(this._elevation?this._elevation.getAtPointOrZero(i.ae.fromLngLat(u)):0),R=i.ae.fromLngLat(u,D),U=[R.x-P.x,R.y-P.y,R.z-P.z];f||(f=[0,0,1]),f[2]=Math.abs(f[2]),this.orientation=aN(U,f)}setPitchBearing(u,f){this.orientation=v5(i.an(u),i.an(-f))}}class iN{constructor(u,f){this._transform=i.bA([]),this.orientation=f,this.position=u}get mercatorPosition(){const u=this.position;return new i.ae(u[0],u[1],u[2])}get position(){const u=i.ca(this._transform,3);return[u[0],u[1],u[2]]}set position(u){var f;u&&i.cg(this._transform,3,[(f=u)[0],f[1],f[2],1])}get orientation(){return this._orientation}set orientation(u){this._orientation=u||i.c7([]),u&&Bm(this._transform,this._orientation)}getPitchBearing(){const u=this.forward(),f=this.right();return{bearing:Math.atan2(-f[1],f[0]),pitch:Math.atan2(Math.sqrt(u[0]*u[0]+u[1]*u[1]),-u[2])}}setPitchBearing(u,f){this._orientation=v5(u,f),Bm(this._transform,this._orientation)}forward(){const u=i.ca(this._transform,2);return[-u[0],-u[1],-u[2]]}up(){const u=i.ca(this._transform,1);return[-u[0],-u[1],-u[2]]}right(){const u=i.ca(this._transform,0);return[u[0],u[1],u[2]]}getCameraToWorld(u,f){const k=new Float64Array(16);return i.bl(k,this.getWorldToCamera(u,f)),k}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(u,f,k){const P=this.position;i.c5(P,P,-u);const D=new Float64Array(16);return i.bq(D,[k,k,k]),i.br(D,D,P),D[10]*=f,D}getWorldToCamera(u,f){const k=new Float64Array(16),P=new Float64Array(4),D=this.position;return i.cb(P,this._orientation),i.c5(D,D,-u),i.cc(k,P),i.br(k,k,D),k[1]*=-1,k[5]*=-1,k[9]*=-1,k[13]*=-1,k[8]*=f,k[9]*=f,k[10]*=f,k[11]*=f,k}getCameraToClipPerspective(u,f,k,P){const D=new Float64Array(16);return i.cd(D,u,f,k,P),D}getCameraToClipOrthographic(u,f,k,P,D,R){const U=new Float64Array(16);return i.ce(U,u,f,k,P,D,R),U}getDistanceToElevation(u,f=!1){const k=u===0?0:i.cf(u,f?i.a$(this.position[1]):this.position[1]),P=this.forward();return(k-this.position[2])/P[2]}clone(){return new iN([...this.position],[...this.orientation])}}const Rl={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class oN{constructor(u=0,f=0,k=0,P=0){if(isNaN(u)||u<0||isNaN(f)||f<0||isNaN(k)||k<0||isNaN(P)||P<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=u,this.bottom=f,this.left=k,this.right=P}interpolate(u,f,k){return f.top!=null&&u.top!=null&&(this.top=i.ak(u.top,f.top,k)),f.bottom!=null&&u.bottom!=null&&(this.bottom=i.ak(u.bottom,f.bottom,k)),f.left!=null&&u.left!=null&&(this.left=i.ak(u.left,f.left,k)),f.right!=null&&u.right!=null&&(this.right=i.ak(u.right,f.right,k)),this}getCenter(u,f){const k=i.aA((this.left+u-this.right)/2,0,u),P=i.aA((this.top+f-this.bottom)/2,0,f);return new i.P(k,P)}equals(u){return this.top===u.top&&this.bottom===u.bottom&&this.left===u.left&&this.right===u.right}clone(){return new oN(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Qh=15;class _5{constructor(u,f,k,P,D,R,U){this.tileSize=512,this._renderWorldCopies=D===void 0||D,this._minZoom=u||0,this._maxZoom=f||22,this._minPitch=k??0,this._maxPitch=P??60,this.setProjection(R),this.setMaxBounds(U),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 oN,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new iN,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 u=new _5(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return u._elevation=this._elevation,u._centerAltitude=this._centerAltitude,u._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,u.tileSize=this.tileSize,u.mercatorFromTransition=this.mercatorFromTransition,u.width=this.width,u.height=this.height,u.cameraElevationReference=this.cameraElevationReference,u._center=this._center,u._setZoom(this.zoom),u._seaLevelZoom=this._seaLevelZoom,u.angle=this.angle,u._fov=this._fov,u._pitch=this._pitch,u._nearZ=this._nearZ,u._farZ=this._farZ,u._averageElevation=this._averageElevation,u._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,u._unmodified=this._unmodified,u._edgeInsets=this._edgeInsets.clone(),u._camera=this._camera.clone(),u._calcMatrices(),u.freezeTileCoverage=this.freezeTileCoverage,u.frustumCorners=this.frustumCorners,u._allowWorldUnderZoom=this._allowWorldUnderZoom,u}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||u===Number.NEGATIVE_INFINITY&&(!f||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const k=this._elevation;f||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&k.exaggeration()&&this._centerAltitudeValidForExaggeration!==k.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*k.exaggeration(),this._centerAltitudeValidForExaggeration=k.exaggeration()):(this._centerAltitude=u||0,this._centerAltitudeValidForExaggeration=k.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(this._centerAltitudeValidForExaggeration===void 0)return;const u=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(u)}sampleAverageElevation(){if(!this._elevation)return 0;const u=this._elevation,f=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],k=this.horizonLineFromTop();let P=0,D=0;for(let R=0;R{const Re=i.cY(he,me,pe,ke,_e);G.has(Re)||(D.push(new i.aQ(me,he,pe,ke,_e)),G.add(Re))};for(let me=0;mehe.canonical.z)continue;const pe=he.canonical,ke=he.overscaledZ,_e=he.wrap,Re=1<0,nt=pe.y+10,kt=he.wrap-(He?0:1),xt=he.wrap+(De?0:1),_t=He?pe.x-1:Re-1,gt=De?pe.x+1:0;if(R)k[0]<0?(J(ke,xt,pe.z,gt,pe.y),k[1]<0&&nt&&(J(ke,_e,pe.z,pe.x,pe.y+1),J(ke,xt,pe.z,gt,pe.y+1)),k[1]>0&&We&&(J(ke,_e,pe.z,pe.x,pe.y-1),J(ke,xt,pe.z,gt,pe.y-1))):k[0]>0?(J(ke,kt,pe.z,_t,pe.y),k[1]<0&&nt&&(J(ke,_e,pe.z,pe.x,pe.y+1),J(ke,kt,pe.z,_t,pe.y+1)),k[1]>0&&We&&(J(ke,_e,pe.z,pe.x,pe.y-1),J(ke,kt,pe.z,_t,pe.y-1))):k[1]<0&&nt?J(ke,_e,pe.z,pe.x,pe.y+1):We&&J(ke,_e,pe.z,pe.x,pe.y-1);else{const ut=he.visibleQuadrants;1&ut&&(J(ke,kt,pe.z,_t,pe.y),We&&(J(ke,_e,pe.z,pe.x,pe.y-1),J(ke,kt,pe.z,_t,pe.y-1))),2&ut&&(J(ke,xt,pe.z,gt,pe.y),We&&(J(ke,_e,pe.z,pe.x,pe.y-1),J(ke,xt,pe.z,gt,pe.y-1))),4&ut&&(J(ke,kt,pe.z,_t,pe.y),nt&&(J(ke,_e,pe.z,pe.x,pe.y+1),J(ke,kt,pe.z,_t,pe.y+1))),8&ut&&(J(ke,xt,pe.z,gt,pe.y),nt&&(J(ke,_e,pe.z,pe.x,pe.y+1),J(ke,xt,pe.z,gt,pe.y+1)))}}const te=[];for(const me of D)D.some(he=>me.isChildOf(he))||te.push(me);if(D=te.filter(me=>!u.some(he=>!!(me.overscaledZ{const De=Re.canonical.x+.5-pe[0],He=Re.canonical.y+.5-pe[1];return De*De+He*He<_e})}return D}extendTileCoverToNearPlane(u,f,k){const P=[],D=new Set;for(const He of u)D.add(He.key);const R=(He,nt,We,kt,xt)=>{const _t=i.cY(nt,He,We,kt,xt);D.has(_t)||(P.push(new i.aQ(He,nt,We,kt,xt)),D.add(_t))},U=u.reduce((He,nt)=>Math.max(He,nt.overscaledZ),k),G=1<{const We=Math.floor(He[0]),kt=Math.floor(He[1]),xt=(He[0]-We)*i.al,_t=(He[1]-kt)*i.al,gt=Math.floor(nt[0]),ut=Math.floor(nt[1]),Tt=(nt[0]-gt)*i.al,Bt=(nt[1]-ut)*i.al;for(let zt=-1;zt<=1;zt++){const Qt=We+zt;if(!(Qt<0||Qt>=G)){te.x=xt-zt*i.al,me.x=Tt-(Qt-gt)*i.al;for(let er=-1;er<=1;er++){const ur=kt+er;te.y=_t-er*i.al,me.y=Bt-(ur-ut)*i.al,i.cZ(te,me,J)&&R(U,0,k,Qt,ur)}}}},pe=f.points,ke=pe[i.cv],_e=pe[i.cw],Re=this._projectToGround(ke,pe[i.cx]),De=this._projectToGround(_e,pe[i.cy]);return he(ke,Re),he(_e,De),P}_projectToGround(u,f){return i.cz(i.cA(),u,f,u[2]/(u[2]-f[2]))}coveringTiles(u){let f=this.coveringZoomLevel(u);const k=f,P=this.elevation&&this.elevation.exaggeration(),D=P&&!u.isTerrainDEM,R=this.projection.name==="mercator";if(u.minzoom!==void 0&&fu.maxzoom&&(f=u.maxzoom);const U=this.locationCoordinate(this.center),G=this.center.lat,J=1<{const Xt=new i.ae(Pt.x+25e-6,Pt.y,Pt.z),gr=new i.ae(Pt.x,Pt.y+25e-6,Pt.z),$r=Pt.toLngLat(),rs=Xt.toLngLat(),Or=gr.toLngLat(),Tr=this.locationCoordinate($r),vs=this.locationCoordinate(rs),ps=this.locationCoordinate(Or),Qr=Math.hypot(vs.x-Tr.x,vs.y-Tr.y),ns=Math.hypot(ps.x-Tr.x,ps.y-Tr.y);return Math.sqrt(Qr*ns)*_t/25e-6},ut=Pt=>{const nr=kt,Xt=xt;return{aabb:i.cF(this,J,0,0,0,Pt,Xt,nr,this.projection),zoom:0,x:0,y:0,minZ:Xt,maxZ:nr,wrap:Pt,fullyVisible:!1}},Tt=[];let Bt=[];const zt=f,Qt=u.reparseOverscaled?k:f,er=(Re-this._centerAltitude)*_e,ur=Pt=>{if(!this._elevation||!Pt.tileID||!R)return;const nr=this._elevation.getMinMaxForTile(Pt.tileID),Xt=Pt.aabb;nr?(Xt.min[2]=nr.min,Xt.max[2]=nr.max,Xt.center[2]=(Xt.min[2]+Xt.max[2])/2):(Pt.shouldSplit=Kt(Pt),Pt.shouldSplit||(Xt.min[2]=Xt.max[2]=Xt.center[2]=this._centerAltitude))},Sr=(Pt,nr)=>{if(.707*nr{if(Pt.zoom=.9)return!0}else if(D&&(gr=Pt.aabb.distanceZ(De)*_e),this.projection.isReprojectedInTileSpace&&k<=5){const ns=Math.pow(2,Pt.zoom),Ps=gt(new i.ae((Pt.x+.5)/ns,(Pt.y+.5)/ns));$r=Ps>.85?1:Ps}if(!R&&!me){const ns=Math.sqrt(nr*nr+Xt*Xt+gr*gr);let Ps=(1<0;){const Pt=Tt.pop(),nr=Pt.x,Xt=Pt.y;let gr=Pt.fullyVisible;const $r=()=>this.projection.name==="globe"&&(Pt.y===0||Pt.y===(1<>1),vs={aabb:R?Pt.aabb.quadrant(rs):i.cF(this,J,Pt.zoom+1,Or,Tr,Pt.wrap,Pt.minZ,Pt.maxZ,this.projection),zoom:Pt.zoom+1,x:Or,y:Tr,wrap:Pt.wrap,fullyVisible:gr,tileID:void 0,shouldSplit:void 0,minZ:Pt.minZ,maxZ:Pt.maxZ};D&&!me&&(vs.tileID=new i.aQ(Pt.zoom+1===zt?Qt:Pt.zoom+1,Pt.wrap,Pt.zoom+1,Or,Tr),ur(vs)),Tt.push(vs)}else{const rs=Pt.zoom===zt?Qt:Pt.zoom;if(u.minzoom&&u.minzoom>rs)continue;let Or=0;if(!gr){let Qr=He?Pt.aabb.intersectsPrecise(pe):Pt.aabb.intersectsPreciseFlat(pe);if(Qr===0&&$r()){const ns=new i.cD(Pt.zoom,nr,Xt);Qr=i.cE(this,J,ns,!0).intersectsPrecise(pe)}if(Qr===0)continue;if(u.calculateQuadrantVisibility)if(pe.containsPoint(Pt.aabb.center))Or=15;else for(let ns=0;ns<4;ns++)Pt.aabb.quadrant(ns).intersects(pe)!==0&&(Or|=1<{const gr=[0,0,0,1],$r=[i.al,i.al,0,1],rs=this.calculateFogTileMatrix(Xt.tileID.toUnwrapped());i.aC(gr,gr,rs),i.aC($r,$r,rs);const Or=i.cG([],gr,$r),Tr=i.cH([],gr,$r),vs=i.c$(Or,Tr);if(vs===0)return!0;let ps=!1;const Qr=this._elevation;if(Qr&&vs>Pt&&nr!==0){const ns=this.calculateProjMatrix(Xt.tileID.toUnwrapped());let Ps;u.isTerrainDEM||(Ps=Qr.getMinMaxForTile(Xt.tileID)),Ps||(Ps={min:xt,max:kt});const hn=i.cI(this.rotation),ta=[hn[0]*i.al,hn[1]*i.al,Ps.max];i.af(ta,ta,ns),ps=(1-ta[1])*this.height*.5Pt.distanceSq-nr.distanceSq).map(Pt=>Pt.tileID)}resize(u,f){this.width=u,this.height=f,this.pixelsToGLUnits=[2/u,-2/f],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(u){return Math.pow(2,u)}scaleZoom(u){return Math.log2(u)}project(u){const f=i.aA(u.lat,-i.cJ,i.cJ),k=this.projection.project(u.lng,f);return new i.P(k.x*this.worldSize,k.y*this.worldSize)}unproject(u){return this.projection.unproject(u.x/this.worldSize,u.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(u,f){let k,P;const D=this.centerPoint;if(this.projection.name==="globe"){const U=this.worldSize;k=(f.x-D.x)/U,P=(f.y-D.y)/U}else{const U=this.pointCoordinate(f),G=this.pointCoordinate(D);k=U.x-G.x,P=U.y-G.y}const R=this.locationCoordinate(u);this.setLocation(new i.ae(R.x-k,R.y-P))}setLocation(u){this.center=this.coordinateLocation(u),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(u,f){return this.projection.locationPoint(this,u,f)}locationPoint3D(u,f){return this.projection.locationPoint(this,u,f,!0)}pointLocation(u){return this.coordinateLocation(this.pointCoordinate(u))}pointLocation3D(u,f){return this.coordinateLocation(this.pointCoordinate3D(u,f))}locationCoordinate(u,f){const k=f?i.cf(f,u.lat):void 0,P=this.projection.project(u.lng,u.lat);return new i.ae(P.x,P.y,k)}coordinateLocation(u){return this.projection.unproject(u.x,u.y)}pointRayIntersection(u,f){const k=f??this._centerAltitude,P=[u.x,u.y,0,1],D=[u.x,u.y,1,1];i.aC(P,P,this.pixelMatrixInverse),i.aC(D,D,this.pixelMatrixInverse);const R=D[3];i.cK(P,P,1/P[3]),i.cK(D,D,1/R);const U=P[2],G=D[2];return{p0:P,p1:D,t:U===G?0:(k-U)/(G-U)}}screenPointToMercatorRay(u){const f=[u.x,u.y,0,1],k=[u.x,u.y,1,1];return i.aC(f,f,this.pixelMatrixInverse),i.aC(k,k,this.pixelMatrixInverse),i.cK(f,f,1/f[3]),i.cK(k,k,1/k[3]),f[2]=i.cf(f[2],this._center.lat)*this.worldSize,k[2]=i.cf(k[2],this._center.lat)*this.worldSize,i.cK(f,f,1/this.worldSize),i.cK(k,k,1/this.worldSize),new i.ax([f[0],f[1],f[2]],i.aw([],i.av([],k,f)))}rayIntersectionCoordinate(u){const{p0:f,p1:k,t:P}=u,D=i.cf(f[2],this._center.lat),R=i.cf(k[2],this._center.lat);return new i.ae(i.ak(f[0],k[0],P)/this.worldSize,i.ak(f[1],k[1],P)/this.worldSize,i.ak(D,R,P))}pointCoordinate(u,f=this._centerAltitude){return this.projection.pointCoordinate(this,u.x,u.y,f)}pointCoordinate3D(u,f){if(!this.elevation)return this.pointCoordinate(u,f);let k=this.projection.pointCoordinate3D(this,u.x,u.y);if(k)return new i.ae(k[0],k[1],k[2]);let P=0,D=this.horizonLineFromTop();if(u.y>D)return this.pointCoordinate(u,f);const R=.02*D,U=u.clone();for(let G=0;G<10&&D-P>R;G++){U.y=i.ak(P,D,.66);const J=this.projection.pointCoordinate3D(this,U.x,U.y);J?(D=U.y,k=J):P=U.y}return k?new i.ae(k[0],k[1],k[2]):this.pointCoordinate(u)}isPointAboveHorizon(u){return this.projection.isPointAboveHorizon(this,u)}isPointOnSurface(u){if(u.y<0||u.y>this.height||u.x<0||u.x>this.width)return!1;if(this.elevation||this.zoom>=i.cL)return!this.isPointAboveHorizon(u);const f=this.pointCoordinate(u);return f.y>=0&&f.y<=1}_coordinatePoint(u,f){const k=f&&this.elevation?this.elevation.getAtPointOrZero(u,this._centerAltitude):this._centerAltitude,P=[u.x*this.worldSize,u.y*this.worldSize,k+u.toAltitude(),1];return i.aC(P,P,this.pixelMatrix),P[3]>0?new i.P(P[0]/P[3],P[1]/P[3]):new i.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:u,left:f}=this._edgeInsets,k=this.height-this._edgeInsets.bottom,P=this.width-this._edgeInsets.right,D=this.pointLocation3D(new i.P(f,u)),R=this.pointLocation3D(new i.P(P,u)),U=this.pointLocation3D(new i.P(P,k)),G=this.pointLocation3D(new i.P(f,k));let J=Math.min(D.lng,R.lng,U.lng,G.lng),te=Math.max(D.lng,R.lng,U.lng,G.lng),me=Math.min(D.lat,R.lat,U.lat,G.lat),he=Math.max(D.lat,R.lat,U.lat,G.lat);const pe=Math.pow(2,-this.zoom)/16*270,ke=this.projection.name==="globe"?1:4,_e=(Re,De,He,nt,We)=>{const kt=(Re+He)/2,xt=(De+nt)/2,_t=new i.P(kt,xt),{lng:gt,lat:ut}=this.pointLocation3D(_t),Tt=Math.max(0,J-gt,me-ut,gt-te,ut-he);J=Math.min(J,gt),te=Math.max(te,gt),me=Math.min(me,ut),he=Math.max(he,ut),(Wepe)&&(_e(Re,De,kt,xt,We+1),_e(kt,xt,He,nt,We+1))};if(_e(f,u,P,u,1),_e(P,u,P,k,1),_e(P,k,f,k,1),_e(f,k,f,u,1),this.projection.name==="globe"){const[Re,De]=i.cM(this);Re?(he=90,te=180,J=-180):De&&(me=-90,te=180,J=-180)}return new i.aI(new i.aT(J,me),new i.aT(te,he))}_getBoundsRectangular(u,f){const{top:k,left:P}=this._edgeInsets,D=this.height-this._edgeInsets.bottom,R=this.width-this._edgeInsets.right,U=new i.P(P,k),G=new i.P(R,k),J=new i.P(R,D),te=new i.P(P,D);let me=this.pointCoordinate(U,u),he=this.pointCoordinate(G,u);const pe=this.pointCoordinate(J,f),ke=this.pointCoordinate(te,f),_e=(Re,De)=>(De.y-Re.y)/(De.x-Re.x);return me.y>1&&he.y>=0?me=new i.ae((1-ke.y)/_e(ke,me)+ke.x,1):me.y<0&&he.y<=1&&(me=new i.ae(-ke.y/_e(ke,me)+ke.x,0)),he.y>1&&me.y>=0?he=new i.ae((1-pe.y)/_e(pe,he)+pe.x,1):he.y<0&&me.y<=1&&(he=new i.ae(-pe.y/_e(pe,he)+pe.x,0)),new i.aI().extend(this.coordinateLocation(me)).extend(this.coordinateLocation(he)).extend(this.coordinateLocation(ke)).extend(this.coordinateLocation(pe))}_getBoundsRectangularTerrain(){const u=this.elevation;if(!u.visibleDemTiles.length||u.isUsingMockSource())return this._getBoundsRectangular(0,0);const f=u.visibleDemTiles.reduce((k,P)=>{if(P.dem){const D=P.dem.tree;k.min=Math.min(k.min,D.minimums[0]),k.max=Math.max(k.max,D.maximums[0])}return k},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(f.min*u.exaggeration(),f.max*u.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(u=!0){const f=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,k=this.height/2-f*(1-this._horizonShift);return u?Math.max(0,k):k}getMaxBounds(){return this.maxBounds}setMaxBounds(u){this.maxBounds=u,this.minLat=-i.cJ,this.maxLat=i.cJ,this.minLng=-180,this.maxLng=180,u&&(this.minLat=u.getSouth(),this.maxLat=u.getNorth(),this.minLng=u.getWest(),this.maxLng=u.getEast(),this.maxLngme&&(U=me-J),me-tepe&&(R=pe-G),pe-he{for(let Kt=0;Kt<16;Kt++)Qt[Kt]=i.ak(er[Kt],ur[Kt],Sr)})(U,U,G,i.d0(this.pitch>=Qh?1:this.pitch/Qh))}else U=G;const J=i.cP([],G,R);let te=i.cP([],U,R);if(this.projection.isReprojectedInTileSpace){const ut=this.locationCoordinate(this.center),Tt=i.bA([]);i.br(Tt,Tt,[ut.x*this.worldSize,ut.y*this.worldSize,0]),i.aB(Tt,Tt,i.cQ(this)),i.br(Tt,Tt,[-ut.x*this.worldSize,-ut.y*this.worldSize,0]),i.aB(te,te,Tt),i.aB(J,J,Tt),this.inverseAdjustmentMatrix=i.cR(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=i.cS([],te,[this.worldSize,this.worldSize,this.worldSize/D,1]),this.projMatrix=te,this.invProjMatrix=i.bl(new Float64Array(16),this.projMatrix),f){const ut=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);ut[8]=2*-u.x/this.width,ut[9]=2*u.y/this.height,this.expandedFarZProjMatrix=i.cP([],ut,R)}else this.expandedFarZProjMatrix=this.projMatrix;const me=i.bl([],U);this.frustumCorners=i.cT.fromInvProjectionMatrix(me,this.horizonLineFromTop(),this.height),this.cameraFrustum=i.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!f);const he=new Float32Array(16);i.bA(he),i.cS(he,he,[1,-1,1]),i.cU(he,he,this._pitch),i.bB(he,he,this.angle);const pe=i.cd(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=i.bz(pe);const ke=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;pe[8]=2*-u.x/this.width,pe[9]=2*(u.y+ke)/this.height,this.skyboxMatrix=i.aB(he,pe,he);const _e=this.point,Re=_e.x,De=_e.y,He=this.width%2/2,nt=this.height%2/2,We=Math.cos(this.angle),kt=Math.sin(this.angle),xt=Re-Math.round(Re)+We*He+kt*nt,_t=De-Math.round(De)+We*nt+kt*He,gt=new Float64Array(te);if(i.br(gt,gt,[xt>.5?xt-1:xt,_t>.5?_t-1:_t,0]),this.alignedProjMatrix=gt,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,J),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 u=this.cameraWorldSizeForFog,f=this.cameraPixelsPerMeter,k=this._camera.position,P=1/this.height/this._pixelsPerMercatorPixel,D=[u,u,f];i.c5(D,D,P),i.c5(k,k,-1),i.cW(k,k,D);const R=i.bC();i.br(R,R,k),i.cS(R,R,D),this.mercatorFogMatrix=R,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(u,f,P)}_computeCameraPosition(u){const f=(u=u||this.pixelsPerMeter)/this.pixelsPerMeter,k=this._camera.forward(),P=this.point,D=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*f-u/this.worldSize*this._centerAltitude;return[P.x/this.worldSize-k[0]*D,P.y/this.worldSize-k[1]*D,u/this.worldSize*this._centerAltitude-k[2]*D]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(u){const f=this._maxCameraBoundsDistance()*Math.cos(this._pitch),k=this._camera.position[2],P=u[2];let D=1;this.projection.wrap&&(this.center=this.center.wrap()),P>0&&(D=Math.min((f-k)/P,1)),this._camera.position=i.bH([],this._camera.position,u,D),this._updateStateFromCamera()}_updateStateFromCamera(){const u=this._camera.position,f=this._camera.forward(),{pitch:k,bearing:P}=this._camera.getPitchBearing(),D=i.cf(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,R=this._mercatorZfromZoom(this._maxZoom)*Math.cos(i.an(this._maxPitch)),U=Math.max((u[2]-D)/Math.cos(k),R),G=this._zoomFromMercatorZ(U);i.bH(u,u,f,U),this._pitch=i.aA(k,i.an(this.minPitch),i.an(this.maxPitch)),this.angle=i.bT(P,-Math.PI,Math.PI),this._setZoom(i.aA(G,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new i.ae(u[0],u[1],u[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(u){return Math.pow(2,u)*this.tileSize}_mercatorZfromZoom(u){return this.cameraToCenterDistance/this._worldSizeFromZoom(u)}_minimumHeightOverTerrain(){const u=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(u)}_zoomFromMercatorZ(u){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,u)*this.tileSize))}zoomFromMercatorZAdjusted(u){let f=0,k=i.cL,P=0,D=1/0;for(;k-f>1e-6&&k>f;){const R=f+.5*(k-f),U=this.tileSize*Math.pow(2,R),G=this.getCameraToCenterDistance(this.projection,R,U),J=this.scaleZoom(G/(Math.max(0,u)*this.tileSize)),te=Math.abs(R-J);teJ||he.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(u,f){const k=i.ag(i.av([],this._camera.position,u)),P=this._zoomFromMercatorZ(k)+f;return k-this._mercatorZfromZoom(P)}getCameraPoint(){if(this.projection.name==="globe"){const u=function([f,k,P],D){const R=[f,k,P,1];i.aC(R,R,D);const U=R[3]=Math.max(R[3],1e-6);return R[0]/=U,R[1]/=U,R[2]/=U,R}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new i.P(u[0],u[1])}{const u=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.P(0,u))}}getCameraToCenterDistance(u,f=this.zoom,k=this.worldSize){const P=i.cO(u,f,this.width,this.height,1024),D=u.pixelSpaceConversion(this.center.lat,k,P);let R=.5/Math.tan(.5*this._fov)*this.height*D;return this.isOrthographic&&(R=i.ak(1,R,i.d0(this.pitch>=Qh?1:this.pitch/Qh))),R}getWorldToCameraMatrix(){const u=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&i.aB(u,u,this.globeMatrix),u}getFrustum(u){return i.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,u,this.projection.zAxisUnit==="meters")}}const ag=(w,u)=>{if(u>0&&w.terrain&&i.w("Cutoff is currently disabled on terrain"),u<=0||w.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const f=w.transform,k=Math.max(Math.abs(f._zoom-(w.minCutoffZoom-1)),1),P=f.isLODDisabled(!1)?i.ah(60,45,f.pitch):i.ah(30,15,f.pitch),D=f._farZ-f._nearZ,R=u*f.height,U=((1-(G=P))*f.cameraToCenterDistance+G*(f._farZ+R))*k;var G;return{shouldRenderCutoff:P<1,uniformValues:{u_cutoff_params:[f._nearZ,f._farZ,(U-f._nearZ)/D,(U-R-f._nearZ)/D]}}},yh=2048;class Kv{constructor(u,f){this.aabb=u,this.lastCascade=f}}class Kie{add(u,f){const k=this.receivers[u.key];k!==void 0?(k.aabb.min[0]=Math.min(k.aabb.min[0],f.min[0]),k.aabb.min[1]=Math.min(k.aabb.min[1],f.min[1]),k.aabb.min[2]=Math.min(k.aabb.min[2],f.min[2]),k.aabb.max[0]=Math.max(k.aabb.max[0],f.max[0]),k.aabb.max[1]=Math.max(k.aabb.max[1],f.max[1]),k.aabb.max[2]=Math.max(k.aabb.max[2],f.max[2])):this.receivers[u.key]=new Kv(f,null)}clear(){this.receivers={}}get(u){return this.receivers[u.key]}computeRequiredCascades(u,f,k){const P=i.d9.fromPoints(u.points);let D=0;for(const R in this.receivers){const U=this.receivers[R];if(!U||!P.intersectsAabb(U.aabb))continue;U.aabb.min=P.closestPoint(U.aabb.min),U.aabb.max=P.closestPoint(U.aabb.max);const G=U.aabb.getCorners();for(let J=0;J1||he[1]<-1||he[1]>1){te=!1;break}}if(U.lastCascade=J,D=Math.max(D,J),te)break}}return D+1}}class l0{constructor(u){this.painter=u,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new Kie,this._depthMode=new ks(u.context.gl.LEQUAL,ks.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 u of this._cascades)u.texture.destroy(),u.framebuffer.destroy();this._cascades=[]}updateShadowParameters(u,f){const k=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!f||!f.properties)return;const P=f.properties.get("shadow-intensity");if(!f.shadowsEnabled()||P<=0||(this._shadowLayerCount=k.style.order.reduce((ke,_e)=>{const Re=k.style._mergedLayers[_e];return ke+(Re.hasShadowPass()&&!Re.isHidden(u.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const D=k.context,R=yh,U=yh;if(this._cascades.length===0||yh!==this._cascades[0].texture.size[0]){this._cascades=[];for(let ke=0;ke<2;++ke){const _e=k._shadowMapDebug,Re=D.gl,De=D.createFramebuffer(R,U,_e?1:0,"texture"),He=new i.T(D,{width:R,height:U,data:null},Re.DEPTH_COMPONENT16);if(De.depthAttachment.set(He.texture),_e){const nt=new i.T(D,{width:R,height:U,data:null},Re.RGBA8);De.colorAttachment0.set(nt.texture)}this._cascades.push({framebuffer:De,texture:He,matrix:[],far:0,boundingSphereRadius:0,frustum:new i.cB,scale:0})}}this.shadowDirection=Yv(f);let G=0;if(u.elevation){const ke=u.elevation,_e=[1e4,-1e4];ke.visibleDemTiles.filter(Re=>Re.dem).forEach(Re=>{const De=Re.dem.tree;_e[0]=Math.min(_e[0],De.minimums[0]),_e[1]=Math.max(_e[1],De.maximums[0])}),_e[0]!==1e4&&(G=(_e[1]-_e[0])*ke.exaggeration())}const J=1.5*u.cameraToCenterDistance,te=3*J,me=new Float64Array(16);for(let ke=0;ke=0)return{};const D=function(G,J,te){const me=te/(1<0&&(i.d8(D[1],D[1],[P[0]*R,0,0]),i.d8(D[2],D[2],[P[0]*R,0,0])),P[1]<0?(i.d8(D[0],D[0],[0,P[1]*R,0]),i.d8(D[1],D[1],[0,P[1]*R,0])):P[1]>0&&(i.d8(D[2],D[2],[0,P[1]*R,0]),i.d8(D[3],D[3],[0,P[1]*R,0]));const U={};return U.vertices=D,U.planes=[Zv(D[1],D[0],D[4]),Zv(D[2],D[1],D[5]),Zv(D[3],D[2],D[6]),Zv(D[0],D[3],D[7])],U}addShadowReceiver(u,f,k){this._receivers.add(u,i.d9.fromTileIdAndHeight(u,f,k))}getMaxCascadeForTile(u){const f=this._receivers.get(u);return f&&f.lastCascade?f.lastCascade:0}}function Zv(w,u,f){const k=i.av([],f,u),P=i.av([],w,u),D=i.bI([],k,P),R=i.ag(D);return R===0?[0,0,1,0]:(i.c5(D,D,1/R),[D[0],D[1],D[2],-i.bJ(D,u)])}function Yv(w){const u=w.properties.get("direction"),f=i.d4(u.x,u.y,u.z);f[2]=i.aA(f[2],0,75);const k=i.d6([f[0],f[1],f[2]]);return i.d5(k.x,k.y,k.z)}function Bp(w,u,f){const k=u.properties.get("color-use-theme")==="none",P=u.properties.get("color"),D=u.properties.get("intensity"),R=u.properties.get("direction"),U=[R.x,R.y,R.z],G=f.properties.get("color-use-theme")==="none",J=f.properties.get("color"),te=f.properties.get("intensity"),me=Math.max(i.bJ([0,0,1],U),0),he=[0,0,0];i.c5(he,J.toPremultipliedRenderColor(G?null:w.getLut(u.scope)).toArray01Linear().slice(0,3),te);const pe=[0,0,0];return i.c5(pe,P.toPremultipliedRenderColor(k?null:w.getLut(f.scope)).toArray01Linear().slice(0,3),me*D),i.db([he[0]>0?he[0]/(he[0]+pe[0]):0,he[1]>0?he[1]/(he[1]+pe[1]):0,he[2]>0?he[2]/(he[2]+pe[2]):0])}function ig(w,u,f,k,P,D){const R=w.zoom,U=w.scale,G=w.worldSize,J=1/G,te=w.aspect,me=Math.sqrt(1+te*te)*Math.tan(.5*w.fovX),he=me*me,pe=k-f,ke=k+f;let _e,Re;he>pe/ke?(_e=k,Re=k*me):(_e=.5*ke*(1+he),Re=.5*Math.sqrt(pe*pe+2*(k*k+f*f)*he+ke*ke*he*he));const De=w.projection.pixelsPerMeter(w.center.lat,G),He=w._camera.getCameraToWorldMercator(),nt=[0,0,-_e*J];i.af(nt,nt,He);let We=Re*J;const kt=w._edgeInsets;if(!(kt.left===0&&kt.top===0&&kt.right===0&&kt.bottom===0||kt.left===kt.right&&kt.top===kt.bottom)){const gr=w._camera.getWorldToCamera(w.worldSize,w.projection.zAxisUnit==="meters"?De:1),$r=w._camera.getCameraToClipPerspective(w._fov,w.width/w.height,f,k);$r[8]=2*-w.centerOffset.x/w.width,$r[9]=2*w.centerOffset.y/w.height;const rs=new Float64Array(16);i.cP(rs,$r,gr);const Or=new Float64Array(16);i.bl(Or,rs);const Tr=i.cB.fromInvProjectionMatrix(Or,G,R,!0);for(const vs of Tr.points){const ps=((xt=vs)[0]/=U,xt[1]/=U,xt[2]=i.cf(xt[2],w._center.lat),xt);We=Math.max(We,i.c6(i.da([],nt,ps)))}}var xt;We*=P/(P-1);const _t=Math.acos(u[2]),gt=Math.atan2(-u[0],-u[1]),ut=new iN;ut.position=nt,ut.setPitchBearing(_t,gt);const Tt=ut.getWorldToCamera(G,De),Bt=We*G,zt=Math.min(w._mercatorZfromZoom(17)*G*-2,-2*Bt),Qt=ut.getCameraToClipOrthographic(-Bt,Bt,-Bt,Bt,zt,(Bt+D*De)/u[2]),er=new Float64Array(16);i.aB(er,Qt,Tt);const ur=i.d5(Math.floor(1e6*nt[0])/1e6*G,Math.floor(1e6*nt[1])/1e6*G,0),Sr=.5*P,Kt=[0,0,0];i.af(Kt,ur,er),i.c5(Kt,Kt,Sr);const Pt=[Math.floor(Kt[0]),Math.floor(Kt[1]),Math.floor(Kt[2])],nr=[0,0,0];i.av(nr,Kt,Pt),i.c5(nr,nr,-1/Sr);const Xt=new Float64Array(16);return i.bA(Xt),i.br(Xt,Xt,nr),i.aB(er,Xt,er),[er,Bt]}class Zie extends i.E{constructor(u){super(),this.requestManager=u,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(u,f){return i.dc(this.requestManager.transformRequest(f,i.R.Model).url).then(k=>{if(!k)return;const P=i.dd(k),D=new i.de(u,f,void 0,void 0,P);return D.computeBoundsAndApplyParent(),D}).catch(k=>{if(k&&k.status===404)return null;this.fire(new i.y(new Error(`Could not load model ${u} from ${f}: ${k.message}`)))})}load(u,f,k={forceReload:!1}){this.models[f]||(this.models[f]={});const P=Object.keys(u),D=[],R=[];for(const U of P){const G=u[U];this.hasURLBeenRequested(G)&&!k.forceReload||(this.modelByURL[G]={modelId:U,scope:f},D.push(this.loadModel(U,G)),R.push(U)),this.models[f][U]||(this.models[f][U]={model:null,numReferences:1})}this.numModelsLoading[f]=(this.numModelsLoading[f]||0)+R.length,Promise.allSettled(D).then(U=>{for(let G=0;G{this.fire(new i.y(new Error(`Could not load models: ${U.message}`)))})}isLoaded(){for(const u in this.numModelsLoading)if(this.numModelsLoading[u]>0)return!1;return!0}hasModel(u,f,k={exactIdMatch:!1}){return!!(k.exactIdMatch?this.getModel(u,f):this.getModelByURL(this.modelUris[f][u]))}getModel(u,f){return this.models[f]||(this.models[f]={}),this.models[f][u]?this.models[f][u].model:void 0}getModelByURL(u){if(!u)return null;const f=this.modelByURL[u];return f?this.models[f.scope][f.modelId].model:null}hasModelBeenAdded(u,f){return this.models[f]&&this.models[f][u]!==void 0}getModelURIs(u){return this.modelUris[u]||{}}addModel(u,f,k){this.models[k]||(this.models[k]={}),this.modelUris[k]||(this.modelUris[k]={});const P=this.requestManager.normalizeModelURL(f);if((this.hasModel(u,k,{exactIdMatch:!0})||this.hasModelBeenAdded(u,k))&&this.modelUris[k][u]===P)this.models[k][u].numReferences++;else if(this.hasURLBeenRequested(P)){const{scope:D,modelId:R}=this.modelByURL[P];this.models[D][R].numReferences++}else this.modelUris[k][u]=P,this.load({[u]:this.modelUris[k][u]},k)}addModelURLs(u,f){this.models[f]||(this.models[f]={}),this.modelUris[f]||(this.modelUris[f]={});const k=this.modelUris[f];for(const P in u)k[P]=this.requestManager.normalizeModelURL(u[P])}reloadModels(u){this.load(this.modelUris[u],u,{forceReload:!0})}addModelsFromBucket(u,f){this.models[f]||(this.models[f]={}),this.modelUris[f]||(this.modelUris[f]={});const k={};for(const P of u)this.hasModel(P,f,{exactIdMatch:!0})||this.hasURLBeenRequested(P)?this.models[f][P].numReferences++:this.modelUris[f][P]&&!this.hasURLBeenRequested(P)?k[P]=this.modelUris[f][P]:!this.hasURLBeenRequested(P)&&i.df(P,!1)&&(this.modelUris[f][P]=this.requestManager.normalizeModelURL(P),k[P]=this.modelUris[f][P]);this.load(k,f)}hasURLBeenRequested(u){return this.modelByURL[u]!==void 0}removeModel(u,f,k=!1,P=!1){if(this.models[f]&&this.models[f][u]&&(this.models[f][u].numReferences--,this.models[f][u].numReferences===0||P)){const D=this.modelUris[f][u];k||delete this.modelUris[f][u],delete this.modelByURL[D];const R=this.models[f][u].model;if(!R)return;delete this.models[f][u],R.destroy()}}destroy(){for(const u of Object.keys(this.models))for(const f of Object.keys(this.models[u])){const k=this.models[u][f].model;delete this.models[u][f],k&&k.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(u){return this.models[u]||(this.models[u]={}),Object.keys(this.models[u])}upload(u,f){this.models[f]||(this.models[f]={});for(const k in this.models[f])this.models[f][k].model&&this.models[f][k].model.upload(u.context)}}const b5=i.a6.colorTheme,Yie=new i.a9({data:new i.aa(b5.data)});function KP(w){if(!w.metadata||!w.metadata.content_area)return;const u=i.o.devicePixelRatio,{left:f,top:k,width:P,height:D}=w.metadata.content_area,R=f*u,U=k*u;return[R,U,R+P*u,U+D*u]}function ZP(w){if(w)return w.map(([u,f])=>[u*i.o.devicePixelRatio,f*i.o.devicePixelRatio])}class w5{constructor(u,f,k){this.id=u,this.scope=f,this.sourceCache=k,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(u){this.missingRequests.has(u.name)||this.pendingRequests.has(u.name)||this.pendingRequests.add(u.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const u=new Map;if(!this.sourceCache.loaded())return u;const f=this.sourceCache.getVisibleCoordinates();if(f.length===0)return u;const k=this.sourceCache.getSource();if(!(k instanceof yc))return u;const P=f.map(R=>this.sourceCache.getTile(R)),D=k.getImages(P,Array.from(this.pendingRequests));for(const[R,U]of D)u.set(i.I.from({name:R,iconsetId:this.id}),U),this.pendingRequests.delete(R);for(const R of this.pendingRequests)this.missingRequests.add(R);return this.pendingRequests.clear(),u}}const og=(w,u)=>Ke(w,u&&u.filter(f=>f.identifier!=="source.canvas")),YP=i.aH(aa,["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"]),XP=i.aH(aa,["setCenter","setZoom","setBearing","setPitch"]),lN=new Set(["background","sky","slot","custom"]),lg={version:8,layers:[],sources:{}},Xv={duration:300,delay:0};class vh extends i.E{constructor(u,f={}){super(),this.map=u,this.scope=f.scope||"",this.globalId=null,this.fragments=[],this.importDepth=f.importDepth||0,this.importsCache=f.importsCache||new Map,this.resolvedImports=f.resolvedImports||new Set,this.transition=Object.assign({},Xv),this._buildingIndex=new p5(this),this.crossTileSymbolIndex=new Xh,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=f.styleChanges||new je,this._hasDataDrivenEmissive=!1,this.dispatcher=f.dispatcher?f.dispatcher:new i.D(i.dh(),this),f.imageManager?this.imageManager=f.imageManager:(this.imageManager=new Me(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=f.glyphManager?f.glyphManager:new i.di(u._requestManager,f.localFontFamily?i.dj.all:f.localIdeographFontFamily?i.dj.ideographs:i.dj.none,f.localFontFamily||f.localIdeographFontFamily),f.modelManager?this.modelManager=f.modelManager:(this.modelManager=new Zie(u._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=f.configOptions?f.configOptions:new Map,this._configDependentLayers=f.configDependentLayers?f.configDependentLayers:new Set,this._indoorDependentLayers=f.indoorDependentLayers?f.indoorDependentLayers:new Set,this._config=f.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:f.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=f.initialConfig,this.dispatcher.broadcast("setReferrer",i.dk());const k=this;this._rtlTextPluginCallback=vh.registerForPluginStateChange(P=>{k.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:P.pluginStatus,pluginURL:P.pluginURL},(D,R)=>{if(i.dl(D),R&&R.every(U=>U))for(const U in k._sourceCaches){const G=k._sourceCaches[U],J=G.getSource().type;J!=="vector"&&J!=="geojson"||G.reload()}})}),this.on("data",P=>{if(P.dataType!=="source"||P.sourceDataType!=="metadata")return;const D=this.getOwnSource(P.sourceId);if(D&&D.vectorLayerIds)for(const R in this._layers){const U=this._layers[R];U.source===D.id&&this._validateLayer(U)}})}load(u){return u?(typeof u=="string"?this.loadURL(u):this.loadJSON(u),this):this}_getGlobalId(u){if(!u)return null;if(typeof u=="string"){if(i.h(u))return u;const f=i.dm(u);if(!f.startsWith("http"))try{return new URL(f,location.href).toString()}catch{return f}return f}return`json://${i.dn(JSON.stringify(u))}`}_diffStyle(u,f,k){this.globalId=this._getGlobalId(u);const P=(D,R)=>{try{R(null,this.setState(D,k))}catch(U){R(U,!1)}};if(typeof u=="string"){const D=this.map._requestManager.normalizeStyleURL(u),R=this.map._requestManager.transformRequest(D,i.R.Style);i.m(R,(U,G)=>{U?this.fire(new i.y(U)):G&&P(G,f)})}else typeof u=="object"&&P(u,f)}loadURL(u,f={}){this.fire(new i.z("dataloading",{dataType:"style"}));const k=typeof f.validate=="boolean"?f.validate:!i.h(u);this.globalId=this._getGlobalId(u),u=this.map._requestManager.normalizeStyleURL(u,f.accessToken),this.resolvedImports.add(u);const P=this.importsCache.get(u);if(P)return this._load(P,k);const D=this.map._requestManager.transformRequest(u,i.R.Style);this._request=i.m(D,(R,U)=>{if(this._request=null,R)this.fire(new i.y(R));else if(U)return this.importsCache.set(u,U),this._load(U,k)})}loadJSON(u,f={}){this.fire(new i.z("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(u),this._request=i.o.frame(()=>{this._request=null,this._load(u,f.validate!==!1)})}loadEmpty(){this.fire(new i.z("dataloading",{dataType:"style"})),this._load(lg,!1)}_loadImports(u,f,k){if(this.importDepth>=4)return i.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const P=[];for(const D of u){const R=this._createFragmentStyle(D),U=new Promise(te=>{R.once("style.import.load",te),R.once("error",te)}).then(()=>this.mergeAll());if(P.push(U),this.resolvedImports.has(D.url)){R.loadEmpty();continue}const G=D.data||this.importsCache.get(D.url);G?(R.loadJSON(G,{validate:f}),this._isInternalStyle(G)&&(R.globalId=null)):D.url?R.loadURL(D.url,{validate:f}):R.loadEmpty();const J={style:R,id:D.id,config:D.config};if(k){const te=this.fragments.findIndex(({id:me})=>me===k);this.fragments=this.fragments.slice(0,te).concat(J).concat(this.fragments.slice(te))}else this.fragments.push(J)}return Promise.allSettled(P)}getImportGlobalIds(u=this,f=new Set){for(const k of u.fragments)k.style.globalId&&f.add(k.style.globalId),this.getImportGlobalIds(k.style,f);return[...f.values()]}_createFragmentStyle(u){const f=this.scope?i.B(u.id,this.scope):u.id;let k;const P=this._initialConfig&&this._initialConfig[f];(u.config||P)&&(k=Object.assign({},u.config,P));const D=new vh(this.map,{scope:f,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:k,configOptions:this.options,colorThemeOverride:u["color-theme"],configDependentLayers:this._configDependentLayers,indoorDependentLayers:this._indoorDependentLayers});return D.setEventedParent(this.map,{style:D}),D}_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(u){return this.isRootStyle()&&(u.fragment||!!u.schema&&u.fragment!==!1)}_load(u,f){if(this._isInternalStyle(u)){const D=Object.assign({},lg,{imports:[{id:"basemap",data:u,url:""}]},u.center?{center:u.center}:{},u.bearing?{bearing:u.bearing}:{},u.pitch?{pitch:u.pitch}:{},u.zoom?{zoom:u.zoom}:{},u.light?{light:u.light}:{});return this._importedAsBasemap=!0,void this._load(D,f)}if(this.updateConfig(this._config,u.schema),f&&og(this,Gn(u)))return;this._loaded=!0,this.stylesheet=i.dp(u);const k=()=>{for(const G in u.sources)this.addSource(G,u.sources[G],{validate:!1,isInitialLoad:!0});if(u.iconsets)for(const G in u.iconsets)this.addIconset(G,u.iconsets[G]);u.sprite?this._loadIconset(u.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&u.glyphs&&this.glyphManager.setURL(u.glyphs);const D=yx(this.stylesheet.layers);if(this._order=D.map(G=>G.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 G=this.stylesheet.lights[0];this.light=new Lt(G.properties,G.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new Lt(this.stylesheet.light)),this._layers={};for(const G of D){const J=i.du(G,this.scope,this._styleColorTheme.lut,this.options);J.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(J.fqid),J.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(J.fqid),this._hasAppearances=this._hasAppearances||J.getAppearances().length!==0,J.setEventedParent(this,{layer:{id:J.id}}),this._layers[J.id]=J;const te=this.getOwnLayerSourceCache(J),me=!!this.directionalLight&&this.directionalLight.shadowsEnabled();te&&J.canCastShadows()&&me&&(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 U=this.isRootStyle();u.imports?this._loadImports(u.imports,f).then(()=>{this._reloadImports(),this.fire(new i.z(U?"style.load":"style.import.load"))}).catch(G=>{this.fire(new i.y(new Error("Failed to load imports",G))),this.fire(new i.z(U?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new i.z(U?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const P=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(P){const D=this._evaluateColorThemeData(P);this._loadColorTheme(D).then(()=>{k()}).catch(R=>{i.w(`Couldn't load color theme from the stylesheet: ${R}`),k()})}else this._styleColorTheme.lut=null,k()}isRootStyle(){return this.importDepth===0}hasAppearances(){return this._hasAppearances||this.fragments.some(u=>u.style.hasAppearances())}mergeAll(){let u,f,k,P,D,R,U,G,J,te;const me={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(he=>{if(he.stylesheet){if(he.light!=null&&(u=he.light),he.stylesheet.lights)for(const pe of he.stylesheet.lights)pe.type==="ambient"&&he.ambientLight!=null&&(f=he.ambientLight),pe.type==="directional"&&he.directionalLight!=null&&(k=he.directionalLight);P=this._prioritizeTerrain(P,he.terrain,he.stylesheet.terrain),he.stylesheet.fog&&he.fog!=null&&(D=he.fog),he.stylesheet.snow&&he.snow!=null&&(R=he.snow),he.stylesheet.rain&&he.rain!=null&&(U=he.rain),he.stylesheet.camera!=null&&(te=he.stylesheet.camera),he.stylesheet.projection!=null&&(G=he.stylesheet.projection),he.stylesheet.transition!=null&&(J=he.stylesheet.transition),me[he.scope]=he._styleColorTheme}}),this.light=u,this.ambientLight=f,this.directionalLight=k,this.fog=D,this.snow=R,this.rain=U,this._styleColorThemeForScope=me,P===null?delete this.terrain:this.terrain=P,this.camera=te||{"camera-projection":"perspective"},this.projection=G||{name:"mercator"},this.transition=Object.assign({},Xv,J),this.mergeSources(),this.mergeLayers(),this.mergeIndoor()}forEachFragmentStyle(u){const f=k=>{for(const P of k.fragments)f(P.style);u(k)};f(this)}_prioritizeTerrain(u,f,k){const P=u&&u.drapeRenderMode===0;return k===null?f&&f.drapeRenderMode===0?f:P?u:null:f!=null&&(!u||P||f&&f.drapeRenderMode===1)?f:u}mergeTerrain(){let u;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(f=>{u=this._prioritizeTerrain(u,f.terrain,f.stylesheet.terrain)}),u===null?delete this.terrain:this.terrain=u}mergeProjection(){let u;this.forEachFragmentStyle(f=>{f.stylesheet.projection!=null&&(u=f.stylesheet.projection)}),this.projection=u||{name:"mercator"}}mergeSources(){const u={},f={},k={};this.forEachFragmentStyle(P=>{for(const D in P._sourceCaches){const R=i.B(D,P.scope);u[R]=P._sourceCaches[D]}for(const D in P._otherSourceCaches){const R=i.B(D,P.scope);f[R]=P._otherSourceCaches[D]}for(const D in P._symbolSourceCaches){const R=i.B(D,P.scope);k[R]=P._symbolSourceCaches[D]}}),this._mergedSourceCaches=u,this._mergedOtherSourceCaches=f,this._mergedSymbolSourceCaches=k}mergeIndoor(){this.forEachFragmentStyle(u=>{if(u.stylesheet&&u.stylesheet.indoor)for(const f of Object.values(u.stylesheet.indoor)){const k=f,P=i.B(k.sourceId,u.scope);this._mergedIndoor[P]=new Set(k.sourceLayers||[])}})}mergeLayers(){const u={},f=[],k={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(R=>{for(const U of R._order){const G=R._layers[U];if(G.type==="slot"){const J=i.dq(U);if(u[J])continue;u[J]=[]}G.slot&&u[G.slot]?u[G.slot].push(G):f.push(G)}}),this._mergedOrder=[];let P=-1;const D=(R=[])=>{for(const U of R)if(U.type==="slot"){const G=i.dq(U.id);u[G]&&D(u[G]),this._mergedSlots.push(G)}else{const G=i.B(U.id,U.scope);this._mergedOrder.push(G),k[G]=U,U.is3D(!!this.terrain)&&(this._has3DLayers=!0,P=this._mergedOrder.length-1),U.type==="circle"&&(this._hasCircleLayers=!0),U.type==="symbol"&&(this._hasSymbolLayers=!0),U.type==="clip"&&(this._clipLayerPresent=!0)}};if(D(f),this._has3DLayers){const R={};for(let U=0;UR[U]-R[G])}this._mergedLayers=k,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged(),this._updateDataDrivenEmissiveStrength()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(u){return this.stylesheet.camera=Object.assign({},this.stylesheet.camera,u),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(u){return u.data?function(f,k,P,D){const R=Object.assign({},k);for(const G of Object.keys(b5))R[G]===void 0&&(R[G]=b5[G].default);const U=new i.a8(Yie,f,new Map(P));return U.setTransitionOrValue(R,P),U.untransitioned().possiblyEvaluate(new i.ac(0,{worldview:void 0}))}(this.scope,u,this.options).get("data"):null}_loadColorTheme(u){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const f=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((k,P)=>{const D="data:image/png;base64,";if(!u||u.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void k();let R=u;R.startsWith(D)||(R=D+R);const U=i.I.from("mapbox-reserved-lut"),G=new Image;G.src=R,G.onerror=()=>{this._styleColorTheme.lutLoading=!1,P(new Error("Failed to load image data"))},G.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==f)return void k();this._styleColorTheme.lutLoading=!1;const{width:J,height:te,data:me}=i.o.getImageData(G);if(te>32)return void P(new Error("The height of the image must be less than or equal to 32 pixels."));if(J!==te*te)return void P(new Error("The width of the image must be equal to the height squared."));this.getImage(U)&&this.removeImage(U),this.addImage(U,{data:new i.q({width:J,height:te},me),pixelRatio:1,sdf:!1,usvg:!1,version:0});const he=this.imageManager.getImage(U,this.scope);he?(this._styleColorTheme.lut={image:he.data,data:u},k()):P(new Error("Missing LUT image."))}})}getLut(u){const f=this._styleColorThemeForScope[u];return f?f.lut:null}setProjection(u){u?this.stylesheet.projection=u: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(u){this._spriteRequest=function(f,k,P){let D,R,U;const G=i.o.devicePixelRatio>1?"@2x":"";let J=i.m(k.transformRequest(k.normalizeSpriteURL(f,G,".json"),i.R.SpriteJSON),(he,pe)=>{J=null,U||(U=he,D=pe,me())}),te=i.n(k.transformRequest(k.normalizeSpriteURL(f,G,".png"),i.R.SpriteImage),(he,pe)=>{te=null,U||(U=he,R=pe,me())});function me(){if(U)P(U);else if(D&&R){const he=i.o.getImageData(R),pe={};for(const ke in D){const{width:_e,height:Re,x:De,y:He,sdf:nt,pixelRatio:We,stretchX:kt,stretchY:xt,content:_t}=D[ke],gt=new i.q({width:_e,height:Re});i.q.copy(he,gt,{x:De,y:He},{x:0,y:0},{width:_e,height:Re},null),pe[ke]={data:gt,pixelRatio:We!==void 0?We:1,sdf:nt!==void 0&&nt,stretchX:kt,stretchY:xt,content:_t,usvg:!1,version:0}}P(null,pe)}}return{cancel(){J&&(J.cancel(),J=null),te&&(te.cancel(),te=null)}}}(u,this.map._requestManager,(f,k)=>{if(this._spriteRequest=null,f)this.fire(new i.y(f));else if(k){const P=new Map;for(const D in k)P.set(i.I.from(D),k[D]);this.addImages(P)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new i.z("data",{dataType:"style"}))})}addIconset(u,f){if(f.type==="sprite")return void this._loadSprite(f.url);const k=this.getOwnSourceCache(f.source);if(!k)return void this.fire(new i.y(new Error(`Source "${f.source}" as specified by iconset "${u}" does not exist and cannot be used as an iconset source`)));const P=k.getSource();if(P.type!=="raster-array")return void this.fire(new i.y(new Error(`Source "${f.source}" as specified by iconset "${u}" is not a "raster-array" source and cannot be used as an iconset source`)));P.partial=!1;const D=new w5(u,this.scope,k);this.imageManager.addImageProvider(D,this.scope)}removeIconset(u){this.imageManager.removeImageProvider(u,this.scope)}_loadIconset(u){if(!i.h(u)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(u);const f=this.map._spriteFormat==="auto";var k,P;this._spriteRequest=(P=(D,R)=>{if(this._spriteRequest=null,D)f?this._loadSprite(u):this.fire(new i.y(D));else if(R){const U=new Map;for(const G in R)U.set(i.I.from(G),R[G]);this.addImages(U)}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((k=this.map._requestManager).transformRequest(k.normalizeIconsetURL(u),i.R.Iconset),(D,R)=>{if(D)return void P(D);const U={},G=i.dg(new i.bt(R));for(const J of G.icons){const te={version:1,pixelRatio:i.o.devicePixelRatio,content:KP(J),stretchX:J.metadata?ZP(J.metadata.stretch_x_areas):void 0,stretchY:J.metadata?ZP(J.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:J};U[J.name]=te}P(null,U)}))}_validateLayer(u){const f=this.getOwnSource(u.source);if(!f)return;const k=u.sourceLayer;k&&(f.type==="geojson"||f.vectorLayerIds&&f.vectorLayerIds.indexOf(k)===-1)&&this.fire(new i.y(new Error(`Source layer "${k}" does not exist on source "${f.id}" as specified by style layer "${u.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const u in this._sourceCaches)if(!this._sourceCaches[u].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:u}of this.fragments)if(!u.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((u,f)=>{const k=this.fragments[f];return k&&k.style&&(u.data=k.style.serialize()),u})}_serializeSources(){const u={};for(const f in this._sourceCaches){const k=this._sourceCaches[f].getSource();u[k.id]||(u[k.id]=k.serialize())}return u}_serializeLayers(u){const f=[];for(const k of u){const P=this._layers[k];P&&P.type!=="custom"&&f.push(P.serialize())}return f}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 u in this._sourceCaches)if(this._sourceCaches[u].hasTransition())return!0;for(const u in this._layers)if(this._layers[u].hasTransition())return!0;return!1}_updateDataDrivenEmissiveStrength(){for(const u in this._mergedLayers){const f=this._mergedLayers[u];if(f._transitionablePaint&&f._transitionablePaint._values){const k=f._transitionablePaint._values["line-emissive-strength"];if(k&&k.value&&k.value.isDataDriven())return void(this._hasDataDrivenEmissive=!0)}}this._hasDataDrivenEmissive=!1}hasDataDrivenEmissiveStrength(){return this._hasDataDrivenEmissive}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(u){return u?this.order:this._mergedOrder}isLayerDraped(u){return!!this.terrain&&u.isDraped(this.getLayerSourceCache(u))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(u){const f=this.getOwnLayer(u);if(f)return f;this.fire(new i.y(new Error(`The layer '${u}' does not exist in the map's style.`)))}_checkSource(u){const f=this.getOwnSource(u);if(f)return f;this.fire(new i.y(new Error(`The source '${u}' does not exist in the map's style.`)))}precompilePrograms(u,f){const k=this.map.painter;if(k)for(let P=u.minzoom||0;P<(u.maxzoom||25.5);P++){const D=u.getProgramIds();if(D)for(const R of D){const U=u.getDefaultProgramParams(R,f.zoom,this._styleColorTheme.lut);U&&(k.style=this,this.fog&&(k._fogVisible=!0,U.overrideFog=!0,k.getOrCreateProgram(R,U)),k._fogVisible=!1,U.overrideFog=!1,k.getOrCreateProgram(R,U),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(U.overrideRtt=!0,k.getOrCreateProgram(R,U)))}}}update(u){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(u),this.directionalLight&&this.directionalLight.recalculate(u);const f=this.calculateLightsBrightness();u.brightness=f||0,f!==this._brightness&&(this._brightness=f,this.dispatcher.broadcast("setBrightness",f)),u.worldview!==this._worldview&&(this._worldview=u.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const k=this._changes.isDirty();let P=!1;if(this._changes.isDirty()){const U=this._changes.getLayerUpdatesByScope();for(const G in U){const{updatedIds:J,removedIds:te}=U[G];(J||te)&&(this._updateWorkerLayers(G,J,te),P=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(u),this.light&&this.light.updateTransitions(u),this.ambientLight&&this.ambientLight.updateTransitions(u),this.directionalLight&&this.directionalLight.updateTransitions(u),this.fog&&this.fog.updateTransitions(u),this.snow&&this.snow.updateTransitions(u),this.rain&&this.rain.updateTransitions(u),this._changes.reset()}const D={};for(const U in this._mergedSourceCaches){const G=this._mergedSourceCaches[U];D[U]=G.used,G.used=!1,G.tileCoverLift=0}for(const U of this._mergedOrder){const G=this._mergedLayers[U];if(G.visibility!=="none"&&G.recalculate(u,this._availableImages),!G.isHidden(u.zoom)){const J=this.getLayerSourceCache(G);J&&(J.used=!0,J.tileCoverLift=Math.max(J.tileCoverLift,G.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>{this.precompilePrograms(G,u)}):this.precompilePrograms(G,u))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&P&&this.mergeLayers();const R=this.imageManager.getPendingImageProviders();for(const U of R)U.sourceCache.used=!0;for(const U in D){const G=this._mergedSourceCaches[U];D[U]!==G.used&&G.getSource().fire(new i.z("data",{sourceDataType:"visibility",dataType:"source",sourceId:G.getSource().id}))}this.light&&this.light.recalculate(u),this.terrain&&this.terrain.recalculate(u),this.fog&&this.fog.recalculate(u),this.snow&&this.snow.recalculate(u),this.rain&&this.rain.recalculate(u),this.z=u.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),k&&this.fire(new i.z("data",{dataType:"style"}))}updateImageProviders(){const u=this.imageManager.getPendingImageProviders();for(const f of u){const k=f.resolvePendingRequests(),P=this.getFragmentStyle(f.scope);P&&P.addImages(k)}}_updateTilesForChangedImages(){const u={};for(const f in this._mergedSourceCaches){const k=this._mergedSourceCaches[f].getSource().scope;u[k]=u[k]||this._changes.getUpdatedImages(k),u[k].length!==0&&this._mergedSourceCaches[f].reloadTilesForDependencies(["icons","patterns"],u[k])}for(const f in u)this._changes.resetUpdatedImages(f)}_updateWorkerLayers(u,f,k){const P=this.getFragmentStyle(u);P&&this.dispatcher.broadcast("updateLayers",{layers:f?P._serializeLayers(f):[],scope:u,removedIds:k||[],options:P.options})}setState(u,f){if(this._checkLoaded(),og(this,Gn(u)))return!1;(u=i.dp(u)).layers=yx(u.layers);const k=function(R,U){if(!R)return[{command:aa.setStyle,args:[U]}];let G=[];try{if(!i.by(R.version,U.version))return[{command:aa.setStyle,args:[U]}];if(i.by(R.center,U.center)||G.push({command:aa.setCenter,args:[U.center]}),i.by(R.zoom,U.zoom)||G.push({command:aa.setZoom,args:[U.zoom]}),i.by(R.bearing,U.bearing)||G.push({command:aa.setBearing,args:[U.bearing]}),i.by(R.pitch,U.pitch)||G.push({command:aa.setPitch,args:[U.pitch]}),i.by(R.sprite,U.sprite)||G.push({command:aa.setSprite,args:[U.sprite]}),i.by(R.glyphs,U.glyphs)||G.push({command:aa.setGlyphs,args:[U.glyphs]}),i.by(R.imports,U.imports)||function(pe=[],ke=[],_e){ke=ke||[];const Re=(pe=pe||[]).map(sg),De=ke.map(sg),He=pe.reduce(vx,{}),nt=ke.reduce(vx,{}),We=Re.slice();let kt,xt,_t,gt;for(kt=0,xt=0;kt{pe.source&&J[pe.source]?G.push({command:aa.removeLayer,args:[pe.id]}):me.push(pe)});let he=R.terrain;he&&J[he.source]&&(G.push({command:aa.setTerrain,args:[void 0]}),he=void 0),G=G.concat(te),i.by(he,U.terrain)||G.push({command:aa.setTerrain,args:[U.terrain]}),function(pe,ke,_e){ke=ke||[];const Re=(pe=pe||[]).map(sg),De=ke.map(sg),He=pe.reduce(vx,{}),nt=ke.reduce(vx,{}),We=Re.slice(),kt=Object.create(null);let xt,_t,gt,ut,Tt,Bt,zt;for(xt=0,_t=0;xt!(R.command in XP));if(k.length===0)return!1;const P=k.filter(R=>!(R.command in YP));if(P.length>0)throw new Error(`Unimplemented: ${P.map(R=>R.command).join(", ")}.`);const D=[];return k.forEach(R=>{D.push(this[R.command](...R.args))}),f&&Promise.all(D).then(f).catch(f),this.stylesheet=u,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(u){if(u.size===0)return this;for(const[f,k]of u.entries()){if(this.getImage(f))return this.fire(new i.y(new Error(`An image with the name "${f.name}" already exists.`)));this.imageManager.addImage(f,this.scope,k),this._changes.updateImage(f,this.scope)}return this._updateWorkerImages(),this.fire(new i.z("data",{dataType:"style"})),this}addImage(u,f){return this.getImage(u)?this.fire(new i.y(new Error(`An image with the name "${u.name}" already exists.`))):(this.imageManager.addImage(u,this.scope,f),this._changes.updateImage(u,this.scope),this._updateWorkerImages(),this.fire(new i.z("data",{dataType:"style"})),this)}updateImage(u,f,k=!1){this.imageManager.updateImage(u,this.scope,f),k&&(this._changes.updateImage(u,this.scope),this._updateWorkerImages(),this.fire(new i.z("data",{dataType:"style"})))}getImage(u){return this.imageManager.getImage(u,this.scope)}removeImage(u){return this.getImage(u)?(this.imageManager.removeImage(u,this.scope),this._changes.updateImage(u,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(u){return this.modelManager.addModelURLs(u,this.getActualScope()),this._updateWorkerModels(),this.fire(new i.z("data",{dataType:"style"})),this}addModel(u,f,k={}){return this._checkLoaded(),this._validate(ye,`models.${u}`,f,null,k)||(this.modelManager.addModel(u,f,this.getActualScope()),this.fire(new i.z("data",{dataType:"style"}))),this}hasModel(u){return this.modelManager.hasModel(u,this.getActualScope())}removeModel(u){return this.hasModel(u)?(this.modelManager.removeModel(u,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(u,f,k={}){if(this._checkLoaded(),this.getOwnSource(u)!==void 0)throw new Error(`There is already a source with ID "${u}".`);if(!f.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(f).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(f.type)>=0&&this._validate(Ai,`sources.${u}`,f,null,k))return;this.map&&this.map._collectResourceTiming&&(f.collectResourceTiming=!0);const P=Jo(u,f,this.dispatcher,this);P.scope=this.scope,P.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(P.id),source:P.serialize(),sourceId:P.id}));const D=R=>{const U=(R?"symbol:":"other:")+P.id,G=i.B(U,this.scope),J=this._sourceCaches[U]=new kd(G,P,R);(R?this._symbolSourceCaches:this._otherSourceCaches)[P.id]=J,J.onAdd(this.map)};D(!1),f.type!=="vector"&&f.type!=="geojson"||D(!0),P.onAdd&&P.onAdd(this.map),k.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(u){this._checkLoaded();const f=this.getOwnSource(u);if(!f)throw new Error("There is no source with this ID");for(const P in this._layers)if(this._layers[P].source===u)return this.fire(new i.y(new Error(`Source "${u}" cannot be removed while layer "${P}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===u)return this.fire(new i.y(new Error(`Source "${u}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const P=Object.entries(this.stylesheet.iconsets).find(([D,R])=>R.type==="source"&&R.source===u);if(P)return this.fire(new i.y(new Error(`Source "${u}" cannot be removed while iconset "${P[0]}" is using it.`)))}const k=this.getOwnSourceCaches(u);for(const P of k){const D=i.dq(P.id);delete this._sourceCaches[D],this._changes.discardSourceCacheUpdate(P.id),P.fire(new i.z("data",{sourceDataType:"metadata",dataType:"source",sourceId:P.getSource().id})),P.setEventedParent(null),P.clearTiles()}return delete this._otherSourceCaches[u],delete this._symbolSourceCaches[u],this.mergeSources(),f.setEventedParent(null),f.onRemove&&f.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(u,f){this._checkLoaded(),this.getOwnSource(u).setData(f),this._changes.setDirty()}getOwnSource(u){const f=this.getOwnSourceCache(u);return f&&f.getSource()}getOwnSources(){const u=[];for(const f in this._otherSourceCaches){const k=this.getOwnSourceCache(f);k&&u.push(k.getSource())}return u}areTilesLoaded(){const u=this._mergedSourceCaches;for(const f in u){const k=u[f]._tiles;for(const P in k){const D=k[P];if(D.state!=="loaded"&&D.state!=="errored")return!1}}return!0}setLights(u){if(this._checkLoaded(),!u)return delete this.ambientLight,void delete this.directionalLight;const f=this._getTransitionParameters();for(const D of u){if(this._validate(Fa,"lights",D))return;switch(D.type){case"ambient":if(this.ambientLight){const R=this.ambientLight;R.set(D),R.updateTransitions(f)}else this.ambientLight=new la(D,Mo||(Mo=new i.a9({color:new i.aa(i.a6.properties_light_ambient.color),"color-use-theme":new i.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new i.aa(i.a6.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const R=this.directionalLight;R.set(D),R.updateTransitions(f)}else this.directionalLight=new la(D,Sa||(Sa=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 k=Object.assign(f,{worldview:this.map.getWorldview()}),P=new i.ac(this.z||0,k);this.ambientLight&&this.ambientLight.recalculate(P),this.directionalLight&&this.directionalLight.recalculate(P),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const u=this.directionalLight,f=this.ambientLight;if(!u||!f)return;const k=he=>.2126*(he[0]<=.03928?he[0]/12.92:Math.pow((he[0]+.055)/1.055,2.4))+.7152*(he[1]<=.03928?he[1]/12.92:Math.pow((he[1]+.055)/1.055,2.4))+.0722*(he[2]<=.03928?he[2]/12.92:Math.pow((he[2]+.055)/1.055,2.4)),P=u.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),D=u.properties.get("intensity"),R=u.properties.get("direction"),U=1-i.d4(R.x,R.y,R.z)[2]/90,G=k(P)*D*U,J=f.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),te=f.properties.get("intensity"),me=k(J)*te;return Number(((G+me)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const u=[];return this.directionalLight&&u.push(this.directionalLight.get()),this.ambientLight&&u.push(this.ambientLight.get()),u}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(u){if(u==null||u===""&&this.isRootStyle())return this;if(i.dr(u)){const f=i.ds(u),k=this.fragments.find(({id:D})=>D===f);if(!k)return;const P=i.dq(u);return k.style.getFragmentStyle(P)}{const f=this.fragments.find(({id:k})=>k===u);return f?f.style:void 0}}setFeaturesetSelectors(u){if(!u)return;const f={},k=(P,D="")=>`${P}::${D}`;this._featuresetSelectors={};for(const P in u){const D=this._featuresetSelectors[P]=[];for(const R of u[P].selectors){if(R.featureNamespace){const G=this.getOwnLayer(R.layer);if(!G){i.w(`Layer is undefined for selector: ${R.layer}`);continue}const J=k(G.source,G.sourceLayer);if(J in f&&f[J]!==R.featureNamespace){i.w(`"featureNamespace ${R.featureNamespace} of featureset ${P}'s selector is not associated to the same source, skip this selector`);continue}f[J]=R.featureNamespace}let U;if(R.properties)for(const G in R.properties){const J=i.U(R.properties[G]);J.result==="success"&&(U=U||{},U[G]=J.value)}D.push({layerId:R.layer,namespace:R.featureNamespace,properties:U,uniqueFeatureID:R._uniqueFeatureID})}}}getFeaturesetDescriptors(u){const f=this.getFragmentStyle(u);if(!f||!f.stylesheet.featuresets)return[];const k=[];for(const P in f.stylesheet.featuresets)k.push({featuresetId:P,importId:f.scope?f.scope:void 0});return k}getFeaturesetLayers(u,f){const k=this.getFragmentStyle(f),P=k.stylesheet.featuresets;if(!P||!P[u])return this.fire(new i.y(new Error(`The featureset '${u}' does not exist in the map's style and cannot be queried.`))),[];const D=[];for(const R of P[u].selectors){const U=k.getOwnLayer(R.layer);U&&D.push(U)}return D}getConfigProperty(u,f){const k=this.getFragmentStyle(u);if(!k)return null;const P=i.B(f,k.scope),D=k.options.get(P),R=D?D.value||D.default:null;return R?R.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(u,f){const k=i.B(u,f);return this._mergedIndoor[k]}setIndoorData(u,f){this.map.indoor.setIndoorData(f)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(u,f,k){const P=this.getFragmentStyle(u);if(!P)return;const D=P.stylesheet.schema;if(!D||!D[f])return;const R=i.U(k);if(R.result!=="success")return void og(this,R.value);const U=R.value.expression,G=i.B(f,P.scope),J=P.options.get(G);if(!J)return;let te;const{minValue:me,maxValue:he,stepValue:pe,type:ke,values:_e}=D[f],Re=i.U(D[f].default);Re.result==="success"&&(te=Re.value.expression),te?(this.options.set(G,Object.assign({},J,{value:U,default:te,minValue:me,maxValue:he,stepValue:pe,type:ke,values:_e})),this.updateConfigDependencies(f)):this.fire(new i.y(new Error(`No schema defined for the config option "${f}" in the "${u}" fragment.`)))}getConfig(u){const f=this.getFragmentStyle(u);if(!f)return null;const k=f.stylesheet.schema;if(!k)return null;const P={};for(const D in k){const R=i.B(D,f.scope),U=f.options.get(R),G=U?U.value||U.default:null;P[D]=G?G.serialize():null}return P}setConfig(u,f){const k=this.getFragmentStyle(u);k&&(k.updateConfig(f,k.stylesheet.schema),this.updateConfigDependencies())}getSchema(u){const f=this.getFragmentStyle(u);return f?f.stylesheet.schema:null}setSchema(u,f){const k=this.getFragmentStyle(u);k&&(k.stylesheet.schema=f,k.updateConfig(k._config,f),this.updateConfigDependencies())}updateConfig(u,f){if(this._config=u,u||f)if(f)for(const k in f){let P,D;const R=i.U(f[k].default);if(R.result==="success"&&(P=R.value.expression),u&&u[k]!==void 0){const he=i.U(u[k]);he.result==="success"&&(D=he.value.expression)}const{minValue:U,maxValue:G,stepValue:J,type:te,values:me}=f[k];if(P){const he=i.B(k,this.scope);this.options.set(he,{default:P,value:D,minValue:U,maxValue:G,stepValue:J,type:te,values:me})}else this.fire(new i.y(new Error(`No schema defined for config option "${k}".`)))}else this.fire(new i.y(new Error("Attempting to set config for a style without schema.")))}_updateLayers(u,f=()=>!0){for(const k of u){const P=this.getLayer(k);P&&f(P)&&(P.possiblyEvaluateVisibility(),this._updateLayer(P),this._changes.setDirty())}}updateConfigDependencies(u){this._updateLayers(this._configDependentLayers,f=>!u||f.expressionDependencies.configDependencies.has(u)),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(f=>{const k=f._styleColorTheme.colorThemeOverride?f._styleColorTheme.colorThemeOverride:f._styleColorTheme.colorTheme;if(k){const P=f._evaluateColorThemeData(k);(!f._styleColorTheme.lut&&P!==""||f._styleColorTheme.lut&&P!==f._styleColorTheme.lut.data)&&f.setColorTheme(k)}}),this._changes.setDirty()}addLayer(u,f,k={}){this._checkLoaded();const P=u.id;if(this._layers[P])return void this.fire(new i.y(new Error(`Layer with id "${P}" already exists on this map`)));let D;if(u.type==="custom"){if(og(this,i.dt(u)))return;D=i.du(u,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof u.source=="object"&&(this.addSource(P,u.source),u=i.dp(u),u=Object.assign(u,{source:P})),this._validate(gc,`layers.${P}`,u,{arrayIndex:-1},k))return;D=i.du(u,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(D),D.setEventedParent(this,{layer:{id:P}})}const R=i.B(D.source,D.scope);D.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(R),D.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(R);let U=this._order.length;if(f){const me=this._order.indexOf(f);if(me===-1)return void this.fire(new i.y(new Error(`Layer with id "${f}" does not exist on this map.`)));D.slot===this._layers[f].slot?U=me:i.w(`Layer with id "${f}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(U,0,P),this._layerOrderChanged=!0,this._layers[P]=D;const G=this.getOwnLayerSourceCache(D),J=!!this.directionalLight&&this.directionalLight.shadowsEnabled();G&&D.canCastShadows()&&J&&(G.castsShadows=!0);const te=this._changes.getRemovedLayer(D);if(te&&D.source&&G&&D.type!=="custom"){this._changes.discardLayerRemoval(D);const me=i.B(D.source,D.scope);te.type!==D.type?this._changes.updateSourceCache(me,"clear"):(this._changes.updateSourceCache(me,"reload"),G.pause())}this._updateLayer(D),D.onAdd&&D.onAdd(this.map),D.scope=this.scope,this.mergeLayers()}moveLayer(u,f){this._checkLoaded();const k=this._checkLayer(u);if(!k||u===f)return;const P=this._order.indexOf(u);this._order.splice(P,1);let D=this._order.length;if(f){const R=this._order.indexOf(f);if(R===-1)return void this.fire(new i.y(new Error(`Layer with id "${f}" does not exist on this map.`)));k.slot===this._layers[f].slot?D=R:i.w(`Layer with id "${f}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(D,0,u),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(u){this._checkLoaded();const f=this._checkLayer(u);if(!f)return;f.setEventedParent(null);const k=this._order.indexOf(u);this._order.splice(k,1),delete this._layers[u],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(f.fqid),this._indoorDependentLayers.delete(f.fqid),this._changes.removeLayer(f);const P=this.getOwnLayerSourceCache(f);if(P&&P.castsShadows){let D=!1;for(const R in this._layers)if(this._layers[R].source===f.source&&this._layers[R].canCastShadows()){D=!0;break}P.castsShadows=D}f.onRemove&&f.onRemove(this.map),this.mergeLayers()}getOwnLayer(u){return this._layers[u]}hasLayer(u){return u in this._mergedLayers}hasLayerType(u){for(const f in this._layers)if(this._layers[f].type===u)return!0;return!1}setLayerZoomRange(u,f,k){this._checkLoaded();const P=this._checkLayer(u);P&&(P.minzoom===f&&P.maxzoom===k||(f!=null&&(P.minzoom=f),k!=null&&(P.maxzoom=k),this._updateLayer(P)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(u,f){this._checkLoaded();const k=this._checkLayer(u);k&&k.slot!==f&&(k.slot=f,this._updateLayer(k))}setFilter(u,f,k={}){this._checkLoaded();const P=this._checkLayer(u);if(P&&!i.by(P.filter,f))return f==null?(P.filter=void 0,void this._updateLayer(P)):void(this._validate(jo,`layers.${P.id}.filter`,f,{layerType:P.type},k)||(P.filter=i.dp(f),this._updateLayer(P)))}getFilter(u){const f=this._checkLayer(u);if(f)return i.dp(f.filter)}setLayoutProperty(u,f,k,P={}){this._checkLoaded();const D=this._checkLayer(u);if(D&&!i.by(D.getLayoutProperty(f),k)){if(k!=null&&(!P||P.validate!==!1)&&og(D,st.call(Gn,{key:`layers.${u}.layout.${f}`,layerType:D.type,objectKey:f,value:k,styleSpec:i.a6,style:{glyphs:!0,sprite:!0}})))return;D.setLayoutProperty(f,k),D.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(D.fqid),D.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(D.fqid),this._updateLayer(D)}}setLayerProperty(u,f,k,P={}){this._checkLoaded();const D=this._checkLayer(u);D&&(f==="appearances"?(D.setAppearances(k),this._changes.setDirty()):D.isPaintProperty(f)?this.setPaintProperty(u,f,k,P):this.setLayoutProperty(u,f,k,P))}getLayoutProperty(u,f){const k=this._checkLayer(u);if(k)return k.getLayoutProperty(f)}setPaintProperty(u,f,k,P={}){this._checkLoaded();const D=this._checkLayer(u);if(!D||i.by(D.getPaintProperty(f),k)||k!=null&&(!P||P.validate!==!1)&&og(D,xc.call(Gn,{key:`layers.${u}.paint.${f}`,layerType:D.type,objectKey:f,value:k,styleSpec:i.a6})))return;const R=D.setPaintProperty(f,k);D.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(D.fqid),D.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(D.fqid),R&&this._updateLayer(D),this._changes.updatePaintProperties(D)}getPaintProperty(u,f){const k=this._checkLayer(u);if(k)return k.getPaintProperty(f)}setFeatureState(u,f){if(this._checkLoaded(),"target"in u){if("featuresetId"in u.target){const{featuresetId:G,importId:J}=u.target,te=this.getFragmentStyle(J),me=te.getFeaturesetLayers(G);for(const{source:he,sourceLayer:pe}of me)te.setFeatureState({id:u.id,source:he,sourceLayer:pe},f)}else if("layerId"in u.target){const{layerId:G}=u.target,J=this.getLayer(G);this.setFeatureState({id:u.id,source:J.source,sourceLayer:J.sourceLayer},f)}return}const k=u.source,P=u.sourceLayer,D=this._checkSource(k);if(!D)return;const R=D.type;if(R==="geojson"&&P)return void this.fire(new i.y(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(R==="vector"&&!P)return void this.fire(new i.y(new Error("The sourceLayer parameter must be provided for vector source types.")));u.id===void 0&&this.fire(new i.y(new Error("The feature id parameter must be provided.")));const U=this.getOwnSourceCaches(k);for(const G of U)G.setFeatureState(P,u.id,f)}removeFeatureState(u,f){if(this._checkLoaded(),"target"in u){if("featuresetId"in u.target){const{featuresetId:G,importId:J}=u.target,te=this.getFragmentStyle(J),me=te.getFeaturesetLayers(G);for(const{source:he,sourceLayer:pe}of me)te.removeFeatureState({id:u.id,source:he,sourceLayer:pe},f)}else if("layerId"in u.target){const{layerId:G}=u.target,J=this.getLayer(G);this.removeFeatureState({id:u.id,source:J.source,sourceLayer:J.sourceLayer},f)}return}const k=u.source,P=this._checkSource(k);if(!P)return;const D=P.type,R=D==="vector"?u.sourceLayer:void 0;if(D==="vector"&&!R)return void this.fire(new i.y(new Error("The sourceLayer parameter must be provided for vector source types.")));if(f&&typeof u.id!="string"&&typeof u.id!="number")return void this.fire(new i.y(new Error("A feature id is required to remove its specific state property.")));const U=this.getOwnSourceCaches(k);for(const G of U)G.removeFeatureState(R,u.id,f)}getFeatureState(u){if(this._checkLoaded(),"target"in u){let D;if("featuresetId"in u.target){const{featuresetId:R,importId:U}=u.target,G=this.getFragmentStyle(U),J=G.getFeaturesetLayers(R);for(const{source:te,sourceLayer:me}of J){const he=G.getFeatureState({id:u.id,source:te,sourceLayer:me});if(he&&!D)D=he;else if(!i.by(D,he))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 u.target){const{layerId:R}=u.target,U=this.getLayer(R);D=this.getFeatureState({id:u.id,source:U.source,sourceLayer:U.sourceLayer})}return D}const f=u.source,k=u.sourceLayer,P=this._checkSource(f);if(P){if(P.type!=="vector"||k)return u.id===void 0&&this.fire(new i.y(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(f)[0].getFeatureState(k,u.id);this.fire(new i.y(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(u){return this.stylesheet.transition=Object.assign({},this.stylesheet.transition,u),this.transition=this.stylesheet.transition,this}getTransition(){return Object.assign({},this.stylesheet.transition)}serialize(){this._checkLoaded();const u=this.getTerrain(),f=u&&this.terrain&&this.terrain.scope===this.scope?u: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:f,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)},k=>k!==void 0)}_updateFilteredLayers(u){for(const f of Object.values(this._mergedLayers))u(f)&&this._updateLayer(f)}_updateLayer(u){this._changes.updateLayer(u);const f=this.getLayerSourceCache(u),k=i.B(u.source,u.scope),P=this._changes.getUpdatedSourceCaches();u.source&&!P[k]&&f&&f.getSource().type!=="raster"&&(this._changes.updateSourceCache(k,"reload"),f.pause()),u.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(u){const f=U=>this._mergedLayers[U].is3D(!!this.terrain),k=this.order,P={},D=[];for(let U=k.length-1;U>=0;U--){const G=k[U];if(f(G)){P[G]=U;for(const J of u){const te=J[G];if(te)for(const me of te)D.push(me)}}}D.sort((U,G)=>G.intersectionZ-U.intersectionZ);const R=[];for(let U=k.length-1;U>=0;U--){const G=k[U];if(f(G))for(let J=D.length-1;J>=0;J--){const te=D[J].feature;if(te.layer&&P[te.layer.id]{if(lN.has(te.type))return;const me=this.getOwnLayerSourceCache(te),he=D[me.id]=D[me.id]||{sourceCache:me,layers:{},has3DLayers:!1};te.is3D(!!this.terrain)&&(he.has3DLayers=!0),he.layers[te.fqid]=he.layers[te.fqid]||{styleLayer:te,targets:[]},he.layers[te.fqid].targets.push({filter:P})};if(f&&f.layers){if(!Array.isArray(f.layers))return this.fire(new i.y(new Error("parameters.layers must be an Array."))),[];for(const te of f.layers){const me=this._layers[te];if(!me)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(me)}}else for(const te in this._layers)R(this._layers[te]);const U=this._queryRenderedFeatures(u,D,k),G=this._flattenAndSortRenderedFeatures(U),J=[];for(const te of G)i.dw(te.layer.id)===this.scope&&J.push(te);return J}queryRenderedFeatureset(u,f,k){let P;f&&!Array.isArray(f)&&f.filter&&(this._validate(jo,"queryRenderedFeatures.filter",f.filter,null,f),P=i.b6(f.filter));const D="mock",R=[];if(f&&f.target)R.push(Object.assign({},f,{targetId:D,filter:P}));else{const te=this.getFeaturesetDescriptors();for(const me of te)R.push({targetId:D,filter:P,target:me});for(const{style:me}of this.fragments){const he=me.getFeaturesetDescriptors();for(const pe of he)R.push({targetId:D,filter:P,target:pe})}}const U=this.queryRenderedTargets(u,R,k),G=[],J=new Set;for(const te of U)for(const me of te.variants[D])rg(me,te,J)||G.push(new i.dx(te,me));return G}queryRenderedTargets(u,f,k){const P={},D=(U,G,J,te)=>{const me=P[G.id]=P[G.id]||{sourceCache:G,layers:{},has3DLayers:!1};if(me.layers[U.fqid]=me.layers[U.fqid]||{styleLayer:U,targets:[]},U.is3D(!!this.terrain)&&(me.has3DLayers=!0),!te)return J.uniqueFeatureID=!1,void me.layers[U.fqid].targets.push(J);me.layers[U.fqid].targets.push(Object.assign({},J,{namespace:te.namespace,properties:te.properties,uniqueFeatureID:te.uniqueFeatureID}))};for(const U of f)if("featuresetId"in U.target){const{featuresetId:G,importId:J}=U.target,te=this.getFragmentStyle(J);if(!te||!te._featuresetSelectors)continue;const me=te._featuresetSelectors[G];if(!me){this.fire(new i.y(new Error(`The featureset '${G}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const he of me){const pe=te.getOwnLayer(he.layerId);pe&&!lN.has(pe.type)&&D(pe,te.getOwnLayerSourceCache(pe),U,he)}}else if("layerId"in U.target){const{layerId:G}=U.target,J=this.getLayer(G);if(!J||lN.has(J.type))continue;D(J,this.getLayerSourceCache(J),U)}const R=this._queryRenderedFeatures(u,P,k);return this._flattenAndSortRenderedFeatures(R)}_queryRenderedFeatures(u,f,k){const P=[],D=!!this.map._showQueryGeometry,R=zi.createFromScreenPoints(u,k);for(const U in f){const G=Jy(R,f[U],this._availableImages,k,D);Object.keys(G).length&&P.push(G)}if(this.placement)for(const U in f){if(!f[U].sourceCache._onlySymbols)continue;const G=e0(R.screenGeometry,f[U],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(G).length&&P.push(G)}return P}querySourceFeatures(u,f){const k=f&&f.filter;k&&this._validate(jo,"querySourceFeatures.filter",k,null,f);let P=[];const D=this.getOwnSourceCaches(u);for(const R of D)P=P.concat(t0(R,f));return P}addSourceType(u,f,k){return vh.getSourceType(u)?k(new Error(`A source type called "${u}" already exists.`)):(vh.setSourceType(u,f),f.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:u,url:f.workerSourceURL},k):k(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(u,f,k={}){this._checkLoaded();const P=this.light.getLight();let D=!1;for(const U in u)if(!i.by(u[U],P[U])){D=!0;break}if(!D)return;const R=this._getTransitionParameters();this.light.setLight(u,f,k),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(u,f=1){if(this._checkLoaded(),!u)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),f===0&&delete this.terrain,u===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let k=u;const P=!("source"in u)||u.source==null;if(f===1){if(this.disableElevatedTerrain)return;if("source"in k&&typeof k.source=="object"){const U="terrain-dem-src";this.addSource(U,k.source),k=i.dp(k),k=Object.assign(k,{source:U})}const D=Object.assign({},k),R={};if(this.terrain&&P){D.source=this.terrain.get().source;const U=this.terrain?this.getFragmentStyle(this.terrain.scope):null;U&&(R.style=U.serialize())}if(this._validate(mo,"terrain",D,R))return}if(!this.terrain||this.terrain.scope!==this.scope&&!P||this.terrain&&f!==this.terrain.drapeRenderMode){if(!k)return;this._createTerrain(k,f),this.fire(new i.z("data",{dataType:"style"}))}else{const D=this.terrain,R=D.get();for(const U of Object.keys(i.a6.terrain))!k.hasOwnProperty(U)&&i.a6.terrain[U].default&&(k[U]=i.a6.terrain[U].default);for(const U in u)if(!i.by(u[U],R[U])){D.set(u,this.options),this.stylesheet.terrain=u;const G=this._getTransitionParameters({duration:0});D.updateTransitions(G),this.fire(new i.z("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(u){const f=this.fog=new un(u,this.map.transform,this.scope,this.options);this.stylesheet.fog=f.get();const k=this._getTransitionParameters({duration:0});f.updateTransitions(k)}_createSnow(u){const f=this.snow=new Io(u,this.map.transform,this.scope,this.options);this.stylesheet.snow=f.get();const k=this._getTransitionParameters({duration:0});f.updateTransitions(k)}_createRain(u){const f=this.rain=new Fi(u,this.map.transform,this.scope,this.options);this.stylesheet.rain=f.get();const k=this._getTransitionParameters({duration:0});f.updateTransitions(k)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const u of this.map._markers)u._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(u){if(this._checkLoaded(),!u)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const f=this.fog;if(!i.by(f.get(),u)){f.set(u,this.options),this.stylesheet.fog=f.get();const k=this._getTransitionParameters({duration:0});f.updateTransitions(k)}}else this._createFog(u);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(u){if(this._checkLoaded(),!u)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const f=this.snow;if(!i.by(f.get(),u)){f.set(u,this.options),this.stylesheet.snow=f.get();const k=this._getTransitionParameters({duration:0});f.updateTransitions(k)}}else this._createSnow(u);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(u){if(this._checkLoaded(),!u)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const f=this.rain;if(!i.by(f.get(),u)){f.set(u,this.options),this.stylesheet.rain=f.get();const k=this._getTransitionParameters({duration:0});f.updateTransitions(k)}}else this._createRain(u);this._markersNeedUpdate=!0}_reloadColorTheme(){const u=()=>{for(const P in this._layers)this._layers[P].lut=this._styleColorTheme.lut;for(const P in this._sourceCaches)this._sourceCaches[P].clearTiles()},f=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!f)return this._styleColorTheme.lut=null,void u();const k=this._evaluateColorThemeData(f);this._loadColorTheme(k).then(()=>{this.fire(new i.z("colorthemeset")),u()}).catch(P=>{i.w(`Couldn't set color theme: ${P}`)})}setColorTheme(u){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=u,this._reloadColorTheme()}setImportColorTheme(u,f){const k=this.getFragmentStyle(u);k&&(k._styleColorTheme.colorThemeOverride=f,k._reloadColorTheme())}_getTransitionParameters(u){return{now:i.o.now(),transition:Object.assign(this.transition,u)}}updateDrapeFirstLayers(){if(!this.terrain)return;const u=[],f=[];for(const k of this._mergedOrder)this.isLayerDraped(this._mergedLayers[k])?u.push(k):f.push(k);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...u),this._drapedFirstOrder.push(...f)}_createTerrain(u,f){const k=this.terrain=new Ft(u,f,this.scope,this.options,this.map.getWorldview());f===1&&(this.stylesheet.terrain=u),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const P=this._getTransitionParameters({duration:0});k.updateTransitions(P)}_force3DLayerUpdate(){for(const u in this._layers){const f=this._layers[u];f.type==="fill-extrusion"&&this._updateLayer(f)}}_forceSymbolLayerUpdate(){for(const u in this._layers){const f=this._layers[u];f.type==="symbol"&&this._updateLayer(f)}}_validate(u,f,k,P,D={}){if(D&&D.validate===!1)return!1;const R=Object.assign({},this.serialize());return og(this,u.call(Gn,Object.assign({key:f,style:R,value:k,styleSpec:i.a6},P)))}_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 u in this._mergedLayers)this._mergedLayers[u].setEventedParent(null);for(const u in this._mergedSourceCaches)this._mergedSourceCaches[u].clearTiles(),this._mergedSourceCaches[u].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(u){const f=this.getSourceCaches(u);for(const k of f)k.clearTiles()}clearSources(){for(const u in this._mergedSourceCaches)this._mergedSourceCaches[u].clearTiles()}clearLayers(){for(const u in this._mergedLayers){const f=this._mergedLayers[u];f._clear&&f._clear()}}reloadSource(u){const f=this.getSourceCaches(u);for(const k of f)k.resume(),k.reload()}reloadSources(){for(const u of this.getSources())u.reload&&u.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(u=>{u.modelManager.reloadModels(u.scope)})}updateSources(u){let f;this.directionalLight&&(f=Yv(this.directionalLight));const k=new Set,P=new Set;for(const D in this._mergedLayers){const R=this._mergedLayers[D];R.type==="building"&&k.add(R.source),R.hasElevation()&&!P.has(R.source)&&P.add(R.source)}for(const D in this._mergedSourceCaches){const R=this._mergedSourceCaches[D],U=P.has(R._source.id);k.has(R._source.id)&&(R._source.reparseOverscaled=!1),R.update(u,void 0,void 0,f,U)}}_generateCollisionBoxes(){for(const u in this._sourceCaches){const f=this._sourceCaches[u];f.resume(),f.reload()}}_updatePlacement(u,f,k,P,D,R,U=!1){let G=!1,J=!1;const te={},me={};for(const _e of this._mergedOrder){const Re=this._mergedLayers[_e];if(Re.type!=="symbol")continue;const De=i.B(Re.source,Re.scope);let He=te[De];if(!He){const We=this.getLayerSourceCache(Re);if(!We)continue;const kt=We.getRenderableIds(!0).map(xt=>We.getTileByID(xt));me[De]=kt.slice(),He=te[De]=kt.sort((xt,_t)=>_t.tileID.overscaledZ-xt.tileID.overscaledZ||(xt.tileID.isLessThan(_t.tileID)?-1:1))}const nt=this.crossTileSymbolIndex.addLayer(Re,He,f.center.lng,f.projection);G=G||nt}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),U=U||this._layerOrderChanged,this._layerOrderChanged&&this.fire(new i.z("neworder"));const he=!!(this.placement&&!f.equals(this.placement.transform)),pe=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!R||this.placement.lastReplacementSourceUpdateTime!==R.updateTime)),ke=(he||pe||G||this.placement&&this.placement.isStale())&&P===0;if((U||!this.pauseablePlacement||ke||P!==0&&this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.o.now(),f.zoom))&&(this.pauseablePlacement=new jl(f,this._mergedOrder,U||P===0,k,P,D,this.placement,this.fog&&f.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,me,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(i.o.now()),J=!0),G&&this.pauseablePlacement.placement.setStale()),J||G){this._buildingIndex.onNewFrame(f.zoom);for(let _e=0;_eD===u.id)!==-1)return void this.fire(new i.y(new Error(`Import with id '${u.id}' already exists in the map's style.`)));if(!f)return k.push(u),this._loadImports([u],!0);const P=k.findIndex(({id:D})=>D===f);return P===-1&&this.fire(new i.y(new Error(`Import with id "${f}" does not exist on this map.`))),this.stylesheet.imports=k.slice(0,P).concat(u).concat(k.slice(P)),this._loadImports([u],!0,f)}updateImport(u,f){this._checkLoaded();const k=this.stylesheet.imports||[],P=this.getImportIndex(u);return P===-1?this:typeof f=="string"?(this.setImportUrl(u,f),this):(f.url&&f.url!==k[P].url&&this.setImportUrl(u,f.url),i.by(f.config,k[P].config)||this.setImportConfig(u,f.config,f.data.schema),i.by(f.data,k[P].data)||this.setImportData(u,f.data),this)}moveImport(u,f){this._checkLoaded();let k=this.stylesheet.imports||[];const P=this.getImportIndex(u);if(P===-1)return this;const D=this.getImportIndex(f);if(D===-1)return this;const R=k[P],U=this.fragments[P];return k=k.filter(({id:G})=>G!==u),this.fragments=this.fragments.filter(({id:G})=>G!==u),this.stylesheet.imports=k.slice(0,D).concat(R).concat(k.slice(D)),this.fragments=this.fragments.slice(0,D).concat(U).concat(this.fragments.slice(D)),this.mergeLayers(),this}setImportUrl(u,f){this._checkLoaded();const k=this.stylesheet.imports||[],P=this.getImportIndex(u);if(P===-1)return this;k[P].url=f;const D=this.fragments[P];return D.style=this._createFragmentStyle(k[P]),D.style.on("style.import.load",()=>this.mergeAll()),D.style.loadURL(f),this}setImportData(u,f){this._checkLoaded();const k=this.getImportIndex(u),P=this.stylesheet.imports||[];return k===-1?this:f?(this.fragments[k].style.setState(f),this._reloadImports(),this):(delete P[k].data,this.setImportUrl(u,P[k].url))}setImportConfig(u,f,k){this._checkLoaded();const P=this.getImportIndex(u),D=this.stylesheet.imports||[];if(P===-1)return this;f?D[P].config=f:delete D[P].config;const R=this.fragments[P];k&&R.style.stylesheet&&(R.style.stylesheet.schema=k);const U=R.style.stylesheet&&R.style.stylesheet.schema;return R.config=f,R.style.updateConfig(f,U),this.updateConfigDependencies(),this}removeImport(u){this._checkLoaded();const f=this.stylesheet.imports||[],k=this.getImportIndex(u);k!==-1&&(f.splice(k,1),this.fragments[k].style._remove(),this.fragments.splice(k,1),this._reloadImports())}getImportIndex(u){const f=(this.stylesheet.imports||[]).findIndex(k=>k.id===u);return f===-1&&this.fire(new i.y(new Error(`Import '${u}' does not exist in the map's style and cannot be updated.`))),f}getLayer(u){return this._mergedLayers[u]}getSources(){const u=[];for(const f in this._mergedOtherSourceCaches){const k=this._mergedOtherSourceCaches[f];k&&u.push(k.getSource())}return u}getSource(u,f){const k=this.getSourceCache(u,f);return k&&k.getSource()}getLayerSource(u){const f=this.getLayerSourceCache(u);return f&&f.getSource()}getSourceCache(u,f){const k=i.B(u,f);return this._mergedOtherSourceCaches[k]}getLayerSourceCache(u){const f=i.B(u.source,u.scope);return u.type==="symbol"?this._mergedSymbolSourceCaches[f]:this._mergedOtherSourceCaches[f]}getSourceCaches(u){if(u==null)return Object.values(this._mergedSourceCaches);const f=[];return this._mergedOtherSourceCaches[u]&&f.push(this._mergedOtherSourceCaches[u]),this._mergedSymbolSourceCaches[u]&&f.push(this._mergedSymbolSourceCaches[u]),f}updateSourceCaches(){const u=this._changes.getUpdatedSourceCaches();for(const f in u){const k=u[f];k==="reload"?this.reloadSource(f):k==="clear"&&this.clearSource(f)}}updateLayers(u){const f=this._changes.getUpdatedPaintProperties();for(const k of f){const P=this.getLayer(k);P&&P.updateTransitions(u)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(u){this.stylesheet.glyphs=u,this.glyphManager.setURL(u)}getImages(u,f,k){this.imageManager.getImages(f.images,f.scope,k),this._updateTilesForChangedImages();const P=R=>{if(R){const U=f.images.map(G=>i.I.toString(G));R.setDependencies(f.tileID.key,f.type,U)}},D=i.B(f.source,f.scope);P(this._mergedOtherSourceCaches[D]),P(this._mergedSymbolSourceCaches[D]),f.images.some(R=>R.iconsetId)&&this.fire(new i.z("data",{dataType:"style"}))}rasterizeImages(u,f,k){this.imageManager.rasterizeImages(f,k)}getGlyphs(u,f,k){this.glyphManager.getGlyphs(f.stacks,k)}getResource(u,f,k){return i.dz(f,k)}getOwnSourceCache(u){return this._otherSourceCaches[u]}getOwnLayerSourceCache(u){return u.type==="symbol"?this._symbolSourceCaches[u.source]:this._otherSourceCaches[u.source]}getOwnSourceCaches(u){const f=[];return this._otherSourceCaches[u]&&f.push(this._otherSourceCaches[u]),this._symbolSourceCaches[u]&&f.push(this._symbolSourceCaches[u]),f}_isSourceCacheLoaded(u){const f=this.getOwnSourceCaches(u);return f.length===0?(this.fire(new i.y(new Error(`There is no source with ID '${u}'`))),!1):f.every(k=>k.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(u,f){if(!this._clipLayerPresent&&u.type!=="fill-extrusion"&&u.type!=="building")return!1;const k=u.type==="fill-extrusion"&&(u.sourceLayer==="building"||u.sourceLayer==="procedural_buildings"),P=u.type==="building";if(u.is3D(!!this.terrain)){if(k||P||f&&f.type==="batched-model"||u.type==="model")return!0}else if(u.type==="symbol")return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(u=>{u.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}vh.getSourceType=function(w){return fh[w]},vh.setSourceType=function(w,u){fh[w]=u},vh.registerForPluginStateChange=i.dA;class QP extends i.E{constructor(u){super(),this._style=u,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(u){u===this._selectedFloorId&&this._activeFloorsVisible||(this._selectedFloorId=u,this._activeFloorsVisible=!0,this._updateActiveFloors())}setActiveFloorsVisibility(u){this._activeFloorsVisible=u,this._updateActiveFloors(),this._updateIndoorSelector()}setIndoorData(u){for(const[f,k]of Object.entries(u.buildings))if(this._buildings[f])for(const P of k.floorIds)this._buildings[f].floors[P]||(this._buildings[f].floors[P]=k.floors[P]);else this._buildings[f]=k;for(const f of u.activeFloors)this._activeFloors.add(f);this._updateIndoorSelector()}getIndoorTileOptions(u,f){const k=this._style.getIndoorSourceLayers(u,f);return k&&this._indoorState?{sourceLayers:k,indoorState:this._indoorState}:null}_updateUI(u,f,k){const P=function(D,R,U,G){let J=null,te=Number.MAX_SAFE_INTEGER;if(G<16)return null;for(const[me,he]of Object.entries(D)){const pe=he.center;if(pe){const ke=R.distanceTo(i.aT.convert(pe));ke({id:R,name:k.floors[R].name,zIndex:k.floors[R].zIndex})).sort((R,U)=>U.zIndex-R.zIndex);this.fire(new i.z("selector-update",{selectedFloorId:P,activeFloorsVisible:this._activeFloorsVisible,floors:D}))}_updateActiveFloors(){const u=this._activeFloors;this._activeFloors=new Set,this._indoorState={selectedFloorId:this._selectedFloorId,lastActiveFloors:u,activeFloorsVisible:this._activeFloorsVisible},this._style.updateIndoorDependentLayers()}}var c0=` #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`,d0=` #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;}`,j5=` #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`,cN="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;}",Fu=` #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`,dN=`#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`,Rr=`#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`,k5=`#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`,uN=`#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;}`,hN=`#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`,N5=`#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 Qv=/#include\s+"([^"]+)"/g,$m=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,S5=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,bx=new Set(["ifdef","ifndef","elif","if","defined"]),wx=new Set;dg(c0,wx),dg(j5,wx),dg(d0,wx);const cg={"_prelude_fog.vertex.glsl":dN,"_prelude_terrain.vertex.glsl":Fu,"_prelude_shadow.vertex.glsl":hN,"_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":Rr,"_prelude_shadow.fragment.glsl":N5,"_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":k5,"_prelude_raster_particle.glsl":uN},mN={};ua("",Fu),ua(Rr,dN),ua(N5,hN),ua(k5,""),ua(uN,"");const JP=ua(d0,j5),pN=c0,Xie=[` #if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING) #extension GL_EXT_blend_func_extended : require #endif`,"precision mediump float;",pN,JP.fragmentSource].join(` `),e6=["precision highp float;",pN,JP.vertexSource].join(` `);var C5={background:ua(`#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:ua(`#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:ua(`#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:ua(`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:ua(`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:ua(`#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:ua("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:ua(`#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:ua(`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:ua("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:ua("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:ua("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:ua(`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:ua(`#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:ua(`#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:ua(`#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:ua(`#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:ua(`#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:ua(`#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:ua(`#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:ua(`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:ua(`#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:ua(`#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:ua(`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:ua(`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:ua(`#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:ua(`#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:ua(`#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:ua(`#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:ua(`#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:ua("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:ua("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:ua(`#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:ua(`#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:ua(`#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:ua("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:ua(`#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 }`,cN),skyboxGradient:ua(`#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 }`,cN),skyboxCapture:ua(` 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:ua(`#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:ua(`#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:ua(`#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:ua(`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:ua(`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:ua("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:ua("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:ua("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:ua("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 dg(w,u){const f=w.split(` `);for(let k of f){if(k=k.trimStart(),k[0]!=="#"||!k.includes("if")||k.startsWith("#endif"))continue;const P=k.match(S5);if(P)for(const D of P)bx.has(D)||u.add(D)}}function ua(w,u){const f=new Set,k=[],P=[];w=w.replace(Qv,(R,U)=>(P.push(U),"")),u=u.replace(Qv,(R,U)=>(k.push(U),""));let D=new Set(wx);dg(w,D),dg(u,D);for(const R of[...k,...P])mN[R]||(mN[R]=new Set,dg(cg[R],mN[R])),D=new Set([...D,...mN[R]]);return{fragmentSource:w=w.replace($m,(R,U,G,J,te)=>(f.add(te),U==="define"?` #ifndef HAS_UNIFORM_u_${te} in ${G} ${J} ${te}; #else uniform ${G} ${J} u_${te}; #endif `:U==="initialize"?` #ifdef HAS_UNIFORM_u_${te} ${G} ${J} ${te} = u_${te}; #endif `:U==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${te} in ${G} ${J} ${te}; #endif `:U==="initialize-attribute"?"":void 0)),vertexSource:u=u.replace($m,(R,U,G,J,te)=>{const me=`MATERIAL_ATTRIBUTE_OFFSET_${te}`,he=J==="float"?"vec2":J,pe=`GET_ATTRIBUTE_${he}(a_${te}, materialInfo, ${me})`,ke=te.match(/color/)?"color":he;return U==="define-attribute-vertex-shader-only"?` #ifdef HAS_ATTRIBUTE_a_${te} in ${G} ${J} a_${te}; #endif `:f.has(te)?U==="define"?` #ifndef HAS_UNIFORM_u_${te} uniform lowp float u_${te}_t; #if !defined(${me}) in ${G} ${he} a_${te}; #endif out ${G} ${J} ${te}; #else uniform ${G} ${J} u_${te}; #endif `:U==="initialize"?ke==="vec4"?` #ifndef HAS_UNIFORM_u_${te} ${te} = a_${te}; #else ${G} ${J} ${te} = u_${te}; #endif `:` #if !defined(HAS_UNIFORM_u_${te}) #ifdef ${me} ${te} = unpack_mix_${ke}(${pe}, u_${te}_t); #else ${te} = unpack_mix_${ke}(a_${te}, u_${te}_t); #endif #else ${G} ${J} ${te} = u_${te}; #endif `:U==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${te} in ${G} ${J} a_${te}; out ${G} ${J} ${te}; #endif `:U==="initialize-attribute"?` #ifdef HAS_ATTRIBUTE_a_${te} ${te} = a_${te}; #endif `:void 0:U==="define"?` #ifndef HAS_UNIFORM_u_${te} uniform lowp float u_${te}_t; #if !defined(${me}) in ${G} ${he} a_${te}; #endif #else uniform ${G} ${J} u_${te}; #endif `:U==="define-instanced"?ke==="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 ${G} ${J} u_${te}; #endif `:` #ifdef INSTANCED_ARRAYS in ${G} ${he} a_${te}; #else uniform ${G} ${J} u_${te}; #endif `:U==="initialize-attribute-custom"?` #ifdef HAS_ATTRIBUTE_a_${te} ${G} ${J} ${te} = a_${te}; #endif `:ke==="vec4"?` #ifndef HAS_UNIFORM_u_${te} #ifdef ${me} ${G} ${J} ${te} = ${pe}; #else ${G} ${J} ${te} = a_${te}; #endif #else ${G} ${J} ${te} = u_${te}; #endif `:` #ifndef HAS_UNIFORM_u_${te} #ifdef ${me} ${G} ${J} ${te} = unpack_mix_${ke}(${pe}, u_${te}_t); #else ${G} ${J} ${te} = unpack_mix_${ke}(a_${te}, u_${te}_t); #endif #else ${G} ${J} ${te} = u_${te}; #endif `}),usedDefines:D,vertexIncludes:k,fragmentIncludes:P}}class Qie{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(u,f,k,P,D,R,U,G){this.context=u;let J=this.boundPaintVertexBuffers.length!==P.length;for(let me=0;!J&&me{const kt=nt.paint.get("hillshade-shadow-color"),xt=nt.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",_t=nt.paint.get("hillshade-highlight-color"),gt=nt.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",ut=nt.paint.get("hillshade-accent-color"),Tt=nt.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",Bt=nt.paint.get("hillshade-emissive-strength");let zt=i.an(nt.paint.get("hillshade-illumination-direction"));if(nt.paint.get("hillshade-illumination-anchor")==="viewport")zt-=De.transform.angle;else if(De.style&&De.style.enable3dLights()&&De.style.directionalLight){const er=De.style.directionalLight.properties.get("direction"),ur=i.d4(er.x,er.y,er.z);zt=i.an(ur[1])}const Qt=!De.options.moving;return{u_matrix:We||De.transform.calculateProjMatrix(He.tileID.toUnwrapped(),Qt),u_image:0,u_latrange:Jie(0,He.tileID),u_light:[nt.paint.get("hillshade-exaggeration"),zt],u_shadow:kt.toPremultipliedRenderColor(xt?null:nt.lut),u_highlight:_t.toPremultipliedRenderColor(gt?null:nt.lut),u_emissive_strength:Bt,u_accent:ut.toPremultipliedRenderColor(Tt?null:nt.lut)}})(w,f,k,w.terrain?u.projMatrix:null);w.uploadCommonUniforms(U,he,u.toUnwrapped());const{tileBoundsBuffer:ke,tileBoundsIndexBuffer:_e,tileBoundsSegments:Re}=w.getTileBoundsBuffers(f);he.draw(w,G.TRIANGLES,P,D,R,Zs.disabled,pe,k.id,ke,_e,Re)}function M5(w,u,f){if(!u.needsDEMTextureUpload)return;const k=w.context,P=k.gl;k.pixelStoreUnpackPremultiplyAlpha.set(!1),u.demTexture=u.demTexture||w.getTileTexture(f.stride);const D=f.getPixels();u.demTexture?u.demTexture.update(D,{premultiply:!1}):u.demTexture=new i.T(k,D,P.R32F,{premultiply:!1}),u.needsDEMTextureUpload=!1}function toe(w,u,f){const k=w.context,P=k.gl;if(!u.dem)return;const D=u.dem;if(k.activeTexture.set(P.TEXTURE1),M5(w,u,D),!u.demTexture)return;u.demTexture.bind(P.NEAREST,P.CLAMP_TO_EDGE);const R=D.dim;k.activeTexture.set(P.TEXTURE0);let U=u.hillshadeFBO;if(!U){const he=new i.T(k,{width:R,height:R,data:null},P.RGBA8);he.bind(P.LINEAR,P.CLAMP_TO_EDGE),U=u.hillshadeFBO=k.createFramebuffer(R,R,1,"renderbuffer"),U.colorAttachment0.set(he.texture)}k.bindFramebuffer.set(U.framebuffer),k.viewport.set([0,0,R,R]);const{tileBoundsBuffer:G,tileBoundsIndexBuffer:J,tileBoundsSegments:te}=w.getMercatorTileBoundsBuffers(),me=[];w.linearFloatFilteringSupported()&&me.push("TERRAIN_DEM_FLOAT_FORMAT"),w.terrain&&w.terrain.renderingToTexture&&w.emissiveMode==="mrt-fallback"&&me.push("USE_MRT1"),w.getOrCreateProgram("hillshadePrepare",{defines:me}).draw(w,P.TRIANGLES,ks.disabled,Xs.disabled,bn.unblended,Zs.disabled,((he,pe)=>{const ke=pe.stride,_e=i.bC();return i.ce(_e,0,i.al,-i.al,0,0,1),i.br(_e,_e,[0,-i.al,0]),{u_matrix:_e,u_image:1,u_dimension:[ke,ke],u_zoom:he.overscaledZ}})(u.tileID,D),f.id,G,J,te),u.needsHillshadePrepare=!1}class $i{constructor(u){this.gl=u.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(u){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class roe extends $i{getDefault(){return i.ao.transparent.toNonPremultipliedRenderColor(null)}set(u){const f=this.current;(u.r!==f.r||u.g!==f.g||u.b!==f.b||u.a!==f.a||this.dirty)&&(this.gl.clearColor(u.r,u.g,u.b,u.a),this.current=u,this.dirty=!1)}}class t6 extends $i{getDefault(){return 1}set(u){(u!==this.current||this.dirty)&&(this.gl.clearDepth(u),this.current=u,this.dirty=!1)}}class T5 extends $i{getDefault(){return 0}set(u){(u!==this.current||this.dirty)&&(this.gl.clearStencil(u),this.current=u,this.dirty=!1)}}class fN extends $i{getDefault(){return[!0,!0,!0,!0]}set(u){const f=this.current;(u[0]!==f[0]||u[1]!==f[1]||u[2]!==f[2]||u[3]!==f[3]||this.dirty)&&(this.gl.colorMask(u[0],u[1],u[2],u[3]),this.current=u,this.dirty=!1)}}class A5 extends $i{getDefault(){return!0}set(u){(u!==this.current||this.dirty)&&(this.gl.depthMask(u),this.current=u,this.dirty=!1)}}class jx extends $i{getDefault(){return 255}set(u){(u!==this.current||this.dirty)&&(this.gl.stencilMask(u),this.current=u,this.dirty=!1)}}class u0 extends $i{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(u){const f=this.current;(u.func!==f.func||u.ref!==f.ref||u.mask!==f.mask||this.dirty)&&(this.gl.stencilFunc(u.func,u.ref,u.mask),this.current=u,this.dirty=!1)}}class Jv extends $i{getDefault(){const u=this.gl;return[u.KEEP,u.KEEP,u.KEEP]}set(u){const f=this.current;(u[0]!==f[0]||u[1]!==f[1]||u[2]!==f[2]||this.dirty)&&(this.gl.stencilOp(u[0],u[1],u[2]),this.current=u,this.dirty=!1)}}class h0 extends $i{getDefault(){return!1}set(u){if(u===this.current&&!this.dirty)return;const f=this.gl;u?f.enable(f.STENCIL_TEST):f.disable(f.STENCIL_TEST),this.current=u,this.dirty=!1}}class r6 extends $i{getDefault(){return[0,1]}set(u){const f=this.current;(u[0]!==f[0]||u[1]!==f[1]||this.dirty)&&(this.gl.depthRange(u[0],u[1]),this.current=u,this.dirty=!1)}}class E5 extends $i{getDefault(){return!1}set(u){if(u===this.current&&!this.dirty)return;const f=this.gl;u?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST),this.current=u,this.dirty=!1}}class s6 extends $i{getDefault(){return this.gl.LESS}set(u){(u!==this.current||this.dirty)&&(this.gl.depthFunc(u),this.current=u,this.dirty=!1)}}class m0 extends $i{getDefault(){return!1}set(u){if(u===this.current&&!this.dirty)return;const f=this.gl;u?f.enable(f.BLEND):f.disable(f.BLEND),this.current=u,this.dirty=!1}}class gN extends $i{getDefault(){const u=this.gl;return[u.ONE,u.ZERO,u.ONE,u.ZERO]}set(u){const f=this.current;(u[0]!==f[0]||u[1]!==f[1]||u[2]!==f[2]||u[3]!==f[3]||this.dirty)&&(this.gl.blendFuncSeparate(u[0],u[1],u[2],u[3]),this.current=u,this.dirty=!1)}}class xN extends $i{getDefault(){return i.ao.transparent.toNonPremultipliedRenderColor(null)}set(u){const f=this.current;(u.r!==f.r||u.g!==f.g||u.b!==f.b||u.a!==f.a||this.dirty)&&(this.gl.blendColor(u.r,u.g,u.b,u.a),this.current=u,this.dirty=!1)}}class I5 extends $i{getDefault(){return this.gl.FUNC_ADD}set(u){(u!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(u,u),this.current=u,this.dirty=!1)}}class yN extends $i{getDefault(){return!1}set(u){if(u===this.current&&!this.dirty)return;const f=this.gl;u?f.enable(f.CULL_FACE):f.disable(f.CULL_FACE),this.current=u,this.dirty=!1}}class e_ extends $i{getDefault(){return this.gl.BACK}set(u){(u!==this.current||this.dirty)&&(this.gl.cullFace(u),this.current=u,this.dirty=!1)}}class n6 extends $i{getDefault(){return this.gl.CCW}set(u){(u!==this.current||this.dirty)&&(this.gl.frontFace(u),this.current=u,this.dirty=!1)}}let a6=class extends $i{getDefault(){return null}set(w){(w!==this.current||this.dirty)&&(this.gl.useProgram(w),this.current=w,this.dirty=!1)}};class i6 extends $i{getDefault(){return this.gl.TEXTURE0}set(u){(u!==this.current||this.dirty)&&(this.gl.activeTexture(u),this.current=u,this.dirty=!1)}}class p0 extends $i{getDefault(){const u=this.gl;return[0,0,u.drawingBufferWidth,u.drawingBufferHeight]}set(u){const f=this.current;(u[0]!==f[0]||u[1]!==f[1]||u[2]!==f[2]||u[3]!==f[3]||this.dirty)&&(this.gl.viewport(u[0],u[1],u[2],u[3]),this.current=u,this.dirty=!1)}}class o6 extends $i{getDefault(){return null}set(u){if(u===this.current&&!this.dirty)return;const f=this.gl;f.bindFramebuffer(f.FRAMEBUFFER,u),this.current=u,this.dirty=!1}}class soe extends $i{getDefault(){return null}set(u){if(u===this.current&&!this.dirty)return;const f=this.gl;f.bindRenderbuffer(f.RENDERBUFFER,u),this.current=u,this.dirty=!1}}class noe extends $i{getDefault(){return null}set(u){if(u===this.current&&!this.dirty)return;const f=this.gl;f.bindTexture(f.TEXTURE_2D,u),this.current=u,this.dirty=!1}}class aoe extends $i{getDefault(){return null}set(u){if(u===this.current&&!this.dirty)return;const f=this.gl;f.bindBuffer(f.ARRAY_BUFFER,u),this.current=u,this.dirty=!1}}class P5 extends $i{getDefault(){return null}set(u){const f=this.gl;f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,u),this.current=u,this.dirty=!1}}class L5 extends $i{getDefault(){return null}set(u){this.gl&&(u!==this.current||this.dirty)&&(this.gl.bindVertexArray(u),this.current=u,this.dirty=!1)}}class O5 extends $i{getDefault(){return 4}set(u){if(u===this.current&&!this.dirty)return;const f=this.gl;f.pixelStorei(f.UNPACK_ALIGNMENT,u),this.current=u,this.dirty=!1}}class D5 extends $i{getDefault(){return!1}set(u){if(u===this.current&&!this.dirty)return;const f=this.gl;f.pixelStorei(f.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u),this.current=u,this.dirty=!1}}class l6 extends $i{getDefault(){return!1}set(u){if(u===this.current&&!this.dirty)return;const f=this.gl;f.pixelStorei(f.UNPACK_FLIP_Y_WEBGL,u),this.current=u,this.dirty=!1}}class vN extends $i{constructor(u,f){super(u),this.context=u,this.parent=f}getDefault(){return null}}class _N extends vN{constructor(u,f,k=0){super(u,f),this.attachmentPoint=u.gl.COLOR_ATTACHMENT0+k}setDirty(){this.dirty=!0}set(u){if(u===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const f=this.gl;f.framebufferTexture2D(f.FRAMEBUFFER,this.attachmentPoint,f.TEXTURE_2D,u,0),this.current=u,this.dirty=!1}}class f0 extends vN{attachment(){return this.gl.DEPTH_ATTACHMENT}set(u){if(u===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const f=this.gl;f.framebufferRenderbuffer(f.FRAMEBUFFER,this.attachment(),f.RENDERBUFFER,u),this.current=u,this.dirty=!1}}class t_ extends vN{attachment(){return this.gl.DEPTH_ATTACHMENT}set(u){if(u===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const f=this.gl;f.framebufferTexture2D(f.FRAMEBUFFER,this.attachment(),f.TEXTURE_2D,u,0),this.current=u,this.dirty=!1}}class c6 extends f0{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const zu=(w,u,f,k)=>({u_matrix:w,u_image0:0,u_image1:1,u_skirt_height:u,u_ground_shadow_factor:f,u_emissive_texture_available:k}),bN=(w,u,f,k,P,D,R,U,G,J,te,me,he,pe,ke,_e,Re)=>({u_proj_matrix:Float32Array.from(w),u_globe_matrix:u,u_normalize_matrix:Float32Array.from(k),u_merc_matrix:f,u_zoom_transition:P,u_merc_center:D,u_image0:0,u_image1:1,u_frustum_tl:R,u_frustum_tr:U,u_frustum_br:G,u_frustum_bl:J,u_globe_pos:te,u_globe_radius:me,u_viewport:he,u_grid_matrix:Re?Float32Array.from(Re):new Float32Array(9),u_skirt_height:pe,u_far_z_cutoff:ke,u_emissive_texture_available:_e});function r_(w,u){return w!=null&&u!=null&&!(!w.hasData()||!u.hasData())&&w.demTexture!=null&&u.demTexture!=null&&w.tileID.key!==u.tileID.key}const $p=new class{constructor(){this.operations={}}newMorphing(w,u,f,k,P){if(w in this.operations){const D=this.operations[w];D.to.tileID.key!==f.tileID.key&&(D.queued=f)}else this.operations[w]={startTime:k,phase:0,duration:P,from:u,to:f,queued:null}}getMorphValuesForProxy(w){if(!(w in this.operations))return null;const u=this.operations[w];return{from:u.from,to:u.to,phase:u.phase}}update(w){for(const u in this.operations){const f=this.operations[u];for(f.phase=(w-f.startTime)/f.duration;f.phase>=1||!this._validOp(f);)if(!this._nextOp(f,w)){delete this.operations[u];break}}}_nextOp(w,u){return!!w.queued&&(w.from=w.to,w.to=w.queued,w.queued=null,w.phase=0,w.startTime=u,!0)}_validOp(w){return w.from.hasData()&&w.to.hasData()}},wN={0:null,1:"TERRAIN_VERTEX_MORPHING"};function jN(w,u,f){if(u===0)return 0;const k=u<1&&f===514?.25/u:1;return 6*Math.pow(1.5,22-w)*Math.max(u,1)*k}function R5(w,u){const f=1<({u_matrix:w});function n_(w,u,f,k,P){if(P>0){const D=i.o.now(),R=(D-w.timeAdded)/P,U=u?(D-u.timeAdded)/P:-1,G=f.getSource(),J=k.coveringZoomLevel({tileSize:G.tileSize,roundZoom:G.roundZoom}),te=!u||Math.abs(u.tileID.overscaledZ-J)>Math.abs(w.tileID.overscaledZ-J),me=te&&w.refreshedUponExpiration?1:i.aA(te?R:1-U,0,1);return u?{opacity:1,mix:1-me,isFading:R<1}:{opacity:me,mix:0,isFading:R<1}}return{opacity:1,mix:0,isFading:!1}}class kN extends kd{constructor(u){const f=Jo("mock-dem",{type:"raster-dem",maxzoom:u.transform.maxZoom},u.style.dispatcher,u.style);super("mock-dem",f,!1),f.setEventedParent(this),this._sourceLoaded=!0}_loadTile(u,f){u.state="loaded",f(null)}}class F5 extends kd{constructor(u){const f=Jo("proxy",{type:"geojson",maxzoom:u.transform.maxZoom},u.style.dispatcher,u.style);super("proxy",f,!1),f.setEventedParent(this),this.map=this.getSource().map=u,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(u,f,k){if(u.freezeTileCoverage)return;this.transform=u;const P=u.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((D,R)=>{if(D[R.key]="",!this._tiles[R.key]){const U=new Dp(R,this._source.tileSize*R.overscaleFactor(),u.tileZoom,void 0,void 0,this._source.worldview);U.state="loaded",this._tiles[R.key]=U}return D},{});for(const D in this._tiles)D in P||(this.freeFBO(D),this._tiles[D].unloadVectorData(),delete this._tiles[D])}freeFBO(u){const f=this.proxyCachedFBO[u];if(f!==void 0){const k=Object.values(f);this.renderCachePool.push(...k),delete this.proxyCachedFBO[u]}}deallocRenderCache(){this.renderCache.forEach(u=>u.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class z5 extends i.aQ{constructor(u,f,k){super(u.overscaledZ,u.wrap,u.canonical.z,u.canonical.x,u.canonical.y),this.proxyTileKey=f,this.projMatrix=k}}class B5 extends i.bV{constructor(u,f){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},this.painter=u,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[k,P,D]=function(G){const J=new i.bd,te=new i.b0,me=131;J.reserve(17161),te.reserve(33800);const he=i.al/128,pe=i.al+he/2,ke=pe+he;for(let Re=-he;Repe||Re<0||Re>pe?24575:0,nt=i.aA(Math.round(De),0,i.al),We=i.aA(Math.round(Re),0,i.al);J.emplaceBack(nt+He,We)}const _e=(Re,De)=>{const He=De*me+Re;te.emplaceBack(He+1,He,He+me),te.emplaceBack(He+me,He+me+1,He+1)};for(let Re=1;Re<129;Re++)for(let De=1;De<129;De++)_e(De,Re);return[0,129].forEach(Re=>{for(let De=0;De<130;De++)_e(De,Re),_e(Re,De)}),[J,te,32768]}(),R=u.context;this.gridBuffer=R.createVertexBuffer(k,i.bf.members),this.gridIndexBuffer=R.createIndexBuffer(P),this.gridSegments=i.bg.simpleSegment(0,0,k.length,P.length),this.gridNoSkirtSegments=i.bg.simpleSegment(0,0,k.length,D),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new F5(f.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 U=R.gl;this._overlapStencilMode=new Xs({func:U.GEQUAL,mask:255},0,255,U.KEEP,U.KEEP,U.REPLACE),this._previousZoom=u.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=f,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new kN(f.map),this._pendingGroundEffectLayers=[],this._emissiveTexture=!1}set style(u){u.on("data",this._onStyleDataEvent.bind(this)),this._style=u,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(u,f,k){if(u&&u.terrain){this._style!==u&&(this.style=u,this._evaluationZoom=void 0);const P=u.terrain.properties,D=u.terrain.drapeRenderMode===0,R=u.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=i.o.now();const U=u.terrain&&u.terrain.scope,G=P.get("source"),J=D?this._mockSourceCache:u.getSourceCache(G,U);if(!J)return void i.w(`Couldn't find terrain source "${G}".`);if(this.sourceCache=J,this._attenuationRange=u.terrain.getAttenuationRange(),this._exaggeration=R?this.calculateExaggeration(f):P.get("exaggeration"),!f.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 me=this.getScaledDemTileSize();this.sourceCache.update(f,me,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,te(),this._initializing=!0),te(),f.updateElevation(!0,k),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(f),this._emptyDEMTextureDirty=!0,this._previousZoom=f.zoom}else this._disable()}calculateExaggeration(u){if(this._attenuationRange&&u.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(u.zoom);const f=this._previousCameraAltitude,k=u.getFreeCameraOptions().position.z/u.pixelsPerMeter*u.worldSize;this._previousCameraAltitude=k;const P=f!=null?k-f:Number.MAX_VALUE;if(Math.abs(P)<2)return this._exaggeration;const D=u.zoom,R=this._style.terrain;if(!this._previousUpdateTimestamp)return R.getExaggeration(D);let U=D-this._previousZoom;const G=this._previousUpdateTimestamp;let J=D;this._evaluationZoom!=null&&(J=this._evaluationZoom,Math.abs(D-J)>.5&&(U=.5*(D-J+U)),U*P<0&&(J+=U)),this._evaluationZoom=J;const te=R.getExaggeration(J),me=te===R.getExaggeration(Math.max(0,J-.1));if(me&&Math.abs(te-this._exaggeration)<.01)return te;let he=Math.min(.1,.00375*(this._updateTimestamp-G));return(me||te<.1||Math.abs(U)<1e-4)&&(he=Math.min(.2,4*he)),i.ak(this._exaggeration,te,he)}resetTileLookupCache(u){this._findCoveringTileCache[u]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(u){u.dataType==="source"&&u.coord?this._clearRenderCacheForTile(u.sourceCacheId,u.coord):u.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 u in this._style._mergedSourceCaches)this._style._mergedSourceCaches[u].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(u=>u.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 u=2*this.proxySourceCache.getSource().tileSize;return[u,u]}set useVertexMorphing(u){this._useVertexMorphing=u}updateTileBinding(u){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const f=this.proxySourceCache,k=this.painter.transform;this._initializing&&(this._initializing=k._centerAltitude===0&&this.getAtPointOrZero(i.ae.fromLngLat(k.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const P=this.proxyCoords=f.getIds().map(G=>{const J=f.getTileByID(G).tileID;return J.projMatrix=k.calculateProjMatrix(J.toUnwrapped()),J});(function(G,J){const te=J.transform.pointCoordinate(J.transform.getCameraPoint()),me=new i.P(te.x,te.y);G.sort((he,pe)=>{if(pe.overscaledZ-he.overscaledZ)return pe.overscaledZ-he.overscaledZ;const ke=new i.P(he.canonical.x+(1<{this.proxyToSource[G.key]={}}),this.terrainTileForTile={};const R=this._style._mergedSourceCaches;for(const G in R){const J=R[G];if(!J.used||(J!==this.sourceCache&&this.resetTileLookupCache(J.id),this._setupProxiedCoordsForOrtho(J,u[G],D),J.usedForTerrain))continue;const te=u[G];J.getSource().reparseOverscaled&&this._assignTerrainTiles(te)}this.proxiedCoords[f.id]=P.map(G=>new z5(G,G.key,this.orthoMatrix)),this._assignTerrainTiles(P),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(D),this.renderingToTexture=!1;const U={};this._visibleDemTiles=[];for(const G of this.proxyCoords){const J=this.terrainTileForTile[G.key];if(!J)continue;const te=J.tileID.key;te in U||(this._visibleDemTiles.push(J),U[te]=te)}}_assignTerrainTiles(u){this._initializing||u.forEach(f=>{if(this.terrainTileForTile[f.key])return;const k=this._findTileCoveringTileID(f,this.sourceCache);k&&(this.terrainTileForTile[f.key]=k)})}_prepareDEMTextures(){const u=this.painter.context,f=u.gl;for(const k in this.terrainTileForTile){const P=this.terrainTileForTile[k],D=P.dem;!D||P.demTexture&&!P.needsDEMTextureUpload||(u.activeTexture.set(f.TEXTURE1),M5(this.painter,P,D))}}_prepareDemTileUniforms(u,f,k,P){if(!f||f.demTexture==null)return!1;const D=u.tileID.canonical,R=Math.pow(2,f.tileID.canonical.z-D.z),U=P||"";return k[`u_dem_tl${U}`]=[D.x*R%1,D.y*R%1],k[`u_dem_scale${U}`]=R,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let u=0;const f=this._visibleDemTiles.reduce((k,P)=>{if(!P.dem)return k;const D=P.dem.tree.minimums[0];return D>0&&u++,k+D},0);return u?f/u:0}_updateEmptyDEMTexture(){const u=this.painter.context,f=u.gl;u.activeTexture.set(f.TEXTURE2);const k=this._getLoadedAreaMinimum(),P=new i.dL({width:1,height:1},new Float32Array([k]));this._emptyDEMTextureDirty=!1;let D=this._emptyDEMTexture;return D?D.update(P,{premultiply:!1}):D=this._emptyDEMTexture=new i.T(u,P,f.R32F,{premultiply:!1}),D}setupElevationDraw(u,f,k){const P=this.painter.context,D=P.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 U=null,G=null,J=1;if(k&&k.morphing&&this._useVertexMorphing){const pe=k.morphing.srcDemTile,ke=k.morphing.dstDemTile;J=k.morphing.phase,pe&&ke&&(this._prepareDemTileUniforms(u,pe,R,"_prev")&&(G=pe),this._prepareDemTileUniforms(u,ke,R)&&(U=ke))}const te=pe=>pe&&pe.demTexture&&this.painter.linearFloatFilteringSupported()?D.LINEAR:D.NEAREST;let me=null;var he;if(this.enabled?G&&U?(me=U.demTexture,P.activeTexture.set(D.TEXTURE4),G.demTexture.bind(te(G),D.CLAMP_TO_EDGE),R.u_dem_lerp=J):(U=this.terrainTileForTile[u.tileID.key],me=this._prepareDemTileUniforms(u,U,R)?U.demTexture:this.emptyDEMTexture):me=this.emptyDEMTexture,P.activeTexture.set(D.TEXTURE2),me&&(R.u_dem_size=(he=me).size[0]===1?1:he.size[0]-2,me.bind(te(U),D.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(k&&k.useDepthForOcclusion,f,R),k&&k.useMeterToDem&&U){const pe=(1<{if(De===er)return;const ur=[wN[er],"PROJECTION_GLOBE_VIEW"];nt&&ur.push("CUSTOM_ANTIALIASING");const Sr=J.isTileAffectedByFog(Qt);Re=J.getOrCreateProgram("globeRaster",{defines:ur,overrideFog:Sr}),De=er},kt=J.colorModeForRenderPass(),xt=new ks(_e.LEQUAL,ks.ReadWrite,J.depthRangeFor3D);$p.update(pe);const _t=i.dF(He),gt=[i.aF(He.center.lng),i.aJ(He.center.lat)],ut=J.globeSharedBuffers,Tt=[He.width*i.o.devicePixelRatio,He.height*i.o.devicePixelRatio],Bt=Float32Array.from(He.globeMatrix),zt={useDenormalizedUpVectorScale:!0};{const Qt=J.transform,er=jN(Qt.zoom,te.exaggeration(),te.sourceCache._source.tileSize);De=-1;const ur=_e.TRIANGLES;for(const Sr of he){const Kt=me.getTile(Sr),Pt=Xs.disabled,nr=te.prevTerrainTileForTile[Sr.key],Xt=te.terrainTileForTile[Sr.key];r_(nr,Xt)&&$p.newMorphing(Sr.key,nr,Xt,pe,250),g0(J,Kt.emissiveTexture),ke.activeTexture.set(_e.TEXTURE0),Kt.texture&&Kt.texture.bind(_e.LINEAR,_e.CLAMP_TO_EDGE);const gr=$p.getMorphValuesForProxy(Sr.key),$r=gr?1:0;gr&&Object.assign(zt,{morphing:{srcDemTile:gr.from,dstDemTile:gr.to,phase:i.dD(gr.phase)}});const rs=i.dG(Sr.canonical),Or=i.dH(rs.getCenter().lat),Tr=i.dI(Sr.canonical,rs,Or,Qt.worldSize/Qt._pixelsPerMercatorPixel),vs=i.bk(i.dJ(Sr.canonical)),ps=J.emissiveMode==="mrt-fallback"?1:0,Qr=bN(Qt.expandedFarZProjMatrix,Bt,_t,vs,i.aj(Qt.zoom),gt,Qt.frustumCorners.TL,Qt.frustumCorners.TR,Qt.frustumCorners.BR,Qt.frustumCorners.BL,Qt.globeCenterInViewSpace,Qt.globeRadius,Tt,er,Qt._farZ,ps,Tr);if(We(Sr,$r),Re&&(te.setupElevationDraw(Kt,Re,zt),J.uploadCommonUniforms(ke,Re,Sr.toUnwrapped()),ut)){const[ns,Ps,hn]=ut.getGridBuffers(Or,er!==0);Re.draw(J,ur,xt,Pt,kt,Zs.backCCW,Qr,"globe_raster",ns,Ps,hn)}}}if(ut&&(J.renderDefaultNorthPole||J.renderDefaultSouthPole)){const Qt=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];nt&&Qt.push("CUSTOM_ANTIALIASING"),Re=J.getOrCreateProgram("globeRaster",{defines:Qt});for(const er of he){const{x:ur,y:Sr,z:Kt}=er.canonical,Pt=Sr===0,nr=Sr===(1<ns.draw(J,_e.TRIANGLES,xt,Xs.disabled,kt,Zs.disabled,bN(He.expandedFarZProjMatrix,Tr,Tr,vs,0,gt,He.frustumCorners.TL,He.frustumCorners.TR,He.frustumCorners.BR,He.frustumCorners.BL,He.globeCenterInViewSpace,He.globeRadius,Tt,0,He._farZ,ps),"globe_pole_raster",Ps,$r,rs);te.setupElevationDraw(Or,Re,zt),J.uploadCommonUniforms(ke,Re,er.toUnwrapped()),Pt&&J.renderDefaultNorthPole&&Qr(Re,Xt),nr&&J.renderDefaultSouthPole&&(Tr=i.cS(i.bC(),Tr,[1,-1,1]),Qr(Re,gr))}}}})(P,D,R,U,G);else{const J=P.context,te=J.gl;let me,he;const pe=P.shadowRenderer,ke=ag(P,P.longestCutoffRange),_e=kt=>{if(he===kt)return;const xt=[];xt.push(wN[kt]),ke.shouldRenderCutoff&&xt.push("RENDER_CUTOFF"),pe&&(xt.push("RENDER_SHADOWS","DEPTH_TEXTURE"),pe.useNormalOffset&&xt.push("NORMAL_OFFSET")),me=P.getOrCreateProgram("terrainRaster",{defines:xt}),he=kt},Re=P.colorModeForRenderPass(),De=new ks(te.LEQUAL,ks.ReadWrite,P.depthRangeFor3D);$p.update(G);const He=P.transform,nt=jN(He.zoom,D.exaggeration(),D.sourceCache._source.tileSize);let We=[0,0,0];if(pe){const kt=P.style.directionalLight,xt=P.style.ambientLight;kt&&xt&&(We=Bp(P.style,kt,xt))}{he=-1;const kt=te.TRIANGLES,[xt,_t]=[D.gridIndexBuffer,D.gridSegments];for(const gt of U){const ut=R.getTile(gt),Tt=Xs.disabled,Bt=D.prevTerrainTileForTile[gt.key],zt=D.terrainTileForTile[gt.key];r_(Bt,zt)&&$p.newMorphing(gt.key,Bt,zt,G,250),g0(P,ut.emissiveTexture),J.activeTexture.set(te.TEXTURE0),ut.texture&&ut.texture.bind(te.LINEAR,te.CLAMP_TO_EDGE);const Qt=$p.getMorphValuesForProxy(gt.key),er=Qt?1:0;let ur;Qt&&(ur={morphing:{srcDemTile:Qt.from,dstDemTile:Qt.to,phase:i.dD(Qt.phase)}});const Sr=P.emissiveMode==="mrt-fallback"?1:0,Kt=zu(gt.projMatrix,R5(gt.canonical,He.renderWorldCopies)?nt/10:nt,We,Sr);if(_e(er),!me)continue;D.setupElevationDraw(ut,me,ur);const Pt=gt.toUnwrapped();pe&&pe.setupShadows(Pt,me),P.uploadCommonUniforms(J,me,Pt,null,ke),me.draw(P,kt,De,Tt,Re,Zs.backCCW,Kt,"terrain_raster",D.gridBuffer,xt,_t)}}}}(f,this,this.proxySourceCache,u,this._updateTimestamp),this.renderingToTexture=!0,f.gpuTimingDeferredRenderEnd(),u.splice(0,u.length))}renderBatch(u){if(this._drapedRenderBatches.length===0)return u+1;this.renderingToTexture=!0;const f=this.painter,k=this.painter.context,P=this.proxySourceCache,D=this.proxiedCoords[P.id],R=this._drapedRenderBatches.shift(),U=f.style.order,G=[];this._updateFBOs(f.emissiveMode==="mrt-fallback");let J=0;for(const te of D){const me=P.getTileByID(te.proxyTileKey),he=P.proxyCachedFBO[te.key]?P.proxyCachedFBO[te.key][u]:void 0,pe=he!==void 0?P.renderCache[he]:this.pool[J++],ke=he!==void 0;if(me.texture=pe.tex,me.emissiveTexture=pe.emissiveTex,ke&&!pe.dirty){G.push(me.tileID);continue}k.bindFramebuffer.set(pe.fb.framebuffer);const _e=k.gl;let Re;_e.drawBuffers(f.emissiveMode==="mrt-fallback"?[_e.COLOR_ATTACHMENT0,_e.COLOR_ATTACHMENT1]:[_e.COLOR_ATTACHMENT0]),this.renderedToTile=!1,pe.dirty&&(k.clear({color:i.ao.transparent,stencil:0}),pe.dirty=!1);for(let De=R.start;De<=R.end;++De){const He=f.style._mergedLayers[U[De]];if(He.isHidden(f.transform.zoom))continue;const nt=f.style.getLayerSourceCache(He),We=nt?this.proxyToSource[te.key][nt.id]:[te];if(!We)continue;const kt=We;k.viewport.set([0,0,pe.fb.width,pe.fb.height]),Re!==(nt?nt.id:null)&&(this._setupStencil(pe,We,He,nt),Re=nt?nt.id:null),f.renderLayer(f,nt,He,kt)}if(_e.drawBuffers([_e.COLOR_ATTACHMENT0]),this._drapedRenderBatches.length===0)for(const De of this._pendingGroundEffectLayers){const He=f.style._mergedLayers[U[De]];if(He.isHidden(f.transform.zoom))continue;const nt=f.style.getLayerSourceCache(He),We=nt?this.proxyToSource[te.key][nt.id]:[te];if(!We)continue;const kt=We;k.viewport.set([0,0,pe.fb.width,pe.fb.height]),Re!==(nt?nt.id:null)&&(this._setupStencil(pe,We,He,nt),Re=nt?nt.id:null),f.renderLayer(f,nt,He,kt)}this.renderedToTile?(pe.dirty=!0,G.push(me.tileID)):ke||--J,J===5&&(J=0,this.renderToBackBuffer(G))}return this.renderToBackBuffer(G),this.renderingToTexture=!1,k.bindFramebuffer.set(null),k.viewport.set([0,0,f.width,f.height]),R.end+1}postRender(){}isLayerOrderingCorrect(u){const f=u.order.length;let k=-1,P=f;for(let D=0;Dk}getMinElevationBelowMSL(){let u=0;return this._visibleDemTiles.filter(f=>f.dem).forEach(f=>{u=Math.min(u,f.dem.tree.minimums[0])}),u===0?u:(u-30)*this._exaggeration}raycast(u,f,k){if(!this._visibleDemTiles)return null;const P=this._visibleDemTiles.filter(D=>D.dem).map(D=>{const R=D.tileID,U=1<(D.t!==null?D.t:Number.MAX_VALUE)-(R.t!==null?R.t:Number.MAX_VALUE));for(const D of P){if(D.t==null)return null;const R=D.tile.dem.tree.raycast(D.minx,D.miny,D.maxx,D.maxy,u,f,k);if(R!=null)return R}return null}_createFBO(){const u=this.painter.context,f=u.gl,k=this.drapeBufferSize;u.activeTexture.set(f.TEXTURE0);const P=new i.T(u,{width:k[0],height:k[1],data:null},f.RGBA8);P.bind(f.LINEAR,f.CLAMP_TO_EDGE);const D=u.createFramebuffer(k[0],k[1],1,null);let R;return D.colorAttachment0.set(P.texture),this._emissiveTexture&&(R=new i.T(u,{width:k[0],height:k[1],data:null},f.R8),R.bind(f.LINEAR,f.CLAMP_TO_EDGE),D.createColorAttachment(u,1),D.colorAttachment1.set(R.texture)),D.depthAttachment=new c6(u,D.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=u.createRenderbuffer(u.gl.DEPTH_STENCIL,k[0],k[1]),this._stencilRef=0,D.depthAttachment.set(this._sharedDepthStencil),u.clear({stencil:0})):D.depthAttachment.set(this._sharedDepthStencil),u.extTextureFilterAnisotropic&&f.texParameterf(f.TEXTURE_2D,u.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,u.extTextureFilterAnisotropicMax),{fb:D,tex:P,emissiveTex:R,dirty:!1}}_updateFBOs(u){if(this._emissiveTexture!==u){for(const f of this.pool)this._updateFBO(f,u);for(const f of this.proxySourceCache.renderCache)this._updateFBO(f,u);this._emissiveTexture=u}}_updateFBO(u,f){const k=u.fb,P=this.painter.context,D=P.gl,R=this.drapeBufferSize;if(f){const U=new i.T(P,{width:R[0],height:R[1],data:null},D.R8);U.bind(D.LINEAR,D.CLAMP_TO_EDGE),u.emissiveTex=U,k.createColorAttachment(P,1),k.colorAttachment1.set(U.texture)}else u.emissiveTex=void 0,k.removeColorAttachment(P,1);u.dirty=!0}_initFBOPool(){for(;this.pool.length{const f=this._style._mergedLayers[u],k=f.isHidden(this.painter.transform.zoom);return f.type==="hillshade"||f.type==="custom"?!k&&f.shouldRedrape():!k&&f.hasTransition()})}_clearLineLayersFromRenderCache(){let u=!1;for(const k of this._style.getSources())if(k instanceof Om){u=!0;break}if(!u)return;const f={};for(let k=0;kG>U.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=k}_setupRenderCache(u){const f=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,f.renderCache.length>f.renderCachePool.length){const R=Object.values(f.proxyCachedFBO);f.proxyCachedFBO={};for(let U=0;U=0;R--){const U=k[R];if(f.getTileByID(U.key),f.proxyCachedFBO[U.key]!==void 0){const G=u[U.key],J=this.proxyToSource[U.key];let te=0;for(const me in J){const he=J[me],pe=G[me];if(!pe||pe.length!==he.length||he.some((ke,_e)=>ke!==pe[_e]||P[me]&&P[me].hasOwnProperty(ke.key))){te=-1;break}++te}for(const me in f.proxyCachedFBO[U.key])f.renderCache[f.proxyCachedFBO[U.key][me]].dirty=te<0||te!==Object.values(G).length}}const D=[...this._drapedRenderBatches];D.sort((R,U)=>U.end-U.start-(R.end-R.start));for(const R of D)for(const U of k){if(f.proxyCachedFBO[U.key])continue;let G=f.renderCachePool.pop();G===void 0&&f.renderCache.length<50&&(G=f.renderCache.length,f.renderCache.push(this._createFBO())),G!==void 0&&(f.proxyCachedFBO[U.key]={},f.proxyCachedFBO[U.key][R.start]=G,f.renderCache[G].dirty=!0)}this._tilesDirty={}}_setupStencil(u,f,k,P){if(!P||!this._sourceTilesOverlap[P.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const D=this.painter.context,R=D.gl;if(f.length<=1)return void(this._overlapStencilType=!1);let U;if(k.isTileClipped())U=f.length,this._overlapStencilMode.test={func:R.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(f[0].overscaledZ>f[f.length-1].overscaledZ))return void(this._overlapStencilType=!1);U=1,this._overlapStencilMode.test={func:R.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+U>255&&(D.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=U,this._overlapStencilMode.ref=this._stencilRef,k.isTileClipped()&&this._renderTileClippingMasks(f,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(u){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[u.key]),this._overlapStencilMode):Xs.disabled}_renderTileClippingMasks(u,f){const k=this.painter,P=this.painter.context,D=P.gl;k._tileClippingMaskIDs={},P.setColorMode(bn.disabled),P.setDepthMode(ks.disabled);const R=k.getOrCreateProgram("clippingMask");for(const U of u){const G=k._tileClippingMaskIDs[U.key]=--f;R.draw(k,D.TRIANGLES,ks.disabled,new Xs({func:D.ALWAYS,mask:0},G,255,D.KEEP,D.KEEP,D.REPLACE),bn.disabled,Zs.disabled,s_(U.projMatrix),"$clipping",k.tileExtentBuffer,k.quadTriangleIndexBuffer,k.tileExtentSegments)}}pointCoordinate(u){const f=this.painter.transform;if(u.x<0||u.x>f.width||u.y<0||u.y>f.height)return null;const k=[u.x,u.y,1,1];i.aC(k,k,f.pixelMatrixInverse),i.cK(k,k,1/k[3]),k[0]/=f.worldSize,k[1]/=f.worldSize;const P=f._camera.position,D=i.cf(1,f.center.lat),R=[P[0],P[1],P[2]/D,0],U=i.da([],k.slice(0,3),R);i.aw(U,U);const G=this.raycast(R,U,this._exaggeration);return G!==null&&G?(i.bH(R,R,U,G),R[3]=R[2],R[2]*=D,R):null}_setupProxiedCoordsForOrtho(u,f,k){if(u.getSource()instanceof i.aU)return this._setupProxiedCoordsForImageSource(u,f,k);this._findCoveringTileCache[u.id]=this._findCoveringTileCache[u.id]||{};const P=this.proxiedCoords[u.id]=[],D=this.proxyCoords;for(let G=0;Gte.overscaledZ-J.overscaledZ)}_setupProxiedCoordsForImageSource(u,f,k){if(!u.getSource().loaded())return;const P=this.proxiedCoords[u.id]=[],D=this.proxyCoords,R=u.getSource(),U=R.tileID;if(!U)return;const G=new i.P(U.x,U.y)._div(1<(me.min.x=Math.min(me.min.x,he.x-G.x),me.min.y=Math.min(me.min.y,he.y-G.y),me.max.x=Math.max(me.max.x,he.x-G.x),me.max.y=Math.max(me.max.y,he.y-G.y),me),{min:new i.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new i.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),te=(me,he)=>{const pe=me.wrap+me.canonical.x/(1<Re+J.max.x||ke+_eDe+J.max.y};for(let me=0;meR.key===f.tileID.key);if(D)return D}if(f.tileID.key!==u.key){const D=u.canonical.z-f.tileID.canonical.z;let R,U,G;P=i.bC();const J=f.tileID.wrap-u.wrap<0?(R=i.al>>D,U=R*((f.tileID.canonical.x<=me){const he=u.canonical.z-me;f.getSource().reparseOverscaled?(U=Math.max(u.canonical.z+2,f.transform.tileZoom),R=new i.aQ(U,u.wrap,me,u.canonical.x>>he,u.canonical.y>>he)):he!==0&&(U=me,R=new i.aQ(U,u.wrap,me,u.canonical.x>>he,u.canonical.y>>he))}R.key!==u.key&&(J.push(R.key),k=f.getTile(R))}const te=me=>{J.forEach(he=>{P[he]=me}),J.length=0};for(U-=1;U>=G&&(!k||!k.hasData());U--){k&&te(k.tileID.key);const me=R.calculateScaledKey(U);if(k=f.getTileByID(me),k&&k.hasData())break;const he=P[me];if(he===null)break;he===void 0?J.push(me):k=f.getTileByID(he)}return te(k?k.tileID.key:null),k&&k.hasData()?k:null}findDEMTileFor(u){return this.enabled?this._findTileCoveringTileID(u,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(u,f){let k=this._tilesDirty[u];k||(k=this._tilesDirty[u]={}),k[f.key]=!0}}function x0(w,u,f){const k=function(U,G,J){const te=i.bJ(G,U),me=i.bJ(J,[.2126,.7152,.0722]),he=(ke,_e,Re)=>(1-Re)*ke+Re*_e,pe=he(1-.3*Math.min(me,1),1,Math.min(te+1,1));return he(.92,1,Math.asin(i.aA(G[2],-1,1))/Math.PI+.5)*pe}(w,[0,0,1],u),P=[0,0,0];i.c5(P,f.slice(0,3),k);const D=[0,0,0];i.c5(D,u.slice(0,3),w[2]);const R=[0,0,0];return i.d8(R,P,D),i.db(R)}const ioe=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],ooe=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class d6{static cacheKey(u,f,k,P){const D=[f];P&&D.push(P.cacheKey);for(const R of k)u.usedDefines.has(R)&&D.push(R);return D.join("/")}constructor(u,f,k,P,D,R){const U=u.gl;this.program=U.createProgram(),this.configuration=P,this.name=f,this.fixedDefines=[...R];const G=`#version 300 es ${(P?P.defines():[]).concat(R.map(_e=>`#define ${_e}`)).join(` `)}`,J=[G,Xie];for(const _e of k.fragmentIncludes)J.push(cg[_e]);J.push(k.fragmentSource);const te=J.join(` `),me=[G,e6];for(const _e of k.vertexIncludes)me.push(cg[_e]);this.forceManualRenderingForInstanceIDShaders=u.forceManualRenderingForInstanceIDShaders&&k.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&me.push("uniform int u_instanceID;"),me.push(k.vertexSource);let he=me.join(` `);this.forceManualRenderingForInstanceIDShaders&&(he=he.replaceAll("gl_InstanceID","u_instanceID"));const pe=U.createShader(U.FRAGMENT_SHADER);if(U.isContextLost())return void(this.failedToCreate=!0);U.shaderSource(pe,te),U.compileShader(pe),U.attachShader(this.program,pe);const ke=U.createShader(U.VERTEX_SHADER);U.isContextLost()?this.failedToCreate=!0:(U.shaderSource(ke,he),U.compileShader(ke),U.attachShader(this.program,ke),this.attributes={},U.linkProgram(this.program),U.deleteShader(ke),U.deleteShader(pe),this.fixedUniforms=D(u),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=P?P.getUniforms(u):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(_e=>({u_instanceID:new i.ch(_e)}))(u)),(R.includes("TERRAIN")||f.includes("symbol")||f.includes("circle"))&&(this.terrainUniforms=(_e=>({u_dem:new i.ch(_e),u_dem_prev:new i.ch(_e),u_dem_tl:new i.ck(_e),u_dem_scale:new i.cj(_e),u_dem_tl_prev:new i.ck(_e),u_dem_scale_prev:new i.cj(_e),u_dem_size:new i.cj(_e),u_dem_lerp:new i.cj(_e),u_exaggeration:new i.cj(_e),u_depth:new i.ch(_e),u_depth_size_inv:new i.ck(_e),u_depth_range_unpack:new i.ck(_e),u_occluder_half_size:new i.cj(_e),u_occlusion_depth_offset:new i.cj(_e),u_meter_to_dem:new i.cj(_e),u_label_plane_matrix_inv:new i.cl(_e)}))(u)),R.includes("GLOBE")&&(this.globeUniforms=(_e=>({u_tile_tl_up:new i.ci(_e),u_tile_tr_up:new i.ci(_e),u_tile_br_up:new i.ci(_e),u_tile_bl_up:new i.ci(_e),u_tile_up_scale:new i.cj(_e)}))(u)),R.includes("FOG")&&(this.fogUniforms=(_e=>({u_fog_matrix:new i.cl(_e),u_fog_range:new i.ck(_e),u_fog_color:new i.d3(_e),u_fog_horizon_blend:new i.cj(_e),u_fog_vertical_limit:new i.ck(_e),u_fog_temporal_offset:new i.cj(_e),u_frustum_tl:new i.ci(_e),u_frustum_tr:new i.ci(_e),u_frustum_br:new i.ci(_e),u_frustum_bl:new i.ci(_e),u_globe_pos:new i.ci(_e),u_globe_radius:new i.cj(_e),u_globe_transition:new i.cj(_e),u_is_globe:new i.ch(_e),u_viewport:new i.ck(_e)}))(u)),R.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(_e=>({u_cutoff_params:new i.d3(_e)}))(u)),R.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(_e=>({u_lighting_ambient_color:new i.ci(_e),u_lighting_directional_dir:new i.ci(_e),u_lighting_directional_color:new i.ci(_e),u_ground_radiance:new i.ci(_e)}))(u)),R.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(_e=>({u_light_matrix_0:new i.cl(_e),u_light_matrix_1:new i.cl(_e),u_fade_range:new i.ck(_e),u_shadow_normal_offset:new i.ci(_e),u_shadow_intensity:new i.cj(_e),u_shadow_texel_size:new i.cj(_e),u_shadow_map_resolution:new i.cj(_e),u_shadow_direction:new i.ci(_e),u_shadow_bias:new i.ci(_e),u_shadowmap_0:new i.ch(_e),u_shadowmap_1:new i.ch(_e)}))(u)))}getAttributeLocation(u,f){let k=this.attributes[f];return k===void 0&&(k=this.attributes[f]=u.getAttribLocation(this.program,f)),k}setTerrainUniformValues(u,f){if(!this.terrainUniforms)return;const k=this.terrainUniforms;if(!this.failedToCreate){u.program.set(this.program);for(const P in f)k[P]&&k[P].set(this.program,P,f[P])}}setGlobeUniformValues(u,f){if(!this.globeUniforms)return;const k=this.globeUniforms;if(!this.failedToCreate){u.program.set(this.program);for(const P in f)k[P]&&k[P].set(this.program,P,f[P])}}setFogUniformValues(u,f){if(!this.fogUniforms)return;const k=this.fogUniforms;if(!this.failedToCreate){u.program.set(this.program);for(const P in f)k[P].set(this.program,P,f[P])}}setCutoffUniformValues(u,f){if(!this.cutoffUniforms)return;const k=this.cutoffUniforms;if(!this.failedToCreate){u.program.set(this.program);for(const P in f)k[P].set(this.program,P,f[P])}}setLightsUniformValues(u,f){if(!this.lightsUniforms)return;const k=this.lightsUniforms;if(!this.failedToCreate){u.program.set(this.program);for(const P in f)k[P].set(this.program,P,f[P])}}setShadowUniformValues(u,f){if(this.failedToCreate||!this.shadowUniforms)return;const k=this.shadowUniforms;u.program.set(this.program);for(const P in f)k[P].set(this.program,P,f[P])}_drawDebugWireframe(u,f,k,P,D,R,U,G,J,te){const me=u.options.wireframe;if(me.terrain===!1&&me.layers2D===!1&&me.layers3D===!1)return;const he=u.context;if(!(!(!me.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!me.layers2D||u._terrain&&u._terrain.renderingToTexture||!ioe.includes(this.name))||!(!me.layers3D||!ooe.includes(this.name))))return;const pe=he.gl,ke=u.wireframeDebugCache.getLinesFromTrianglesBuffer(u.frameCounter,D,he);if(!ke)return;const _e=[...this.fixedDefines,"DEBUG_WIREFRAME"],Re=u.getOrCreateProgram(this.name,{config:this.configuration,defines:_e});he.program.set(Re.program);const De=(We,kt,xt)=>{if(kt[We]&&xt[We])for(const _t in kt[We])xt[We][_t]&&xt[We][_t].set(xt.program,_t,kt[We][_t].current)};J&&J.setUniforms(Re.program,he,Re.binderUniforms,U,{zoom:G}),De("fixedUniforms",this,Re),De("terrainUniforms",this,Re),De("globeUniforms",this,Re),De("fogUniforms",this,Re),De("lightsUniforms",this,Re),De("shadowUniforms",this,Re),ke.bind(),he.setColorMode(new bn([pe.ONE,pe.ONE_MINUS_SRC_ALPHA,pe.ZERO,pe.ONE],i.ao.transparent,[!0,!0,!0,!1])),he.setDepthMode(new ks(f.func===pe.LESS?pe.LEQUAL:f.func,ks.ReadOnly,f.range)),he.setStencilMode(Xs.disabled);const He=3*R.primitiveLength*2,nt=3*R.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const We=te||1;for(let kt=0;kt1?pe.drawElementsInstanced(pe.LINES,He,pe.UNSIGNED_SHORT,nt,te):pe.drawElements(pe.LINES,He,pe.UNSIGNED_SHORT,nt);D.bind(),he.program.set(this.program),he.setDepthMode(f),he.setStencilMode(k),he.setColorMode(P)}checkUniforms(u,f,k){if(this.fixedDefines.includes(f)){for(const P of Object.keys(k))if(!k[P].initialized)throw new Error(`Program '${this.name}', from draw '${u}': uniform ${P} not set but required by ${f} being defined`)}}draw(u,f,k,P,D,R,U,G,J,te,me,he,pe,ke,_e,Re){const De=u.context,He=De.gl;if(this.failedToCreate)return;De.program.set(this.program),De.setDepthMode(k),De.setStencilMode(P),De.setColorMode(D),De.setCullFace(R);for(const[gt,ut]of this.fixedUniformsEntries)ut.set(this.program,gt,U[gt]);ke&&ke.setUniforms(this.program,De,this.binderUniforms,he,{zoom:pe});const nt={[He.POINTS]:1,[He.LINES]:2,[He.TRIANGLES]:3,[He.LINE_STRIP]:1}[f];this.checkUniforms(G,"RENDER_SHADOWS",this.shadowUniforms);const We=_e||[],kt=ke?ke.getPaintVertexBuffers():[],xt=f===He.TRIANGLES&&te,_t=Re&&Re>0?1:void 0;for(const gt of me.get()){const ut=gt.vaos||(gt.vaos={});if((ut[G]||(ut[G]=new Qie)).bind(De,this,J,kt,te,gt.vertexOffset,We,_t),this.forceManualRenderingForInstanceIDShaders){const Tt=Re||1;for(let Bt=0;Bt1?He.drawElementsInstanced(f,gt.primitiveLength*nt,He.UNSIGNED_SHORT,gt.primitiveOffset*nt*2,Re):te?He.drawElements(f,gt.primitiveLength*nt,He.UNSIGNED_SHORT,gt.primitiveOffset*nt*2):He.drawArrays(f,gt.vertexOffset,gt.vertexLength);xt&&this._drawDebugWireframe(u,k,P,D,te,gt,he,pe,ke,Re)}}}function u6(w,u,f=0){const k=Math.pow(2,u.tileID.overscaledZ),P=u.tileSize*Math.pow(2,w.transform.tileZoom)/k,D=P*(u.tileID.canonical.x+u.tileID.wrap*k),R=P*u.tileID.canonical.y;return{u_image:0,u_texsize:u.imageAtlasTexture?u.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/i.ay(u,1,w.transform.tileZoom),u_pixel_coord_upper:[D>>16,R>>16],u_pixel_coord_lower:[65535&D,65535&R],u_pattern_transition:f}}const NN={terrain:0,flat:1},loe=i.bC(),SN=(w,u,f,k,P,D,R,U,G,J,te,me,he,pe,ke,_e,Re,De)=>{const He=u.style.light,nt=He.properties.get("position"),We=[nt.x,nt.y,nt.z],kt=i.dO();He.properties.get("anchor")==="viewport"&&(i.dP(kt,-u.transform.angle),i.dQ(We,We,kt));const xt=He.properties.get("color").toPremultipliedRenderColor(null),_t=u.transform,gt={u_matrix:w,u_lightpos:We,u_lightintensity:He.properties.get("intensity"),u_lightcolor:[xt.r,xt.g,xt.b],u_vertical_gradient:+f,u_opacity:k,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:loe,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:NN[J],u_base_type:NN[te],u_ao:P,u_edge_radius:D,u_width_scale:R,u_flood_light_color:ke,u_vertical_scale:_e,u_flood_light_intensity:Re,u_ground_shadow_factor:De};return _t.projection.name==="globe"&&(gt.u_tile_id=[U.canonical.x,U.canonical.y,1<({u_matrix:w,u_edge_radius:u,u_width_scale:f,u_vertical_scale:k,u_height_type:NN[P],u_base_type:NN[D]}),h6=(w,u,f,k,P,D,R,U,G,J,te,me,he,pe,ke,_e,Re,De)=>{const He=SN(w,u,f,k,P,D,R,U,J,te,me,he,pe,ke,_e,Re,1,[0,0,0]),nt={u_height_factor:-Math.pow(2,U.overscaledZ)/G.tileSize/8};return Object.assign(He,u6(u,G,De),nt)},y0=(w,u,f,k,P,D,R,U,G,J,te)=>({u_matrix:u,u_opacity:f,u_ao_pass:k?1:0,u_meter_to_tile:P,u_ao:D,u_flood_light_intensity:R,u_flood_light_color:U,u_attenuation:G,u_edge_radius:J,u_fb:0,u_fb_size:te,u_dynamic_offset:1}),U5=(w,u,f)=>({u_matrix:w,u_emissive_strength:u,u_ground_shadow_factor:f}),q5=(w,u,f,k,P,D=0)=>Object.assign(U5(w,u,P),u6(f,k,D)),m6=(w,u,f,k)=>({u_matrix:w,u_world:f,u_emissive_strength:u,u_ground_shadow_factor:k}),V5=(w,u,f,k,P,D,R=0)=>Object.assign(q5(w,u,f,k,D,R),{u_world:P}),ug=(w,u)=>({u_matrix:w,u_ground_shadow_factor:u}),kx=(w,u,f,k,P)=>({u_matrix:w,u_camera_pos:[u[0],u[1],u[2]],u_depth_bias:f,u_height_scale:k,u_reset_depth:P}),CN=(w,u,f,k,P,D,R,U,G)=>({u_matrix:w,u_normal_matrix:u,u_opacity:f,u_faux_facade_ao_intensity:k,u_camera_pos:P,u_tile_to_meter:D,u_facade_emissive_chance:R,u_flood_light_color:U,u_flood_light_intensity:G}),p6=w=>({u_matrix:w}),hg=w=>({u_matrix:w}),H5=(w,u,f,k,P,D,R,U)=>{const G=i.al/D.tileSize;return{u_matrix:w,u_inv_rot_matrix:u,u_camera_to_center_distance:f.getCameraToCenterDistance(U),u_extrude_scale:[f.pixelsToGLUnits[0]/G,f.pixelsToGLUnits[1]/G],u_zoom_transition:k,u_tile_id:R,u_merc_center:P}},a_=(w,u,f=1)=>({u_matrix:w,u_color:u,u_overlay:0,u_overlay_scale:f}),f6=i.bC(),g6=(w,u,f,k,P,D,R)=>{const U=w.transform,G=U.projection.name==="globe",J=G?i.dR(U.zoom,u.canonical)*U._pixelsPerMercatorPixel:i.ay(f,1,D),te={u_matrix:u.projMatrix,u_extrude_scale:J,u_intensity:R,u_inv_rot_matrix:f6,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(G){te.u_inv_rot_matrix=k,te.u_merc_center=P,te.u_tile_id=[u.canonical.x,u.canonical.y,1<({u_matrix:w,u_normalize_matrix:u,u_globe_matrix:f,u_merc_matrix:k,u_grid_matrix:P,u_tl_parent:D,u_scale_parent:J,u_fade_t:te.mix,u_opacity:te.opacity*me.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:me.paint.get("raster-brightness-min"),u_brightness_high:me.paint.get("raster-brightness-max"),u_saturation_factor:i.dT(me.paint.get("raster-saturation")),u_contrast_factor:i.dS(me.paint.get("raster-contrast")),u_spin_weights:y6(me.paint.get("raster-hue-rotate")),u_perspective_transform:he,u_raster_elevation:pe,u_zoom_transition:R,u_merc_center:U,u_cutoff_params:G,u_colorization_mix:MN(i.dU,_e,De),u_colorization_offset:TN(i.dU,Re,De),u_color_ramp:ke,u_texture_offset:[nt/(He+2*nt),He/(He+2*nt)],u_texture_res:[He+2*nt,He+2*nt],u_emissive_strength:We});function y6(w){w*=Math.PI/180;const u=Math.sin(w),f=Math.cos(w);return[(2*f+1)/3,(-Math.sqrt(3)*u-f+1)/3,(Math.sqrt(3)*u-f+1)/3]}const Um=.05,coe=(w,u,f,k,P,D,R,U,G,J,te,me)=>({u_matrix:w,u_normalize_matrix:u,u_globe_matrix:f,u_merc_matrix:k,u_grid_matrix:P,u_tl_parent:D,u_scale_parent:J,u_fade_t:te.mix,u_opacity:te.opacity,u_image0:0,u_image1:1,u_raster_elevation:me,u_zoom_transition:R,u_merc_center:U,u_cutoff_params:G}),doe=(w,u,f,k,P,D,R,U,G,J)=>({u_particle_texture:w,u_particle_texture_side_len:u,u_tile_offset:f,u_velocity:k,u_color_ramp:D,u_velocity_res:P,u_max_speed:R,u_uv_offset:U,u_data_scale:[255*G[0],255*G[1]],u_data_offset:J,u_particle_pos_scale:1.1,u_particle_pos_offset:[Um,Um]}),v6=(w,u,f,k,P,D,R,U,G,J)=>({u_particle_texture:w,u_particle_texture_side_len:u,u_velocity:f,u_velocity_res:k,u_max_speed:P,u_speed_factor:D,u_reset_rate:R,u_rand_seed:Math.random(),u_uv_offset:U,u_data_scale:[255*G[0],255*G[1]],u_data_offset:J,u_particle_pos_scale:1.1,u_particle_pos_offset:[Um,Um]}),_6=i.bC(),AN=(w,u,f,k,P,D,R,U,G,J,te,me,he,pe,ke,_e,Re,De,He,nt,We,kt,xt,_t)=>{const gt=P.transform,ut={u_is_size_zoom_constant:+(w==="constant"||w==="source"),u_is_size_feature_constant:+(w==="constant"||w==="camera"),u_size_t:u?u.uSizeT:0,u_size:u?u.uSize:0,u_camera_to_center_distance:gt.getCameraToCenterDistance(He),u_rotate_symbol:+f,u_aspect_ratio:gt.width/gt.height,u_fade_change:P.options.fadeDuration?P.symbolFadeChange:1,u_matrix:D,u_label_plane_matrix:R,u_coord_matrix:U,u_is_text:+J,u_elevation_from_sea:G?1:0,u_pitch_with_map:+k,u_texsize:te,u_texsize_icon:me,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:_6,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:_6,u_up_vector:[0,-1,0],u_color_adj_mat:kt,u_icon_transition:xt||0,u_gamma_scale:k?P.transform.getCameraToCenterDistance(He)*Math.cos(P.terrain?0:P.transform._pitch):1,u_device_pixel_ratio:i.o.devicePixelRatio,u_is_halo:1,u_scale_factor:_t||1,u_ground_shadow_factor:nt,u_inv_matrix:i.bl(i.bC(),R),u_normal_scale:We,u_lutTexture:Rl.LUT};return He.name==="globe"&&(ut.u_tile_id=[pe.canonical.x,pe.canonical.y,1<({u_matrix:w,u_emissive_strength:u,u_opacity:f,u_color:k}),mg=(w,u,f,k,P,D,R,U,G)=>Object.assign(function(J,te,me,he,pe,ke){const{width:_e,height:Re}=he.imageManager.getPixelSize(te),De=Math.pow(2,ke.tileID.overscaledZ),He=ke.tileSize*Math.pow(2,he.transform.tileZoom)/De,nt=He*(ke.tileID.canonical.x+ke.tileID.wrap*De),We=He*ke.tileID.canonical.y;return{u_image:0,u_pattern_tl:me.tl,u_pattern_br:me.br,u_texsize:[_e,Re],u_pattern_size:me.displaySize,u_pattern_units_to_pixels:pe?[he.transform.width,-1*he.transform.height]:[1/i.ay(ke,1,he.transform.tileZoom),1/i.ay(ke,1,he.transform.tileZoom)],u_pixel_coord_upper:[nt>>16,We>>16],u_pixel_coord_lower:[65535&nt,65535&We]}}(0,D,R,k,U,G),{u_matrix:w,u_emissive_strength:u,u_opacity:f}),v0=new Float32Array(i.bA([])),Nx=(w,u,f,k,P,D,R,U,G,J,te,me,he,pe=[0,0,0],ke,_e,Re)=>{const De=P.style.light,He=De.properties.get("position"),nt=[-He.x,-He.y,He.z],We=i.dO();De.properties.get("anchor")==="viewport"&&(i.dP(We,-P.transform.angle),i.dQ(nt,nt,We));const kt=te.alphaMode==="MASK",xt=De.properties.get("color").toNonPremultipliedRenderColor(null),_t=he.paint.get("model-ambient-occlusion-intensity"),gt=he.paint.get("model-color").constantOr(i.ao.white).toNonPremultipliedRenderColor(null);return gt.a=he.paint.get("model-color-mix-intensity").constantOr(0),Re&&(gt.r=Re[0],gt.g=Re[1],gt.b=Re[2],gt.a=Re[3]),_e&&(gt.r=_e.color.r,gt.g=_e.color.g,gt.b=_e.color.b,gt.a=_e.colorMix,me=_e.emissionStrength,D*=_e.opacity),{u_matrix:w,u_lighting_matrix:u,u_normal_matrix:f,u_node_matrix:k||v0,u_lightpos:nt,u_lightintensity:De.properties.get("intensity"),u_lightcolor:[xt.r,xt.g,xt.b],u_camera_pos:pe,u_opacity:D,u_baseTextureIsAlpha:0,u_alphaMask:+kt,u_alphaCutoff:te.alphaCutoff,u_baseColorFactor:R.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:U.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:G,u_roughnessFactor:J,u_baseColorTexture:Rl.BaseColor,u_metallicRoughnessTexture:Rl.MetallicRoughness,u_normalTexture:Rl.Normal,u_occlusionTexture:Rl.Occlusion,u_emissionTexture:Rl.Emission,u_lutTexture:Rl.LUT,u_color_mix:gt.toArray01(),u_aoIntensity:_t,u_emissive_strength:me,u_occlusionTextureTransform:ke||[0,0,0,0]}},W5=(w,u=v0,f=v0)=>({u_matrix:w,u_instance:u,u_node_matrix:f}),EN={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 Jh{constructor(u,f,k,P){this.id=Jh.uniqueIdxCounter,Jh.uniqueIdxCounter++,this.context=u;const D=u.gl;this.buffer=D.createBuffer(),this.dynamicDraw=!!k,this.context.unbindVAO(),u.bindElementBuffer.set(this.buffer),D.bufferData(D.ELEMENT_ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?D.DYNAMIC_DRAW:D.STATIC_DRAW),this.dynamicDraw||P||f.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(u){this.id=Jh.uniqueIdxCounter,Jh.uniqueIdxCounter++;const f=this.context.gl;this.context.unbindVAO(),this.bind(),f.bufferSubData(f.ELEMENT_ARRAY_BUFFER,0,u.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Jh.uniqueIdxCounter=0;const G5={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class b6{constructor(u,f,k,P,D,R){this.length=f.length,this.attributes=k,this.itemSize=f.bytesPerElement,this.dynamicDraw=P,this.instanceCount=R,this.context=u;const U=u.gl;this.buffer=U.createBuffer(),u.bindVertexBuffer.set(this.buffer),U.bufferData(U.ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?U.DYNAMIC_DRAW:U.STATIC_DRAW),this.dynamicDraw||D||f.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(u){const f=this.context.gl;this.bind(),f.bufferSubData(f.ARRAY_BUFFER,0,u.arrayBuffer)}enableAttributes(u,f){for(let k=0;k0&&u.vertexAttribDivisor(D,k)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class w6{constructor(u,f,k,P,D){this.context=u,this.width=f,this.height=k;const R=this.framebuffer=u.gl.createFramebuffer();P>0&&(this.colorAttachment0=new _N(u,R,0)),P>1&&(this.colorAttachment1=new _N(u,R,1)),D&&(this.depthAttachmentType=D,this.depthAttachment=D==="renderbuffer"?new f0(u,R):new t_(u,R))}createColorAttachment(u,f){f===0?this.colorAttachment0=new _N(u,this.framebuffer,0):f===1&&(this.colorAttachment1=new _N(u,this.framebuffer,1))}removeColorAttachment(u,f){const k=this.context.gl;let P;f===0?(P=this.colorAttachment0.get(),this.colorAttachment0=void 0):f===1&&(P=this.colorAttachment1.get(),this.colorAttachment1=void 0),P&&k.deleteTexture(P)}destroy(){const u=this.context.gl;if(this.colorAttachment0){const f=this.colorAttachment0.get();f&&u.deleteTexture(f)}if(this.colorAttachment1){const f=this.colorAttachment1.get();f&&u.deleteTexture(f)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const f=this.depthAttachment.get();f&&u.deleteRenderbuffer(f)}else{const f=this.depthAttachment.get();f&&u.deleteTexture(f)}u.deleteFramebuffer(this.framebuffer)}}class _0{constructor(u,f){this.gl=u,this.clearColor=new roe(this),this.clearDepth=new t6(this),this.clearStencil=new T5(this),this.colorMask=new fN(this),this.depthMask=new A5(this),this.stencilMask=new jx(this),this.stencilFunc=new u0(this),this.stencilOp=new Jv(this),this.stencilTest=new h0(this),this.depthRange=new r6(this),this.depthTest=new E5(this),this.depthFunc=new s6(this),this.blend=new m0(this),this.blendFunc=new gN(this),this.blendColor=new xN(this),this.blendEquation=new I5(this),this.cullFace=new yN(this),this.cullFaceSide=new e_(this),this.frontFace=new n6(this),this.program=new a6(this),this.activeTexture=new i6(this),this.viewport=new p0(this),this.bindFramebuffer=new o6(this),this.bindRenderbuffer=new soe(this),this.bindTexture=new noe(this),this.bindVertexBuffer=new aoe(this),this.bindElementBuffer=new P5(this),this.bindVertexArrayOES=new L5(this),this.pixelStoreUnpack=new O5(this),this.pixelStoreUnpackPremultiplyAlpha=new D5(this),this.pixelStoreUnpackFlipY=new l6(this),this.options=f?Object.assign({},f):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=u.getExtension("EXT_texture_filter_anisotropic")||u.getExtension("MOZ_EXT_texture_filter_anisotropic")||u.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=u.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=u.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=u.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=u.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=f&&!!f.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.indexOf("PowerVR")!==-1,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=u.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=u.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=u.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=u.getParameter(u.MAX_TEXTURE_SIZE),this.extBlendFuncExtended=u.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(u,f,k){return new Jh(this,u,f,k)}createVertexBuffer(u,f,k,P,D){return new b6(this,u,f,k,P,D)}createRenderbuffer(u,f,k){const P=this.gl,D=P.createRenderbuffer();return this.bindRenderbuffer.set(D),P.renderbufferStorage(P.RENDERBUFFER,u,f,k),this.bindRenderbuffer.set(null),D}createFramebuffer(u,f,k,P){return new w6(this,u,f,k,P)}clear({color:u,depth:f,stencil:k,colorMask:P}){const D=this.gl;let R=0;u&&(R|=D.COLOR_BUFFER_BIT,this.clearColor.set(u.toNonPremultipliedRenderColor(null)),this.colorMask.set(P||[!0,!0,!0,!0])),f!==void 0&&(R|=D.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(f),this.depthMask.set(!0)),k!==void 0&&(R|=D.STENCIL_BUFFER_BIT,this.clearStencil.set(k),this.stencilMask.set(255)),D.clear(R)}setCullFace(u){u.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(u.mode),this.frontFace.set(u.frontFace))}setDepthMode(u){u.func!==this.gl.ALWAYS||u.mask?(this.depthTest.set(!0),this.depthFunc.set(u.func),this.depthMask.set(u.mask),this.depthRange.set(u.range)):this.depthTest.set(!1)}setStencilMode(u){u.test.func!==this.gl.ALWAYS||u.mask?(this.stencilTest.set(!0),this.stencilMask.set(u.mask),this.stencilOp.set([u.fail,u.depthFail,u.pass]),this.stencilFunc.set({func:u.test.func,ref:u.ref,mask:u.test.mask})):this.stencilTest.set(!1)}setColorMode(u){i.by(u.blendFunction,bn.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(u.blendFunction),this.blendColor.set(u.blendColor),u.blendEquation?this.blendEquation.set(u.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(u.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let Sx;function hs(w,u,f,k,P,D,R){const U=w.context,G=U.gl,J=w.transform,te=[i.aF(J.center.lng),i.aJ(J.center.lat)],me=f.layout.get("symbol-placement"),he=f.layout.get("text-variable-anchor"),pe=f.layout.get("icon-rotation-alignment")==="map",ke=f.layout.get("text-rotation-alignment")==="map",_e=me!=="point",Re=[];let De=0,He=0;for(let ut=0;ut0){const Qr=i.bC(),ns=Or;i.cP(Qr,zt.placementInvProjMatrix,J.glCoordMatrix),i.cP(Qr,Qr,zt.placementViewportMatrix),Re.push({circleArray:vs,circleOffset:He,transform:ns,invTransform:Qr,projection:zt.getProjection()}),De+=vs.length/4,He=De}if(!Tr)continue;w.terrain&&w.terrain.setupElevationDraw(Bt,rs);const ps=gr?[Tt.canonical.x,Tt.canonical.y,1<=0&&(pe[nt.associatedIconIndex]={x:zt,y:Qt,z:er,angle:nr})}else Yh(xt,me)}if(J){he.clear();const He=w.icon.placedSymbolArray;for(let nt=0;nt{let ha=[0,0,0];if(Oa){const jn=w.style.directionalLight,ji=w.style.ambientLight;jn&&ji&&(ha=Bp(w.style,jn,ji))}return ha},ba=Oa=>{ut.depthOcclusionForSymbolsAndCircles&&(f.hasOcclusionOpacityProperties||w.terrain)&&(Oa.push("DEPTH_D24"),Oa.push("DEPTH_OCCLUSION"))},nn=Oa=>{f.lut&&!xt&&(f.lut.texture||(f.lut.texture=new i.d$(w.context,f.lut.image,[f.lut.image.height,f.lut.image.height,f.lut.image.height],_t.gl.RGBA8)),_t.activeTexture.set(_t.gl.TEXTURE0+Rl.LUT),f.lut.texture&&f.lut.texture.bind(_t.gl.LINEAR,_t.gl.CLAMP_TO_EDGE),Oa.push("APPLY_LUT_ON_GPU"))},La=()=>{const Oa=Tt&&f.layout.get("symbol-placement")!=="point",ha=[];ba(ha),nn(ha);const jn=Oa||hn,ji=Tr.elevationType==="road",vo=w.shadowRenderer,Xi=ji&&zt&&!!vo&&vo.enabled,si=js(Xi),Ad=ji&&zt&&!w.terrain?Kt:Sr,_c=f.paint.get("icon-image-cross-fade");w.terrainRenderModeElevated()&&zt&&ha.push("PITCH_WITH_MAP_TERRAIN"),vs&&(ha.push("PROJECTION_GLOBE_VIEW"),jn&&ha.push("PROJECTED_POS_ON_VIEWPORT")),_c>0&&Tr.hasAnySecondaryIcon&&ha.push("ICON_TRANSITION"),!Tr.icon.zOffsetVertexBuffer||ji&&w.terrain||ha.push("Z_OFFSET"),De===0&&He===0&&nt===0&&We===1||ha.push("COLOR_ADJUSTMENT"),Tr.sdfIcons&&ha.push("RENDER_SDF"),Xi&&ha.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),ji&&zt&&!w.terrain&&Tr.icon.orientationVertexBuffer&&ha.push("ELEVATED_ROADS");const rl=Tr.icon.programConfigurations.get(f.id),qc=w.getOrCreateProgram("symbol",{config:rl,defines:ha}),Vc=Or.imageAtlasTexture?Or.imageAtlasTexture.size:[0,0],Ql=Tr.iconSizeData,Uu=i.bK(Ql,ut.zoom),jh=zt||!ut.isOrthographic,Xd=Ca(Qr,Or.tileID.canonical,zt,Tt,ut,Tr.getProjection(),ns),co=uu(Qr,Or.tileID.canonical,zt,Tt,ut,Tr.getProjection(),ns),ko=w.translatePosMatrix(co,Or,U,J,!0),ni=w.translatePosMatrix(Qr,Or,U,J),Po=jn?o_:Xd,no=Tt&&!zt&&!Oa;let Qi=$r;!Xt&&!ut.mercatorFromTransition||Tt||(Qi=Up(ut));const kh=vs?Qi:$r,__=f.getColorAdjustmentMatrix(De,He,nt,We),rm=AN(Ql.kind,Uu,no,zt,w,ni,Po,ko,kt,!1,Vc,[0,0],0,rs,ps,Pt,ta,kh,Tr.getProjection(),si,Ta,__,_c,null),b_=Or.imageAtlasTexture?Or.imageAtlasTexture:null,T0=f.layout.get("icon-size").constantOr(0)!==1||Tr.iconsNeedLinear,Gm=Tr.sdfIcons||w.options.rotating||w.options.zooming||T0||jh?gt.LINEAR:gt.NEAREST,Xp=Tr.sdfIcons&&f.paint.get("icon-halo-width").constantOr(1)!==0,A0=w.terrain&&zt&&Oa?i.bl(i.bC(),Xd):o_;if(Oa&&Tr.icon){const vg=i.bV.getAtTileOffsetFunc(rs,ut.center.lat,ut.worldSize,Tr.getProjection()),Qp=Zh(Qr,Or.tileID.canonical,zt,Tt,ut,Tr.getProjection(),ns),sm=f.layout.get("icon-size-scale-range"),Jp=i.aA(w.scaleFactor,sm[0],sm[1]);WP(Tr,Qr,w,!1,Qp,co,zt,_e,vg,rs,Jp)}return{program:qc,buffers:Tr.icon,uniformValues:rm,atlasTexture:b_,atlasTextureIcon:null,atlasInterpolation:Gm,atlasInterpolationIcon:null,isSDF:Tr.sdfIcons,hasHalo:Xp,depthMode:Ad,tile:Or,renderWithShadows:Xi,labelPlaneMatrixInv:A0}},Za=()=>{const Oa=Bt&&f.layout.get("symbol-placement")!=="point",ha=[],jn=Oa||nr||hn,ji=Tr.elevationType==="road",vo=w.shadowRenderer,Xi=ji&&Qt&&!!vo&&vo.enabled,si=js(Xi),Ad=ji&&Qt&&!w.terrain?Kt:Sr;w.terrainRenderModeElevated()&&Qt&&ha.push("PITCH_WITH_MAP_TERRAIN"),vs&&(ha.push("PROJECTION_GLOBE_VIEW"),jn&&ha.push("PROJECTED_POS_ON_VIEWPORT")),!Tr.text.zOffsetVertexBuffer||ji&&w.terrain||ha.push("Z_OFFSET"),Tr.iconsInText&&ha.push("RENDER_TEXT_AND_SYMBOL"),ha.push("RENDER_SDF"),Xi&&ha.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),ji&&Qt&&!w.terrain&&Tr.text.orientationVertexBuffer&&ha.push("ELEVATED_ROADS"),ba(ha);const _c=Tr.text.programConfigurations.get(f.id),rl=w.getOrCreateProgram("symbol",{config:_c,defines:ha});let qc,Vc=[0,0],Ql=null;const Uu=Tr.textSizeData;Tr.iconsInText&&(Vc=Or.imageAtlasTexture?Or.imageAtlasTexture.size:[0,0],Ql=Or.imageAtlasTexture?Or.imageAtlasTexture:null,qc=Qt||!ut.isOrthographic||w.options.rotating||w.options.zooming||Uu.kind==="composite"||Uu.kind==="camera"?gt.LINEAR:gt.NEAREST);const jh=Or.glyphAtlasTexture?Or.glyphAtlasTexture.size:[0,0],Xd=f.layout.get("text-size-scale-range"),co=i.aA(w.scaleFactor,Xd[0],Xd[1]),ko=i.bK(Uu,ut.zoom,co),ni=Ca(Qr,Or.tileID.canonical,Qt,Bt,ut,Tr.getProjection(),ns),Po=uu(Qr,Or.tileID.canonical,Qt,Bt,ut,Tr.getProjection(),ns),no=w.translatePosMatrix(Po,Or,G,te,!0),Qi=w.translatePosMatrix(Qr,Or,G,te),kh=jn?o_:ni,__=Bt&&!Qt&&!Oa;let rm=$r;!Xt&&!ut.mercatorFromTransition||Bt||(rm=Up(ut));const b_=AN(Uu.kind,ko,__,Qt,w,Qi,kh,no,kt,!0,jh,Vc,0,rs,ps,Pt,ta,vs?rm:$r,Tr.getProjection(),si,Ta,null,null,co),T0=Or.glyphAtlasTexture?Or.glyphAtlasTexture:null,Gm=gt.LINEAR,Xp=f.paint.get("text-halo-width").constantOr(1)!==0,A0=w.terrain&&Qt&&Oa?i.bl(i.bC(),ni):o_;if(Oa&&Tr.text){const vg=i.bV.getAtTileOffsetFunc(rs,ut.center.lat,ut.worldSize,Tr.getProjection()),Qp=Zh(Qr,Or.tileID.canonical,Qt,Bt,ut,Tr.getProjection(),ns);WP(Tr,Qr,w,!0,Qp,Po,Qt,Re,vg,rs,co)}return{program:rl,buffers:Tr.text,uniformValues:b_,atlasTexture:T0,atlasTextureIcon:Ql,atlasInterpolation:Gm,atlasInterpolationIcon:qc,isSDF:!0,hasHalo:Xp,depthMode:Ad,tile:Or,renderWithShadows:Xi,labelPlaneMatrixInv:A0}},Ua=Tr.icon.segments.get().length,_a=Tr.text.segments.get().length,wn=Ua&&!R.onlyText?La():null,Pa=_a&&!R.onlyIcons?Za():null,so=f.paint.get("icon-opacity").constantOr(1),Ii=f.paint.get("text-opacity").constantOr(1);if(er&&Tr.canOverlap){ur=!0;const Oa=so&&!R.onlyText?Tr.icon.segments.get():[],ha=Ii&&!R.onlyIcons?Tr.text.segments.get():[];for(const jn of Oa)gr.push({segments:new i.bg([jn]),sortKey:jn.sortKey,state:wn});for(const jn of ha)gr.push({segments:new i.bg([jn]),sortKey:jn.sortKey,state:Pa})}else R.onlyText||gr.push({segments:so?Tr.icon.segments:new i.bg([]),sortKey:0,state:wn}),R.onlyIcons||gr.push({segments:Ii?Tr.text.segments:new i.bg([]),sortKey:0,state:Pa})}ur&&gr.sort((rs,Or)=>rs.sortKey-Or.sortKey);for(const rs of gr){const Or=rs.state;if(Or)if(w.terrain?w.terrain.setupElevationDraw(Or.tile,Or.program,{useDepthForOcclusion:ut.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Or.labelPlaneMatrixInv}):w.setupDepthForOcclusion(ut.depthOcclusionForSymbolsAndCircles,Or.program),_t.activeTexture.set(gt.TEXTURE0),Or.atlasTexture&&Or.atlasTexture.bind(Or.atlasInterpolation,gt.CLAMP_TO_EDGE,!0),Or.atlasTextureIcon&&(_t.activeTexture.set(gt.TEXTURE1),Or.atlasTextureIcon&&Or.atlasTextureIcon.bind(Or.atlasInterpolationIcon,gt.CLAMP_TO_EDGE,!0)),Or.renderWithShadows&&w.shadowRenderer.setupShadows(Or.tile.tileID.toUnwrapped(),Or.program,"vector-tile"),w.uploadCommonLightUniforms(w.context,Or.program),Or.hasHalo){const Tr=Or.uniformValues;Tr.u_is_halo=1,K5(Or.buffers,rs.segments,f,w,Or.program,Or.depthMode,P,D,Tr,2),Tr.u_is_halo=0}else{if(Or.isSDF){const Tr=Or.uniformValues;Or.hasHalo&&(Tr.u_is_halo=1,K5(Or.buffers,rs.segments,f,w,Or.program,Or.depthMode,P,D,Tr,1)),Tr.u_is_halo=0}K5(Or.buffers,rs.segments,f,w,Or.program,Or.depthMode,P,D,Or.uniformValues,1)}}}function K5(w,u,f,k,P,D,R,U,G,J){const te=[w.dynamicLayoutVertexBuffer,w.opacityVertexBuffer,w.iconTransitioningVertexBuffer,w.globeExtVertexBuffer,w.zOffsetVertexBuffer,w.orientationVertexBuffer];P.draw(k,k.context.gl.TRIANGLES,D,R,U,Zs.disabled,G,f.id,w.layoutVertexBuffer,w.indexBuffer,u,f.paint,k.transform.zoom,w.programConfigurations.get(f.id),te,J)}function j6(w,u){const f=1<=Qh?1:pe.pitch/Qh))),2*ke}(w.transform),J=w.transform.getFreeCameraOptions().position,te="elevatedStructuresDepthReconstruct",me=w.getOrCreateProgram(te,{defines:["DEPTH_RECONSTRUCTION"]}),he=w.getOrCreateProgram(te);for(const pe of k){const ke=u.getTile(pe),_e=ke.getBucket(f);if(!_e)continue;const Re=_e.elevatedStructures;if(!Re)continue;const De=_e.elevationBufferData.heightRange,He=j6(pe.toUnwrapped(),J),nt=w.translatePosMatrix(pe.projMatrix,ke,f.paint.get("fill-translate"),f.paint.get("fill-translate-anchor"));let We,kt,xt,_t;if(P==="initialize"){if(!De||De.min>=1||Re.depthSegments.segments[0].primitiveLength===0)continue;We=kx(nt,He,G,1,0),kt=R,xt=Re.depthSegments,_t=me}else if(P==="reset"){if(!De||De.min>=0||Re.maskSegments.segments[0].primitiveLength===0)continue;We=kx(nt,He,0,0,1),kt=U,xt=Re.maskSegments,_t=me}else if(P==="geometry"){if(Re.depthSegments.segments[0].primitiveLength===0)continue;We=kx(nt,He,G,1,0),kt=R,xt=Re.depthSegments,_t=he}_t.draw(w,D.TRIANGLES,kt,Xs.disabled,bn.disabled,Zs.disabled,We,f.id,Re.vertexBuffer,Re.indexBuffer,xt,f.paint,w.transform.zoom)}}function PN(w,u,f,k){const{painter:P,sourceCache:D,layer:R,coords:U,colorMode:G,elevationType:J,terrainEnabled:te,pass:me}=w,he=P.context.gl,pe=R.paint.get("fill-pattern"),ke=R.paint.get("fill-pattern-cross-fade"),_e=pe.constantOr(null);let Re=J;J!=="road"||u&&!te||(Re="none");const De=Re==="road",He=w.painter.shadowRenderer,nt=De&&!!He&&He.enabled,We=new ks(P.context.gl.LEQUAL,ks.ReadOnly,P.depthRangeFor3D);let kt=[0,0,0];if(nt){const ut=P.style.directionalLight,Tt=P.style.ambientLight;ut&&Tt&&(kt=Bp(P.style,ut,Tt))}const xt=pe&&pe.constantOr(1),_t=P.terrain&&P.terrain.renderingToTexture,gt=(ut,Tt)=>{let Bt,zt,Qt,er,ur;Tt?(Bt=xt&&!R.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Qt=he.LINES):(Bt=xt?"fillPattern":"fill",Qt=he.TRIANGLES);for(const Sr of U){const Kt=D.getTile(Sr);if(xt&&!Kt.patternsLoaded())continue;const Pt=Kt.getBucket(R);if(!Pt)continue;const nr=u?Pt.elevationBufferData:Pt.bufferData;if(nr.isEmpty())continue;P.prepareDrawTile();const Xt=nr.programConfigurations.get(R.id),gr=P.isTileAffectedByFog(Sr),$r=[],rs=[];De&&($r.push("ELEVATED_ROADS"),rs.push(nr.elevatedLayoutVertexBuffer)),nt&&$r.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),_t&&f&&$r.push("USE_MRT1"),xt&&(P.context.activeTexture.set(he.TEXTURE0),Kt.imageAtlasTexture&&Kt.imageAtlasTexture.bind(he.LINEAR,he.CLAMP_TO_EDGE),Xt.updatePaintBuffers());let Or=!1;if(_e&&Kt.imageAtlas){const ns=Kt.imageAtlas,Ps=i.e3.from(_e),hn=Ps.getPrimary().scaleSelf(i.o.devicePixelRatio).toString(),ta=Ps.getSecondary(),Ta=ns.patternPositions.get(hn),js=ta?ns.patternPositions.get(ta.scaleSelf(i.o.devicePixelRatio).toString()):null;Or=!!Ta&&!!js,Ta&&Xt.setConstantPatternPositions(Ta,js)}ke>0&&(Or||Xt.getPatternTransitionVertexBuffer("fill-pattern"))&&$r.push("FILL_PATTERN_TRANSITION");const Tr=P.getOrCreateProgram(Bt,{config:Xt,overrideFog:gr,defines:$r}),vs=P.translatePosMatrix(Sr.projMatrix,Kt,R.paint.get("fill-translate"),R.paint.get("fill-translate-anchor"));nt&&He.setupShadows(Kt.tileID.toUnwrapped(),Tr,"vector-tile");const ps=R.paint.get("fill-emissive-strength");if(Tt){er=nr.lineIndexBuffer,ur=nr.lineSegments;const ns=P.terrain&&P.terrain.renderingToTexture?P.terrain.drapeBufferSize:[he.drawingBufferWidth,he.drawingBufferHeight];zt=Bt==="fillOutlinePattern"&&xt?V5(vs,ps,P,Kt,ns,kt,ke):m6(vs,ps,ns,kt)}else er=nr.indexBuffer,ur=nr.triangleSegments,zt=xt?q5(vs,ps,P,Kt,kt,ke):U5(vs,ps,kt);P.uploadCommonUniforms(P.context,Tr,Sr.toUnwrapped());let Qr=ut;(J==="road"&&!te||J==="offset")&&(Qr=We),Tr.draw(P,Qt,Qr,k||P.stencilModeForClipping(Sr),G,Zs.disabled,zt,R.id,nr.layoutVertexBuffer,er,ur,R.paint,P.transform.zoom,Xt,rs)}};P.renderPass===me&>(P.depthModeForSublayer(1,P.renderPass==="opaque"?ks.ReadWrite:ks.ReadOnly),!1),Re==="none"&&P.renderPass==="translucent"&&R.paint.get("fill-antialias")&>(P.depthModeForSublayer(R.getPaintProperty("fill-outline-color")?2:0,ks.ReadOnly),!0)}function LN(w,u,f,k,P,D,R,U){f.resetLayerRenderingStats(w);const G=w.context,J=G.gl,te=w.transform,me=f.paint.get("fill-extrusion-pattern"),he=f.paint.get("fill-extrusion-pattern-cross-fade"),pe=me.constantOr(null),ke=me.constantOr(1),_e=f.paint.get("fill-extrusion-opacity"),Re=w.style.enable3dLights(),De=f.paint.get(Re&&!ke?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),He=[f.paint.get("fill-extrusion-ambient-occlusion-intensity"),De],nt=f.layout.get("fill-extrusion-edge-radius"),We=nt>0&&!f.paint.get("fill-extrusion-rounded-roof"),kt=We?0:nt,xt=te.projection.name==="globe"?i.eb():0,_t=te.projection.name==="globe",gt=_t?i.aj(te.zoom):0,ut=[i.aF(te.center.lng),i.aJ(te.center.lat)],Tt=f.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",Bt=f.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(Tt?null:f.lut).toArray01().slice(0,3),zt=f.paint.get("fill-extrusion-flood-light-intensity"),Qt=f.paint.get("fill-extrusion-vertical-scale"),er=f.paint.get("fill-extrusion-line-width").constantOr(1)!==0,ur=f.paint.get("fill-extrusion-height-alignment"),Sr=f.paint.get("fill-extrusion-base-alignment"),Kt=ag(w,f.paint.get("fill-extrusion-cutoff-fade-range")),Pt=[];let nr;_t&&Pt.push("PROJECTION_GLOBE_VIEW"),He[0]>0&&Pt.push("FAUX_AO"),We&&Pt.push("ZERO_ROOF_RADIUS"),U&&Pt.push("HAS_CENTROID"),zt>0&&Pt.push("FLOOD_LIGHT"),Kt.shouldRenderCutoff&&Pt.push("RENDER_CUTOFF"),er&&Pt.push("RENDER_WALL_MODE");const Xt=w.renderPass==="shadow",gr=w.shadowRenderer,$r=Xt&&!!gr,rs=Xt?Zs.disabled:Zs.backCCW;w.shadowRenderer&&(w.shadowRenderer.useNormalOffset=!0);let Or=[0,0,0];if(gr){const ps=w.style.directionalLight,Qr=w.style.ambientLight;ps&&Qr&&(Or=Bp(w.style,ps,Qr)),Xt||(Pt.push("RENDER_SHADOWS","DEPTH_TEXTURE"),gr.useNormalOffset&&Pt.push("NORMAL_OFFSET")),nr=Pt.concat(["SHADOWS_SINGLE_CASCADE"])}const Tr=$r?"fillExtrusionDepth":ke?"fillExtrusionPattern":"fillExtrusion",vs=f.getLayerRenderingStats();for(const ps of k){const Qr=u.getTile(ps),ns=Qr.getBucket(f);if(!ns||ns.projection.name!==te.projection.name)continue;let Ps=!1;gr&&(Ps=gr.getMaxCascadeForTile(ps.toUnwrapped())===0);const hn=w.isTileAffectedByFog(ps),ta=ns.programConfigurations.get(f.id);let Ta=!1;if(pe&&Qr.imageAtlas){const _a=Qr.imageAtlas,wn=i.e3.from(pe),Pa=wn.getPrimary().scaleSelf(i.o.devicePixelRatio).toString(),so=wn.getSecondary(),Ii=_a.patternPositions.get(Pa),Oa=so?_a.patternPositions.get(so.scaleSelf(i.o.devicePixelRatio).toString()):null;Ta=!!Ii&&!!Oa,Ii&&ta.setConstantPatternPositions(Ii,Oa)}he>0&&(Ta||ta.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&Pt.push("FILL_EXTRUSION_PATTERN_TRANSITION");const js=w.getOrCreateProgram(Tr,{config:ta,defines:Ps?nr:Pt,overrideFog:hn});if(w.terrain&&w.terrain.setupElevationDraw(Qr,js,{useMeterToDem:!0}),!ns.centroidVertexBuffer){const _a=js.getAttributeLocation(J,"a_centroid_pos");_a!==-1&&J.vertexAttrib2f(_a,0,0)}!Xt&&gr&&gr.setupShadows(Qr.tileID.toUnwrapped(),js,"vector-tile"),ke&&(w.context.activeTexture.set(J.TEXTURE0),Qr.imageAtlasTexture&&Qr.imageAtlasTexture.bind(J.LINEAR,J.CLAMP_TO_EDGE),ta.updatePaintBuffers());const ba=f.paint.get("fill-extrusion-vertical-gradient"),nn=1/ns.tileToMeter;let La;if(Xt&&gr){if(Vp(Qr.tileID,ns.maxHeight,w))continue;const _a=gr.calculateShadowPassMatrixFromTile(Qr.tileID.toUnwrapped());La=$5(_a,kt,nn,Qt,ur,Sr)}else{const _a=w.translatePosMatrix(ps.expandedProjMatrix,Qr,f.paint.get("fill-extrusion-translate"),f.paint.get("fill-extrusion-translate-anchor")),wn=te.projection.createInversionMatrix(te,ps.canonical);La=ke?h6(_a,w,ba,_e,He,kt,nn,ps,Qr,xt,ur,Sr,gt,ut,wn,Bt,Qt,he):SN(_a,w,ba,_e,He,kt,nn,ps,xt,ur,Sr,gt,ut,wn,Bt,Qt,zt,Or)}w.uploadCommonUniforms(G,js,ps.toUnwrapped(),null,Kt);let Za=ns.segments;if(te.projection.name==="mercator"&&!Xt&&(Za=ns.getVisibleSegments(Qr.tileID,w.terrain,w.transform.getFrustum(0)),!Za.get().length))continue;if(vs)if(Xt)for(const _a of Za.get())vs.numRenderedVerticesInShadowPass+=_a.primitiveLength;else for(const _a of Za.get())vs.numRenderedVerticesInTransparentPass+=_a.primitiveLength;const Ua=[];(w.terrain||U)&&Ua.push(ns.centroidVertexBuffer),_t&&Ua.push(ns.layoutVertexExtBuffer),er&&Ua.push(ns.wallVertexBuffer),js.draw(w,G.gl.TRIANGLES,P,D,R,rs,La,f.id,ns.layoutVertexBuffer,ns.indexBuffer,Za,f.paint,w.transform.zoom,ta,Ua)}w.shadowRenderer&&(w.shadowRenderer.useNormalOffset=!1)}class Z5{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function qp(w,u,f,k,P,D,R,U,G,J,te,me,he,pe,ke,_e,Re,De,He,nt){const We=u.context,kt=We.gl,xt=u.transform,_t=u.transform.zoom,gt=[],ut=w.translate,Tt=w.translateAnchor,Bt=w.edgeRadius,zt=ag(u,w.cutoffFadeRange);te==="clear"?(gt.push("CLEAR_SUBPASS"),nt&&(gt.push("CLEAR_FROM_TEXTURE"),We.activeTexture.set(kt.TEXTURE0),nt.bind(kt.LINEAR,kt.CLAMP_TO_EDGE))):te==="sdf"?gt.push("SDF_SUBPASS"):te==="emissive"&&(gt.push("USE_MRT1"),We.activeTexture.set(kt.TEXTURE0),nt.bind(kt.LINEAR,kt.CLAMP_TO_EDGE)),De&>.push("HAS_CENTROID"),zt.shouldRenderCutoff&>.push("RENDER_CUTOFF");const Qt=(er,ur,Sr,Kt,Pt)=>{let nr=gt;ur.groundRadiusBuffer!=null&&(nr=gt.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const Xt=ur.programConfigurations.get(k.id),gr=u.isTileAffectedByFog(er),$r=u.getOrCreateProgram("fillExtrusionGroundEffect",{config:Xt,defines:nr,overrideFog:gr}),rs=y0(u,Kt,me,J,Pt,[he,pe*Pt],ke,_e,Re,_t>=17?0:Bt*Pt,nt?nt.size[0]:0),Or=[];De&&Or.push(ur.hiddenByLandmarkVertexBuffer),ur.groundRadiusBuffer!=null&&Or.push(ur.groundRadiusBuffer),u.uploadCommonUniforms(We,$r,er.toUnwrapped(),null,zt),$r.draw(u,We.gl.TRIANGLES,D,R,U,G,rs,k.id,ur.vertexBuffer,ur.indexBuffer,Sr,k.paint,_t,Xt,Or)};for(const er of P){const ur=f.getTile(er),Sr=ur.getBucket(k);if(!Sr||Sr.projection.name!==xt.projection.name||!Sr.groundEffect||Sr.groundEffect&&!Sr.groundEffect.hasData())continue;const Kt=Sr.groundEffect,Pt=1/Sr.tileToMeter;{const nr=u.translatePosMatrix(er.projMatrix,ur,ut,Tt),Xt=Kt.getDefaultSegment();Qt(er,Kt,Xt,nr,Pt)}if(He)for(let nr=0;nr<4;nr++){const Xt=i.e9[nr](er),gr=f.getTile(Xt);if(!gr)continue;const $r=gr.getBucket(k);if(!$r||$r.projection.name!==xt.projection.name||!$r.groundEffect||$r.groundEffect&&!$r.groundEffect.hasData())continue;const rs=$r.groundEffect;let Or,Tr;nr===0?(Or=[-i.al,0,0],Tr=1):nr===1?(Or=[i.al,0,0],Tr=0):nr===2?(Or=[0,-i.al,0],Tr=3):(Or=[0,i.al,0],Tr=2);const vs=rs.regionSegments[Tr];if(!vs)continue;const ps=new Float32Array(16);i.br(ps,er.projMatrix,Or),Qt(er,rs,vs,u.translatePosMatrix(ps,ur,ut,Tt),Pt)}}}function uoe(w,u,f,k,P,D,R){k.centroidVertexArray.length===0&&k.createCentroidsBuffer();const U=D?D.findDEMTileFor(f):null;if(!(U&&U.dem||R))return;D&&U&&U.dem&&k.selfDEMTileTimestamp!==U.dem._timestamp&&(k.borderDoneWithNeighborZ=[-1,-1,-1,-1],k.selfDEMTileTimestamp=U.dem._timestamp);const G=De=>new i.P(Math.ceil((De+i.ed)*i.ee),0),J=De=>{const He=u.getSource().minzoom,nt=kt=>{const xt=u.getTileByID(kt);if(xt&&xt.hasData())return xt.getBucket(P)},We=[0,-1,1];for(const kt of We){if(De.overscaledZ+kt(te[0]=Math.min(De.min.y,He.min.y),te[1]=Math.max(De.max.y,He.max.y),te[2]=i.al-He.min.x>De.max.x?He.min.x-i.al:De.max.x,te),he=(De,He)=>(te[0]=Math.min(De.min.x,He.min.x),te[1]=Math.max(De.max.x,He.max.x),te[2]=i.al-He.min.y>De.max.y?He.min.y-i.al:De.max.y,te),pe=[(De,He)=>me(De,He),(De,He)=>me(He,De),(De,He)=>he(De,He),(De,He)=>he(He,De)],ke=(De,He,nt,We,kt,xt,_t)=>{if(!D)return 0;const gt=[[xt?nt:De,xt?De:nt,0],[xt?nt:He,xt?He:nt,0]],ut=_t<0?i.al+_t:_t,Tt=[xt?ut:(De+He)/2,xt?(De+He)/2:ut,0];return nt===0&&_t<0||nt!==0&&_t>0?D.getForTilePoints(kt,[Tt],!0,We):gt.push(Tt),D.getForTilePoints(f,gt,!0,U),Math.max(gt[0][2],gt[1][2],Tt[2])/D.exaggeration()};for(let De=0;De<4;De++){const He=k.borderFeatureIndices[De];if(He.length===0)continue;const nt=i.e9[De](f),We=J(nt);if(!(We&&We instanceof i.ea))continue;const kt=D?D.findDEMTileFor(nt):null;if(!(kt&&kt.dem||R)||(D&&kt&&kt.dem&&k.borderDEMTileTimestamp[De]!==kt.dem._timestamp&&(k.borderDoneWithNeighborZ[De]=-1,k.borderDEMTileTimestamp[De]=kt.dem._timestamp),k.borderDoneWithNeighborZ[De]===We.canonical.z))continue;We.centroidVertexArray.length===0&&We.createCentroidsBuffer();const xt=(De<2?1:5)-De,_t=We.borderDoneWithNeighborZ[xt]!==k.canonical.z,gt=We.borderFeatureIndices[xt];let ut=0;if(k.canonical.z!==We.canonical.z){for(const Tt of He)k.showCentroid(k.featuresOnBorder[Tt]);if(_t)for(const Tt of gt)We.showCentroid(We.featuresOnBorder[Tt]);k.borderDoneWithNeighborZ[De]=We.canonical.z,We.borderDoneWithNeighborZ[xt]=k.canonical.z}for(const Tt of He){const Bt=k.featuresOnBorder[Tt],zt=k.centroidData[Bt.centroidDataIndex],Qt=Bt.borders[De];let er;for(;utQt[0]+3||ur[0]>Qt[0]-3)break;We.showCentroid(er),ut++}if(er&&utQt[1]-3)&&(Sr++,++ut!==gt.length);)er=We.featuresOnBorder[gt[ut]];er=We.featuresOnBorder[gt[ur]];let Kt=!1;if(Sr>=1){const Xt=er.borders[xt];Math.abs(Qt[0]-Xt[0])<3&&Math.abs(Qt[1]-Xt[1])<3&&(Sr=1,Kt=!0,ut=ur+1)}else if(Sr===0){k.showCentroid(Bt);continue}const Pt=We.centroidData[er.centroidDataIndex];R&&Kt&&(((_e=zt).flags|(Re=Pt).flags)&i.ec?(_e.flags|=i.ec,Re.flags|=i.ec):(_e.flags&=~i.ec,Re.flags&=~i.ec));const nr=Bt.intersectsCount()>1||er.intersectsCount()>1;if(Sr>1)ut=ur,zt.centroidXY=Pt.centroidXY=new i.P(0,0);else if(kt&&kt.dem&&!nr){const Xt=pe[De](zt,Pt),gr=De%2?i.al-1:0,$r=ke(Xt[0],Math.min(i.al-1,Xt[1]),gr,kt,nt,De<2,Xt[2]);zt.centroidXY=Pt.centroidXY=G($r)}else nr?zt.centroidXY=Pt.centroidXY=new i.P(0,0):(zt.centroidXY=k.encodeBorderCentroid(Bt),Pt.centroidXY=We.encodeBorderCentroid(er));k.writeCentroidToBuffer(zt),We.writeCentroidToBuffer(Pt)}else k.showCentroid(Bt)}k.borderDoneWithNeighborZ[De]=We.canonical.z,We.borderDoneWithNeighborZ[xt]=k.canonical.z}var _e,Re;(k.needsCentroidUpdate||!k.centroidVertexBuffer&&k.centroidVertexArray.length!==0)&&k.uploadCentroid(w)}const hu=[1,0,0],Y5=[0,1,0],Md=[0,0,1];function Vp(w,u,f){const k=f.transform,P=f.shadowRenderer;if(!P)return!0;const D=w.toUnwrapped(),R=k.tileSize*P._cascades[f.currentShadowCascade].scale;let U=u;if(k.elevation){const _e=k.elevation.getMinMaxForTile(w);_e&&(U+=_e.max)}const G=[...P.shadowDirection];G[2]=-G[2];const J=P.computeSimplifiedTileShadowVolume(D,U,R,G);if(!J)return!1;const te=[hu,Y5,Md,G,[G[0],0,G[2]],[0,G[1],G[2]]],me=k.projection.name==="globe",he=k.scaleZoom(R),pe=i.cB.fromInvProjectionMatrix(k.invProjMatrix,k.worldSize,he,!me),ke=P.getCurrentCascadeFrustum();return pe.intersectsPrecise(J.vertices,J.planes,te)===0||ke.intersectsPrecise(J.vertices,J.planes,te)===0}function c_(w){const{painter:u,source:f,layer:k,coords:P}=w;let D=w.defines;const R=u.context,U=u.renderPass==="shadow",G=u.renderPass==="light-beam",J=u.shadowRenderer,te=i.ef(u.transform.center.lat,u.transform.zoom),me=ag(u,k.paint.get("building-cutoff-fade-range"));me.shouldRenderCutoff&&(D=D.concat("RENDER_CUTOFF")),w.floodLightIntensity>0&&(D=D.concat("FLOOD_LIGHT"));for(const he of P){const pe=f.getTile(he),ke=pe.getBucket(k);if(!ke)continue;J&&J.getMaxCascadeForTile(he.toUnwrapped())===0&&(D=D.concat("SHADOWS_SINGLE_CASCADE"));const _e=ke.programConfigurations.get(k.id);let Re,De,He,nt=u.translatePosMatrix(he.expandedProjMatrix,pe,[0,0],"map");if(nt=i.cS(i.bC(),nt,[1,1,w.verticalScale]),U&&J){if(Vp(pe.tileID,ke.maxHeight*te,u))continue;let kt=J.calculateShadowPassMatrixFromTile(pe.tileID.toUnwrapped());kt=i.cS(i.bC(),kt,[1,1,w.verticalScale]),He=hg(kt),Re=De=u.getOrCreateProgram("buildingDepth",{config:_e,defines:D,overrideFog:!1})}else if(G)Re=De=u.getOrCreateProgram("buildingBloom",{config:_e,defines:D,overrideFog:!1}),He=p6(nt);else{const kt=u.transform.calculatePosMatrix(he.toUnwrapped(),u.transform.worldSize);i.cS(kt,kt,[1,1,w.verticalScale]);const xt=i.bC();i.cS(xt,kt,[1,-1,1/te]),i.bl(xt,xt),i.eg(xt,xt);const _t=u.transform.getFreeCameraOptions().position,gt=1<{if(G){const _t=kt.entranceBloom;xt.draw(u,R.gl.TRIANGLES,w.depthMode,Xs.disabled,w.blendMode,Zs.disabled,He,k.id,_t.layoutVertexBuffer,_t.indexBuffer,_t.segmentsBucket,k.paint,u.transform.zoom,_e,[_t.layoutAttenuationBuffer,_t.layoutColorBuffer])}else{const _t=kt.segmentsBucket;let gt=[kt.layoutNormalBuffer,kt.layoutCentroidBuffer,kt.layoutColorBuffer,kt.layoutFloodLightDataBuffer];kt.layoutFacadePaintBuffer&&(gt=gt.concat([kt.layoutFacadeDataBuffer,kt.layoutFacadeVerticalRangeBuffer,kt.layoutFacadePaintBuffer])),xt.draw(u,R.gl.TRIANGLES,w.depthMode,Xs.disabled,w.blendMode,U?Zs.disabled:Zs.backCW,He,k.id,kt.layoutVertexBuffer,kt.indexBuffer,_t,k.paint,u.transform.zoom,_e,gt)}};u.uploadCommonUniforms(R,De,he.toUnwrapped(),null,me),ke.buildingWithoutFacade&&We(ke.buildingWithoutFacade,De),ke.buildingWithFacade&&(Re!==De&&u.uploadCommonUniforms(R,Re,he.toUnwrapped(),null,me),We(ke.buildingWithFacade,Re))}}function ON(w,u,f,k,P,D,R,U,G,J,te,me,he){const pe=w.context.gl,ke=w.depthModeForSublayer(1,ks.ReadOnly,pe.LEQUAL,!0),_e=.1*(1-(Re=te))+3*Re;var Re;const De=w._showOverdrawInspector,He=me,nt=new Z5;De||qp(nt,w,u,f,k,ke,new Xs({func:pe.ALWAYS,mask:255},255,255,pe.KEEP,pe.KEEP,pe.REPLACE),new bn([pe.ONE,pe.ONE,pe.ONE,pe.ONE],i.ao.transparent,[!1,!1,!1,!0],pe.MIN),Zs.disabled,P,"sdf",D,R,U,G,J,_e,He,!1);{const We=De?Xs.disabled:new Xs({func:pe.EQUAL,mask:255},255,255,pe.KEEP,pe.DECR,pe.DECR),kt=De?w.colorModeForRenderPass():new bn([pe.ONE_MINUS_DST_ALPHA,pe.DST_ALPHA,pe.ONE,pe.ONE],i.ao.transparent,[!0,!0,!0,!0]);qp(nt,w,u,f,k,ke,We,kt,Zs.disabled,P,"color",D,R,U,G,J,_e,He,!1)}}function DN(w){return[w[0]*i.eh,w[1]*i.eh,w[2]*i.eh,0]}function d_(w,u,f,k,P,D,R,U,G){const J=k.getSource(),te=f.globeSharedBuffers;if(!te)return;let me,he,pe;if(u&&(me=k.getTile(u)),J instanceof i.aU?(he=J.texture,pe=i.dK(0,0,f.transform)):me&&u&&(he=me.texture,pe=i.dK(u.canonical.z,u.canonical.x,f.transform)),!he||!pe)return;w||(pe=i.cS(i.bC(),pe,[1,-1,1]));const ke=f.context,_e=ke.gl,Re=P.paint.get("raster-resampling")==="nearest"?_e.NEAREST:_e.LINEAR,De=f.colorModeForDrapableLayerRenderPass(D),He=R.defines;He.push("GLOBE_POLES");const nt=new ks(_e.LEQUAL,ks.ReadWrite,f.depthRangeFor3D),We=Float32Array.from(f.transform.expandedFarZProjMatrix),kt=Float32Array.from(i.bk(i.dJ(new i.cD(0,0,0))));f.terrain&&f.terrain.prepareDrawTile(),ke.activeTexture.set(_e.TEXTURE0),he.bind(Re,_e.CLAMP_TO_EDGE),ke.activeTexture.set(_e.TEXTURE1),he.bind(Re,_e.CLAMP_TO_EDGE),"useMipmap"in he&&ke.extTextureFilterAnisotropic&&f.transform.pitch>20&&_e.texParameterf(_e.TEXTURE_2D,ke.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,ke.extTextureFilterAnisotropicMax);const[xt,_t,gt,ut]=u?te.getPoleBuffers(u.canonical.z,!1):te.getPoleBuffers(0,!0),Tt=P.paint.get("raster-elevation");let Bt;w?(Bt=xt,f.renderDefaultNorthPole=Tt!==0):(Bt=_t,f.renderDefaultSouthPole=Tt!==0);const zt=DN(R.mix),Qt=((ur,Sr,Kt,Pt,nr,Xt,gr,$r,rs,Or,Tr,vs,ps)=>x6(ur,Sr,Kt,new Float32Array(16),new Float32Array(9),[0,0],Pt,[0,0],[0,0,0,0],1,{opacity:1,mix:0},Xt,[0,0],$r,2,Or,Tr,vs,1,0,ps))(We,kt,pe,i.aj(f.transform.zoom),0,P,0,Tt,0,zt,R.offset,R.range,D),er=f.getOrCreateProgram("raster",{defines:He});f.uploadCommonUniforms(ke,er,null),er.draw(f,_e.TRIANGLES,nt,G,De,U,Qt,P.id,Bt,gt,ut)}function k6(w){const u=w._nearZ,f=w.projection.farthestPixelDistance(w),k=f-u,P=.2*w.height,D=u+P;return[u,f,(D-P-u)/k,(D-u)/k]}function Hp(w,u,f,k){if(w)return u instanceof yc&&w instanceof r0?u.getTextureDescriptor(w,f,!0):{texture:w.texture,mix:DN(k.mix),offset:k.offset,buffer:0,tileSize:1}}var gi=i.ei([{name:"a_index",type:"Int16",components:1}]);class RN{constructor(u,f,k,P){const D={width:k[0],height:k[1],data:null},R=u.gl;this.targetColorTexture=new i.T(u,D,R.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new i.T(u,D,R.RGBA8,{useMipmap:!1}),this.context=u,this.updateParticleTexture(f,P),this.lastInvalidatedAt=0}updateParticleTexture(u,f){if(this.particleTextureDimension===f.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const k=this.context.gl,P=f.width*f.height;this.particleTexture0=new i.T(this.context,f,k.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new i.T(this.context,f,k.RGBA8,{premultiply:!1,useMipmap:!1});const D=new i.ej;D.reserve(P);for(let R=0;R0){const zt=i.bj(f.canonical,G),Qt=i.el(zt);he=i.aB(new Float32Array(16),G.globeMatrix,Qt),i.aB(he,G.projMatrix,he)}const pe=i.bC();pe[12]+=2*P/(i.o.devicePixelRatio*G.width),pe[13]+=2*D/(i.o.devicePixelRatio*G.height),i.aB(he,pe,he);const ke=w.getOrCreateProgram("debug",{defines:me}),_e=u.getTileByID(f.key);w.terrain&&w.terrain.setupElevationDraw(_e,ke);const Re=ks.disabled,De=Xs.disabled,He=w.colorModeForRenderPass(),nt="$debug";U.activeTexture.set(J.TEXTURE0),w.emptyTexture.bind(J.LINEAR,J.CLAMP_TO_EDGE),te?_e._makeGlobeTileDebugBuffers(w.context,G):_e._makeDebugTileBoundsBuffers(w.context,G.projection);const We=_e._tileDebugBuffer||w.debugBuffer,kt=_e._tileDebugIndexBuffer||w.debugIndexBuffer,xt=_e._tileDebugSegments||w.debugSegments;if(ke.draw(w,J.LINE_STRIP,Re,De,He,Zs.disabled,a_(he,k.toPremultipliedRenderColor(null)),nt,We,kt,xt,null,null,null,[_e._globeTileDebugBorderBuffer]),R){const zt=_e.latestRawTileData,Qt=Math.floor((zt&&zt.byteLength||0)/1024);let er=f.canonical.toString();f.overscaledZ!==f.canonical.z&&(er+=` => ${f.overscaledZ}`),er+=` ${_e.state}`,er+=` ${Qt}kb`,function(ur,Sr){ur.initDebugOverlayCanvas();const Kt=ur.debugOverlayCanvas,Pt=ur.context.gl,nr=ur.debugOverlayCanvas.getContext("2d");nr.clearRect(0,0,Kt.width,Kt.height),nr.shadowColor="white",nr.shadowBlur=2,nr.lineWidth=1.5,nr.strokeStyle="white",nr.textBaseline="top",nr.font="bold 36px Open Sans, sans-serif",nr.fillText(Sr,5,5),nr.strokeText(Sr,5,5),ur.debugOverlayTexture.update(Kt),ur.debugOverlayTexture.bind(Pt.LINEAR,Pt.CLAMP_TO_EDGE)}(w,er)}const _t=u.getTile(f).tileSize,gt=512/Math.min(_t,512)*(f.overscaledZ/G.zoom)*.5,ut=_e._tileDebugTextBuffer||w.debugBuffer,Tt=_e._tileDebugTextIndexBuffer||w.quadTriangleIndexBuffer,Bt=_e._tileDebugTextSegments||w.debugSegments;ke.draw(w,J.TRIANGLES,Re,De,bn.alphaBlended,Zs.disabled,a_(he,i.ao.transparent.toPremultipliedRenderColor(null),gt),nt,ut,Tt,Bt,null,null,null,[_e._globeTileDebugTextBuffer])}function Tx(w,u,f,k){Vt(w,0,u+f/2,w.transform.width,f,k)}function lo(w,u,f,k){Vt(w,u-f/2,0,f,w.transform.height,k)}function Vt(w,u,f,k,P,D){const R=w.context,U=R.gl;U.enable(U.SCISSOR_TEST),U.scissor(u*i.o.devicePixelRatio,f*i.o.devicePixelRatio,k*i.o.devicePixelRatio,P*i.o.devicePixelRatio),R.clear({color:D}),U.disable(U.SCISSOR_TEST)}const T6=i.ei([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:FN}=T6;function qm(w,u,f,k){w.emplaceBack(u,f,k)}class zN{constructor(u){this.vertexArray=new i.em,this.indices=new i.b0,qm(this.vertexArray,-1,-1,1),qm(this.vertexArray,1,-1,1),qm(this.vertexArray,-1,1,1),qm(this.vertexArray,1,1,1),qm(this.vertexArray,-1,-1,-1),qm(this.vertexArray,1,-1,-1),qm(this.vertexArray,-1,1,-1),qm(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=u.createVertexBuffer(this.vertexArray,FN),this.indexBuffer=u.createIndexBuffer(this.indices),this.segment=i.bg.simpleSegment(0,0,36,12)}}function Ax(w,u,f,k,P,D){const R=w.context.gl,U=u.paint.get("sky-atmosphere-color"),G=u.paint.get("sky-atmosphere-halo-color"),J=u.paint.get("sky-atmosphere-sun-intensity"),te=((me,he,pe,ke,_e)=>({u_matrix_3f:me,u_sun_direction:he,u_sun_intensity:pe,u_color_tint_r:[ke.r,ke.g,ke.b,ke.a],u_color_tint_m:[_e.r,_e.g,_e.b,_e.a],u_luminance:5e-5}))(i.eo(i.dO(),k),P,J,U.toPremultipliedRenderColor(null),G.toPremultipliedRenderColor(null));R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_CUBE_MAP_POSITIVE_X+D,u.skyboxTexture,0),f.draw(w,R.TRIANGLES,ks.disabled,Xs.disabled,bn.unblended,Zs.frontCW,te,"skyboxCapture",u.skyboxGeometry.vertexBuffer,u.skyboxGeometry.indexBuffer,u.skyboxGeometry.segment)}const A6=i.ei([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class b0{constructor(u){const f=new i.ep;f.emplaceBack(-1,1,1,0,0),f.emplaceBack(1,1,1,1,0),f.emplaceBack(1,-1,1,1,1),f.emplaceBack(-1,-1,1,0,1);const k=new i.b0;k.emplaceBack(0,1,2),k.emplaceBack(2,3,0),this.vertexBuffer=u.createVertexBuffer(f,A6.members),this.indexBuffer=u.createIndexBuffer(k),this.segments=i.bg.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const hoe=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 moe{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class E6{constructor(u){this.colorModeAlphaBlendedWriteRGB=new bn([1,zm,1,zm],i.ao.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new bn([1,0,1,0],i.ao.transparent,[!1,!1,!1,!0]),this.params=new moe,this.updateNeeded=!0}update(u){const f=u.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new b0(f);const k=this.params.sizeRange,P=this.params.intensityRange,D=function(te){const me=i.eq(30),he=[];for(let pe=0;pe{const gt=D.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];_t&>.push("ALPHA_PASS");const ut=u.getOrCreateProgram("globeAtmosphere",{defines:gt}),Tt=((zt,Qt,er,ur,Sr,Kt,Pt,nr,Xt,gr,$r,rs)=>({u_frustum_tl:zt,u_frustum_tr:Qt,u_frustum_br:er,u_frustum_bl:ur,u_horizon:Sr,u_transition:Kt,u_fadeout_range:Pt,u_atmosphere_fog_color:nr.toArray01(),u_high_color:Xt.toArray01(),u_space_color:gr.toArray01(),u_temporal_offset:$r,u_horizon_angle:rs}))(D.frustumCorners.TL,D.frustumCorners.TR,D.frustumCorners.BR,D.frustumCorners.BL,D.frustumCorners.horizon,U,Re,te,he,ke,He,kt);u.uploadCommonUniforms(k,ut);const Bt=this.atmosphereBuffer;Bt&&ut.draw(u,P.TRIANGLES,R,Xs.disabled,_t?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,Zs.backCW,Tt,_t?"atmosphere_glow_alpha":"atmosphere_glow",Bt.vertexBuffer,Bt.indexBuffer,Bt.segments)};xt(!1),xt(!0)}drawStars(u,f){const k=i.aA(f.properties.get("star-intensity"),0,1);if(k===0)return;const P=u.context,D=P.gl,R=u.transform,U=u.getOrCreateProgram("stars"),G=i.c7([]);i.c9(G,G,-R._pitch),i.c8(G,G,-R.angle),i.c9(G,G,i.an(R._center.lat)),i.et(G,G,-i.an(R._center.lng));const J=i.cc(new Float32Array(16),G),te=i.aB([],R.starsProjMatrix,J),me=i.eo([],J),he=i.eu([],me),pe=[0,1,0];i.dQ(pe,pe,he),i.c5(pe,pe,this.params.sizeMultiplier);const ke=[1,0,0];i.dQ(ke,ke,he),i.c5(ke,ke,this.params.sizeMultiplier);const _e=(Re=pe,De=ke,He=k,{u_matrix:Float32Array.from(te),u_up:Re,u_right:De,u_intensity_multiplier:He});var Re,De,He;u.uploadCommonUniforms(P,U),this.starsVx&&this.starsIdx&&U.draw(u,D.TRIANGLES,ks.disabled,Xs.disabled,this.colorModeAlphaBlendedWriteRGB,Zs.disabled,_e,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class BN{constructor(){this.visibleTiles=[]}updateBorders(u,f){const k=[],P=[],D=u._getRenderableCoordinates(!1,!0);for(const G of D){const J=u.getTile(G);if(!J.hasData())continue;const te=J.getBucket(f);te&&(te.isEmpty()||(k.push(G.key),P.push({bucket:te,tileID:G.canonical})))}let R=k.length!==this.visibleTiles.length;if(!R){k.sort();for(let G=0;GG.tileID.z-J.tileID.z||G.tileID.x-J.tileID.x||G.tileID.y-J.tileID.y);for(const G of P){const J=new Array,te=new Array,me=G.bucket;for(const he of me.featuresOnBorder)U.has(he.featureId)?te.push(he.footprintIndex):(U.add(he.featureId),J.push(he.footprintIndex));me.updateFootprintHiddenFlags(J,i.ev,!1),me.updateFootprintHiddenFlags(te,i.ev,!0)}}}function $N(w,u){const f=[...w],k=u.cameraWorldSizeForFog/u.worldSize,P=i.bA([]);return i.cS(P,P,[k,k,1]),i.aB(f,P,f),i.aB(f,u.worldToFogMatrix,f),f}function UN(w,u,f,k,P){const D=f.material,R=k.context,{baseColorTexture:U,metallicRoughnessTexture:G}=D.pbrMetallicRoughness,{normalTexture:J,occlusionTexture:te,emissionTexture:me}=D;function he(ke,_e,Re){if(ke&&(w.push(_e),R.activeTexture.set(R.gl.TEXTURE0+Re),ke.gfxTexture)){const{minFilter:De,magFilter:He,wrapS:nt,wrapT:We}=ke.sampler;ke.gfxTexture.bindExtraParam(De,He,nt,We)}}he(U,"HAS_TEXTURE_u_baseColorTexture",Rl.BaseColor),he(G,"HAS_TEXTURE_u_metallicRoughnessTexture",Rl.MetallicRoughness),he(J,"HAS_TEXTURE_u_normalTexture",Rl.Normal),he(te,"HAS_TEXTURE_u_occlusionTexture",Rl.Occlusion),he(me,"HAS_TEXTURE_u_emissionTexture",Rl.Emission),P&&(P.texture||(P.texture=new i.d$(k.context,P.image,[P.image.height,P.image.height,P.image.height],R.gl.RGBA8)),R.activeTexture.set(R.gl.TEXTURE0+Rl.LUT),P.texture&&P.texture.bind(R.gl.LINEAR,R.gl.CLAMP_TO_EDGE),w.push("APPLY_LUT_ON_GPU")),f.texcoordBuffer&&(w.push("HAS_ATTRIBUTE_a_uv_2f"),u.push(f.texcoordBuffer)),f.colorBuffer&&(w.push(f.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),u.push(f.colorBuffer)),f.normalBuffer&&(w.push("HAS_ATTRIBUTE_a_normal_3f"),u.push(f.normalBuffer)),f.pbrBuffer&&(w.push("HAS_ATTRIBUTE_a_pbr"),w.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),u.push(f.pbrBuffer)),D.alphaMode!=="OPAQUE"&&D.alphaMode!=="MASK"||w.push("UNPREMULT_TEXTURE_IN_SHADER"),D.defined||w.push("DIFFUSE_SHADED");const pe=k.shadowRenderer;pe&&(w.push("RENDER_SHADOWS","DEPTH_TEXTURE"),pe.useNormalOffset&&w.push("NORMAL_OFFSET"))}function qN(w,u,f,k,P,D){const R=w.modelOpacity,U=u.context,G=new ks(u.context.gl.LEQUAL,w.isLightMesh?ks.ReadOnly:ks.ReadWrite,u.depthRangeFor3D),J=u.transform,te=w.mesh,me=te.material,he=me.pbrMetallicRoughness,pe=u.style.fog;let ke;ke=u.transform.projection.zAxisUnit==="pixels"?[...w.nodeModelMatrix]:i.aB([],k.zScaleMatrix,w.nodeModelMatrix),i.aB(ke,k.negCameraPosMatrix,ke);const _e=i.bl([],ke);i.eg(_e,_e);const Re=f.paint.get("model-color-use-theme").constantOr("default")==="none",De=f.paint.get("model-emissive-strength").constantOr(0),He=Nx(new Float32Array(w.worldViewProjection),new Float32Array(ke),new Float32Array(_e),null,u,R,he.baseColorFactor,me.emissiveFactor,he.metallicFactor,he.roughnessFactor,me,De,f,void 0,void 0,w.materialOverride,w.modelColor),nt={defines:[]},We=[],kt=u.shadowRenderer;kt&&(kt.useNormalOffset=!1),UN(nt.defines,We,te,u,Re?null:f.lut);let xt=null;if(pe){const ut=$N(w.nodeModelMatrix,u.transform);if(xt=new Float32Array(ut),J.projection.name!=="globe"){const Tt=te.aabb.min,Bt=te.aabb.max,[zt,Qt]=pe.getOpacityForBounds(ut,Tt[0],Tt[1],Bt[0],Bt[1]);nt.overrideFog=zt>=hr||Qt>=hr}}const _t=ag(u,f.paint.get("model-cutoff-fade-range"));_t.shouldRenderCutoff&&nt.defines.push("RENDER_CUTOFF");const gt=u.getOrCreateProgram("model",nt);u.uploadCommonUniforms(U,gt,null,xt,_t),u.renderPass!=="shadow"&&kt&&kt.setupShadowsFromMatrix(w.nodeModelMatrix,gt),gt.draw(u,U.gl.TRIANGLES,G,P,D,te.material.doubleSided?Zs.disabled:Zs.backCCW,He,f.id,te.vertexBuffer,te.indexBuffer,te.segments,f.paint,u.transform.zoom,void 0,We)}function u_(w,u){return w.style._importedAsBasemap?"basemap":u.scope}function Ex(w,u,f,k,P,D,R,U,G,J){const te=w.transform,me=!!u.isGeometryBloom&&u.isGeometryBloom;if(me&&w.renderPass==="shadow")return;const he=te.projection.name==="globe"?i.eD(f,te):[...f];i.aB(he,he,u.globalMatrix);const pe=i.aB([],k,he);if(u.meshes)for(const ke of u.meshes){const _e=U.get(ke.material.name);if(_e&&_e.opacity<=0)continue;if(ke.material.alphaMode!=="BLEND"){R.push({mesh:ke,depth:0,modelIndex:P,worldViewProjection:pe,nodeModelMatrix:he,isLightMesh:me,materialOverride:_e,modelOpacity:G,modelColor:J});continue}const Re=i.af([],ke.centroid,pe);!te.isOrthographic&&Re[2]<=0||D.push({mesh:ke,depth:Re[2],modelIndex:P,worldViewProjection:pe,nodeModelMatrix:he,isLightMesh:me,materialOverride:_e,modelOpacity:G,modelColor:J})}if(u.children)for(const ke of u.children)Ex(w,ke,f,k,P,D,R,U,G,J)}function em(w,u,f,k){const P=f.shadowRenderer;if(!P)return;const D=P.getShadowPassDepthMode(),R=P.getShadowPassColorMode(),U=P.calculateShadowPassMatrixFromMatrix(u),G=W5(U);f.getOrCreateProgram("modelDepth",{defines:f._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(f,f.context.gl.TRIANGLES,D,Xs.disabled,R,Zs.disabled,G,k.id,w.vertexBuffer,w.indexBuffer,w.segments,k.paint,f.transform.zoom,void 0,void 0)}function I6(w,u,f,k,P,D){for(const R of P){const U=Object.assign({},k);U.part=R;const G={type:"Unknown",id:u,properties:U},J={orientation:w.paint.get("model-rotation").evaluate(G,f)};D.set(R,J)}}function P6(w,u,f,k,P,D){for(const R of P){const U=Object.assign({},k);U.part=R;const G={type:"Unknown",id:u,properties:U},J={color:w.paint.get("model-color").evaluate(G,f),colorMix:w.paint.get("model-color-mix-intensity").evaluate(G,f),opacity:w.paint.get("model-opacity").evaluate(G,f),emissionStrength:w.paint.get("model-emissive-strength").evaluate(G,f)};D.set(R,J)}}function L6(w,u,f,k,P){let D=!1;for(const U of k)U.modelOpacity!==1&&(qN(U,w,u,P[U.modelIndex],Xs.disabled,bn.disabled),D=!0);for(const U of k)qN(U,w,u,P[U.modelIndex],U.modelOpacity!==1?w.stencilModeFor3D():Xs.disabled,w.colorModeForRenderPass());D&&w.resetStencilClippingMasks();const R=bn.additive;for(const U of f)qN(U,w,u,P[U.modelIndex],Xs.disabled,U.isLightMesh?R:w.colorModeForRenderPass())}function O6(w,u,f){const k=u.updateZoomBasedPaintProperties(),P=function(D,R,U){let G,J,te,me=D.terrain?D.terrain.exaggeration():0;if(D.terrain&&me>0){const he=D.terrain,pe=he.findDEMTileFor(U);pe&&pe.dem?G=i.eF.create(he,U,pe):me=0}if(me===0&&(R.terrainElevationMin=0,R.terrainElevationMax=0),me===R.validForExaggeration&&(me===0||G&&G._demTile&&G._demTile.tileID===R.validForDEMTile.id&&G._dem._timestamp===R.validForDEMTile.timestamp))return!1;for(const he in R.instancesPerModel){const pe=R.instancesPerModel[he];for(let ke=0;keJ&&(J=pe.max)}const te=i.aA(k.x,D,R)-k.x,me=i.aA(k.y,U,G)-k.y,he=i.cf(J,u.center.lat)-k.z;return u._zoomFromMercatorZ(Math.sqrt(te*te+me*me+he*he))}function D6(w,u,f,k,P,D,R){const U=w.context,G=w.renderPass==="shadow",J=w.shadowRenderer,te=G&&J?J.getShadowPassDepthMode():new ks(U.gl.LEQUAL,ks.ReadWrite,w.depthRangeFor3D),me=w.isTileAffectedByFog(D),he=w.transform.projection.name==="globe";if(f.meshes)for(const pe of f.meshes){const ke=he?[]:["MODEL_POSITION_ON_GPU"],_e=[];let Re,De,He;const nt=!he&&k.instancedDataArray.length>20;nt&&ke.push("INSTANCED_ARRAYS");const We=ag(w,u.paint.get("model-cutoff-fade-range"));if(We.shouldRenderCutoff&&ke.push("RENDER_CUTOFF"),G&&J)Re=w.getOrCreateProgram("modelDepth",{defines:ke}),De=W5(R.shadowTileMatrix,R.shadowTileMatrix,Float32Array.from(f.globalMatrix)),He=J.getShadowPassColorMode();else{UN(ke,_e,pe,w,u.paint.get("model-color-use-theme").constantOr("default")==="none"?null:u.lut),Re=w.getOrCreateProgram("model",{defines:ke,overrideFog:me});const xt=pe.material,_t=xt.pbrMetallicRoughness,gt=u.paint.get("model-opacity").constantOr(1),ut=u.paint.get("model-emissive-strength").constantOr(0);De=Nx(D.expandedProjMatrix,Float32Array.from(f.globalMatrix),new Float32Array(16),null,w,gt,_t.baseColorFactor,xt.emissiveFactor,_t.metallicFactor,_t.roughnessFactor,xt,ut,u,P),J&&(R.shadowUniformsInitialized?Re.setShadowUniformValues(U,J.getShadowUniformValues()):(J.setupShadows(D.toUnwrapped(),Re,"model-tile"),R.shadowUniformsInitialized=!0)),He=We.shouldRenderCutoff||gt<1||xt.alphaMode!=="OPAQUE"?bn.alphaBlended:bn.unblended}w.uploadCommonUniforms(U,Re,D.toUnwrapped(),null,We);const kt=pe.material.doubleSided?Zs.disabled:Zs.backCCW;if(nt)_e.push(k.instancedDataBuffer),Re.draw(w,U.gl.TRIANGLES,te,Xs.disabled,He,kt,De,u.id,pe.vertexBuffer,pe.indexBuffer,pe.segments,u.paint,w.transform.zoom,void 0,_e,k.instancedDataArray.length);else{const xt=G?"u_instance":"u_normal_matrix";for(let _t=0;_tG[1]?R:G,D[0]=f.max[0],R=i.aC(i.eG(),D,P),U=R[1]G[1]?R:G,D[1]=f.min[1],R=i.aC(i.eG(),D,P),U=R[1]G[1]?R:G;const J=i.aA(k[0],0,1),te=100*u.pixelsPerMeter*i.aA(k[1],0,1),me=i.aA(k[2],0,1),he=i.eH(i.eG(),U,G,J),pe=Math.tan(.5*u.fovX),ke=-he[2]*pe;if(te===0)return he[1]<-Math.abs(ke)?me:1;const _e=(-Math.abs(ke)-he[1])/te,Re=(He,nt,We)=>(1-We)*He+We*nt,De=i.aA(Re(1,me,_e),me,1);return Re(1,De,i.aA((u.pitch-20)/20,0,1))}class R6{}class fg{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(u,f,k){{const me=this._storage.get(f.id);if(me)return me.lastUsedFrameIdx=u,me.buf}const P=k.gl,D=P.getBufferParameter(P.ELEMENT_ARRAY_BUFFER,P.BUFFER_SIZE),R=new ArrayBuffer(D),U=new Int16Array(R);P.getBufferSubData(P.ELEMENT_ARRAY_BUFFER,0,new Int16Array(R));const G=new i.eJ;for(let me=0;me30&&(k.buf.destroy(),this._storage.delete(f))}destroy(){for(const[u,f]of this._storage)f.buf.destroy(),this._storage.delete(u)}}class w0{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const j0=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 Wp{constructor(u){this.revealStart=11,this.revealRange=2}}const Q5=i.ei([{type:"Float32",name:"a_pos_2f",components:2}]);class J5{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(u,f){const k=u.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const R=new i.eK,U=new i.b0;R.emplaceBack(-1,-1),R.emplaceBack(1,-1),R.emplaceBack(1,1),R.emplaceBack(-1,1),U.emplaceBack(0,1,2),U.emplaceBack(0,2,3),this.vignetteVx=u.context.createVertexBuffer(R,Q5.members),this.vignetteIdx=u.context.createIndexBuffer(U)}const P=i.bg.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){u.uploadCommonUniforms(u.context,k);const R={u_vignetteShape:(D={vignetteShape:[f.start,f.range,Math.pow(10,f.fadePower)],vignetteColor:[f.color.r,f.color.g,f.color.b,f.color.a*f.strength]}).vignetteShape,u_vignetteColor:D.vignetteColor};k.draw(u,u.context.gl.TRIANGLES,ks.disabled,Xs.disabled,bn.alphaBlended,Zs.disabled,R,"vignette",this.vignetteVx,this.vignetteIdx,P)}var D}}class eM{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(u,f){const k=u.getFreeCameraOptions().position,P=k.toAltitude(),D=k.toLngLat(),R=i.an(D.lng),U=i.an(D.lat),G=u.pixelsPerMeter/f,J=R*i.eM,te=i.eM*Math.log(Math.tan(Math.PI/4+U/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 me=-this._offsetYPrev+te,he=-this._elevationPrev+P;this._accumulatedOffsetX+=(-this._offsetXPrev+J)*G,this._accumulatedOffsetY+=me*G,this._accumulatedElevation+=he*G,this._offsetXPrev=J,this._offsetYPrev=te,this._elevationPrev=P}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function VN(w,u){return[-(w[0]-Math.floor(w[0]/u)*u),-(w[1]-Math.floor(w[1]/u)*u),-(w[2]-Math.floor(w[2]/u)*u)]}function Bu(w){const u=i.eq(1323123451230),f=[];for(let k=0;k Rain"),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(u){const f=u.context;if(!this.particlesVx){const k=Bu(this.particlesCount),P=new i.eN,D=new i.b0;let R=0;const U=i.eq(1323123451230);for(let G=0;Gk)return;const P=Zd(0,1,f.revealStart,f.revealStart+f.revealRange,k);if(!this.particlesVx||!this.particlesIdx)return;const D=structuredClone(this._params);let R=[-D.direction.x,D.direction.y,-100];i.aw(R,R);const U=structuredClone(this._vignetteParams);U.strength*=P,D.overrideStyleParameters||(D.intensity=u.style.rain.state.density,D.timeFactor=u.style.rain.state.intensity,D.color=structuredClone(u.style.rain.state.color),R=structuredClone(u.style.rain.state.direction),D.screenThinning.intensity=u.style.rain.state.centerThinning,D.dropletSizeX=u.style.rain.state.dropletSize[0],D.dropletSizeYScale=u.style.rain.state.dropletSize[1]/u.style.rain.state.dropletSize[0],D.distortionStrength=100*u.style.rain.state.distortionStrength,U.strength=1,U.color=structuredClone(u.style.rain.state.vignetteColor));const G=this.updateOnRender(u,D.timeFactor),J=u.context,te=J.gl,me=u.transform;this.screenTexture&&this.screenTexture.size[0]===u.width&&this.screenTexture.size[1]===u.height||(this.screenTexture=new i.T(J,{width:u.width,height:u.height,data:null},te.RGBA8)),D.distortionStrength>0&&(J.activeTexture.set(te.TEXTURE0),this.screenTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE),te.copyTexSubImage2D(te.TEXTURE_2D,0,0,0,0,0,u.width,u.height));const he=u.getOrCreateProgram("rainParticle");u.uploadCommonUniforms(J,he),J.activeTexture.set(te.TEXTURE0),this.screenTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE);const pe=[D.color.r,D.color.g,D.color.b,D.color.a],ke=(_e,Re)=>{const De=VN(this._movement.getPosition(),_e),He=D.dropletSizeX,nt=D.dropletSizeX*D.dropletSizeYScale,We=u.width/2,kt=u.height/2,xt=Zd(0,D.screenThinning.start,0,1,D.screenThinning.intensity),_t=Zd(.001,D.screenThinning.range,0,1,D.screenThinning.intensity),gt=Zd(0,D.screenThinning.particleOffset,0,1,D.screenThinning.intensity),ut=(Tt={modelview:G.modelviewMatrix,projection:G.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:De,velocityConeAperture:D.velocityConeAperture,velocity:D.velocity,boxSize:_e,rainDropletSize:[He,nt],distortionStrength:D.distortionStrength,rainDirection:R,color:pe,screenSize:[me.width,me.height],thinningCenterPos:[We,kt],thinningShape:[xt,_t,Math.pow(10,D.screenThinning.fadePower)],thinningAffectedRatio:D.screenThinning.affectedRatio,thinningParticleOffset:gt,shapeDirectionalPower:D.shapeDirPower,shapeNormalPower:D.shapeNormalPower,mode:Re?0:1},{u_modelview:Float32Array.from(Tt.modelview),u_projection:Float32Array.from(Tt.projection),u_time:Tt.time,u_cam_pos:Tt.camPos,u_texScreen:0,u_velocityConeAperture:Tt.velocityConeAperture,u_velocity:Tt.velocity,u_boxSize:Tt.boxSize,u_rainDropletSize:Tt.rainDropletSize,u_distortionStrength:Tt.distortionStrength,u_rainDirection:Tt.rainDirection,u_color:Tt.color,u_screenSize:Tt.screenSize,u_thinningCenterPos:Tt.thinningCenterPos,u_thinningShape:Tt.thinningShape,u_thinningAffectedRatio:Tt.thinningAffectedRatio,u_thinningParticleOffset:Tt.thinningParticleOffset,u_shapeDirectionalPower:Tt.shapeDirectionalPower,u_shapeNormalPower:Tt.shapeNormalPower,u_mode:Tt.mode});var Tt;const Bt=Math.round(D.intensity*this.particlesCount),zt=i.bg.simpleSegment(0,0,4*Bt,2*Bt);he.draw(u,te.TRIANGLES,ks.disabled,Xs.disabled,bn.alphaBlended,Zs.disabled,ut,"rain_particles",this.particlesVx,this.particlesIdx,zt)};D.distortionStrength>0&&ke(D.boxSize,!0),ke(D.boxSize,!1),this._vignette.draw(u,U)}}const tM=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 rM extends Ix{constructor(u){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 Wp("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(u){const f=u.context;if(!this.particlesVx){const k=Bu(this.particlesCount),P=new i.eO,D=new i.b0;let R=0;const U=i.eq(1323123451230);for(let G=0;GR)return;const U=Zd(0,1,D.revealStart,D.revealStart+D.revealRange,R);P.strength*=U,f.overrideStyleParameters||(f.intensity=u.style.snow.state.density,f.timeFactor=u.style.snow.state.intensity,f.color=structuredClone(u.style.snow.state.color),k=structuredClone(u.style.snow.state.direction),f.screenThinning.intensity=u.style.snow.state.centerThinning,f.billboardSize=2.79*u.style.snow.state.flakeSize,P.strength=1,P.color=structuredClone(u.style.snow.state.vignetteColor));const G=this.updateOnRender(u,f.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const J=u.context,te=J.gl,me=u.transform,he=u.getOrCreateProgram("snowParticle");u.uploadCommonUniforms(J,he),((pe,ke,_e)=>{const Re=VN(this._movement.getPosition(),pe),De=me.width/2,He=me.height/2,nt=Zd(0,_e.screenThinning.start,0,1,_e.screenThinning.intensity),We=Zd(.001,_e.screenThinning.range,0,1,_e.screenThinning.intensity),kt=Zd(0,_e.screenThinning.particleOffset,0,1,_e.screenThinning.intensity),xt=(_t={modelview:G.modelviewMatrix,projection:G.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:Re,velocityConeAperture:_e.velocityConeAperture,velocity:_e.velocity,horizontalOscillationRadius:_e.horizontalOscillationRadius,horizontalOscillationRate:_e.horizontalOscillationRate,boxSize:pe,billboardSize:1*_e.billboardSize,simpleShapeParameters:[_e.shapeFadeStart,_e.shapeFadePower],screenSize:[me.width,me.height],thinningCenterPos:[De,He],thinningShape:[nt,We,Math.pow(10,_e.screenThinning.fadePower)],thinningAffectedRatio:_e.screenThinning.affectedRatio,thinningParticleOffset:kt,color:[_e.color.r,_e.color.g,_e.color.b,_e.color.a],direction:k},{u_modelview:Float32Array.from(_t.modelview),u_projection:Float32Array.from(_t.projection),u_time:_t.time,u_cam_pos:_t.camPos,u_velocityConeAperture:_t.velocityConeAperture,u_velocity:_t.velocity,u_horizontalOscillationRadius:_t.horizontalOscillationRadius,u_horizontalOscillationRate:_t.horizontalOscillationRate,u_boxSize:_t.boxSize,u_billboardSize:_t.billboardSize,u_simpleShapeParameters:_t.simpleShapeParameters,u_screenSize:_t.screenSize,u_thinningCenterPos:_t.thinningCenterPos,u_thinningShape:_t.thinningShape,u_thinningAffectedRatio:_t.thinningAffectedRatio,u_thinningParticleOffset:_t.thinningParticleOffset,u_particleColor:_t.color,u_direction:_t.direction});var _t;const gt=Math.round(_e.intensity*this.particlesCount),ut=i.bg.simpleSegment(0,0,4*gt,2*gt);this.particlesVx&&this.particlesIdx&&he.draw(u,te.TRIANGLES,ks.disabled,Xs.disabled,bn.alphaBlended,Zs.disabled,xt,"snow_particles",this.particlesVx,this.particlesIdx,ut)})(f.boxSize,0,f),this._vignette.draw(u,P)}}const gg={symbol:function(w,u,f,k,P){if(w.renderPass!=="translucent")return;const D=Xs.disabled,R=w.colorModeForRenderPass(),U=f.layout.get("text-variable-anchor"),G=f.layout.get("text-size-scale-range"),J=i.aA(w.scaleFactor,G[0],G[1]);U&&function(he,pe,ke,_e,Re,De,He,nt){const We=pe.transform,kt=Re==="map",xt=De==="map";for(const _t of he){const gt=_e.getTile(_t),ut=gt.getBucket(ke);if(!ut||!ut.text||!ut.text.segments.get().length)continue;const Tt=i.bK(ut.textSizeData,We.zoom,nt),Bt=Vr(_t,ut.getProjection(),We),zt=We.calculatePixelsToTileUnitsMatrix(gt),Qt=Ca(Bt,gt.tileID.canonical,xt,kt,We,ut.getProjection(),zt),er=ut.hasIconTextFit()&&ut.hasIconData();Tt&&Ds(ut,kt,xt,He,We,Qt,_t,Math.pow(2,We.zoom-gt.tileID.overscaledZ),Tt,er)}}(k,w,f,u,f.layout.get("text-rotation-alignment"),f.layout.get("text-pitch-alignment"),P,J);const te=f.paint.get("icon-opacity").constantOr(1)!==0,me=f.paint.get("text-opacity").constantOr(1)!==0;f.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(te||me)?l_(w,u,f,k,D,R):(te&&l_(w,u,f,k,D,R,{onlyIcons:!0}),me&&l_(w,u,f,k,D,R,{onlyText:!0})),u.map.showCollisionBoxes&&(hs(w,u,f,k,f.paint.get("text-translate"),f.paint.get("text-translate-anchor"),!0),hs(w,u,f,k,f.paint.get("icon-translate"),f.paint.get("icon-translate-anchor"),!1))},circle:function(w,u,f,k){if(w.renderPass!=="translucent")return;const P=f.paint.get("circle-opacity"),D=f.paint.get("circle-stroke-width"),R=f.paint.get("circle-stroke-opacity"),U=f.layout.get("circle-sort-key").constantOr(1)!==void 0,G=f.paint.get("circle-emissive-strength");if(P.constantOr(1)===0&&(D.constantOr(1)===0||R.constantOr(1)===0))return;const J=w.context,te=J.gl,me=w.transform,he=!(!w.terrain||!w.terrain.enabled),pe=f.layout.get("circle-elevation-reference"),ke=w.depthModeForSublayer(0,ks.ReadOnly),_e=new ks(w.context.gl.LEQUAL,ks.ReadOnly,w.depthRangeFor3D),Re=pe==="none"||he?ke:_e,De=Xs.disabled,He=w.colorModeForDrapableLayerRenderPass(G),nt=me.projection.name==="globe",We=[i.aF(me.center.lng),i.aJ(me.center.lat)],kt=[];for(let _t=0;_t_t.sortKey-gt.sortKey);const xt={useDepthForOcclusion:me.depthOcclusionForSymbolsAndCircles};for(const _t of kt){const{programConfiguration:gt,program:ut,layoutVertexBuffer:Tt,dynamicBuffers:Bt,indexBuffer:zt,uniformValues:Qt,tile:er}=_t.state,ur=_t.segments;w.terrain&&w.terrain.setupElevationDraw(er,ut,xt),w.uploadCommonUniforms(J,ut,er.tileID.toUnwrapped()),ut.draw(w,te.TRIANGLES,Re,De,He,Zs.disabled,Qt,f.id,Tt,zt,ur,f.paint,me.zoom,gt,Bt)}},heatmap:function(w,u,f,k){if(f.paint.get("heatmap-opacity")!==0)if(w.renderPass==="offscreen"){const P=w.context,D=P.gl,R=Xs.disabled,U=new bn([D.ONE,D.ONE,D.ONE,D.ONE],i.ao.transparent,[!0,!0,!0,!0]);(function(pe,ke,_e,Re){const De=pe.gl,He=ke.width*Re,nt=ke.height*Re;pe.activeTexture.set(De.TEXTURE1),pe.viewport.set([0,0,He,nt]);let We=_e.heatmapFbo;if(!We||We&&(We.width!==He||We.height!==nt)){We&&We.destroy();const kt=De.createTexture();De.bindTexture(De.TEXTURE_2D,kt),De.texParameteri(De.TEXTURE_2D,De.TEXTURE_WRAP_S,De.CLAMP_TO_EDGE),De.texParameteri(De.TEXTURE_2D,De.TEXTURE_WRAP_T,De.CLAMP_TO_EDGE),De.texParameteri(De.TEXTURE_2D,De.TEXTURE_MIN_FILTER,De.LINEAR),De.texParameteri(De.TEXTURE_2D,De.TEXTURE_MAG_FILTER,De.LINEAR),We=_e.heatmapFbo=pe.createFramebuffer(He,nt,1,null),function(xt,_t,gt,ut,Tt,Bt){const zt=xt.gl;zt.texImage2D(zt.TEXTURE_2D,0,xt.extRenderToTextureHalfFloat?zt.RGBA16F:zt.RGBA,Tt,Bt,0,zt.RGBA,xt.extRenderToTextureHalfFloat?zt.HALF_FLOAT:zt.UNSIGNED_BYTE,null),ut.colorAttachment0.set(gt)}(pe,0,kt,We,He,nt)}else De.bindTexture(De.TEXTURE_2D,We.colorAttachment0.get()),pe.bindFramebuffer.set(We.framebuffer)})(P,w,f,w.transform.projection.name==="globe"?.5:.25),P.clear({color:i.ao.transparent});const G=w.transform,J=G.projection.name==="globe",te=J?["PROJECTION_GLOBE_VIEW"]:[],me=J?Zs.frontCCW:Zs.disabled,he=[i.aF(G.center.lng),i.aJ(G.center.lat)];for(let pe=0;pe({u_image:0,u_color_ramp:1,u_opacity:me.paint.get("heatmap-opacity")}))(0,D),D.id,P.viewportBuffer,P.quadTriangleIndexBuffer,P.viewportSegments,D.paint,P.transform.zoom)}(w,f))},line:function(w,u,f,k){if(w.renderPass!=="translucent")return;const P=f.paint.get("line-opacity"),D=f.paint.get("line-width");if(P.constantOr(1)===0||D.constantOr(1)===0)return;const R=f.paint.get("line-emissive-strength").isConstant(),U=f.paint.get("line-emissive-strength").constantOr(0),G=f.paint.get("line-occlusion-opacity"),J=f.layout.get("line-elevation-reference"),te=f.layout.get("line-width-unit")==="meters",me=J==="sea",he=!(!w.terrain||!w.terrain.enabled),pe=w.context,ke=pe.gl;if(f.hasElevatedBuckets&&w.transform.projection.name==="globe")return;const _e=f.layout.get("line-cross-slope"),Re=_e!==void 0,De=_e<1,He=w.colorModeForDrapableLayerRenderPass(R?U:null),nt=w.terrain&&w.terrain.renderingToTexture,We=nt?1:i.o.devicePixelRatio,kt=f.paint.get("line-dasharray"),xt=kt.constantOr(1),_t=f.layout.get("line-cap"),gt=kt.constantOr(null),ut=_t.constantOr(null),Tt=f.paint.get("line-pattern"),Bt=Tt.constantOr(1),zt=f.paint.get("line-pattern-cross-fade"),Qt=Tt.constantOr(null),er=f.paint.get("line-opacity").constantOr(1);let ur=!Bt&&er!==1||w.depthOcclusion&&G>0&&G<1;const Sr=f.paint.get("line-gradient"),Kt=Bt?"linePattern":"line",Pt=i.e2(f);let nr;if(nt&&w.terrain&&w.terrain.clipOrMaskOverlapStencilType()&&(ur=!1),G!==0&&w.depthOcclusion){const rs=f.paint._values["line-opacity"];rs&&rs.value&&rs.value.kind==="constant"?nr=rs.value:i.w(`Occlusion opacity for layer ${f.id} is supported only when line-opacity isn't data-driven.`)}D.value.kind!=="constant"&&D.value.isLineProgressConstant===!1&&Pt.push("VARIABLE_LINE_WIDTH"),nt&&(w.emissiveMode!=="dual-source-blending"||R?w.emissiveMode==="mrt-fallback"&&Pt.push("USE_MRT1"):Pt.push("DUAL_SOURCE_BLENDING"));const Xt=(rs,Or,Tr,vs,ps,Qr)=>{for(const ns of rs){const Ps=u.getTile(ns);if(Bt&&!Ps.patternsLoaded())continue;const hn=Ps.getBucket(f);if(!hn||hn.elevationType!=="none"&&!ps||hn.elevationType==="none"&&ps)continue;w.prepareDrawTile();const ta=[...Or],Ta=w.shadowRenderer,js=hn.elevationType==="road"&&!!Ta&&Ta.enabled;let ba=[0,0,0];if(js){const jn=w.style.directionalLight,ji=w.style.ambientLight;jn&&ji&&(ba=Bp(w.style,jn,ji)),ta.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const nn=hn.programConfigurations.get(f.id);let La=!1;if(Qt&&Ps.imageAtlas){const jn=i.e3.from(Qt),ji=jn.getPrimary().scaleSelf(We).toString(),vo=Ps.imageAtlas.patternPositions.get(ji),Xi=jn.getSecondary(),si=Xi?Ps.imageAtlas.patternPositions.get(Xi.scaleSelf(We).toString()):null;La=!!vo&&!!si,vo&&nn.setConstantPatternPositions(vo,si)}zt>0&&(La||nn.getPatternTransitionVertexBuffer("line-pattern"))&&ta.push("LINE_PATTERN_TRANSITION");const Za=w.isTileAffectedByFog(ns),Ua=w.getOrCreateProgram(Kt,{config:nn,defines:ta,overrideFog:Za});if(!Bt&>&&ut&&Ps.lineAtlas){const jn=Ps.lineAtlas.getDash(gt,ut);jn&&nn.setConstantPatternPositions(jn)}js&&Ta.setupShadows(Ps.tileID.toUnwrapped(),Ua,"vector-tile");let[_a,wn]=f.paint.get("line-trim-offset");(ut==="round"||ut==="square")&&_a!==wn&&(_a===0&&(_a-=1),wn===1&&(wn+=1));const Pa=nt?ns.projMatrix:null,so=te?1/hn.tileToMeter/i.ay(Ps,1,w.transform.zoom):1,Ii=te?1/hn.tileToMeter/i.ay(Ps,1,Math.floor(w.transform.zoom)):1,Oa=Bt?i.e4(w,Ps,f,Pa,We,so,Ii,[_a,wn],ba,zt):i.e5(w,Ps,f,Pa,hn.lineClipsArray.length,We,so,Ii,[_a,wn],ba);if(Sr){const jn=hn.gradients[f.id];let ji=jn.texture;if(f.gradientVersion!==jn.version){let vo=256;if(f.stepInterpolant){const Xi=u.getSource().maxzoom,si=ns.canonical.z===Xi?Math.ceil(1<{nr!=null&&(nr.value=er*G),Ua.draw(w,ke.TRIANGLES,Tr,jn,He,Zs.disabled,Oa,f.id,hn.layoutVertexBuffer,hn.indexBuffer,hn.segments,f.paint,w.transform.zoom,nn,[hn.layoutVertexBuffer2,hn.patternVertexBuffer,hn.zOffsetVertexBuffer]),nr!=null&&(nr.value=er)};if(ur&&!ps){const jn=w.stencilModeForClipping(ns).ref;jn===0&&nt&&pe.clear({stencil:0});const ji={func:ke.EQUAL,mask:255};Oa.u_alpha_discard_threshold=.8,ha(new Xs(ji,jn,255,ke.KEEP,ke.KEEP,ke.INVERT)),Oa.u_alpha_discard_threshold=0,ha(new Xs(ji,jn,255,ke.KEEP,ke.KEEP,ke.KEEP))}else Oa.u_alpha_discard_threshold=ur&&ps&&Qr?.8:0,ha(ps?vs:w.stencilModeForClipping(ns))}};let gr=w.depthModeForSublayer(0,ks.ReadOnly);const $r=new ks(w.depthOcclusion?ke.GREATER:ke.LEQUAL,ks.ReadOnly,w.depthRangeFor3D);if(f.hasNonElevatedBuckets){const rs=!nt&&w.terrain;G!==0&&rs?i.w(`Occlusion opacity for layer ${f.id} is supported on terrain only if the layer has line-z-offset enabled.`):rs?i.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${f.id}.`):Xt(k,Pt,gr,Xs.disabled,!1,!0)}if(f.hasElevatedBuckets){J==="hd-road-markup"?he||(gr=$r,Pt.push("ELEVATED_ROADS")):(Pt.push("ELEVATED"),gr=$r,Re&&Pt.push(De?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),me&&Pt.push("ELEVATION_REFERENCE_SEA"));const rs=ur?w.stencilModeFor3D():Xs.disabled;w.forceTerrainMode=!0,Xt(k,Pt,gr,rs,!0,!0),ur&&Xt(k,Pt,gr,rs,!0,!1),w.forceTerrainMode=!1}ur&&(w.resetStencilClippingMasks(),nt&&pe.clear({stencil:0})),G===0||w.depthOcclusion||nt||w.layersWithOcclusionOpacity.push(w.currentLayer)},fill:function(w,u,f,k){const P=f.paint.get("fill-color"),D=f.paint.get("fill-opacity");if(D.constantOr(1)===0)return;const R=f.paint.get("fill-emissive-strength"),U=w.colorModeForDrapableLayerRenderPass(R),G=f.paint.get("fill-pattern"),J=w.opaquePassEnabledForLayer()&&!G.constantOr(1)&&P.constantOr(i.ao.transparent).a===1&&D.constantOr(0)===1?"opaque":"translucent";let te="none";f.layout.get("fill-elevation-reference")!=="none"?te="road":f.paint.get("fill-z-offset").constantOr(1)!==0&&(te="offset");const me=!(!w.terrain||!w.terrain.enabled),he={painter:w,sourceCache:u,layer:f,coords:k,colorMode:U,elevationType:te,terrainEnabled:me,pass:J};if(w.renderPass==="shadow")return void(w.shadowRenderer&&te==="road"&&!me&&function(ke){const{painter:_e,sourceCache:Re,layer:De,coords:He}=ke,nt=_e.context.gl,We=ke.painter.shadowRenderer;for(const kt of He){const xt=Re.getTile(kt),_t=xt.getBucket(De);if(!_t)continue;const gt=_t.elevatedStructures;if(!gt||!gt.shadowCasterSegments||gt.shadowCasterSegments.segments[0].primitiveLength===0)continue;_e.prepareDrawTile();const ut=_t.bufferData.programConfigurations.get(De.id),Tt=_e.isTileAffectedByFog(kt),Bt=_e.getOrCreateProgram("elevatedStructuresDepth",{config:ut,overrideFog:Tt}),zt=We.calculateShadowPassMatrixFromTile(xt.tileID.toUnwrapped());_e.uploadCommonUniforms(_e.context,Bt,kt.toUnwrapped());const Qt={u_matrix:zt,u_depth_bias:0};Bt.draw(_e,nt.TRIANGLES,We.getShadowPassDepthMode(),Xs.disabled,We.getShadowPassColorMode(),Zs.disabled,Qt,De.id,gt.vertexBuffer,gt.indexBuffer,gt.shadowCasterSegments,De.paint,_e.transform.zoom,ut)}}(he));const pe=w.emissiveMode==="mrt-fallback";if(te!=="offset"){if(PN(he,!1,pe),te==="road"){const ke=!me&&w.renderPass==="translucent";ke&&IN(w,u,f,k,"geometry"),PN(he,!0,pe,Xs.disabled),ke&&function(_e){const{painter:Re,sourceCache:De,layer:He,coords:nt,colorMode:We}=_e,kt=Re.context.gl,xt=_e.painter.shadowRenderer,_t=!!xt&&xt.enabled,gt=new ks(Re.context.gl.LEQUAL,ks.ReadOnly,Re.depthRangeFor3D);let ut=[0,0,0];if(_t){const Bt=Re.style.directionalLight,zt=Re.style.ambientLight;Bt&&zt&&(ut=Bp(Re.style,Bt,zt))}const Tt=Bt=>{for(const zt of nt){const Qt=De.getTile(zt),er=Qt.getBucket(He);if(!er)continue;const ur=er.elevatedStructures;if(!ur)continue;let Sr,Kt;if(Bt?(Sr=ur.renderableBridgeSegments,Kt=ur.bridgeProgramConfigurations.get(He.id)):(Sr=ur.renderableTunnelSegments,Kt=ur.tunnelProgramConfigurations.get(He.id)),!Sr||Sr.segments[0].primitiveLength===0)continue;Kt.updatePaintBuffers(),Re.prepareDrawTile();const Pt=Re.isTileAffectedByFog(zt),nr=[];_t&&nr.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const Xt=Re.getOrCreateProgram("elevatedStructures",{config:Kt,overrideFog:Pt,defines:nr}),gr=Re.translatePosMatrix(zt.projMatrix,Qt,He.paint.get("fill-translate"),He.paint.get("fill-translate-anchor"));_t&&xt.setupShadows(Qt.tileID.toUnwrapped(),Xt,"vector-tile");const $r=ug(gr,ut);Re.uploadCommonUniforms(Re.context,Xt,zt.toUnwrapped()),Xt.draw(Re,kt.TRIANGLES,gt,Xs.disabled,We,Zs.backCCW,$r,He.id,ur.vertexBuffer,ur.indexBuffer,Sr,He.paint,Re.transform.zoom,Kt,[ur.vertexBufferNormal])}};Tt(!0),Tt(!1)}(he)}}else PN(he,!1,pe,w.stencilModeFor3D())},"fill-extrusion":function(w,u,f,k){const P=f.paint.get("fill-extrusion-opacity"),D=w.context,R=D.gl,U=w.terrain,G=U&&U.renderingToTexture;if(P===0)return;const J=w.emissiveMode==="mrt-fallback",te=w.conflationActive&&w.style.isLayerClipped(f,u.getSource()),me=w.style.order.indexOf(f.fqid);if(te&&function(he,pe,ke,_e,Re){for(const De of _e){const He=pe.getTile(De).getBucket(ke);He&&(He.updateReplacement(De,he.replacementSource,Re),He.uploadCentroid(he.context))}}(w,u,f,k,me),U||te)for(const he of k){const pe=u.getTile(he).getBucket(f);pe&&uoe(w.context,u,he,pe,f,U,te)}if(w.renderPass==="shadow"&&w.shadowRenderer){const he=w.shadowRenderer;if(U&&P<.65&&f._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof i.ad)return;const pe=he.getShadowPassDepthMode(),ke=he.getShadowPassColorMode();LN(w,u,f,k,pe,Xs.disabled,ke,te)}else if(w.renderPass==="translucent"){const he=!f.paint.get("fill-extrusion-pattern").constantOr(1),pe=f.paint.get("fill-extrusion-color").constantOr(i.ao.white);if(!G&&pe.a!==0){const ke=new ks(w.context.gl.LEQUAL,ks.ReadWrite,w.depthRangeFor3D);P===1&&he?LN(w,u,f,k,ke,Xs.disabled,bn.unblended,te):(LN(w,u,f,k,ke,Xs.disabled,bn.disabled,te),LN(w,u,f,k,ke,w.stencilModeFor3D(),w.colorModeForRenderPass(),te),w.resetStencilClippingMasks())}if(w.style.enable3dLights()&&he&&(!U&&w.transform.projection.name!=="globe"||G)){const ke=f.paint.get("fill-extrusion-opacity"),_e=f.paint.get("fill-extrusion-ambient-occlusion-intensity"),Re=f.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),De=f.paint.get("fill-extrusion-flood-light-intensity"),He=f.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",nt=f.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(He?null:f.lut).toArray01().slice(0,3),We=_e>0&&Re>0,kt=De>0,xt=(ut,Tt,Bt)=>(1-Bt)*ut+Bt*Tt,_t=new Z5;_t.translate=f.paint.get("fill-extrusion-translate"),_t.translateAnchor=f.paint.get("fill-extrusion-translate-anchor"),_t.edgeRadius=f.layout.get("fill-extrusion-edge-radius"),_t.cutoffFadeRange=f.paint.get("fill-extrusion-cutoff-fade-range");const gt=ut=>{const Tt=w.depthModeForSublayer(1,ks.ReadOnly,R.LEQUAL,!0),Bt=f.paint.get(ut?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),zt=xt(.1,3,Bt),Qt=w._showOverdrawInspector;if(!Qt){const er=new Xs({func:R.ALWAYS,mask:255},255,255,R.KEEP,R.KEEP,R.REPLACE),ur=new bn([R.ONE,R.ONE,R.ONE,R.ONE],i.ao.transparent,[!1,!1,!1,!0],R.MIN);qp(_t,w,u,f,k,Tt,er,ur,Zs.disabled,ut,"sdf",ke,_e,Re,De,nt,zt,te,!1)}{const er=Qt?Xs.disabled:new Xs({func:R.EQUAL,mask:255},255,255,R.KEEP,R.DECR,R.DECR),ur=Qt?w.colorModeForRenderPass():new bn([R.ONE_MINUS_DST_ALPHA,R.DST_ALPHA,R.ONE,R.ONE],i.ao.transparent,[!0,!0,!0,!0]);qp(_t,w,u,f,k,Tt,er,ur,Zs.disabled,ut,"color",ke,_e,Re,De,nt,zt,te,!1)}};if(G){const ut=()=>{const Bt=U.drapeBufferSize[0],zt=U.drapeBufferSize[1];let Qt=U.framebufferCopyTexture;return Qt&&(!Qt||Qt.size[0]===Bt&&Qt.size[1]===zt)||(Qt&&Qt.destroy(),Qt=U.framebufferCopyTexture=new i.T(D,new i.q({width:Bt,height:zt}),R.RGBA8)),Qt.bind(R.LINEAR,R.CLAMP_TO_EDGE),R.copyTexSubImage2D(R.TEXTURE_2D,0,0,0,0,0,Bt,zt),Qt},Tt=(Bt,zt,Qt)=>{const er=w.depthModeForSublayer(1,ks.ReadOnly,R.LEQUAL,!1),ur=f.paint.get(Bt?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Sr=xt(.1,3,ur);{const Kt=new bn([R.ONE,R.ONE,R.ONE,R.ONE],i.ao.transparent,[!1,!1,!1,!0]);qp(_t,w,u,f,k,er,Xs.disabled,Kt,Zs.disabled,Bt,"clear",ke,_e,Re,De,nt,Sr,te,zt)}{const Kt=new Xs({func:R.ALWAYS,mask:255},255,255,R.KEEP,R.KEEP,R.REPLACE),Pt=new bn([R.ONE,R.ONE,R.ONE,R.ONE],i.ao.transparent,[!1,!1,!1,!0],R.MIN);qp(_t,w,u,f,k,er,Kt,Pt,Zs.disabled,Bt,"sdf",ke,_e,Re,De,nt,Sr,te,zt)}J&&!Bt&&(Qt=ut());{const Kt=Bt?R.ZERO:R.ONE_MINUS_DST_ALPHA,Pt=new Xs({func:R.EQUAL,mask:255},255,255,R.KEEP,R.DECR,R.DECR),nr=new bn([Kt,R.DST_ALPHA,R.ONE_MINUS_DST_ALPHA,R.ZERO],i.ao.transparent,[!0,!0,!0,!0]);qp(_t,w,u,f,k,er,Pt,nr,Zs.disabled,Bt,"color",ke,_e,Re,De,nt,Sr,te,zt)}if(!J||Bt){const Kt=new bn([R.ONE,R.ONE,R.ONE,Bt?R.ZERO:R.ONE],i.ao.transparent,[!1,!1,!1,!0],Bt?R.FUNC_ADD:R.MAX);qp(_t,w,u,f,k,er,Xs.disabled,Kt,Zs.disabled,Bt,"clear",ke,_e,Re,De,nt,Sr,te,zt,Qt)}else{R.drawBuffers([R.NONE,R.COLOR_ATTACHMENT1]);const Kt=new Xs({func:R.EQUAL,mask:255},254,255,R.KEEP,R.DECR,R.DECR),Pt=new bn([R.ONE,R.ONE,R.ONE,R.ONE],i.ao.transparent,[!0,!1,!1,!1],R.MAX);qp(_t,w,u,f,k,er,Kt,Pt,Zs.disabled,Bt,"emissive",ke,_e,Re,De,nt,Sr,te,zt,Qt),R.drawBuffers([R.COLOR_ATTACHMENT0])}};if(We||kt){let Bt;w.prepareDrawTile(),J&&!We||(Bt=ut()),We&&Tt(!0,!1,Bt),kt&&Tt(!1,!0,Bt)}}else We&>(!0),kt&>(!1),(We||kt)&&w.resetStencilClippingMasks()}}},building:function(w,u,f,k){w.currentLayer0&&D>0,J=!0;const te=f.paint.get("building-vertical-scale");if(te<=0)return;w.shadowRenderer||(J=!1);const me=w.conflationActive&&w.style.isLayerClipped(f,u.getSource()),he=w.style.order.indexOf(f.fqid);if(function(pe,ke,_e,Re,De,He){for(const nt of He){const We=ke.getTile(nt).getBucket(_e);We&&(De&&We.updateReplacement(nt,pe.replacementSource,Re),We.uploadUpdatedIndexBuffer(pe.context))}}(w,u,f,he,me,k),function(pe,ke,_e,Re){for(const De of Re){const He=ke.getTile(De).getBucket(_e);He&&He.needsEvaluation()&&He.uploadUpdatedColorBuffer(pe.context)}}(w,u,f,k),f.resetLayerRenderingStats(w),w.shadowRenderer&&(w.shadowRenderer.useNormalOffset=!0),w.renderPass==="shadow"&&w.shadowRenderer){const pe=w.shadowRenderer,ke=[],_e=pe.getShadowPassDepthMode();c_({painter:w,source:u,layer:f,coords:k,defines:ke,blendMode:pe.getShadowPassColorMode(),depthMode:_e,opacity:U,verticalScale:te,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(w.renderPass==="translucent"){let pe=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];J&&(pe=pe.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),w.shadowRenderer&&w.shadowRenderer.useNormalOffset&&(pe=pe.concat("NORMAL_OFFSET"));const ke=f.paint.get("building-facade-emissive-chance"),_e=f.paint.get("building-ambient-occlusion-intensity"),Re=f.paint.get("building-flood-light-intensity"),De=f.paint.get("building-flood-light-color-use-theme").constantOr("default")==="none",He=f.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(De?null:f.lut).toArray01().slice(0,3),nt=f.paint.get("building-flood-light-ground-attenuation"),We=Re>0,kt=new ks(w.context.gl.LEQUAL,ks.ReadWrite,w.depthRangeFor3D);U<1&&c_({painter:w,source:u,layer:f,coords:k,defines:pe,blendMode:bn.disabled,depthMode:kt,opacity:U,verticalScale:te,facadeEmissiveChance:ke,facadeAOIntensity:_e,floodLightIntensity:Re,floodLightColor:He,depthOnly:!0});const xt=w.colorModeForRenderPass();c_({painter:w,source:u,layer:f,coords:k,defines:pe,blendMode:xt,depthMode:kt,opacity:U,verticalScale:te,facadeEmissiveChance:ke,facadeAOIntensity:_e,floodLightIntensity:Re,floodLightColor:He}),G&&ON(w,u,f,k,!0,U,P,D,Re,He,R,me),We&&ON(w,u,f,k,!1,U,P,D,Re,He,nt,me)}else if(w.renderPass==="light-beam"){const pe=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],ke=new ks(w.context.gl.LEQUAL,ks.ReadOnly,w.depthRangeFor3D);c_({painter:w,source:u,layer:f,coords:k,defines:pe,blendMode:bn.alphaBlended,depthMode:ke,opacity:U,verticalScale:te,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}w.shadowRenderer&&(w.shadowRenderer.useNormalOffset=!1),w.resetStencilClippingMasks()},hillshade:function(w,u,f,k){if(w.renderPass!=="offscreen"&&w.renderPass!=="translucent"||w.style.disableElevatedTerrain)return;const P=w.context,D=w.terrain&&w.terrain.renderingToTexture,[R,U]=w.renderPass!=="translucent"||D?[{},k]:w.stencilConfigForOverlap(k);for(const G of U){const J=u.getTile(G);if(J.needsHillshadePrepare&&w.renderPass==="offscreen")toe(w,J,f);else if(w.renderPass==="translucent"){const te=w.depthModeForSublayer(0,ks.ReadOnly),me=f.paint.get("hillshade-emissive-strength"),he=w.colorModeForDrapableLayerRenderPass(me),pe=D&&w.terrain?w.terrain.stencilModeForRTTOverlap(G):R[G.overscaledZ];eoe(w,G,J,f,te,pe,he)}}P.viewport.set([0,0,w.width,w.height]),w.resetStencilClippingMasks()},raster:function(w,u,f,k,P,D){if(w.renderPass!=="translucent"||f.paint.get("raster-opacity")===0)return;const R=w.transform.projection.name==="globe",U=f.paint.get("raster-elevation")!==0,G=U&&R;if(w.renderElevatedRasterBackface&&!G)return;const J=w.context,te=J.gl,me=u.getSource(),he=function(xt,_t,gt,ut,Tt){const Bt=_t.paint.get("raster-color"),zt=xt.type==="raster-array",Qt=[],er=_t.paint.get("raster-resampling"),ur=_t.paint.get("raster-color-mix");let Sr=_t.paint.get("raster-color-range");const Kt=[ur[0],ur[1],ur[2],0],Pt=ur[3];let nr=er==="nearest"?ut.NEAREST:ut.LINEAR;if(zt&&(Qt.push("RASTER_ARRAY"),Bt||Qt.push("RASTER_COLOR"),er==="linear"&&Qt.push("RASTER_ARRAY_LINEAR"),nr=ut.NEAREST,!Sr&&xt.rasterLayers)){const Xt=xt.rasterLayers.find(({id:gr})=>gr===_t.sourceLayer);Xt&&Xt.fields&&Xt.fields.range&&(Sr=Xt.fields.range)}if(Sr=Sr||[0,1],Bt){Qt.push("RASTER_COLOR"),gt.activeTexture.set(ut.TEXTURE2),_t.updateColorRamp(Sr);let Xt=_t.colorRampTexture;Xt||(Xt=_t.colorRampTexture=new i.T(gt,_t.colorRamp,ut.RGBA8)),Xt.bind(ut.LINEAR,ut.CLAMP_TO_EDGE)}return Tt&&Qt.push("USE_MRT1"),{mix:Kt,range:Sr,offset:Pt,defines:Qt,resampling:nr}}(me,f,J,te,w.terrain&&w.terrain.renderingToTexture&&w.emissiveMode==="mrt-fallback");if(me instanceof i.aU&&!k.length&&!R)return;const pe=f.paint.get("raster-emissive-strength"),ke=w.colorModeForDrapableLayerRenderPass(pe),_e=w.terrain&&w.terrain.renderingToTexture,Re=!w.options.moving,De=f.paint.get("raster-resampling")==="nearest"?te.NEAREST:te.LINEAR;if(me instanceof i.aU&&!k.length&&(me.onNorthPole||me.onSouthPole)){const xt=U?w.stencilModeFor3D():Xs.disabled;return void d_(!!me.onNorthPole,null,w,u,f,pe,he,Zs.disabled,xt)}if(!k.length)return;const[He,nt]=me instanceof i.aU||_e?[{},k]:w.stencilConfigForOverlap(k),We=nt[nt.length-1].overscaledZ;G&&he.defines.push("PROJECTION_GLOBE_VIEW"),U&&he.defines.push("RENDER_CUTOFF");const kt=(xt,_t,gt)=>{for(const ut of xt){const Tt=ut.toUnwrapped(),Bt=u.getTile(ut);if(_e&&(!Bt||!Bt.hasData()))continue;J.activeTexture.set(te.TEXTURE0);const zt=Hp(Bt,me,f,he);if(!zt||!zt.texture)continue;const{texture:Qt,mix:er,offset:ur,tileSize:Sr,buffer:Kt}=zt;let Pt,nr;_e?(Pt=ks.disabled,nr=ut.projMatrix):U?(Pt=new ks(te.LEQUAL,ks.ReadWrite,w.depthRangeFor3D),nr=R?Float32Array.from(w.transform.expandedFarZProjMatrix):w.transform.calculateProjMatrix(Tt,Re)):(Pt=w.depthModeForSublayer(ut.overscaledZ-We,f.paint.get("raster-opacity")===1?ks.ReadWrite:ks.ReadOnly,te.LESS),nr=w.transform.calculateProjMatrix(Tt,Re));const Xt=w.terrain&&_e?w.terrain.stencilModeForRTTOverlap(ut):He[ut.overscaledZ],gr=D?0:f.paint.get("raster-fade-duration");Bt.registerFadeDuration(gr);const $r=u.findLoadedParent(ut,0),rs=n_(Bt,$r,u,w.transform,gr);let Or,Tr;!rs.isFading&&Bt.refreshedUponExpiration&&(Bt.refreshedUponExpiration=!1),w.terrain&&w.terrain.prepareDrawTile(),J.activeTexture.set(te.TEXTURE0),Qt.bind(De,te.CLAMP_TO_EDGE),J.activeTexture.set(te.TEXTURE1),$r?($r.texture&&$r.texture.bind(De,te.CLAMP_TO_EDGE),Or=Math.pow(2,$r.tileID.overscaledZ-Bt.tileID.overscaledZ),Tr=[Bt.tileID.canonical.x*Or%1,Bt.tileID.canonical.y*Or%1]):Qt.bind(De,te.CLAMP_TO_EDGE),"useMipmap"in Qt&&J.extTextureFilterAnisotropic&&w.transform.pitch>20&&te.texParameterf(te.TEXTURE_2D,J.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,J.extTextureFilterAnisotropicMax);const vs=w.transform;let ps;const Qr=U?k6(vs):[0,0,0,0];let ns,Ps,hn,ta,Ta,js=0;if(G&&me instanceof i.aU&&me.coordinates.length>3)ns=Float32Array.from(i.bk(i.dJ(new i.cD(0,0,0)))),Ps=Float32Array.from(vs.globeMatrix),hn=Float32Array.from(i.dF(vs)),ta=[i.aF(vs.center.lng),i.aJ(vs.center.lat)],ps=me.elevatedGlobePerspectiveTransform,Ta=me.elevatedGlobeGridMatrix||new Float32Array(9);else if(G){const Za=i.dG(ut.canonical);js=i.dH(Za.getCenter().lat),ns=Float32Array.from(i.bk(i.dJ(ut.canonical))),Ps=Float32Array.from(vs.globeMatrix),hn=Float32Array.from(i.dF(vs)),ta=[i.aF(vs.center.lng),i.aJ(vs.center.lat)],ps=[0,0],Ta=Float32Array.from(i.dI(ut.canonical,Za,js,vs.worldSize/vs._pixelsPerMercatorPixel))}else ps=me instanceof i.aU?me.perspectiveTransform:[0,0],ns=new Float32Array(16),Ps=new Float32Array(9),hn=new Float32Array(16),ta=[0,0],Ta=new Float32Array(9);const ba=x6(nr,ns,Ps,hn,Ta,Tr||[0,0],i.aj(w.transform.zoom),ta,Qr,Or||1,rs,f,ps,U?f.paint.get("raster-elevation"):0,2,er,ur,he.range,Sr,Kt,pe),nn=w.isTileAffectedByFog(ut),La=w.getOrCreateProgram("raster",{defines:he.defines,overrideFog:nn});if(w.uploadCommonUniforms(J,La,Tt),me instanceof i.aU){const Za=me.elevatedGlobeVertexBuffer,Ua=me.elevatedGlobeIndexBuffer;if(_e||!R)me.boundsBuffer&&me.boundsSegments&&La.draw(w,te.TRIANGLES,Pt,Xs.disabled,ke,Zs.disabled,ba,f.id,me.boundsBuffer,w.quadTriangleIndexBuffer,me.boundsSegments);else if(Za&&Ua){const _a=vs.zoom<=i.c_?me.elevatedGlobeSegments:me.getSegmentsForLongitude(vs.center.lng);_a&&La.draw(w,te.TRIANGLES,Pt,Xs.disabled,ke,_t,ba,f.id,Za,Ua,_a)}}else if(G){Pt=new ks(te.LEQUAL,ks.ReadOnly,w.depthRangeFor3D);const Za=w.globeSharedBuffers;if(Za){const[Ua,_a,wn]=Za.getGridBuffers(js,!1);La.draw(w,te.TRIANGLES,Pt,gt||Xt,w.colorModeForRenderPass(),_t,ba,f.id,Ua,_a,wn)}}else{const{tileBoundsBuffer:Za,tileBoundsIndexBuffer:Ua,tileBoundsSegments:_a}=w.getTileBoundsBuffers(Bt);La.draw(w,te.TRIANGLES,Pt,Xt,ke,Zs.disabled,ba,f.id,Za,Ua,_a)}}if(!(me instanceof i.aU)&&G)for(const ut of xt){const Tt=ut.canonical.y===(1<>>16,2654435769),((ut=Math.imul(ut^ut>>>16,2654435769))>>>0)/4294967296},gt=1/1.1;for(let ut=0;uti.e9[Xt](Qt));Kt.push(Qt);const Pt=Qt.canonical.x,nr=Qt.canonical.y;for(const Xt of Kt){const gr=We.getTile(Tt?Xt.wrapped():Xt);if(!gr)continue;const $r=gr.rasterParticleState;if(!$r)continue;const rs=Xt.canonical.x+(1<_t.tileID)),pe&&(J.activeTexture.set(te.TEXTURE0),w.imageManager.bind(w.context,f.scope));const xt=[];if(w.terrain&&w.terrain.renderingToTexture&&w.emissiveMode==="mrt-fallback"&&xt.push("USE_MRT1"),G){const _t=w.getOrCreateProgram(nt,{overrideFog:!1,overrideRtt:!0,defines:xt}),gt=new Float32Array(i.bA([])),ut=new i.aQ(0,0,0,0,0),Tt=pe?mg(gt,U,R,w,0,f.scope,ke,G,{tileID:ut,tileSize:he}):i_(gt,U,R,P.toPremultipliedRenderColor(D?null:f.lut));_t.draw(w,te.TRIANGLES,De,Re,He,Zs.disabled,Tt,f.id,w.viewportBuffer,w.quadTriangleIndexBuffer,w.viewportSegments)}else for(const _t of kt){const gt=w.isTileAffectedByFog(_t),ut=w.getOrCreateProgram(nt,{overrideFog:gt,defines:xt}),Tt=_t.toUnwrapped(),Bt=k?_t.projMatrix:w.transform.calculateProjMatrix(Tt);w.prepareDrawTile();const zt=u?u.getTile(_t):We?We[_t.key]:new Dp(_t,he,me.zoom,w),Qt=pe?mg(Bt,U,R,w,0,f.scope,ke,G,{tileID:_t,tileSize:he}):i_(Bt,U,R,P.toPremultipliedRenderColor(D?null:f.lut));w.uploadCommonUniforms(J,ut,Tt);const{tileBoundsBuffer:er,tileBoundsIndexBuffer:ur,tileBoundsSegments:Sr}=w.getTileBoundsBuffers(zt);ut.draw(w,te.TRIANGLES,De,Re,He,Zs.disabled,Qt,f.id,er,ur,Sr)}},sky:function(w,u,f){const k=w._atmosphere?i.aj(w.transform.zoom):1,P=f.paint.get("sky-opacity")*k;if(P===0)return;const D=w.context,R=f.paint.get("sky-type"),U=new ks(D.gl.LEQUAL,ks.ReadOnly,[0,1]),G=w.frameCounter/1e3%1;R==="atmosphere"?w.renderPass==="offscreen"?f.needsSkyboxCapture(w)&&(function(J,te,me,he){const pe=J.context,ke=pe.gl;let _e=te.skyboxFbo;if(!_e){_e=te.skyboxFbo=pe.createFramebuffer(32,32,1,null),te.skyboxGeometry=new zN(pe),te.skyboxTexture=pe.gl.createTexture(),ke.bindTexture(ke.TEXTURE_CUBE_MAP,te.skyboxTexture),ke.texParameteri(ke.TEXTURE_CUBE_MAP,ke.TEXTURE_WRAP_S,ke.CLAMP_TO_EDGE),ke.texParameteri(ke.TEXTURE_CUBE_MAP,ke.TEXTURE_WRAP_T,ke.CLAMP_TO_EDGE),ke.texParameteri(ke.TEXTURE_CUBE_MAP,ke.TEXTURE_MIN_FILTER,ke.LINEAR),ke.texParameteri(ke.TEXTURE_CUBE_MAP,ke.TEXTURE_MAG_FILTER,ke.LINEAR);for(let nt=0;nt<6;++nt)ke.texImage2D(ke.TEXTURE_CUBE_MAP_POSITIVE_X+nt,0,ke.RGBA,32,32,0,ke.RGBA,ke.UNSIGNED_BYTE,null)}pe.bindFramebuffer.set(_e.framebuffer),pe.viewport.set([0,0,32,32]);const Re=te.getCenter(J,!0),De=J.getOrCreateProgram("skyboxCapture"),He=new Float64Array(16);i.bA(He),i.en(He,He,.5*-Math.PI),Ax(J,te,De,He,Re,0),i.bA(He),i.en(He,He,.5*Math.PI),Ax(J,te,De,He,Re,1),i.bA(He),i.cU(He,He,.5*-Math.PI),Ax(J,te,De,He,Re,2),i.bA(He),i.cU(He,He,.5*Math.PI),Ax(J,te,De,He,Re,3),i.bA(He),Ax(J,te,De,He,Re,4),i.bA(He),i.en(He,He,Math.PI),Ax(J,te,De,He,Re,5),pe.viewport.set([0,0,J.width,J.height])}(w,f),f.markSkyboxValid(w)):w.renderPass==="sky"&&function(J,te,me,he,pe){const ke=J.context,_e=ke.gl,Re=J.transform,De=J.getOrCreateProgram("skybox");ke.activeTexture.set(_e.TEXTURE0),_e.bindTexture(_e.TEXTURE_CUBE_MAP,te.skyboxTexture);const He=((nt,We,kt,xt,_t)=>({u_matrix:nt,u_sun_direction:We,u_cubemap:0,u_opacity:xt,u_temporal_offset:_t}))(Re.skyboxMatrix,te.getCenter(J,!1),0,he,pe);J.uploadCommonUniforms(ke,De),De.draw(J,_e.TRIANGLES,me,Xs.disabled,J.colorModeForRenderPass(),Zs.backCW,He,"skybox",te.skyboxGeometry.vertexBuffer,te.skyboxGeometry.indexBuffer,te.skyboxGeometry.segment)}(w,f,U,P,G):R==="gradient"&&w.renderPass==="sky"&&function(J,te,me,he,pe){const ke=J.context,_e=ke.gl,Re=J.transform,De=J.getOrCreateProgram("skyboxGradient");te.skyboxGeometry||(te.skyboxGeometry=new zN(ke)),ke.activeTexture.set(_e.TEXTURE0);let He=te.colorRampTexture;He||(He=te.colorRampTexture=new i.T(ke,te.colorRamp,_e.RGBA8)),He.bind(_e.LINEAR,_e.CLAMP_TO_EDGE);const nt=((We,kt,xt,_t,gt)=>({u_matrix:We,u_color_ramp:0,u_center_direction:kt,u_radius:i.an(xt),u_opacity:_t,u_temporal_offset:gt}))(Re.skyboxMatrix,te.getCenter(J,!1),te.paint.get("sky-gradient-radius"),he,pe);J.uploadCommonUniforms(ke,De),De.draw(J,_e.TRIANGLES,me,Xs.disabled,J.colorModeForRenderPass(),Zs.backCW,nt,"skyboxGradient",te.skyboxGeometry.vertexBuffer,te.skyboxGeometry.indexBuffer,te.skyboxGeometry.segment)}(w,f,U,P,G)},custom:function(w,u,f,k){const P=w.context,D=f.implementation;if(!w.transform.projection.unsupportedLayers||!w.transform.projection.unsupportedLayers.includes("custom")||w.terrain&&(w.terrain.renderingToTexture||w.renderPass==="offscreen")&&f.isDraped(u)){if(w.renderPass==="offscreen"){const R=D.prerender;if(R){if(w.setCustomLayerDefaults(),P.setColorMode(w.colorModeForRenderPass()),w.transform.projection.name==="globe"){const U=w.transform.pointMerc;R.call(D,P.gl,w.transform.customLayerMatrix(),w.transform.getProjection(),w.transform.globeToMercatorMatrix(),i.aj(w.transform.zoom),[U.x,U.y],w.transform.pixelsPerMeterRatio)}else R.call(D,P.gl,w.transform.customLayerMatrix());P.setDirty(),w.setBaseState()}}else if(w.renderPass==="translucent"){if(w.terrain&&w.terrain.renderingToTexture){const U=D.renderToTile;if(U){const G=k[0].canonical,J={x:G.x+k[0].wrap*(D.wrapTileId?0:1<{J&&(J.useNormalOffset=!0,te||(J.enabled=!0))},he=u.getSource();if(w.renderPass==="light-beam"&&he.type!=="batched-model")return;if(he.type==="vector"||he.type==="geojson")return function(We,kt,xt,_t,gt){const ut=We.transform,Tt=ut.projection.name==="globe",Bt=ut.getFreeCameraOptions().position;if(!We.modelManager)return;const zt=We.modelManager;xt.modelManager=zt;const Qt=We.shadowRenderer;if(!xt._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const er=xt._unevaluatedLayout._values["model-id"],ur=Object.assign({},xt.layout.get("model-id").parameters),Sr=We.style.order.indexOf(xt.fqid),Kt=xt.paint.get("model-opacity").constantOr(1);for(const Pt of _t){const nr=kt.getTile(Pt).getBucket(xt);if(!nr||nr.projection.name!==ut.projection.name)continue;const Xt=nr.getModelUris();if(Xt&&!nr.modelsRequested&&(zt.addModelsFromBucket(Xt,gt),nr.modelsRequested=!0),Tt)ur.zoom=Pt.overscaledZ;else{const Qr=Td(Pt,ut);ur.zoom=Qr}const gr=er.possiblyEvaluate(ur);if(O6(We,nr,Pt),Vm.shadowUniformsInitialized=!1,Vm.useSingleShadowCascade=!!Qt&&Qt.getMaxCascadeForTile(Pt.toUnwrapped())===0,We.renderPass==="shadow"&&Qt){if(We.currentShadowCascade===1&&nr.isInsideFirstShadowMapFrustum)continue;const Qr=ut.calculatePosMatrix(Pt.toUnwrapped(),ut.worldSize);if(Vm.tileMatrix.set(Qr),Vm.shadowTileMatrix=Float32Array.from(Qt.calculateShadowPassMatrixFromMatrix(Qr)),Vm.aabb.min=[0,0,0],Vm.aabb.max[0]=Vm.aabb.max[1]=i.al,Vm.aabb.max[2]=0,poe(nr,Vm,We,xt.scope))continue}const $r=1<0&&We.style.isLayerClipped(xt,kt.getSource())&&nr.updateReplacement(Pt,We.replacementSource,Sr,xt.scope)&&(nr.uploaded=!1,nr.upload(We.context));let Or=0;const Tr=new Array,vs=new Array,ps=new Array;for(let Qr in nr.instancesPerModel){const ns=nr.instancesPerModel[Qr];ns.features.length>0&&!Tt&&(Qr=gr.evaluate(ns.features[0].feature,{}));const Ps=zt.getModel(Qr,gt);if(Ps||zt.hasURLBeenRequested(Qr)||nr.modelUris.includes(Qr)||(nr.modelUris.push(Qr),nr.modelsRequested=!1),Ps&&Ps.uploaded)if(Tt){const hn=i.c5([],[Bt.x,Bt.y,Bt.z],We.transform.worldSize);i.ew(hn,hn);for(let ta=0;ta0&&ba.elevationUpdate(Qr.terrain,ta,js,Ps.source),ba.needsReEvaluation(Qr,Ta,Ps)&&ba.evaluate(Ps))}})(We,kt,xt,_t),function(){let Qr,ns,Ps;Tr?(Qr=_t.length-1,ns=-1,Ps=-1):(Qr=0,ns=_t.length,Ps=1);const hn=new Float64Array(16),ta=i.cA(),Ta=new i.P(0,0);for(let js=Qr;js!==ns;js+=Ps){const ba=_t[js],nn=kt.getTile(ba).getBucket(xt);if(!nn||!nn.uploaded)continue;let La=!1;Bt&&(La=Bt.getMaxCascadeForTile(ba.toUnwrapped())===0);const Za=ut.calculatePosMatrix(ba.toUnwrapped(),ut.worldSize),Ua=nn.modelTraits;!$r&&Tr&&(i.bl(hn,Za),i.af(ta,Qt,hn),Ta.x=ta[0],Ta.y=ta[1]);const _a=[];nn.setFilter(xt.filter);for(const wn of nn.getNodesInfo()){if(wn.hiddenByReplacement||!wn.node.meshes)continue;const Pa=wn.node;let so=0;We.terrain&&Pa.elevation&&(so=Pa.elevation*We.terrain.exaggeration());const Ii=(()=>{const qc=wn.aabb;return gr.min=[...qc.min],gr.max=[...qc.max],gr.min[2]+=so,gr.max[2]+=so,i.af(gr.min,gr.min,Za),i.af(gr.max,gr.max,Za),gr})(),Oa=wn.evaluatedScale;if(Oa[0]<=1&&Oa[1]<=1&&Oa[2]<=1&&Ii.intersects(rs)===0)continue;if(!$r&&Tr){const qc=.16666666666666666;wn.cameraCollisionOpacity=Qt[0]>Ii.min[0]&&Qt[0]Ii.min[1]&&Qt[1]!Tr||wn.opacity===1&&Pa.opacity===1?wn.depthPa.depth?-1:1);for(const wn of _a){const Pa=wn.nodeInfo,so=Pa.node;let Ii=i.aB([],Kt,wn.tileModelMatrix);i.aB(Ii,ur,Ii);const Oa=i.bl([],Ii);i.eg(Oa,Oa),i.cS(Oa,Oa,h_),Ii=i.aB(Ii,Ii,so.globalMatrix);const ha=We.renderPass==="light-beam",jn=xt.paint.get("model-color-use-theme").constantOr("default")==="none",ji=Ua&i.eI.HasMapboxMeshFeatures,vo=ji?0:Pa.evaluatedRMEA[0][2];for(let Xi=0;Xi=hr||Qi>=hr}}const Ql=si.material;let Uu;Ql.occlusionTexture&&Ql.occlusionTexture.offsetScale&&(Uu=Ql.occlusionTexture.offsetScale,rl.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const jh=We.getOrCreateProgram("model",rl);!$r&&Bt&&Bt.setupShadowsFromMatrix(wn.tileModelMatrix,jh,Bt.useNormalOffset),We.uploadCommonUniforms(gt,jh,null,Vc);const Xd=Ql.pbrMetallicRoughness;Xd.metallicFactor=.9,Xd.roughnessFactor=.5;const co=Nx(new Float32Array(_c),new Float32Array(Ii),new Float32Array(Oa),new Float32Array(so.globalMatrix),We,wn.opacity,Xd.baseColorFactor,Ql.emissiveFactor,Xd.metallicFactor,Xd.roughnessFactor,Ql,vo,xt,[0,0,0],Uu);!Ad&&(Pa.hasTranslucentParts||wn.opacity<1)&&jh.draw(We,gt.gl.TRIANGLES,nr,Xs.disabled,bn.disabled,Zs.backCCW,co,xt.id,si.vertexBuffer,si.indexBuffer,si.segments,xt.paint,We.transform.zoom,void 0,qc),jh.draw(We,gt.gl.TRIANGLES,Ad?Xt:nr,Xs.disabled,Ad||wn.opacity<1||Pa.hasTranslucentParts?bn.alphaBlended:bn.unblended,Zs.backCCW,co,xt.id,si.vertexBuffer,si.indexBuffer,si.segments,xt.paint,We.transform.zoom,void 0,qc)}}}}()}(w,u,f,k),void me();if(he.type!=="model")return;const pe=he.getModels(),ke=[],_e=w.transform.getFreeCameraOptions().position,Re=i.c5([],[_e.x,_e.y,_e.z],w.transform.worldSize);i.ew(Re,Re);const De=[],He=[];let nt=0;for(const We of pe){const kt=u.getFeatureState("",We.id),xt={type:"Unknown",id:We.id,properties:We.featureProperties},_t=f.paint.get("model-rotation").evaluate(xt,kt),gt=f.paint.get("model-scale").evaluate(xt,kt),ut=f.paint.get("model-translation").evaluate(xt,kt),Tt=f.paint.get("model-opacity").evaluate(xt,kt);I6(f,We.id,kt,We.featureProperties,We.nodeOverrideNames,We.nodeOverrides),P6(f,We.id,kt,We.featureProperties,We.materialOverrideNames,We.materialOverrides),We.nodeOverrides.size>0&&We.computeBoundsAndApplyParent(),We.computeModelMatrix(w,_t,gt,ut,U,R,!1);const Bt=i.bA([]),zt=i.ef(We.position.lat,w.transform.zoom),Qt=i.bq([],[1,1,1/zt]);i.br(Bt,Bt,Re),ke.push({zScaleMatrix:Qt,negCameraPosMatrix:Bt});for(const er of We.nodes)Ex(w,er,We.matrix,w.transform.expandedFarZProjMatrix,nt,De,He,We.materialOverrides,Tt);nt++}if(De.sort((We,kt)=>kt.depth-We.depth),w.renderPass!=="shadow")L6(w,f,De,He,ke),me();else{for(const We of He)em(We.mesh,We.nodeModelMatrix,w,f);for(const We of De)em(We.mesh,We.nodeModelMatrix,w,f);me()}}},WN={line:function(w,u,f){if(w.hasElevatedBuckets=!1,w.hasNonElevatedBuckets=!1,w._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||w._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(u){const k=u.getVisibleCoordinates();for(const P of k){const D=u.getTile(P).getBucket(w);if(D&&(D.elevationType!=="none"?w.hasElevatedBuckets=!0:w.hasNonElevatedBuckets=!0,w.hasElevatedBuckets&&w.hasNonElevatedBuckets))break}}}else w.hasNonElevatedBuckets=!0},model:function(w,u,f){const k=u.getSource();if(!k.loaded())return;if(k.type==="vector"||k.type==="geojson")return void(f.modelManager&&f.modelManager.upload(f,u_(f,w)));if(k.type==="batched-model"||k.type!=="model")return;const P=k.getModels();for(const D of P)D.upload(f.context)},raster:function(w,u,f){const k=u.getSource();if(!(k instanceof yc&&k.loaded()))return;const P=w.sourceLayer||k.rasterLayerIds&&k.rasterLayerIds[0];if(!P)return;const D=w.paint.get("raster-array-band")||k.getInitialBand(P);if(D==null)return;const R=u.getIds().map(U=>u.getTileByID(U));for(const U of R)U.updateNeeded(w.id,D)&&k.prepareTile(U,P,w.id,D)},"raster-particle":function(w,u,f){const k=u.getSource();if(!(k instanceof yc&&k.loaded()))return;const P=w.sourceLayer||k.rasterLayerIds&&k.rasterLayerIds[0];if(!P)return;const D=w.paint.get("raster-particle-array-band")||k.getInitialBand(P);if(D==null)return;const R=u.getIds().map(U=>u.getTileByID(U));for(const U of R)U.updateNeeded(w.id,D)&&k.prepareTile(U,P,w.id,D)}},$u={fill:IN},GN={fill:function(w,u,f,k){if(!f.layout||f.layout.get("fill-elevation-reference")==="none"||f.paint.get("fill-opacity").constantOr(1)===0)return;const P=w.context.gl,D=new ks(P.LEQUAL,ks.ReadOnly,w.depthRangeFor3D),R=new Xs({func:P.ALWAYS,mask:255},255,255,P.KEEP,P.KEEP,P.REPLACE),U=w.transform.getFreeCameraOptions().position,G=w.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const J of k){const te=u.getTile(J),me=te.getBucket(f);if(!me)continue;const he=me.elevatedStructures;if(!he||he.depthSegments.segments[0].primitiveLength===0)continue;const pe=j6(J.toUnwrapped(),U),ke=w.translatePosMatrix(J.projMatrix,te,f.paint.get("fill-translate"),f.paint.get("fill-translate-anchor")),_e=kx(ke,pe,0,1,0);G.draw(w,P.TRIANGLES,D,R,bn.disabled,Zs.disabled,_e,f.id,he.vertexBuffer,he.indexBuffer,he.depthSegments,f.paint,w.transform.zoom)}}};class KN{constructor(u,f,k,P,D){this.context=new _0(u,f),this.transform=k,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 G of R)this._debugParams.enabledLayers[G]=!0;for(const G of R);this.occlusionParams=new w0,this.setup(),this.numSublayers=kd.maxUnderzooming+kd.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 l0(this),this._wireframeDebugCache=new fg,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const U=new i.q({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new i.T(this.context,U,u.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=P,this.worldview=D,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(u,f){const k=!!u&&!!u.terrain&&this.transform.projection.supportsTerrain;if(!(k||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new B5(this,u));const P=this._terrain;this.transform.elevation=k?P:null,P.update(u,this.transform,f),this.transform.elevation&&!P.enabled&&(this.transform.elevation=null)}_updateFog(u){const f=u.fog;if(!f||this.transform.projection.name==="globe"||f.getOpacity(this.transform.pitch)<1||f.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[k,P]=f.getFovAdjustedRange(this.transform._fov);if(k>P)return void(this.transform.fogCullDistSq=null);const D=k+.78*(P-k);this.transform.fogCullDistSq=D*D}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(u){u&&!this._terrain&&(this._terrain=new B5(this,this.style)),this._forceTerrainMode=u}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(u,f){if(this.width=u*i.o.devicePixelRatio,this.height=f*i.o.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const k of this.style.order)this.style._mergedLayers[k].resize()}setup(){const u=this.context,f=new i.bd;f.emplaceBack(0,0),f.emplaceBack(i.al,0),f.emplaceBack(0,i.al),f.emplaceBack(i.al,i.al),this.tileExtentBuffer=u.createVertexBuffer(f,i.bf.members),this.tileExtentSegments=i.bg.simpleSegment(0,0,4,2);const k=new i.bd;k.emplaceBack(0,0),k.emplaceBack(i.al,0),k.emplaceBack(0,i.al),k.emplaceBack(i.al,i.al),this.debugBuffer=u.createVertexBuffer(k,i.bf.members),this.debugSegments=i.bg.simpleSegment(0,0,4,5);const P=new i.bd;P.emplaceBack(-1,-1),P.emplaceBack(1,-1),P.emplaceBack(-1,1),P.emplaceBack(1,1),this.viewportBuffer=u.createVertexBuffer(P,i.bf.members),this.viewportSegments=i.bg.simpleSegment(0,0,4,2);const D=new i.b1;D.emplaceBack(0,0,0,0),D.emplaceBack(i.al,0,i.al,0),D.emplaceBack(0,i.al,0,i.al),D.emplaceBack(i.al,i.al,i.al,i.al),this.mercatorBoundsBuffer=u.createVertexBuffer(D,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=u.createIndexBuffer(R);const U=new i.be;for(const J of[0,1,3,2,0])U.emplaceBack(J);this.debugIndexBuffer=u.createIndexBuffer(U),this.emptyTexture=new i.T(u,new i.q({width:1,height:1},Uint8Array.of(0,0,0,0)),u.gl.RGBA8),this.identityMat=i.bC();const G=this.context.gl;this.stencilClearMode=new Xs({func:G.ALWAYS,mask:0},0,255,G.ZERO,G.ZERO,G.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(u){return u._makeTileBoundsBuffers(this.context,this.transform.projection),u._tileBoundsBuffer?{tileBoundsBuffer:u._tileBoundsBuffer,tileBoundsIndexBuffer:u._tileBoundsIndexBuffer,tileBoundsSegments:u._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const u=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,u.TRIANGLES,ks.disabled,this.stencilClearMode,bn.disabled,Zs.disabled,s_(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(u,f,k){if(!f||this.currentStencilSource===f.id||!u.isTileClipped()||!k||k.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let U=!1;for(const G of k)if(this._tileClippingMaskIDs[G.key]===void 0){U=!0;break}if(!U)return}this.currentStencilSource=f.id;const P=this.context,D=P.gl;this.nextStencilID+k.length>256&&this.clearStencil(),P.setColorMode(bn.disabled),P.setDepthMode(ks.disabled);const R=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const U of k){const G=f.getTile(U),J=this._tileClippingMaskIDs[U.key]=this.nextStencilID++,{tileBoundsBuffer:te,tileBoundsIndexBuffer:me,tileBoundsSegments:he}=this.getTileBoundsBuffers(G);R.draw(this,D.TRIANGLES,ks.disabled,new Xs({func:D.ALWAYS,mask:0},J,255,D.KEEP,D.KEEP,D.REPLACE),bn.disabled,Zs.disabled,s_(U.projMatrix),"$clipping",te,me,he)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const u=this.nextStencilID++,f=this.context.gl;return new Xs({func:f.NOTEQUAL,mask:255},u,255,f.KEEP,f.KEEP,f.REPLACE)}stencilModeForClipping(u){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(u);const f=this.context.gl;return new Xs({func:f.EQUAL,mask:255},this._tileClippingMaskIDs[u.key],0,f.KEEP,f.KEEP,f.REPLACE)}stencilConfigForOverlap(u){const f=this.context.gl,k=u.sort((R,U)=>U.overscaledZ-R.overscaledZ),P=k[k.length-1].overscaledZ,D=k[0].overscaledZ-P+1;if(D>1){this.currentStencilSource=void 0,this.nextStencilID+D>256&&this.clearStencil();const R={};for(let U=0;Uthis._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((u,f)=>u+f/this._fpsHistory.length,0))}render(u,f){const k=i.o.now();this._dt=k-this._timeStamp,this._timeStamp=k,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=u.map.repaint,this.style=u,this.options=f;const P=this.style._mergedLayers,D=!(!this.terrain||!this.terrain.enabled),R=()=>this.style._getOrder(D).filter(Kt=>{const Pt=P[Kt];return!(Pt.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[Pt.type]});let U=R(),G=!1,J=!1,te=null,me=0,he=!1;for(const Kt of U){const Pt=P[Kt];Pt.visibility!=="none"&&(Pt.type==="circle"?G=!0:Pt.type==="building"?(te=Pt,++me):Pt.type==="symbol"&&(Pt.hasOcclusionOpacityProperties?J=!0:G=!0))}this.updateEmissiveMode();let pe=U.map(Kt=>P[Kt]);const ke=this.style._mergedSourceCaches;this.imageManager=u.imageManager,this.modelManager=u.modelManager,this.symbolFadeChange=u.placement.symbolFadeChange(i.o.now()),this.imageManager.beginFrame();for(const Kt in ke){const Pt=ke[Kt];Pt.used&&(Pt.prepare(this.context),Pt.getSource().usedInConflation&&++me)}let _e=!1;for(const Kt of pe)Kt.isHidden(this.transform.zoom)||(Kt.type==="clip"&&(_e=!0),this.prepareLayer(Kt));const Re={},De={},He={},nt={},We={};for(const Kt in ke){const Pt=ke[Kt];Re[Kt]=Pt.getVisibleCoordinates(),De[Kt]=Re[Kt].slice().reverse(),He[Kt]=Pt.getVisibleCoordinates(!0).reverse(),nt[Kt]=Pt.getShadowCasterCoordinates(),We[Kt]=Pt.sortCoordinatesByDistance(Re[Kt])}const kt=Kt=>{const Pt=this.style.getLayerSourceCache(Kt);return Pt&&Pt.used?Pt.getSource():null};if(me||_e||this._clippingActiveLastFrame){const Kt=[],Pt=[];let nr=0;for(const Xt of pe)this.isSourceForClippingOrConflation(Xt,kt(Xt))&&(Kt.push(Xt),Pt.push(nr)),nr++;if(Kt&&(_e||Kt.length>1)||this._clippingActiveLastFrame){_e=!1;const Xt=[];for(let gr=0;gr0){const Xt=kt(Pt);Xt&&(this.minCutoffZoom=Math.max(Xt.minzoom,this.minCutoffZoom)),Pt.minzoom&&(this.minCutoffZoom=Math.max(Pt.minzoom,this.minCutoffZoom))}Pt.is3D(D)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=Kt),this._lastOcclusionLayer=Kt)}const xt=this.style&&this.style.fog;xt?(this._fogVisible=xt.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=xt.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(He),this.opaquePassCutoff=0,U=R(),pe=U.map(Kt=>P[Kt]));const _t=this._shadowRenderer;if(_t){_t.updateShadowParameters(this.transform,this.style.directionalLight);for(const Kt in ke)for(const Pt of Re[Kt]){let nr={min:0,max:0};this.terrain&&(nr=this.terrain.getMinMaxForTile(Pt)||nr),_t.addShadowReceiver(Pt.toUnwrapped(),nr.min,nr.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 E6(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const gt=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),ut=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(gt&&!this._snow&&(this._snow=new rM(this)),!gt&&this._snow&&(this._snow.destroy(),delete this._snow),ut&&!this._rain&&(this._rain=new HN(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 BN);const Kt=this.style.getLayerSourceCache(te);this.buildingTileBorderManager.updateBorders(Kt,te)}if(!Ge.has(this.context.gl))return;this.renderPass="offscreen";for(const Kt of pe){const Pt=u.getLayerSourceCache(Kt);if(!Kt.hasOffscreenPass()||Kt.isHidden(this.transform.zoom))continue;const nr=Pt?De[Pt.id]:void 0;(Kt.type==="custom"||Kt.type==="raster"||Kt.type==="raster-particle"||Kt.isSky()||nr&&nr.length)&&this.renderLayer(this,Pt,Kt,nr)}this.depthRangeFor3D=[0,1-(pe.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,nt)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const Tt=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),Bt=(()=>{if(f.showOverdrawInspector)return i.ao.black;const Kt=this.style.fog;if(Kt&&this.transform.projection.supportsFog){const Pt=this.style.getLut(Kt.scope);if(!Tt){const nr=Kt.properties.get("color-use-theme")==="none",Xt=Kt.properties.get("color").toNonPremultipliedRenderColor(nr?null:Pt).toArray01();return new i.ao(...Xt)}if(Tt){const nr=Kt.properties.get("space-color-use-theme")==="none",Xt=Kt.properties.get("space-color").toNonPremultipliedRenderColor(nr?null:Pt).toArray01();return new i.ao(...Xt)}}return i.ao.transparent})();if(this.context.clear({color:Bt,depth:1}),this.clearStencil(),this._showOverdrawInspector=f.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&Tt&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=U.length-1;this.currentLayer>=0;this.currentLayer--){const Kt=pe[this.currentLayer],Pt=u.getLayerSourceCache(Kt);if(Kt.isSky())continue;const nr=Pt?(Kt.is3D(D)?We:De)[Pt.id]:void 0;this._renderTileClippingMasks(Kt,Pt,nr),this.renderLayer(this,Pt,Kt,nr)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&Tt&&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&&Kt.hasShadowPass()&&--Qt==0){{this.clearStencil(),this.resetStencilClippingMasks();const nr=this.currentLayer;for(this.currentLayer=0;this.currentLayer=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const nr=this.currentLayer;this.depthOcclusion=!0;for(const Xt of this.layersWithOcclusionOpacity){this.currentLayer=Xt;const gr=pe[this.currentLayer],$r=u.getLayerSourceCache(gr),rs=$r?De[$r.id]:void 0;this.terrain||this._renderTileClippingMasks(gr,$r,$r?Re[$r.id]:void 0),this.renderLayer(this,$r,gr,rs)}this.depthOcclusion=!1,this.currentLayer=nr,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 Kt=null;pe.forEach(Pt=>{const nr=u.getLayerSourceCache(Pt);nr&&!Pt.isHidden(this.transform.zoom)&&nr.getVisibleCoordinates().length&&(!Kt||Kt.getSource().maxzoom0?f.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(u,f,k){const P=k===void 0?this.terrain&&this.terrain.renderingToTexture:k,D=[];return this.style&&this.style.enable3dLights()&&(u==="globeRaster"||u==="terrainRaster"?(D.push("LIGHTING_3D_MODE"),D.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):P||D.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"&&(this._shadowMapDebug||D.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(D.push("TERRAIN"),this.linearFloatFilteringSupported()&&D.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&D.push("GLOBE"),!this._fogVisible||P||f!==void 0&&!f||D.push("FOG","FOG_DITHERING"),P&&D.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&D.push("OVERDRAW_INSPECTOR"),D}getOrCreateProgram(u,f){this.cache=this.cache||{};const k=f&&f.defines||[],P=f&&f.config,D=this.currentGlobalDefines(u,f&&f.overrideFog,f&&f.overrideRtt).concat(k),R=d6.cacheKey(C5[u],u,D,P);return this.cache[R]||(this.cache[R]=new d6(this.context,u,C5[u],P,EN[u],D)),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 u=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(u.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(u,f){if(this.style.enable3dLights()){const k=this.style.directionalLight,P=this.style.ambientLight;if(k&&P){const D=((R,U,G)=>{const J=R.properties.get("direction"),te=R.properties.get("color-use-theme")==="none",me=R.properties.get("color").toNonPremultipliedRenderColor(te?null:G.getLut(R.scope)).toArray01(),he=R.properties.get("intensity"),pe=U.properties.get("color-use-theme")==="none",ke=U.properties.get("color").toNonPremultipliedRenderColor(pe?null:G.getLut(U.scope)).toArray01(),_e=U.properties.get("intensity"),Re=[J.x,J.y,J.z],De=i.dN(ke,_e),He=i.dN(me,he);return{u_lighting_ambient_color:De,u_lighting_directional_dir:Re,u_lighting_directional_color:He,u_ground_radiance:x0(Re,He,De)}})(k,P,this.style);f.setLightsUniformValues(u,D)}}}uploadCommonUniforms(u,f,k,P,D){if(this.uploadCommonLightUniforms(u,f),this.terrain&&this.terrain.renderingToTexture)return;const R=this.style.fog;if(R){const U=R.getOpacity(this.transform.pitch),G=((J,te,me,he,pe,ke,_e,Re,De,He,nt,We)=>{const kt=J.transform,xt=te.properties.get("color-use-theme")==="none",_t=te.properties.get("color").toNonPremultipliedRenderColor(xt?null:J.style.getLut(te.scope)).toArray01();_t[3]=he;const gt=J.frameCounter/1e3%1,[ut,Tt]=te.properties.get("vertical-range");return{u_fog_matrix:me?kt.calculateFogTileMatrix(me):We||J.identityMat,u_fog_range:te.getFovAdjustedRange(kt._fov),u_fog_color:_t,u_fog_horizon_blend:te.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(ut,Tt),Tt],u_fog_temporal_offset:gt,u_frustum_tl:pe,u_frustum_tr:ke,u_frustum_br:_e,u_frustum_bl:Re,u_globe_pos:De,u_globe_radius:He,u_viewport:nt,u_globe_transition:i.aj(kt.zoom),u_is_globe:+(kt.projection.name==="globe")}})(this,R,k,U,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],P);f.setFogUniformValues(u,G)}D&&f.setCutoffUniformValues(u,D.uniformValues)}setTileLoadedFlag(u){this.tileLoaded=u}saveCanvasCopy(){const u=this.canvasCopy();u&&(this.frameCopies.push(u),this.tileLoaded=!1)}canvasCopy(){const u=this.context.gl,f=u.createTexture();return u.bindTexture(u.TEXTURE_2D,f),u.copyTexImage2D(u.TEXTURE_2D,0,u.RGBA,0,0,u.drawingBufferWidth,u.drawingBufferHeight,0),f}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const u=this.style&&this.style.fog;return!!u&&u.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const u=this._backgroundTiles,f=this._backgroundTiles={},k=this.transform.coveringTiles({tileSize:512});for(const P of k)f[P.key]=u[P.key]||new Dp(P,512,this.transform.tileZoom,this,void 0,this.worldview);return f}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(u,f){return!(!u.is3D(!(!this.terrain||!this.terrain.enabled))||u.type!=="clip"&&u.type!=="building"&&(u.minzoom&&u.minzoom>this.transform.zoom||(this.style._clipLayerPresent||u.sourceLayer!=="building"&&u.sourceLayer!=="procedural_buildings")&&(!f||f.type!=="batched-model")))}isTileAffectedByFog(u){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let f=this._cachedTileFogOpacities[u.key];return f||(this._cachedTileFogOpacities[u.key]=f=this.style.fog.getOpacityForTile(u)),f[0]>=hr||f[1]>=hr}setupDepthForOcclusion(u,f,k){const P=this.context,D=P.gl,R=!!k;var U;k||(k={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}),P.activeTexture.set(D.TEXTURE3),u&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(D.NEAREST,D.CLAMP_TO_EDGE),k.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],k.u_depth_range_unpack=[2/((U=this.depthRangeFor3D)[1]-U[0]),-1-2*U[0]/(U[1]-U[0])],k.u_occluder_half_size=.5*this.occlusionParams.occluderSize,k.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(D.NEAREST,D.CLAMP_TO_EDGE),P.activeTexture.set(D.TEXTURE0),R||f.setTerrainUniformValues(P,k)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const u=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=u?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function ZN(w,u){let f=!1,k=null;const P=()=>{k=null,f&&(w(),k=setTimeout(P,u),f=!1)};return()=>(f=!0,k||P(),k)}class sM{constructor(u){this._hashName=u&&encodeURIComponent(u),i.aY(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=ZN(this._updateHashUnthrottled.bind(this),300)}addTo(u){return this._map=u,window.addEventListener("hashchange",this._onHashChange,!1),u.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 u=this._map;if(!u)return"";const f=el(u);if(this._hashName){const k=this._hashName;let P=!1;const D=location.hash.slice(1).split("&").map(R=>{const U=R.split("=")[0];return U===k?(P=!0,`${U}=${f}`):R}).filter(R=>R);return P||D.push(`${k}=${f}`),`#${D.join("&")}`}return`#${f}`}_getCurrentHash(){const u=location.hash.replace("#","");if(this._hashName){let f;return u.split("&").map(k=>k.split("=")).forEach(k=>{k[0]===this._hashName&&(f=k)}),(f&&f[1]||"").split("/")}return u.split("/")}_onHashChange(){const u=this._map;if(!u)return!1;const f=this._getCurrentHash();if(f.length>=3&&!f.some(k=>isNaN(Number(k)))){const k=u.dragRotate.isEnabled()&&u.touchZoomRotate.isEnabled()?+(f[3]||0):u.getBearing();return u.jumpTo({center:[+f[2],+f[1]],zoom:+f[0],bearing:k,pitch:+(f[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function el(w,u){const f=w.getCenter(),k=Math.round(100*w.getZoom())/100,P=Math.ceil((k*Math.LN2+Math.log(512/360/.5))/Math.LN10),D=Math.pow(10,P),R=Math.round(f.lng*D)/D,U=Math.round(f.lat*D)/D,G=w.getBearing(),J=w.getPitch();let te=u?`/${R}/${U}/${k}`:`${k}/${U}/${R}`;return(G||J)&&(te+="/"+Math.round(10*G)/10),J&&(te+=`/${Math.round(J)}`),te}const k0={linearity:.3,easing:i.eT(0,0,.3,1)},nM=Object.assign({deceleration:2500,maxSpeed:1400},k0),aM=Object.assign({deceleration:20,maxSpeed:1400},k0),Px=Object.assign({deceleration:1e3,maxSpeed:360},k0),iM=Object.assign({deceleration:1e3,maxSpeed:90},k0);class oM{constructor(u){this._map=u,this.clear()}clear(){this._inertiaBuffer=[]}record(u){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:i.o.now(),settings:u})}_drainInertiaBuffer(){const u=this._inertiaBuffer,f=i.o.now();for(;u.length>0&&f-u[0].time>160;)u.shift()}_onMoveEnd(u){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const f={zoom:0,bearing:0,pitch:0,pan:new i.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:D}of this._inertiaBuffer)f.zoom+=D.zoomDelta||0,f.bearing+=D.bearingDelta||0,f.pitch+=D.pitchDelta||0,D.panDelta&&f.pan._add(D.panDelta),D.around&&(f.around=D.around),D.pinchAround&&(f.pinchAround=D.pinchAround);const k=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,P={};if(f.pan.mag()){const D=Hm(f.pan.mag(),k,Object.assign({},nM,u||{}));P.offset=f.pan.mult(D.amount/f.pan.mag()),P.center=this._map.transform.center,N0(P,D)}if(f.zoom){const D=Hm(f.zoom,k,aM);P.zoom=this._map.transform.zoom+D.amount,N0(P,D)}if(f.bearing){const D=Hm(f.bearing,k,Px);P.bearing=this._map.transform.bearing+i.aA(D.amount,-179,179),N0(P,D)}if(f.pitch){const D=Hm(f.pitch,k,iM);P.pitch=this._map.transform.pitch+D.amount,N0(P,D)}if(P.zoom||P.bearing){const D=f.pinchAround===void 0?f.around:f.pinchAround;P.around=D?this._map.unproject(D):this._map.getCenter()}return this.clear(),P.noMoveStart=!0,P}}function N0(w,u){(!w.duration||w.durationf.unproject(G)),U=D.reduce((G,J,te,me)=>G.add(J.div(me.length)),new i.P(0,0));super(u,{points:D,point:U,lngLats:R,lngLat:f.unproject(U),originalEvent:k}),this._defaultPrevented=!1}}class lM extends i.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(u,f){super("wheel",{originalEvent:f}),this._defaultPrevented=!1}}class YN{constructor(u,f){this._map=u,this._clickTolerance=f.clickTolerance}reset(){this._mousedownPos=void 0}wheel(u){return this._firePreventable(new lM(this._map,u))}mousedown(u,f){return this._mousedownPos=f,this._firePreventable(new Yd(u.type,this._map,u))}mouseup(u){this._map.fire(new Yd(u.type,this._map,u))}preclick(u){const f=new MouseEvent("preclick",u);this._map.fire(new Yd(f.type,this._map,f))}click(u,f){this._mousedownPos&&this._mousedownPos.dist(f)>=this._clickTolerance||(this.preclick(u),this._map.fire(new Yd(u.type,this._map,u)))}dblclick(u){return this._firePreventable(new Yd(u.type,this._map,u))}mouseover(u){this._map.fire(new Yd(u.type,this._map,u))}mouseout(u){this._map.fire(new Yd(u.type,this._map,u))}touchstart(u){return this._firePreventable(new xg(u.type,this._map,u))}touchmove(u){this._map.fire(new xg(u.type,this._map,u))}touchend(u){this._map.fire(new xg(u.type,this._map,u))}touchcancel(u){this._map.fire(new xg(u.type,this._map,u))}_firePreventable(u){if(this._map.fire(u),u.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class cM{constructor(u){this._map=u}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(u){this._map.fire(new Yd(u.type,this._map,u))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Yd("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(u){this._delayContextMenu?this._contextMenuEvent=u:this._map.fire(new Yd(u.type,this._map,u)),this._map.listens("contextmenu")&&u.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class XN{constructor(u,f){this._map=u,this._el=u.getCanvasContainer(),this._container=u.getContainer(),this._clickTolerance=f.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(u,f){this.isEnabled()&&u.shiftKey&&u.button===0&&(F(),this._startPos=this._lastPos=f,this._active=!0)}mousemoveWindow(u,f){if(!this._active)return;const k=f,P=this._startPos,D=this._lastPos;if(!P||!D||D.equals(k)||!this._box&&k.dist(P){this._box&&(this._box.style.transform=`translate(${R}px,${G}px)`,this._box.style.width=U-R+"px",this._box.style.height=J-G+"px")})}mouseupWindow(u,f){if(!this._active)return;const k=this._startPos,P=f;if(k&&u.button===0){if(this.reset(),$(),k.x!==P.x||k.y!==P.y)return this._map.fire(new i.z("boxzoomend",{originalEvent:u})),{cameraAnimation:D=>D.fitScreenCoordinates(k,P,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",u)}}keydown(u){this._active&&u.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",u))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),O(),delete this._startPos,delete this._lastPos}_fireEvent(u,f){return this._map.fire(new i.z(u,{originalEvent:f}))}}function QN(w,u){const f={};for(let k=0;kthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=u.timeStamp),k.length===this.numTouches&&(this.centroid=function(P){const D=new i.P(0,0);for(const R of P)D._add(R);return D.div(P.length)}(f),this.touches=QN(k,f)))}touchmove(u,f,k){if(this.aborted||!this.centroid)return;const P=QN(k,f);for(const D in this.touches){const R=P[D];(!R||R.dist(this.touches[D])>30)&&(this.aborted=!0)}}touchend(u,f,k){if((!this.centroid||u.timeStamp-this.startTime>500)&&(this.aborted=!0),k.length===0){const P=!this.aborted&&this.centroid;if(this.reset(),P)return P}}}class JN{constructor(u){this.singleTap=new F6(u),this.numTaps=u.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(u,f,k){this.singleTap.touchstart(u,f,k)}touchmove(u,f,k){this.singleTap.touchmove(u,f,k)}touchend(u,f,k){const P=this.singleTap.touchend(u,f,k);if(P){const D=u.timeStamp-this.lastTime<500,R=!this.lastTap||this.lastTap.dist(P)<30;if(D&&R||this.reset(),this.count++,this.lastTime=u.timeStamp,this.lastTap=P,this.count===this.numTaps)return this.reset(),P}}}class z6{constructor(){this._zoomIn=new JN({numTouches:1,numTaps:2}),this._zoomOut=new JN({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(u,f,k){this._zoomIn.touchstart(u,f,k),this._zoomOut.touchstart(u,f,k)}touchmove(u,f,k){this._zoomIn.touchmove(u,f,k),this._zoomOut.touchmove(u,f,k)}touchend(u,f,k){const P=this._zoomIn.touchend(u,f,k),D=this._zoomOut.touchend(u,f,k);return P?(this._active=!0,u.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:R=>R.easeTo({duration:300,zoom:R.getZoom()+1,around:R.unproject(P)},{originalEvent:u})}):D?(this._active=!0,u.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:R=>R.easeTo({duration:300,zoom:R.getZoom()-1,around:R.unproject(D)},{originalEvent:u})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const B6={0:1,2:2},dM={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class e4{constructor(u){this.reset(),this._clickTolerance=u.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(u,f){return!1}_move(u,f){return{}}mousedown(u,f){if(this._lastPoint)return;const k=X(u);this._correctButton(u,k)&&(this._lastPoint=f,this._eventButton=k)}mousemoveWindow(u,f){const k=this._lastPoint;if(k){if(u.preventDefault(),this._eventButton!=null&&function(P,D){const R=B6[D];return P.buttons===void 0||(P.buttons&R)!==R}(u,this._eventButton))this.reset();else if(this._moved||!(f.dist(k)0&&(this._active=!0);const P=QN(k,f),D=new i.P(0,0),R=new i.P(0,0);let U=0;for(const J in P){const te=P[J],me=this._touches[J];me&&(D._add(te),R._add(te.sub(me)),U++,P[J]=te)}if(this._touches=P,U{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class t4{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(u){}_move(u,f,k){return{}}touchstart(u,f,k){this._firstTwoTouches||k.length<2||(this._firstTwoTouches=[k[0].identifier,k[1].identifier],this._start([f[0],f[1]]))}touchmove(u,f,k){const P=this._firstTwoTouches;if(!P)return;u.preventDefault();const[D,R]=P,U=m_(k,f,D),G=m_(k,f,R);if(!U||!G)return;const J=this._aroundCenter?null:U.add(G).div(2);return this._move([U,G],J,u)}touchend(u,f,k){if(!this._firstTwoTouches)return;const[P,D]=this._firstTwoTouches,R=m_(k,f,P),U=m_(k,f,D);R&&U||(this._active&&$(),this.reset())}touchcancel(){this.reset()}enable(u){this._enabled=!0,this._aroundCenter=!!u&&u.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function m_(w,u,f){for(let k=0;kMath.abs(w.x)}class goe extends t4{constructor(u){super(),this._map=u}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(u){this._lastPoints=u,r4(u[0].sub(u[1]))&&(this._valid=!1)}_move(u,f,k){const P=this._lastPoints;if(!P)return;const D=u[0].sub(P[0]),R=u[1].sub(P[1]);return this._map._cooperativeGestures&&!i.eU()&&k.touches.length<3||(this._valid=this.gestureBeginsVertically(D,R,k.timeStamp),!this._valid)?void 0:(this._lastPoints=u,this._active=!0,{pitchDelta:(D.y+R.y)/2*-.5})}gestureBeginsVertically(u,f,k){if(this._valid!==void 0)return this._valid;const P=u.mag()>=2,D=f.mag()>=2;if(!P&&!D)return;if(!P||!D)return this._firstMove==null&&(this._firstMove=k),k-this._firstMove<100&&void 0;const R=u.y>0==f.y>0;return r4(u)&&r4(f)&&R}}const xoe={panStep:100,bearingStep:15,pitchStep:10};class yoe{constructor(){const u=xoe;this._panStep=u.panStep,this._bearingStep=u.bearingStep,this._pitchStep=u.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(u){if(u.altKey||u.ctrlKey||u.metaKey)return;let f=0,k=0,P=0,D=0,R=0;switch(u.keyCode){case 61:case 107:case 171:case 187:f=1;break;case 189:case 109:case 173:f=-1;break;case 37:u.shiftKey?k=-1:(u.preventDefault(),D=-1);break;case 39:u.shiftKey?k=1:(u.preventDefault(),D=1);break;case 38:u.shiftKey?P=1:(u.preventDefault(),R=-1);break;case 40:u.shiftKey?P=-1:(u.preventDefault(),R=1);break;default:return}return this._rotationDisabled&&(k=0,P=0),{cameraAnimation:U=>{const G=U.getZoom();U.easeTo({duration:300,easeId:"keyboardHandler",easing:p_,zoom:f?Math.round(G)+f*(u.shiftKey?2:1):G,bearing:U.getBearing()+k*this._bearingStep,pitch:U.getPitch()+P*this._pitchStep,offset:[-D*this._panStep,-R*this._panStep],center:U.getCenter()},{originalEvent:u})}}}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 p_(w){return w*(2-w)}const mM=4.000244140625,pM=1/450;class s4{constructor(u,f){this._map=u,this._el=u.getCanvasContainer(),this._handler=f,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=pM,i.aY(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(u){this._defaultZoomRate=u}setWheelZoomRate(u){this._wheelZoomRate=u}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(u){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!u&&u.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(u){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(u.ctrlKey||u.metaKey||this.isZooming()||i.eU()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let f=u.deltaMode===WheelEvent.DOM_DELTA_LINE?40*u.deltaY:u.deltaY;const k=i.o.now(),P=k-(this._lastWheelEventTime||0);this._lastWheelEventTime=k,f!==0&&f%mM==0?this._type="wheel":f!==0&&Math.abs(f)<4?this._type="trackpad":P>400?(this._type=null,this._lastValue=f,this._timeout=window.setTimeout(this._onTimeout,40,u)):this._type||(this._type=Math.abs(P*f)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,f+=this._lastValue)),u.shiftKey&&f&&(f/=4),this._type&&(this._lastWheelEvent=u,this._delta-=f,this._active||this._start(u)),u.preventDefault()}_onTimeout(u){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(u)}_start(u){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 f=H(this._el,u);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:f,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 u=this._map.transform;this._type==="wheel"&&u.projection.wrap&&(u._center.lng>=180||u._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const f=()=>u._terrainEnabled()&&this._aroundCoord?u.computeZoomRelativeTo(this._aroundCoord):u.zoom;if(this._delta!==0){const J=this._type==="wheel"&&Math.abs(this._delta)>mM?this._wheelZoomRate:this._defaultZoomRate;let te=2/(1+Math.exp(-Math.abs(this._delta*J)));this._delta<0&&te!==0&&(te=1/te);const me=f(),he=Math.pow(2,me),pe=typeof this._targetZoom=="number"?u.zoomScale(this._targetZoom):he;this._targetZoom=Math.min(u.maxZoom,Math.max(u.minZoom,u.scaleZoom(pe*te))),this._type==="wheel"&&(this._startZoom=me,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const k=typeof this._targetZoom=="number"?this._targetZoom:f(),P=this._startZoom,D=this._easing;let R,U=!1;if(this._type==="wheel"&&P&&D){const J=Math.min((i.o.now()-this._lastWheelEventTime)/200,1),te=D(J);R=i.ak(P,k,te),J<1?this._frameId||(this._frameId=!0):U=!0}else R=k,U=!0;this._active=!0,U&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let G=R-f();return G*this._lastDelta<0&&(G=0),{noInertia:!0,needsRenderFrame:!U,zoomDelta:G,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(u){let f=i.eV;if(this._prevEase){const k=this._prevEase,P=(i.o.now()-k.start)/k.duration,D=k.easing(P+.01)-k.easing(P),R=.27/Math.sqrt(D*D+1e-4)*.01,U=Math.sqrt(.0729-R*R);f=i.eT(R,U,.25,1)}return this._prevEase={start:i.o.now(),duration:u,easing:f},f}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=j("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 Gp{constructor(u,f){this._clickZoom=u,this._tapZoom=f}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 n4{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(u,f){return u.preventDefault(),{cameraAnimation:k=>{k.easeTo({duration:300,zoom:k.getZoom()+(u.shiftKey?-1:1),around:k.unproject(f)},{originalEvent:u})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class tl{constructor(){this._tap=new JN({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(u,f,k){this._swipePoint||(this._tapTime&&u.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?k.length>0&&(this._swipePoint=f[0],this._swipeTouch=k[0].identifier):this._tap.touchstart(u,f,k))}touchmove(u,f,k){if(this._tapTime){if(this._swipePoint){if(k[0].identifier!==this._swipeTouch)return;const P=f[0],D=P.y-this._swipePoint.y;return this._swipePoint=P,u.preventDefault(),this._active=!0,{zoomDelta:D/128}}}else this._tap.touchmove(u,f,k)}touchend(u,f,k){this._tapTime?this._swipePoint&&k.length===0&&this.reset():this._tap.touchend(u,f,k)&&(this._tapTime=u.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Wm{constructor(u,f,k){this._el=u,this._mousePan=f,this._touchPan=k}enable(u){this._inertiaOptions=u||{},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 f_{constructor(u,f,k){this._pitchWithRotate=u.pitchWithRotate,this._mouseRotate=f,this._mousePitch=k}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 a4{constructor(u,f,k,P){this._el=u,this._touchZoom=f,this._touchRotate=k,this._tapDragZoom=P,this._rotationDisabled=!1,this._enabled=!0}enable(u){this._touchZoom.enable(u),this._rotationDisabled||this._touchRotate.enable(u),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 g_=w=>w.zoom||w.drag||w.pitch||w.rotate;class voe extends i.z{}class x_{constructor(){this.constants=[1,1,.01],this.radius=0}setup(u,f){const k=i.av([],f,u);this.radius=i.ag(k[2]<0?i.eX([],k,this.constants):[k[0],k[1],0])}projectRay(u){i.eX(u,u,this.constants),i.aw(u,u),i.eY(u,u,this.constants);const f=i.c5([],u,this.radius);if(f[2]>0){const k=i.c5([],[0,0,1],i.bJ(f,[0,0,1])),P=i.c5([],i.aw([],[f[0],f[1],0]),this.radius),D=i.d8([],f,i.c5([],i.av([],i.d8([],P,k),f),2));f[0]=D[0],f[1]=D[1]}return f}}function i4(w){return w.panDelta&&w.panDelta.mag()||w.zoomDelta||w.bearingDelta||w.pitchDelta}class _oe{constructor(u,f){this._map=u,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new oM(u),this._bearingSnap=f.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new x_,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(f),i.aY(["handleEvent","handleWindowEvent"],this);const k=this._el;this._listeners=[[k,"touchstart",{passive:!0}],[k,"touchmove",{passive:!1}],[k,"touchend",void 0],[k,"touchcancel",void 0],[k,"mousedown",void 0],[k,"mousemove",void 0],[k,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[k,"mouseover",void 0],[k,"mouseout",void 0],[k,"dblclick",void 0],[k,"click",void 0],[k,"keydown",{capture:!1}],[k,"keyup",void 0],[k,"wheel",{passive:!1}],[k,"contextmenu",void 0],[window,"blur",void 0]];for(const[P,D,R]of this._listeners){const U=P===document?this.handleWindowEvent:this.handleEvent;P.addEventListener(D,U,R)}}destroy(){for(const[u,f,k]of this._listeners){const P=u===document?this.handleWindowEvent:this.handleEvent;u.removeEventListener(f,P,k)}}_addDefaultHandlers(u){const f=this._map,k=f.getCanvasContainer();this._add("mapEvent",new YN(f,u));const P=f.boxZoom=new XN(f,u);this._add("boxZoom",P);const D=new z6,R=new n4;f.doubleClickZoom=new Gp(R,D),this._add("tapZoom",D),this._add("clickZoom",R);const U=new tl;this._add("tapDragZoom",U);const G=f.touchPitch=new goe(f);this._add("touchPitch",G);const J=new uM(u),te=new hM(u);f.dragRotate=new f_(u,J,te),this._add("mouseRotate",J,["mousePitch"]),this._add("mousePitch",te,["mouseRotate"]);const me=new $6(u),he=new U6(f,u);f.dragPan=new Wm(k,me,he),this._add("mousePan",me),this._add("touchPan",he,["touchZoom","touchRotate"]);const pe=new Yi,ke=new foe;f.touchZoomRotate=new a4(k,ke,pe,U),this._add("touchRotate",pe,["touchPan","touchZoom"]),this._add("touchZoom",ke,["touchPan","touchRotate"]),this._add("blockableMapEvent",new cM(f));const _e=f.scrollZoom=new s4(f,this);this._add("scrollZoom",_e,["mousePan"]);const Re=f.keyboard=new yoe;this._add("keyboard",Re);for(const De of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])u.interactive&&u[De]&&f[De].enable(u[De])}_add(u,f,k){this._handlers.push({handlerName:u,handler:f,allowed:k}),this._handlersById[u]=f}stop(u){if(!this._updatingCamera){for(const{handler:f}of this._handlers)f.reset();this._inertia.clear(),this._fireEvents({},{},u),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:u}of this._handlers)if(u.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!g_(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(u,f,k){for(const P in u)if(P!==k&&(!f||f.indexOf(P)<0))return!0;return!1}handleWindowEvent(u){this.handleEvent(u,`${u.type}Window`)}_getMapTouches(u){const f=[];for(const k of u)this._el.contains(k.target)&&f.push(k);return f}handleEvent(u,f){this._updatingCamera=!0;const k=u.type==="renderFrame",P=k?void 0:u,D={needsRenderFrame:!1},R={},U={},G=u.touches?this._getMapTouches(u.touches):void 0,J=G?W(this._el,G):k?void 0:H(this._el,u);for(const{handlerName:he,handler:pe,allowed:ke}of this._handlers){if(!pe.isEnabled())continue;let _e;this._blockedByActive(U,ke,he)?pe.reset():pe[f||u.type]&&(_e=pe[f||u.type](u,J,G),this.mergeHandlerResult(D,R,_e,he,P),_e&&_e.needsRenderFrame&&this._triggerRenderFrame()),(_e||pe.isActive())&&(U[he]=pe)}const te={};for(const he in this._previousActiveHandlers)U[he]||(te[he]=P);this._previousActiveHandlers=U,(Object.keys(te).length||i4(D))&&(this._changes.push([D,R,te]),this._triggerRenderFrame()),(Object.keys(U).length||i4(D))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:me}=D;me&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],me(this._map))}mergeHandlerResult(u,f,k,P,D){if(!k)return;Object.assign(u,k);const R={handlerName:P,originalEvent:k.originalEvent||D};k.zoomDelta!==void 0&&(f.zoom=R),k.panDelta!==void 0&&(f.drag=R),k.pitchDelta!==void 0&&(f.pitch=R),k.bearingDelta!==void 0&&(f.rotate=R)}_applyChanges(){const u={},f={},k={};for(const[P,D,R]of this._changes)P.panDelta&&(u.panDelta=(u.panDelta||new i.P(0,0))._add(P.panDelta)),P.zoomDelta&&(u.zoomDelta=(u.zoomDelta||0)+P.zoomDelta),P.bearingDelta&&(u.bearingDelta=(u.bearingDelta||0)+P.bearingDelta),P.pitchDelta&&(u.pitchDelta=(u.pitchDelta||0)+P.pitchDelta),P.around!==void 0&&(u.around=P.around),P.aroundCoord!==void 0&&(u.aroundCoord=P.aroundCoord),P.pinchAround!==void 0&&(u.pinchAround=P.pinchAround),P.noInertia&&(u.noInertia=P.noInertia),Object.assign(f,D),Object.assign(k,R);this._updateMapTransform(u,f,k),this._changes=[]}_updateMapTransform(u,f,k){const P=this._map,D=P.transform,R=He=>[He.x,He.y,He.z];if((He=>{const nt=this._eventsInProgress.drag;return nt&&!this._handlersById[nt.handlerName].isActive()})()&&!i4(u)){const He=D.zoom;D.cameraElevationReference="sea",this._originalZoom!=null&&D._orthographicProjectionAtLowPitch&&D.projection.name!=="globe"&&D.pitch===0?(D.cameraElevationReference="ground",D.zoom=this._originalZoom):(D.recenterOnTerrain(),D.cameraElevationReference="ground"),He!==D.zoom&&this._map._update(!0)}if(D._isCameraConstrained&&P._stop(!0),!i4(u))return void this._fireEvents(f,k,!0);let{panDelta:U,zoomDelta:G,bearingDelta:J,pitchDelta:te,around:me,aroundCoord:he,pinchAround:pe}=u;D._isCameraConstrained&&(G>0&&(G=0),D._isCameraConstrained=!1),pe!==void 0&&(me=pe),(G||(He=>f[He]&&!this._eventsInProgress[He])("drag"))&&me&&(this._dragOrigin=R(D.pointCoordinate3D(me)),this._originalZoom=D.zoom,this._trackingEllipsoid.setup(D._camera.position,this._dragOrigin)),D.cameraElevationReference="sea",P._stop(!0),me=me||P.transform.centerPoint,J&&(D.bearing+=J),te&&(D.pitch+=te),D._updateCameraState();const ke=[0,0,0];if(U)if(D.projection.name==="mercator"){const He=this._trackingEllipsoid.projectRay(D.screenPointToMercatorRay(me).dir),nt=this._trackingEllipsoid.projectRay(D.screenPointToMercatorRay(me.sub(U)).dir);ke[0]=nt[0]-He[0],ke[1]=nt[1]-He[1]}else{const He=D.pointCoordinate(me);if(D.projection.name==="globe"){U=U.rotate(-D.angle);const nt=D._pixelsPerMercatorPixel/D.worldSize;ke[0]=-U.x*i.eW(i.a$(He.y))*nt,ke[1]=-U.y*i.eW(D.center.lat)*nt}else{const nt=D.pointCoordinate(me.sub(U));He&&nt&&(ke[0]=nt.x-He.x,ke[1]=nt.y-He.y)}}const _e=D.zoom,Re=[0,0,0];if(G){const He=R(he||D.pointCoordinate3D(me)),nt={dir:i.aw([],i.av([],He,D._camera.position))};if(nt.dir[2]<0){const We=D.zoomDeltaToMovement(He,G);i.c5(Re,nt.dir,We)}}const De=i.d8(ke,ke,Re);D._translateCameraConstrained(De),G&&Math.abs(D.zoom-_e)>1e-4&&D.recenterOnTerrain(),D.cameraElevationReference="ground",this._map._update(),u.noInertia||this._inertia.record(u),this._fireEvents(f,k,!0)}_fireEvents(u,f,k){const P=g_(this._eventsInProgress),D=g_(u),R={};for(const te in u){const{originalEvent:me}=u[te];this._eventsInProgress[te]||(R[`${te}start`]=me),this._eventsInProgress[te]=u[te]}!P&&D&&this._fireEvent("movestart",D.originalEvent);for(const te in R)this._fireEvent(te,R[te]);D&&this._fireEvent("move",D.originalEvent);for(const te in u){const{originalEvent:me}=u[te];this._fireEvent(te,me)}const U={};let G;for(const te in this._eventsInProgress){const{handlerName:me,originalEvent:he}=this._eventsInProgress[te];this._handlersById[me].isActive()||(delete this._eventsInProgress[te],G=f[me]||he,U[`${te}end`]=G)}for(const te in U)this._fireEvent(te,U[te]);const J=g_(this._eventsInProgress);if(k&&(P||D)&&!J){this._updatingCamera=!0;const te=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),me=he=>he!==0&&-this._bearingSnap{this._frameId=void 0,this.handleEvent(new voe("renderFrame",{timeStamp:u})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const o4="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class fM extends i.E{constructor(u,f){super(),this._moving=!1,this._zooming=!1,this.transform=u,this._bearingSnap=f.bearingSnap,this._respectPrefersReducedMotion=f.respectPrefersReducedMotion!==!1,i.aY(["_renderFrameCallback"],this)}getCenter(){return new i.aT(this.transform.center.lng,this.transform.center.lat)}setCenter(u,f){return this.jumpTo({center:u},f)}panBy(u,f,k){return u=i.P.convert(u).mult(-1),this.panTo(this.transform.center,Object.assign({offset:u},f),k)}panTo(u,f,k){return this.easeTo(Object.assign({center:u},f),k)}getZoom(){return this.transform.zoom}setZoom(u,f){return this.jumpTo({zoom:u},f),this}zoomTo(u,f,k){return this.easeTo(Object.assign({zoom:u},f),k)}zoomIn(u,f){return this.zoomTo(this.getZoom()+1,u,f),this}zoomOut(u,f){return this.zoomTo(this.getZoom()-1,u,f),this}getBearing(){return this.transform.bearing}setBearing(u,f){return this.jumpTo({bearing:u},f),this}getPadding(){return this.transform.padding}setPadding(u,f){return this.jumpTo({padding:u},f),this}rotateTo(u,f,k){return this.easeTo(Object.assign({bearing:u},f),k)}resetNorth(u,f){return this.rotateTo(0,Object.assign({duration:1e3},u),f),this}resetNorthPitch(u,f){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},u),f),this}snapToNorth(u,f){return Math.abs(this.getBearing())u.aspect?k/(2*Math.tan(.5*u.fovX)*u.aspect):P/(2*Math.tan(.5*u.fovY)*u.aspect)}_cameraForBoundsOnGlobe(u,f,k,P,D,R){const U=u.clone(),G=this._extendCameraOptions(R);U.bearing=P,U.pitch=D;const J=i.aT.convert(f),te=i.aT.convert(k),me=.5*(J.lat+te.lat),he=.5*(J.lng+te.lng),pe=i.eZ(me,he),ke=i.aw([],pe),_e=i.aw([],i.bI([],ke,[0,1,0])),Re=i.bI([],_e,ke),De=[_e[0],_e[1],_e[2],0,Re[0],Re[1],Re[2],0,ke[0],ke[1],ke[2],0,0,0,0,1],He=[pe,i.eZ(J.lat,J.lng),i.eZ(te.lat,J.lng),i.eZ(te.lat,te.lng),i.eZ(J.lat,te.lng),i.eZ(me,J.lng),i.eZ(me,te.lng),i.eZ(J.lat,he),i.eZ(te.lat,he)];let nt=i.d9.fromPoints(He.map(Xt=>[i.bJ(_e,Xt),i.bJ(Re,Xt),i.bJ(ke,Xt)]));const We=i.af([],nt.center,De);i.e_(We)===0&&i.e$(We,0,0,1),i.aw(We,We),i.c5(We,We,i.aD),U.center=i.f0(We);const kt=U.getWorldToCameraMatrix(),xt=i.bl(new Float64Array(16),kt);nt=i.d9.applyTransform(nt,i.aB([],kt,De));const _t=this._extendAABB(nt,U,G,P);if(!_t)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");nt=_t,i.af(We,We,kt);const gt=.5*(nt.max[2]-nt.min[2]),ut=this._minimumAABBFrustumDistance(U,nt),Tt=i.c5([],[0,0,1],gt),Bt=i.d8(Tt,We,Tt),zt=ut+(U.pitch===0?0:i.bG(We,Bt)),Qt=U.globeCenterInViewSpace,er=i.av([],We,[Qt[0],Qt[1],Qt[2]]);i.aw(er,er),i.c5(er,er,zt);const ur=i.d8([],We,er);i.af(ur,ur,xt);const Sr=i.eM/i.aD,Kt=i.ag(ur),Pt=i.cf(Math.max(Kt*Sr-i.eM,Number.EPSILON),0),nr=Math.min(U.zoomFromMercatorZAdjusted(Pt),G.maxZoom);return nr>.5*(i.c_+i.cL)?(U.setProjection({name:"mercator"}),U.zoom=nr,this._cameraForBounds(U,f,k,P,D,R)):{center:U.center,zoom:nr,bearing:P,pitch:D}}_extendAABB(u,f,k,P){const D=.5*((k.padding.left||0)+(k.padding.right||0)),R=.5*((k.padding.top||0)+(k.padding.bottom||0)),U=R,G=D,J=D,te=R,me=f.width-(G+J),he=f.height-(U+te),pe=i.av([],u.max,u.min),ke=Math.min(me/pe[0],he/pe[1]),_e=Math.min(f.scaleZoom(f.scale*ke),k.maxZoom);if(isNaN(_e))return null;const Re=f.scale/f.zoomScale(_e),De=new i.d9([u.min[0]-G*Re,u.min[1]-te*Re,u.min[2]],[u.max[0]+J*Re,u.max[1]+U*Re,u.max[2]]),He=(typeof k.offset.x=="number"&&typeof k.offset.y=="number"?new i.P(k.offset.x,k.offset.y):i.P.convert(k.offset)).rotate(-i.an(P));return De.center[0]-=He.x*Re,De.center[1]+=He.y*Re,De}queryTerrainElevation(u,f){const k=this.transform.elevation;return k?(f=Object.assign({},{exaggerated:!0},f),k.getAtPoint(i.ae.fromLngLat(u),null,f.exaggerated)):null}_cameraForBounds(u,f,k,P,D,R){if(u.projection.name==="globe")return this._cameraForBoundsOnGlobe(u,f,k,P,D,R);const U=u.clone(),G=this._extendCameraOptions(R);U.bearing=P,U.pitch=D;const J=i.aT.convert(f),te=i.aT.convert(k),me=new i.aT(J.lng,te.lat),he=new i.aT(te.lng,J.lat),pe=U.project(J),ke=U.project(te),_e=this.queryTerrainElevation(J),Re=this.queryTerrainElevation(te),De=this.queryTerrainElevation(me),He=this.queryTerrainElevation(he),nt=[[pe.x,pe.y,Math.min(_e||0,Re||0,De||0,He||0)],[ke.x,ke.y,Math.max(_e||0,Re||0,De||0,He||0)]];let We=i.d9.fromPoints(nt);const kt=U.getWorldToCameraMatrix(),xt=i.bl(new Float64Array(16),kt);We=i.d9.applyTransform(We,kt);const _t=this._extendAABB(We,U,G,P);if(!_t)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");We=_t;const gt=.5*i.av([],We.max,We.min)[2],ut=this._minimumAABBFrustumDistance(U,We),Tt=[0,0,1,0];i.aC(Tt,Tt,kt),i.f1(Tt,Tt);const Bt=i.c5([],Tt,ut+gt),zt=i.d8([],We.center,Bt);i.af(We.center,We.center,xt),i.af(zt,zt,xt);const Qt=U.unproject(new i.P(We.center[0],We.center[1])),er=i.f2(U.projection,Qt),ur=Math.pow(2,er),Sr=Math.min(U._zoomFromMercatorZ(zt[2]*U.pixelsPerMeter*ur/U.worldSize),G.maxZoom);return U.mercatorFromTransition&&Sr<.5*(i.c_+i.cL)?(U.setProjection({name:"globe"}),U.zoom=Sr,this._cameraForBounds(U,f,k,P,D,R)):{center:Qt,zoom:Sr,bearing:P,pitch:D}}fitBounds(u,f,k){const P=this.cameraForBounds(u,f);return this._fitInternal(P,f,k)}fitScreenCoordinates(u,f,k,P,D){const R=i.P.convert(u),U=i.P.convert(f),G=new i.P(Math.min(R.x,U.x),Math.min(R.y,U.y)),J=new i.P(Math.max(R.x,U.x),Math.max(R.y,U.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(R,U))return this;const te=this.transform.pointLocation3D(G),me=this.transform.pointLocation3D(J),he=this.transform.pointLocation3D(new i.P(G.x,J.y)),pe=this.transform.pointLocation3D(new i.P(J.x,G.y)),ke=[Math.min(te.lng,me.lng,he.lng,pe.lng),Math.min(te.lat,me.lat,he.lat,pe.lat)],_e=[Math.max(te.lng,me.lng,he.lng,pe.lng),Math.max(te.lat,me.lat,he.lat,pe.lat)],Re=P&&P.pitch?P.pitch:this.getPitch(),De=this._cameraForBounds(this.transform,ke,_e,k,Re,P);return this._fitInternal(De,P,D)}_fitInternal(u,f,k){return u?(f=Object.assign(u,f)).linear?this.easeTo(f,k):this.flyTo(f,k):this}jumpTo(u,f){this.stop();const k=u.preloadOnly?this.transform.clone():this.transform;let P=!1,D=!1,R=!1;"zoom"in u&&k.zoom!==+u.zoom&&(P=!0,k.zoom=+u.zoom),u.center!==void 0&&(k.center=i.aT.convert(u.center)),"bearing"in u&&k.bearing!==+u.bearing&&(D=!0,k.bearing=+u.bearing),"pitch"in u&&k.pitch!==+u.pitch&&(R=!0,k.pitch=+u.pitch);const U=typeof u.padding=="number"?this._extendPadding(u.padding):u.padding;if(u.padding!=null&&!k.isPaddingEqual(U))if(u.retainPadding===!1){const G=k.clone();G.padding=U,k.setLocationAtPoint(k.center,G.centerPoint)}else k.padding=U;return u.preloadOnly?(this._preloadTiles(k),this):(this.fire(new i.z("movestart",f)).fire(new i.z("move",f)),P&&this.fire(new i.z("zoomstart",f)).fire(new i.z("zoom",f)).fire(new i.z("zoomend",f)),D&&this.fire(new i.z("rotatestart",f)).fire(new i.z("rotate",f)).fire(new i.z("rotateend",f)),R&&this.fire(new i.z("pitchstart",f)).fire(new i.z("pitch",f)).fire(new i.z("pitchend",f)),this.fire(new i.z("moveend",f)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||i.w(o4),this.transform.getFreeCameraOptions()}setFreeCameraOptions(u,f){const k=this.transform;if(!k.projection.supportsFreeCamera)return i.w(o4),this;this.stop();const P=k.zoom,D=k.pitch,R=k.bearing;k.setFreeCameraOptions(u);const U=P!==k.zoom,G=D!==k.pitch,J=R!==k.bearing;return this.fire(new i.z("movestart",f)).fire(new i.z("move",f)),U&&this.fire(new i.z("zoomstart",f)).fire(new i.z("zoom",f)).fire(new i.z("zoomend",f)),J&&this.fire(new i.z("rotatestart",f)).fire(new i.z("rotate",f)).fire(new i.z("rotateend",f)),G&&this.fire(new i.z("pitchstart",f)).fire(new i.z("pitch",f)).fire(new i.z("pitchend",f)),this.fire(new i.z("moveend",f)),this}easeTo(u,f){this._stop(!1,u.easeId),((u=Object.assign({offset:[0,0],duration:500,easing:i.eV},u)).animate===!1||this._prefersReducedMotion(u))&&(u.duration=0);const k=this.transform,P=this.getZoom(),D=this.getBearing(),R=this.getPitch(),U=this.getPadding(),G="zoom"in u?+u.zoom:P,J="bearing"in u?this._normalizeBearing(u.bearing,D):D,te="pitch"in u?+u.pitch:R,me=this._extendPadding(u.padding),he=i.P.convert(u.offset);let pe,ke,_e;if(k.projection.name==="globe"){const Tt=i.ae.fromLngLat(k.center),Bt=he.rotate(-k.angle);Tt.x+=Bt.x/k.worldSize,Tt.y+=Bt.y/k.worldSize;const zt=Tt.toLngLat(),Qt=i.aT.convert(u.center||zt);this._normalizeCenter(Qt),pe=k.centerPoint.add(Bt),ke=new i.P(Tt.x,Tt.y).mult(k.worldSize),_e=new i.P(i.aF(Qt.lng),i.aJ(Qt.lat)).mult(k.worldSize).sub(ke)}else{pe=k.centerPoint.add(he);const Tt=k.pointLocation(pe),Bt=i.aT.convert(u.center||Tt);this._normalizeCenter(Bt),ke=k.project(Tt),_e=k.project(Bt).sub(ke)}const Re=k.zoomScale(G-P);let De,He;u.around&&(De=i.aT.convert(u.around),He=k.locationPoint(De));const nt=this._zooming||G!==P,We=this._rotating||D!==J,kt=this._pitching||te!==R,xt=!k.isPaddingEqual(me),_t=u.retainPadding===!1?k.clone():k,gt=Tt=>Bt=>{if(nt&&(Tt.zoom=i.ak(P,G,Bt)),We&&(Tt.bearing=i.ak(D,J,Bt)),kt&&(Tt.pitch=i.ak(R,te,Bt)),xt&&(_t.interpolatePadding(U,me,Bt),pe=_t.centerPoint.add(he)),De)Tt.setLocationAtPoint(De,He);else{const zt=Tt.zoomScale(Tt.zoom-P),Qt=G>P?Math.min(2,Re):Math.max(.5,Re),er=Math.pow(Qt,1-Bt),ur=Tt.unproject(ke.add(_e.mult(Bt*er)).mult(zt));Tt.setLocationAtPoint(Tt.renderWorldCopies?ur.wrap():ur,pe)}return u.preloadOnly||this._fireMoveEvents(f),Tt};if(u.preloadOnly){const Tt=this._emulate(gt,u.duration,k);return this._preloadTiles(Tt),this}const ut={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=nt,this._rotating=We,this._pitching=kt,this._padding=xt,this._easeId=u.easeId,this._prepareEase(f,u.noMoveStart,ut),this._ease(gt(k),Tt=>{k.cameraElevationReference==="sea"&&k.recenterOnTerrain(),this._afterEase(f,Tt)},u),this}_prepareEase(u,f,k={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),f||k.moving||this.fire(new i.z("movestart",u)),this._zooming&&!k.zooming&&this.fire(new i.z("zoomstart",u)),this._rotating&&!k.rotating&&this.fire(new i.z("rotatestart",u)),this._pitching&&!k.pitching&&this.fire(new i.z("pitchstart",u))}_fireMoveEvents(u){this.fire(new i.z("move",u)),this._zooming&&this.fire(new i.z("zoom",u)),this._rotating&&this.fire(new i.z("rotate",u)),this._pitching&&this.fire(new i.z("pitch",u))}_afterEase(u,f){if(this._easeId&&f&&this._easeId===f)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const k=this._zooming,P=this._rotating,D=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,k&&this.fire(new i.z("zoomend",u)),P&&this.fire(new i.z("rotateend",u)),D&&this.fire(new i.z("pitchend",u)),this.fire(new i.z("moveend",u))}flyTo(u,f){if(this._prefersReducedMotion(u)){const Xt=i.aH(u,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(Xt,f)}this.stop(),u=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:i.eV},u);const k=this.transform,P=this.getZoom(),D=this.getBearing(),R=this.getPitch(),U=this.getPadding(),G="zoom"in u?i.aA(+u.zoom,k.minZoom,k.maxZoom):P,J="bearing"in u?this._normalizeBearing(u.bearing,D):D,te="pitch"in u?+u.pitch:R,me=this._extendPadding(u.padding),he=k.zoomScale(G-P),pe=i.P.convert(u.offset);let ke=k.centerPoint.add(pe);const _e=k.pointLocation(ke),Re=i.aT.convert(u.center||_e);this._normalizeCenter(Re);const De=k.project(_e),He=k.project(Re).sub(De);let nt=u.curve;const We=Math.max(k.width,k.height),kt=We/he,xt=He.mag();if("minZoom"in u){const Xt=i.aA(Math.min(u.minZoom,P,G),k.minZoom,k.maxZoom),gr=We/k.zoomScale(Xt-P);nt=Math.sqrt(gr/xt*2)}const _t=nt*nt;function gt(Xt){const gr=(kt*kt-We*We+(Xt?-1:1)*_t*_t*xt*xt)/(2*(Xt?kt:We)*_t*xt);return Math.log(Math.sqrt(gr*gr+1)-gr)}function ut(Xt){return(Math.exp(Xt)-Math.exp(-Xt))/2}function Tt(Xt){return(Math.exp(Xt)+Math.exp(-Xt))/2}const Bt=gt(0);let zt=function(Xt){return Tt(Bt)/Tt(Bt+nt*Xt)},Qt=function(Xt){return We*((Tt(Bt)*(ut(gr=Bt+nt*Xt)/Tt(gr))-ut(Bt))/_t)/xt;var gr},er=(gt(1)-Bt)/nt;if(Math.abs(xt)<1e-6||!isFinite(er)){if(Math.abs(We-kt)<1e-6)return this.easeTo(u,f);const Xt=ktu.maxDuration&&(u.duration=0);const ur=D!==J,Sr=te!==R,Kt=!k.isPaddingEqual(me),Pt=u.retainPadding===!1?k.clone():k,nr=Xt=>gr=>{const $r=gr*er,rs=1/zt($r);Xt.zoom=gr===1?G:P+Xt.scaleZoom(rs),ur&&(Xt.bearing=i.ak(D,J,gr)),Sr&&(Xt.pitch=i.ak(R,te,gr)),Kt&&(Pt.interpolatePadding(U,me,gr),ke=Pt.centerPoint.add(pe));const Or=gr===1?Re:Xt.unproject(De.add(He.mult(Qt($r))).mult(rs));return Xt.setLocationAtPoint(Xt.renderWorldCopies?Or.wrap():Or,ke),Xt._updateCameraOnTerrain(),u.preloadOnly||this._fireMoveEvents(f),Xt};if(u.preloadOnly){const Xt=this._emulate(nr,u.duration,k);return this._preloadTiles(Xt),this}return this._zooming=!0,this._rotating=ur,this._pitching=Sr,this._padding=Kt,this._prepareEase(f,!1),this._ease(nr(k),()=>this._afterEase(f),u),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(u){}_cancelRenderFrame(u){}_stop(u,f){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const k=this._onEaseEnd;this._onEaseEnd=void 0,k.call(this,f)}if(!u){const k=this.handlers;k&&k.stop(!1)}return this}_ease(u,f,k){k.animate===!1||k.duration===0?(u(1),f()):(this._easeStart=i.o.now(),this._easeOptions=k,this._onEaseFrame=u,this._onEaseEnd=f,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const u=Math.min((i.o.now()-this._easeStart)/this._easeOptions.duration,1),f=this._onEaseFrame;f&&f(this._easeOptions.easing(u)),u<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(u,f){u=i.bT(u,-180,180);const k=Math.abs(u-f);return Math.abs(u-360-f)180?-360:k<-180?360:0}_prefersReducedMotion(u){return this._respectPrefersReducedMotion&&i.o.prefersReducedMotion&&!(u&&u.essential)}_emulate(u,f,k){const P=Math.ceil(15*f/1e3),D=[],R=u(k.clone());for(let U=0;U<=P;U++){const G=R(U/P);D.push(G.clone())}return D}_preloadTiles(u,f){}}class y_{constructor(u={}){this.options=u,i.aY(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(u){const f=this.options&&this.options.compact,k=u._getUIString("AttributionControl.ToggleAttribution");this._map=u,this._container=j("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=j("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",k);const P=j("span","mapboxgl-ctrl-icon",this._compactButton);return P.setAttribute("aria-hidden","true"),P.setAttribute("title",k),this._innerContainer=j("div","mapboxgl-ctrl-attrib-inner",this._container),f&&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),f===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 u=this._editLink;u||(u=this._editLink=this._container.querySelector(".mapbox-improve-map"));const f=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||i.e.ACCESS_TOKEN}];if(u){const k=f.reduce((P,D,R)=>(D.value&&(P+=`${D.key}=${D.value}${RP.length-D.length),u=u.filter((P,D)=>{for(let R=D+1;R=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?u=[...this.options.customAttribution,...u]:u.unshift(this.options.customAttribution));const k=u.map(P=>function(D){const R=new DOMParser().parseFromString(D,"text/html");return Array.from(R.body.querySelectorAll("*")).forEach(U=>{const G=U.textContent||"";if(U.tagName!=="A")return void U.replaceWith(R.createTextNode(G));const J=U.getAttribute("href");if(!J||!/^(https?:|mailto:)/i.test(J))return void U.replaceWith(R.createTextNode(G));const te=R.createElement("a");te.href=J,te.textContent=G,te.rel="noopener nofollow";const me=U.getAttribute("class");me&&(te.className=me),U.replaceWith(te)}),R.body.innerHTML}(P)).join(" | ");k!==this._attribHTML&&(this._attribHTML=k,u.length?(this._innerContainer.innerHTML=k,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 v_{constructor(){i.aY(["_updateLogo","_updateCompact"],this)}onAdd(u){this._map=u,this._container=j("div","mapboxgl-ctrl");const f=j("a","mapboxgl-ctrl-logo");return f.target="_blank",f.rel="noopener nofollow",f.href="https://www.mapbox.com/",f.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),f.setAttribute("rel","noopener nofollow"),this._container.appendChild(f),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(u){u&&u.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const u=this._map.style._sourceCaches;if(Object.entries(u).length===0)return!0;for(const f in u){const k=u[f].getSource();if(k.hasOwnProperty("mapbox_logo")&&!k.mapbox_logo)return!1}return!0}_updateCompact(){const u=this._container.children;if(u.length){const f=u[0];this._map.getCanvasContainer().offsetWidth<250?f.classList.add("mapboxgl-compact"):f.classList.remove("mapboxgl-compact")}}}class S0{constructor(){i.aY(["_onIndoorUpdate"],this)}onAdd(u){return this._map=u,this._container=j("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._map.indoor.on("selector-update",f=>this._onIndoorUpdate(f)),this._container}_createButton(u,f){const k=j("button",u,this._container);return k.type="button",k.addEventListener("click",f),k}_createSeparator(){return j("div","mapboxgl-ctrl-separator",this._container)}_setButtonTitle(u,f){this._map&&(u.setAttribute("aria-label",f),u.textContent=f)}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(u){if(!u||!u.floors)return this._model=u,void(this._container.style.display="none");const f=this._model;this._model=u,this._container.style.display="inline-block",this._container.style.borderRadius="8px",f&&Array.from(this._container.children).forEach(k=>k.remove()),u.floors.length>0&&(this.addBuildingsToggleButton(),this.addCurrentFloors(u.floors,u.activeFloorsVisible),this._updateBuildingsButtonState())}addBuildingsToggleButton(){const u=this._createButton("mapboxgl-ctrl-buildings-toggle",()=>{const f=this._map;this._model&&f&&f._setIndoorActiveFloorsVisibility(!this._model.activeFloorsVisible)});j("span","mapboxgl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.classList.add("mapboxgl-ctrl-level-button","mapboxgl-ctrl-buildings-toggle"),this._model&&!this._model.activeFloorsVisible&&u.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(u),this._createSeparator()}_updateBuildingsButtonState(){const u=this._container.querySelector(".mapboxgl-ctrl-buildings-toggle");u&&this._model&&(this._model.activeFloorsVisible?u.classList.remove("mapboxgl-ctrl-level-button-selected"):u.classList.add("mapboxgl-ctrl-level-button-selected"))}addCurrentFloors(u,f){for(let k=0;k{this._map._selectIndoorFloor(P.id)});this._setButtonTitle(D,P.zIndex.toString()),this._model&&P.id===this._model.selectedFloorId&&f&&D.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(D),k=this._endTime)return this._end;const f=i.dD((u-this._startTime)/(this._endTime-this._startTime));return this._start*(1-f)+this._end*f}isEasing(u){return u>=this._startTime&&u<=this._endTime}jumpTo(u){this._startTime=-1/0,this._endTime=-1/0,this._start=u,this._end=u}easeTo(u,f,k){this._start=this.getValue(f),this._end=u,this._startTime=f,this._endTime=f+k}}const Yp={"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 yg extends i.z{constructor(u,f,k,P){const{point:D,lngLat:R,originalEvent:U,target:G}=u;super(u.type,{point:D,lngLat:R,originalEvent:U,target:G}),this.preventDefault=()=>{u.preventDefault()},this.id=f,this.interaction=k,this.feature=P}}class tm{constructor(u){this.map=u,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(u,f){if(this.typeById.has(u))throw new Error(`Interaction id "${u}" already exists.`);const k=f.filter;let P=f.type;k&&this.filters.set(u,i.b6(k)),P==="mouseover"&&(P="mouseenter"),P==="mouseout"&&(P="mouseleave");const D=this.interactionsByType.get(P)||new Map;P==="mouseenter"||P==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(u,f)):D.size===0&&this.map.on(P,this.handleType),D.size===0&&this.interactionsByType.set(P,D),D.set(u,f),this.typeById.set(u,P)}get(u){const f=this.typeById.get(u);if(!f)return;const k=this.interactionsByType.get(f);return k?k.get(u):void 0}remove(u){const f=this.typeById.get(u);if(!f)return;this.typeById.delete(u),this.filters.delete(u);const k=this.interactionsByType.get(f);k&&(k.delete(u),f==="mouseenter"||f==="mouseleave"?(this.delegatedInteractions.delete(u),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):k.size===0&&this.map.off(f,this.handleType))}queryTargets(u,f){const k=[];for(const[P,D]of f)D.target&&k.push({targetId:P,target:D.target,filter:this.filters.get(P)});return this.map.style.queryRenderedTargets(u,k,this.map.transform)}handleMove(u){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const f=this.queryTargets(u.point,Array.from(this.delegatedInteractions).reverse());f.length&&(u.type="mouseenter",this.handleType(u,f));const k=new Map;for(const[P,{feature:D}]of this.prevHoveredFeatures)this.hoveredFeatures.has(P)||k.set(D.id,D);k.size&&(u.type="mouseleave",this.handleType(u,Array.from(k.values())))}handleOut(u){const f=Array.from(this.hoveredFeatures.values()).map(({feature:k})=>k);f.length&&(u.type="mouseleave",this.handleType(u,f)),this.hoveredFeatures.clear()}handleType(u,f){const k=u.type==="mouseenter";if(k&&!this.interactionsByType.has(u.type))return void i.w("mouseenter interaction required for mouseleave to work.");const P=Array.from(this.interactionsByType.get(u.type)).reverse(),D=!!f;f=f||this.queryTargets(u.point,P);let R=!1;const U=new Set;for(const G of f){for(const[J,te]of P){if(!te.target)continue;const me=G.variants?G.variants[J]:null;if(me){for(const he of me){if(rg(he,G,U,J))continue;const pe=new i.dx(G,he),ke=Op(he,G,J);D&&pe.id!==void 0&&(pe.state=this.map.getFeatureState(pe));const _e=k?this.prevHoveredFeatures.get(ke):null,Re=new yg(u,J,te,pe),De=_e?_e.stop:te.handler(Re);if(k&&this.hoveredFeatures.set(ke,{feature:G,stop:De}),De!==!1){R=!0;break}}if(R)break}}if(R)break}if(!R)for(const[G,J]of P){const{handler:te,target:me}=J;if(!me&&te(new yg(u,G,J,null))!==!1)break}}}function boe(w,u){if(Array.isArray(w)&&Array.isArray(u)){const f=new Set(w),k=new Set(u);return f.size===k.size&&w.every(P=>k.has(P))}return i.by(w,u)}const woe={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"},joe={showCompass:!0,showZoom:!0,visualizePitch:!1};class koe{constructor(u,f,k=!1){this._clickTolerance=10,this.element=f,this.mouseRotate=new uM({clickTolerance:u.dragRotate._mouseRotate._clickTolerance}),this.map=u,k&&(this.mousePitch=new hM({clickTolerance:u.dragRotate._mousePitch._clickTolerance})),i.aY(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),f.addEventListener("mousedown",this.mousedown),f.addEventListener("touchstart",this.touchstart,{passive:!1}),f.addEventListener("touchmove",this.touchmove),f.addEventListener("touchend",this.touchend),f.addEventListener("touchcancel",this.reset)}down(u,f){this.mouseRotate.mousedown(u,f),this.mousePitch&&this.mousePitch.mousedown(u,f),F()}move(u,f){const k=this.map,P=this.mouseRotate.mousemoveWindow(u,f),D=P&&P.bearingDelta;if(D&&k.setBearing(k.getBearing()+D),this.mousePitch){const R=this.mousePitch.mousemoveWindow(u,f),U=R&&R.pitchDelta;U&&k.setPitch(k.getPitch()+U)}}off(){const u=this.element;u.removeEventListener("mousedown",this.mousedown),u.removeEventListener("touchstart",this.touchstart),u.removeEventListener("touchmove",this.touchmove),u.removeEventListener("touchend",this.touchend),u.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){O(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(u){this.down(Object.assign({},u,{ctrlKey:!0,preventDefault:()=>u.preventDefault()}),H(this.element,u)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(u){this.move(u,H(this.element,u))}mouseup(u){this.mouseRotate.mouseupWindow(u),this.mousePitch&&this.mousePitch.mouseupWindow(u),this.offTemp()}touchstart(u){u.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=W(this.element,u.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>u.preventDefault()},this._startPos))}touchmove(u){u.targetTouches.length!==1?this.reset():(this._lastPos=W(this.element,u.targetTouches)[0],this.move({preventDefault:()=>u.preventDefault()},this._lastPos))}touchend(u){u.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)f.width||u.y>f.height;f.locationPoint3D(k).distSqr(u)180;){const k=f.locationPoint3D(w);if(k.x>=0&&k.y>=0&&k.x<=f.width&&k.y<=f.height)break;w.lng>f.center.lng?w.lng-=360:w.lng+=360}return w}const Uc={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%)"},_h={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class l4 extends i.E{constructor(u,f){super(),(u instanceof HTMLElement||f)&&(u=Object.assign({element:u},f)),i.aY(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:k="center",color:P="#3FB1CE",scale:D=1,draggable:R=!1,clickTolerance:U=0,rotation:G=_h.rotation,rotationAlignment:J=_h.rotationAlignment,pitchAlignment:te=_h.pitchAlignment,occludedOpacity:me=_h.occludedOpacity,altitude:he=_h.altitude}=u||{};this._anchor=k,this._color=P,this._scale=D,this._draggable=R,this._clickTolerance=U,this._rotation=G,this._rotationAlignment=J,this._pitchAlignment=te,this._occludedOpacity=me,this._altitude=he,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),u&&u.element?(this._element=u.element,this._offset=i.P.convert(u&&u.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=i.P.convert(u&&u.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",_e=>{_e.preventDefault()}),this._element.addEventListener("mousedown",_e=>{_e.preventDefault()});const pe=this._element.classList;for(const _e in Uc)pe.remove(`mapboxgl-marker-anchor-${_e}`);pe.add(`mapboxgl-marker-anchor-${this._anchor}`);const ke=u&&u.className?u.className.trim().split(/\s+/):[];pe.add(...ke),this._popup=null}_createDefaultMarker(){const u=j("div"),f=S("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},u);if(this._altitude===0){const k=S("radialGradient",{id:"shadowGradient"},S("defs",{},f));S("stop",{offset:"10%","stop-opacity":.4},k),S("stop",{offset:"100%","stop-opacity":.05},k),S("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},f)}return S("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"},f),S("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"},f),S("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},f),u}addTo(u){return u===this._map||(this.remove(),this._map=u,u.getCanvasContainer().appendChild(this._element),u.on("move",this._updateMoving),u.on("moveend",this._update),u.on("remove",this._clearFadeTimer),u._addMarker(this),this.setDraggable(this._draggable),this._update(),u.on("click",this._onMapClick)),this}remove(){const u=this._map;return u&&(u.off("click",this._onMapClick),u.off("move",this._updateMoving),u.off("moveend",this._update),u.off("mousedown",this._addDragHandler),u.off("touchstart",this._addDragHandler),u.off("mouseup",this._onUp),u.off("touchend",this._onUp),u.off("mousemove",this._onMove),u.off("touchmove",this._onMove),u.off("remove",this._clearFadeTimer),u._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(u){return this._lngLat=i.aT.convert(u),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(u){return u===this._altitude||(this._defaultMarker&&(this._altitude===0&&u!==0||this._altitude!==0&&u===0)&&(this._element=this._createDefaultMarker()),this._altitude=u||_h.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(u){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")),u){if(!("offset"in u.options)){const P=Math.sqrt(Math.pow(13.5,2)/2);u.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[P,-1*(38.1-13.5+P)],"bottom-right":[-P,-1*(38.1-13.5+P)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=u,u._marker=this,u._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(u){const f=u.code,k=u.charCode||u.keyCode;f!=="Space"&&f!=="Enter"&&k!==32&&k!==13||this.togglePopup()}_onMapClick(u){const f=u.originalEvent.target,k=this._element;this._popup&&(f===k||k.contains(f))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const u=this._popup;return u?(u.isOpen()?(u.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(u.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const u=this._map,f=this._pos;if(!u||!f)return!1;const k=u.unproject(f,this._altitude),P=u.getFreeCameraOptions();if(!P.position)return!1;const D=P.position.toLngLat();return D.distanceTo(k)<.9*D.distanceTo(this._lngLat)}_evaluateOpacity(){const u=this._map;if(!u)return;const f=this._pos;if(!f||f.x<0||f.x>u.transform.width||f.y<0||f.y>u.transform.height)return void this._clearFadeTimer();const k=u.unproject(f,this._altitude);let P;u._showingGlobe()&&i.f5(u.transform,this._lngLat)?P=0:(P=1-u._queryFogOpacity(k),u.transform._terrainEnabled()&&u.getTerrain()&&this._behindTerrain()&&(P*=this._occludedOpacity)),this._element.style.opacity=`${P}`,this._element.style.pointerEvents=P>0?"auto":"none",this._popup&&this._popup._setOpacity(P),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const u=this._pos;if(!u||!this._map)return;const f=this._offset.mult(this._scale);this._element.style.transform=` translate(${u.x}px,${u.y}px) ${Uc[this._anchor]} ${this._calculateXYTransform()} ${this._calculateZTransform()} translate(${f.x}px,${f.y}px) `}_calculateXYTransform(){const u=this._pos,f=this._map,k=this.getPitchAlignment();if(!f||!u||k!=="map")return"";if(!f._showingGlobe()){const G=f.getPitch();return G?`rotateX(${G}deg)`:""}const P=i.cX(i.f6(f.transform,this._lngLat)),D=u.sub(i.f7(f.transform)),R=Math.abs(D.x)+Math.abs(D.y);if(R===0)return"";const U=P/R;return`rotateX(${-D.y*U}deg) rotateY(${D.x*U}deg)`}_calculateZTransform(){const u=this._pos,f=this._map;if(!f||!u)return"";let k=0;const P=this.getRotationAlignment();if(P==="map")if(f._showingGlobe()){const D=f.project(new i.aT(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),R=f.project(new i.aT(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(D);k=i.cX(Math.atan2(R.y,R.x))-90}else k=-f.getBearing();else if(P==="horizon"){const D=i.ah(4,6,f.getZoom()),R=i.f7(f.transform);R.y+=D*f.transform.height;const U=u.sub(R),G=i.cX(Math.atan2(U.y,U.x));k=(G>90?G-270:G+90)*(1-D)}return k+=this._rotation,k?`rotateZ(${k}deg)`:""}_update(u){cancelAnimationFrame(this._updateFrameId);const f=this._map;f&&(f.transform.renderWorldCopies&&(this._lngLat=gM(this._lngLat,this._pos,f.transform)),this._pos=f.project(this._lngLat,this._altitude),u===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),f._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(f._showingGlobe()||f.getTerrain()||f.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(u){return this._offset=i.P.convert(u),this._update(),this}addClassName(u){return this._element.classList.add(u),this}removeClassName(u){return this._element.classList.remove(u),this}toggleClassName(u){return this._element.classList.toggle(u)}_onMove(u){const f=this._map;if(!f)return;const k=this._pointerdownPos,P=this._positionDelta;if(k&&P){if(!this._isDragging){const D=this._clickTolerance||f._clickTolerance;if(u.point.dist(k)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 _5(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 Kp,this._domRenderTaskQueue=new Kp,this._controls=[],this._markers=[],this._popups=[],this._mapId=i.b2(),this._locale=Object.assign({},Yp,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 Zp(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=w.scaleFactor,this._requestManager=new ne(w.transformRequest,w.accessToken,w.testMode),this._silenceAuthErrors=!!w.testMode,this._contextCreateOptions=w.contextCreateOptions?Object.assign({},w.contextCreateOptions):{},typeof w.container=="string"){const f=document.getElementById(w.container);if(!f)throw new Error(`Container '${w.container.toString()}' not found.`);this._container=f}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 _oe(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 sM(typeof w.hash=="string"&&w.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){u.center==null&&u.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:w.center,zoom:w.zoom,bearing:w.bearing,pitch:w.pitch});const f=w.bounds;f&&(this.resize(),this.fitBounds(f,Object.assign({},w.fitBoundsOptions,{duration:0})))}this.resize(),w.attributionControl&&this.addControl(new y_({customAttribution:w.customAttribution})),this._logoControl=new v_,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",f=>{this._update(f.dataType==="style"),this.fire(new i.z(`${f.dataType}data`,f))}),this.on("dataloading",f=>{this.fire(new i.z(`${f.dataType}dataloading`,f))}),this._interactions=new tm(this)}_getMapId(){return this._mapId}addControl(w,u){if(u===void 0&&(u=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 f=w.onAdd(this);this._controls.push(w);const k=this._controlPositions[u];return u.indexOf("bottom")!==-1?k.insertBefore(f,k.firstChild):k.appendChild(f),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 u=this._controls.indexOf(w);return u>-1&&this._controls.splice(u,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 u=!this._moving;return u&&this.fire(new i.z("movestart",w)).fire(new i.z("move",w)),this.fire(new i.z("resize",w)),u&&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(u=>u.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(u=>u==="auto"?navigator.language:u):w}setLanguage(w){const u=this._parseLanguage(w);if(!this.style||u===this._language)return this;this._language=u,this.style.reloadSources();for(const f of this._controls)f._setLanguage&&f._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,u=w.projection.name;let f;u==="globe"&&w.zoom>=i.cL?(w.setMercatorFromTransition(),f=!0):u==="mercator"&&w.zoom=i.cL?this.transform.setMercatorFromTransition():this.transform.setProjection(w),this.style.applyProjectionUpdate();const k=this.transform.getProjection().name==="mercator"&&f!==this.transform.mercatorFromTransition;return(u||k)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(w,u){return this.transform.locationPoint3D(i.aT.convert(w),u)}unproject(w,u){return this.transform.pointLocation3D(i.P.convert(w),u)}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,u,f){const k=P=>{let D=[];if(Array.isArray(u)){const R=u.filter(U=>this.getLayer(U));D=R.length?this.queryRenderedFeatures(P,{layers:R}):[]}else D=this.queryRenderedFeatures(P,{target:u});return D};if(w==="mouseenter"||w==="mouseover"){let P=!1;return{listener:f,targets:u,delegates:{mousemove:R=>{const U=k(R.point);U.length?P||(P=!0,f.call(this,new Yd(w,this,R.originalEvent,{features:U}))):P=!1},mouseout:()=>{P=!1}}}}if(w==="mouseleave"||w==="mouseout"){let P=!1;return{listener:f,targets:u,delegates:{mousemove:U=>{k(U.point).length?P=!0:P&&(P=!1,f.call(this,new Yd(w,this,U.originalEvent)))},mouseout:U=>{P&&(P=!1,f.call(this,new Yd(w,this,U.originalEvent)))}}}}{const P=D=>{const R=k(D.point);R.length&&(D.features=R,f.call(this,D),delete D.features)};return{listener:f,targets:u,delegates:{[w]:P}}}}on(w,u,f){if(typeof u=="function"||f===void 0)return super.on(w,u);if(typeof u=="string"&&(u=[u]),!this._areTargetsValid(u))return this;const k=this._createDelegatedListener(w,u,f);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[w]=this._delegatedListeners[w]||[],this._delegatedListeners[w].push(k);for(const P in k.delegates)this.on(P,k.delegates[P]);return this}once(w,u,f){if(typeof u=="function"||f===void 0)return super.once(w,u);if(typeof u=="string"&&(u=[u]),!this._areTargetsValid(u))return this;const k=this._createDelegatedListener(w,u,f);for(const P in k.delegates)this.once(P,k.delegates[P]);return this}off(w,u,f){if(typeof u=="function"||f===void 0)return super.off(w,u);if(typeof u=="string"&&(u=[u]),!this._areTargetsValid(u))return this;const k=this._delegatedListeners?this._delegatedListeners[w]:void 0;return k&&(P=>{for(let D=0;D{if(f){const P=typeof f=="string"?f:f instanceof Error?f.message:f.error;i.w(`Unable to perform style diff: ${P}. Rebuilding the style from scratch.`),this._updateStyle(w,u)}else k&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=u.localIdeographFontFamily,this._localFontFamily=u.localFontFamily,this._updateStyle(w,u))}_getUIString(w){const u=this._locale[w];if(u==null)throw new Error(`Missing UI string '${w}'`);return u}_updateStyle(w,u){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),w){const f=Object.assign({},u);u&&u.config&&(f.initialConfig=u.config,delete f.config),this.style=new vh(this,f).load(w),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new vh(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 u of w)if(!this._isValidId(u))return!1;return!0}return this._isTargetValid(w)}addSource(w,u){return this._isValidId(w)?(this._lazyInitEmptyStyle(),this.style.addSource(w,u),this._update(!0)):this}isSourceLoaded(w){return!!this._isValidId(w)&&!!this.style&&this.style._isSourceCacheLoaded(w)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(w,u,f){this._lazyInitEmptyStyle(),this.style.addSourceType(w,u,f)}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,u,{pixelRatio:f=1,sdf:k=!1,stretchX:P,stretchY:D,content:R}={}){this._lazyInitEmptyStyle();const U=i.I.from(w);if(u instanceof HTMLImageElement||ImageBitmap&&u instanceof ImageBitmap){const{width:G,height:J,data:te}=i.o.getImageData(u);this.style.addImage(U,{data:new i.q({width:G,height:J},te),pixelRatio:f,stretchX:P,stretchY:D,content:R,sdf:k,version:0,usvg:!1})}else if(u.width===void 0||u.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:G,height:J}=u,te=u;this.style.addImage(U,{data:new i.q({width:G,height:J},new Uint8Array(te.data)),pixelRatio:f,stretchX:P,stretchY:D,content:R,sdf:k,usvg:!1,version:0,userImage:te}),te.onAdd&&te.onAdd(this,w)}}updateImage(w,u){this._lazyInitEmptyStyle();const f=i.I.from(w),k=this.style.getImage(f);if(!k)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 P=u instanceof HTMLImageElement||ImageBitmap&&u instanceof ImageBitmap?i.o.getImageData(u):u,{width:D,height:R,data:U}=P;if(D===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(D!==(k.usvg?k.icon.usvg_tree.width:k.data.width)||R!==(k.usvg?k.icon.usvg_tree.height:k.data.height))return void this.fire(new i.y(new Error(`The width and height of the updated image (${D}, ${R}) must be that same as the previous version of the image (${k.data.width}, ${k.data.height})`)));const G=!(u instanceof HTMLImageElement||ImageBitmap&&u instanceof ImageBitmap);let J=!1;k.usvg?(k.data=new i.q({width:D,height:R},new Uint8Array(U)),k.usvg=!1,k.icon=void 0,J=!0):k.data.replace(U,G),this.style.updateImage(f,k,J)}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,u){i.n(this._requestManager.transformRequest(w,i.R.Image),(f,k)=>{u(f,k instanceof HTMLImageElement?i.o.getImageData(k):k)})}listImages(){return this.style.listImages().map(w=>w.name)}addModel(w,u){this._lazyInitEmptyStyle(),this.style.addModel(w,u)}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,u){return this._isValidId(w.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(w,u),this._update(!0)):this}getSlot(w){const u=this.getLayer(w);return u&&u.slot||null}setSlot(w,u){return this.style.setSlot(w,u),this.style.mergeLayers(),this._update(!0)}addImport(w,u){return this.style.addImport(w,u).catch(f=>this.fire(new i.y(new Error("Failed to add import",f)))),this}updateImport(w,u){return typeof u!="string"&&u.id!==w?(this.removeImport(w),this.addImport(u)):(this.style.updateImport(w,u),this._update(!0))}removeImport(w){return this.style.removeImport(w),this}moveImport(w,u){return this.style.moveImport(w,u),this._update(!0)}moveLayer(w,u){return this._isValidId(w)?(this.style.moveLayer(w,u),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 u=this.style.getOwnLayer(w);return u?u.type==="custom"?u.implementation:u.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(w,u,f){return this._isValidId(w)?(this.style.setLayerZoomRange(w,u,f),this._update(!0)):this}setFilter(w,u,f={}){return this._isValidId(w)?(this.style.setFilter(w,u,f),this._update(!0)):this}getFilter(w){return this._isValidId(w)?this.style.getFilter(w):null}setPaintProperty(w,u,f,k={}){return this._isValidId(w)?(this.style.setPaintProperty(w,u,f,k),this._update(!0)):this}getPaintProperty(w,u){return this._isValidId(w)?this.style.getPaintProperty(w,u):null}setLayoutProperty(w,u,f,k={}){return this._isValidId(w)?(this.style.setLayoutProperty(w,u,f,k),this._update(!0)):this}getLayoutProperty(w,u){return this._isValidId(w)?this.style.getLayoutProperty(w,u):null}setLayerProperty(w,u,f,k={}){return this._isValidId(w)?(u==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(w,u,f,k),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,u){return this.style.setSchema(w,u),this._update(!0)}getConfig(w){return this.style.getConfig(w)}setConfig(w,u){return this.style.setConfig(w,u),this._update(!0)}getConfigProperty(w,u){return this.style.getConfigProperty(w,u)}setConfigProperty(w,u,f){return this.style.setConfigProperty(w,u,f),this._update(!0)}getFeaturesetDescriptors(w){return this.style.getFeaturesetDescriptors(w)}setLights(w){if(this._lazyInitEmptyStyle(),w&&w.length===1&&w[0].type==="flat"){const u=w[0];u.properties?this.style.setFlatLight(u.properties,u.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,u={}){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,u){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(w,u),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,u){return w.source&&!this._isValidId(w.source)?this:(this.style.setFeatureState(w,u),this._update())}removeFeatureState(w,u){return w.source&&!this._isValidId(w.source)?this:(this.style.removeFeatureState(w,u),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 S0),this.addControl(this._indoorControl,"right")}_removeIndoorControl(){this._indoorControl&&this.removeControl(this._indoorControl)}_updateContainerDimensions(){if(!this._container)return;const w=this._container.getBoundingClientRect().width||400,u=this._container.getBoundingClientRect().height||300;let f,k,P,D=this._container;for(;D&&(!k||!P);){const R=window.getComputedStyle(D).transform;R&&R!=="none"&&(f=R.match(/matrix.*\((.+)\)/)[1].split(", "),f[0]&&f[0]!=="0"&&f[0]!=="1"&&(k=f[0]),f[3]&&f[3]!=="0"&&f[3]!=="1"&&(P=f[3])),D=D.parentElement}this._containerWidth=k?Math.abs(w/k):w,this._containerHeight=P?Math.abs(u/P):u}_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 QP(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=j("div","mapboxgl-canary",w)).style.visibility="hidden",this._detectMissingCSS();const u=this._canvasContainer=j("div","mapboxgl-canvas-container",w);this._canvas=j("canvas","mapboxgl-canvas",u),this._interactive&&(u.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 f=this._controlContainer=j("div","mapboxgl-control-container",w),k=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(P=>{k[P]=j("div",`mapboxgl-ctrl-${P}`,f)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(w,u){const f=i.o.devicePixelRatio||1;this._canvas.width=f*Math.ceil(w),this._canvas.height=f*Math.ceil(u),this._canvas.style.width=`${w}px`,this._canvas.style.height=`${u}px`}_addMarker(w){this._markers.push(w)}_removeMarker(w){const u=this._markers.indexOf(w);u!==-1&&this._markers.splice(u,1)}_addPopup(w){this._popups.push(w)}_removePopup(w){const u=this._popups.indexOf(w);u!==-1&&this._popups.splice(u,1)}_setupPainter(){const w=Object.assign({},N.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),u=this._canvas.getContext("webgl2",w);u?(rt(u,!0),this.painter=new KN(u,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",f=>{f.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),i.k.testSupport(u)):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 u;this.fire(new i.z("renderstart")),++this._frameId;const f=this.painter.context.extTimerQuery,k=i.o.now(),P=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(u=P.createQuery(),P.beginQuery(f.TIME_ELAPSED_EXT,u)),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 D=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const J=this.transform.zoom,te=this.transform.pitch,me=i.o.now(),he=new i.ac(J,{now:me,fadeDuration:D,pitch:te,transition:this.style.transition,worldview:this._worldview});this.style.update(he)}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(k),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):R=this._updateAverageElevation(k);const U=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,D,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),U&&(this._placementDirty=U.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:D,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,g.mark(m.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(),u){const J=i.o.now()-k;P.endQuery(f.TIME_ELAPSED_EXT),setTimeout(()=>{const te=P.getQueryParameter(u,P.QUERY_RESULT)/1e6;P.deleteQuery(u),this.fire(new i.z("gpu-timing-frame",{cpuTime:J,gpuTime:te}))},50)}if(this.listens("gpu-timing-layer")){const J=this.painter.collectGpuTimers();setTimeout(()=>{const te=this.painter.queryGpuTimers(J);this.fire(new i.z("gpu-timing-layer",{layerTimes:te}))},50)}if(this.listens("gpu-timing-deferred-render")){const J=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const te=this.painter.queryGpuTimeDeferredRender(J);this.fire(new i.z("gpu-timing-deferred-render",{gpuTime:te}))},50)}const G=this._sourcesDirty||this._styleDirty||this._placementDirty||R;if(G||this._repaint)this.triggerRepaint();else{const J=this.idle();if(J&&(R=this._updateAverageElevation(k,!0)),R)this.triggerRepaint();else if(this._triggerFrame(!1),J&&(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||G||(this._fullyLoaded=!0,g.mark(m.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 u of this._markers)w&&!this.getRenderWorldCopies()&&(u._lngLat=u._lngLat.wrap()),u._update();for(const u of this._popups)!w||this.getRenderWorldCopies()||u._trackPointer||(u._lngLat=u._lngLat.wrap()),u._update()}_updateAverageElevation(w,u=!1){const f=P=>(this.transform.averageElevation=P,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&f(0);const k=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(k||(u||w-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(w)){const P=this.transform.averageElevation;let D=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(D)?D=0:this._averageElevationLastSampledAt=w;const R=Math.abs(P-D);if(R>1){if(this._isInitialLoad||k)return this._averageElevation.jumpTo(D),f(D);this._averageElevation.easeTo(D,w,300)}else if(R>1e-4)return this._averageElevation.jumpTo(D),f(D)}return!!this._averageElevation.isEasing(w)&&f(this._averageElevation.getValue(w))}_authenticate(){$e(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,w=>{if(w&&(w.message===le||w.status===401)){const u=this.painter.context.gl;rt(u,!1),this._logoControl instanceof v_&&this._logoControl._updateLogo(),u&&u.clear(u.DEPTH_BUFFER_BIT|u.COLOR_BUFFER_BIT|u.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/")))}}),Ae(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()&&Ie(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){It(this._requestManager._customAccessToken)}_updateTerrain(){const w=this._isDragging();this.painter.updateTerrain(this.style,w)}_calculateSpeedIndex(){const w=this.painter.canvasCopy(),u=this.painter.getCanvasCopiesAndTimestamps();u.timeStamps.push(performance.now());const f=this.painter.context.gl,k=f.createFramebuffer();function P(D){f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,D,0);const R=new Uint8Array(f.drawingBufferWidth*f.drawingBufferHeight*4);return f.readPixels(0,0,f.drawingBufferWidth,f.drawingBufferHeight,f.RGBA,f.UNSIGNED_BYTE,R),R}return f.bindFramebuffer(f.FRAMEBUFFER,k),this._canvasPixelComparison(P(w),u.canvasCopies.map(P),u.timeStamps)}_canvasPixelComparison(w,u,f){let k=f[1]-f[0];const P=w.length/4;for(let D=0;D{const f=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,f&&this._render(u)}))}_preloadTiles(w){const u=this.style?this.style.getSourceCaches():[];return i.bw(u,(f,k)=>f._preloadTiles(w,k),()=>{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,u){i.f4(w,u)}get version(){return d}},NavigationControl:class{constructor(w={}){this.options=Object.assign({},joe,w),this._container=j("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",u=>u.preventDefault()),this.options.showZoom&&(i.aY(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",u=>{this._map&&this._map.zoomIn({},{originalEvent:u})}),j("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",u=>{this._map&&this._map.zoomOut({},{originalEvent:u})}),j("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(i.aY(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",u=>{const f=this._map;f&&(this.options.visualizePitch?f.resetNorthPitch({},{originalEvent:u}):f.resetNorth({},{originalEvent:u}))}),this._compassIcon=j("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const w=this._map;if(!w)return;const u=w.getZoom(),f=u===w.getMaxZoom(),k=u===w.getMinZoom();this._zoomInButton.disabled=f,this._zoomOutButton.disabled=k,this._zoomInButton.setAttribute("aria-disabled",f.toString()),this._zoomOutButton.setAttribute("aria-disabled",k.toString())}_rotateCompassArrow(){const w=this._map;if(!w)return;const u=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=u)})}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 koe(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,u){const f=j("button",w,this._container);return f.type="button",f.addEventListener("click",u),f}_setButtonTitle(w,u){if(!this._map)return;const f=this._map._getUIString(`NavigationControl.${u}`);w.setAttribute("aria-label",f),w.firstElementChild&&w.firstElementChild.setAttribute("title",f)}},GeolocateControl:class extends i.E{constructor(w={}){super();const u=navigator.geolocation;this.options=Object.assign({geolocation:u},Noe,w),i.aY(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=ZN(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(w){return this._map=w,this._container=j("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 u=(f=!!this.options.geolocation)=>{this._supportsGeolocation=f,w(f)};this._supportsGeolocation!==void 0?w(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(f=>u(f.state!=="denied")).catch(()=>u()):u()}_isOutOfMapMaxBounds(w){const u=this._map.getMaxBounds(),f=w.coords;return!!u&&(f.longitudeu.getEast()||f.latitudeu.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 u=new i.aT(w.coords.longitude,w.coords.latitude),f=w.coords.accuracy,k=this._map.getBearing(),P=Object.assign({bearing:k},this.options.fitBoundsOptions);this._map.fitBounds(u.toBounds(f),P,{geolocateSource:!0})}_updateMarker(w){if(w){const u=new i.aT(w.coords.longitude,w.coords.latitude);this._accuracyCircleMarker.setLngLat(u).addTo(this._map),this._userLocationDotMarker.setLngLat(u).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,u=i.cf(1,w._center.lat)*w.worldSize,f=Math.ceil(2*this._accuracy*u);this._circleElement.style.width=`${f}px`,this._circleElement.style.height=`${f}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 u=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",u),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",u),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",u=>u.preventDefault()),this._geolocateButton=j("button","mapboxgl-ctrl-geolocate",this._container),j("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 u=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",u),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",u)}else{const u=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",u),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",u)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=j("div","mapboxgl-user-location"),this._dotElement.appendChild(j("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(j("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new l4({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=j("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new l4({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",u=>{u.geolocateSource||this._watchState!=="ACTIVE_LOCK"||u.originalEvent&&u.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(u=>{u==="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:y_,ScaleControl:class{constructor(w={}){this.options=Object.assign({},C0,w),i.aY(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const w=this.options.maxWidth||100,u=this._map,f=u._containerHeight/2,k=u._containerWidth/2-w/2,P=u.unproject([k,f]),D=u.unproject([k+w,f]),R=P.distanceTo(D);if(this.options.unit==="imperial"){const U=3.2808*R;U>5280?this._setScale(w,U/5280,"mile"):this._setScale(w,U,"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,u,f){this._map._requestDomTask(()=>{const k=function(D){const R=Math.pow(10,`${Math.floor(D)}`.length-1);let U=D/R;return U=U>=10?10:U>=5?5:U>=3?3:U>=2?2:U>=1?1:function(G){const J=Math.pow(10,Math.ceil(-Math.log(G)/Math.LN10));return Math.round(G*J)/J}(U),R*U}(u),P=k/u;this._container.innerHTML=f!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:f}).format(k):`${k} ${xM[f]}`,this._container.style.width=w*P+"px"})}onAdd(w){return this._map=w,this._language=w.getLanguage(),this._container=j("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=j("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=j("button","mapboxgl-ctrl-fullscreen",this._controlContainer);j("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:S0,Popup:class extends i.E{constructor(w){super(),this.options=Object.assign(Object.create(bh),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 u=this._map;return u&&(u.on("move",this._update),u.off("mousemove",this._onMouseEvent),u._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 u=document.createDocumentFragment(),f=document.createElement("body");let k;for(f.innerHTML=w;k=f.firstChild,k;)u.appendChild(k);return this.setDOMContent(u)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(w){return this.options.maxWidth=w,this._update(),this}setDOMContent(w){let u=this._content;if(u)for(;u.hasChildNodes();)u.firstChild&&u.removeChild(u.firstChild);else u=this._content=j("div","mapboxgl-popup-content",this._container||void 0);if(u.appendChild(w),this.options.closeButton){const f=this._closeButton=j("button","mapboxgl-popup-close-button",u);f.type="button",f.setAttribute("aria-label","Close popup"),f.innerHTML='',f.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 u;return this._classList.delete(w)?u=!1:(this._classList.add(w),u=!0),this._updateClassList(),u}_onMouseEvent(w){this._update(w.point)}_getAnchor(w){if(this.options.anchor)return this.options.anchor;const u=this._map,f=this._container,k=this._pos;if(!u||!f||!k)return"bottom";const P=f.offsetWidth,D=f.offsetHeight,R=k.x

u.transform.width-P/2;if(k.y+wu.transform.height-D){if(R)return"bottom-left";if(U)return"bottom-right"}return R?"left":U?"right":"bottom"}_updateClassList(){const w=this._container;if(!w)return;const u=[...this._classList];u.push("mapboxgl-popup"),this._anchor&&u.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&u.push("mapboxgl-popup-track-pointer"),w.className=u.join(" ")}_update(w){const u=this._map,f=this._content;if(!u||!this._lngLat&&!this._trackPointer||!f)return;let k=this._container;if(k||(k=this._container=j("div","mapboxgl-popup",u.getContainer()),this._tip=j("div","mapboxgl-popup-tip",k),k.appendChild(f)),this.options.maxWidth&&k.style.maxWidth!==this.options.maxWidth&&(k.style.maxWidth=this.options.maxWidth),u.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=gM(this._lngLat,this._pos,u.transform)),!this._trackPointer||w){const P=this._pos=this._trackPointer&&w instanceof i.P?w:u.project(this._lngLat,this._altitude),D=Lx(this.options.offset),R=this._anchor=this._getAnchor(D.y),U=Lx(this.options.offset,R),G=P.add(U).round();u._requestDomTask(()=>{this._container&&R&&(this._container.style.transform=`${Uc[R]} translate(${G.x}px,${G.y}px)`)})}if(!this._marker&&u._showingGlobe()){const P=i.f5(u.transform,this._lngLat)?0:1;this._setOpacity(P)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const w=this._container.querySelector(wh);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:l4,Style:vh,LngLat:i.aT,LngLatBounds:i.aI,Point:i.P,MercatorCoordinate:i.ae,FreeCameraOptions:Cd,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})})(Q8e);var xct=Q8e.exports;const oc=oo(xct);function fr({className:t,...r}){return e.jsx("div",{className:qt("animate-pulse rounded-md bg-muted",t),...r})}const nNe={coming_soon:"#3B82F6",active:"#10B981",price_improvement:"#F97316",under_contract:"#8B5CF6",sold:"#6B7280"},aNe={coming_soon:"Coming Soon",active:"Active",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"};function yct(t){return t>=1e6?`$${(t/1e6).toFixed(1)}M`:`$${(t/1e3).toFixed(0)}K`}function vct({listings:t,isLoading:r}){const s=Ws(),n=E.useRef(null),a=E.useRef(null),o=E.useRef([]),[l,i]=E.useState(""),[d,m]=E.useState(!0);return E.useEffect(()=>{(async()=>{m(!0);try{const{data:v}=await Z.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();v!=null&&v.value&&i(v.value)}catch(v){console.error("Error fetching mapbox token:",v)}m(!1)})()},[]),E.useEffect(()=>{if(!n.current||!l||a.current)return;oc.accessToken=l;const y=t.filter(N=>N.latitude!=null&&N.longitude!=null);let v=[-98.5795,39.8283],b=4;if(y.length>0){const N=y.reduce((S,A)=>S+A.longitude,0)/y.length,j=y.reduce((S,A)=>S+A.latitude,0)/y.length;v=[N,j],b=y.length===1?12:10}return a.current=new oc.Map({container:n.current,style:"mapbox://styles/mapbox/light-v11",zoom:b,center:v}),a.current.addControl(new oc.NavigationControl,"top-right"),()=>{var N;(N=a.current)==null||N.remove(),a.current=null}},[l]),E.useEffect(()=>{if(!a.current||!l)return;o.current.forEach(v=>v.remove()),o.current=[];const y=t.filter(v=>v.latitude!=null&&v.longitude!=null);if(y.forEach(v=>{var F,O,B;const b=nNe[v.status]||"#10B981",N=((F=v.photos)==null?void 0:F.find($=>$.is_primary))||((O=v.photos)==null?void 0:O[0]),S=window.location.hostname==="listings.relevelup.com"||window.location.hostname.startsWith("listings.")?`/${v.slug||v.id}`:`/public/listing/${v.slug||v.id}`,A=document.createElement("div");A.className="cursor-pointer",A.innerHTML=`

`;const M=new oc.Popup({offset:25,closeButton:!0,maxWidth:"280px"}).setHTML(`
${N!=null&&N.photo_url?``:""}
${yct(v.price)}
${v.property_address||""}
${v.city}, ${v.state}
${aNe[v.status]||v.status} ${v.bedrooms?`${v.bedrooms} bed`:""} ${v.bathrooms?`${v.bathrooms} bath`:""}
${(B=v.agent)!=null&&B.name?`
Listed by ${v.agent.name}
`:""}
Click to view details →
`),I=new oc.Marker(A).setLngLat([v.longitude,v.latitude]).setPopup(M).addTo(a.current);o.current.push(I)}),y.length>1){const v=new oc.LngLatBounds;y.forEach(b=>v.extend([b.longitude,b.latitude])),a.current.fitBounds(v,{padding:60,maxZoom:13})}else y.length===1&&a.current.flyTo({center:[y[0].longitude,y[0].latitude],zoom:12})},[t,l]),E.useEffect(()=>(window.__navigateToPublicListing__=y=>{s(y)},()=>{delete window.__navigateToPublicListing__}),[s]),d||r?e.jsx(fr,{className:"w-full h-[500px] rounded-lg"}):!l||t.filter(y=>y.latitude!=null&&y.longitude!=null).length===0?null:e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex flex-wrap items-center gap-3 text-sm",children:Object.entries(nNe).map(([y,v])=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-3 h-3 rounded-full border-2 border-white shadow",style:{background:v}}),e.jsx("span",{className:"text-xs text-gray-600",children:aNe[y]})]},y))}),e.jsx("div",{ref:n,className:"w-full h-[500px] rounded-lg shadow-lg border border-gray-200"})]})}function YE(t,[r,s]){return Math.min(s,Math.max(r,t))}function wP(t){const r=E.useRef({value:t,previous:t});return E.useMemo(()=>(r.current.value!==t&&(r.current.previous=r.current.value,r.current.value=t),r.current.previous),[t])}var _ct=[" ","Enter","ArrowUp","ArrowDown"],bct=[" ","Enter"],_k="Select",[Vne,Hne,wct]=oP(_k),[V3]=fc(_k,[wct,ux]),Wne=ux(),[jct,Av]=V3(_k),[kct,Nct]=V3(_k),eOe=t=>{const{__scopeSelect:r,children:s,open:n,defaultOpen:a,onOpenChange:o,value:l,defaultValue:i,onValueChange:d,dir:m,name:g,autoComplete:y,disabled:v,required:b,form:N}=t,j=Wne(r),[S,A]=E.useState(null),[M,I]=E.useState(null),[F,O]=E.useState(!1),B=Bk(m),[$,H]=oh({prop:n,defaultProp:a??!1,onChange:o,caller:_k}),[W,X]=oh({prop:l,defaultProp:i,onChange:d,caller:_k}),se=E.useRef(null),ae=S?N||!!S.closest("form"):!0,[le,ne]=E.useState(new Set),fe=Array.from(le).map(oe=>oe.props.value).join(";");return e.jsx(uP,{...j,children:e.jsxs(jct,{required:b,scope:r,trigger:S,onTriggerChange:A,valueNode:M,onValueNodeChange:I,valueNodeHasChildren:F,onValueNodeHasChildrenChange:O,contentId:bd(),value:W,onValueChange:X,open:$,onOpenChange:H,dir:B,triggerPointerDownPosRef:se,disabled:v,children:[e.jsx(Vne.Provider,{scope:r,children:e.jsx(kct,{scope:t.__scopeSelect,onNativeOptionAdd:E.useCallback(oe=>{ne(de=>new Set(de).add(oe))},[]),onNativeOptionRemove:E.useCallback(oe=>{ne(de=>{const ue=new Set(de);return ue.delete(oe),ue})},[]),children:s})}),ae?e.jsxs(kOe,{"aria-hidden":!0,required:b,tabIndex:-1,name:g,autoComplete:y,value:W,onChange:oe=>X(oe.target.value),disabled:v,form:N,children:[W===void 0?e.jsx("option",{value:""}):null,Array.from(le)]},fe):null]})})};eOe.displayName=_k;var tOe="SelectTrigger",rOe=E.forwardRef((t,r)=>{const{__scopeSelect:s,disabled:n=!1,...a}=t,o=Wne(s),l=Av(tOe,s),i=l.disabled||n,d=ga(r,l.onTriggerChange),m=Hne(s),g=E.useRef("touch"),[y,v,b]=SOe(j=>{const S=m().filter(I=>!I.disabled),A=S.find(I=>I.value===l.value),M=COe(S,j,A);M!==void 0&&l.onValueChange(M.value)}),N=j=>{i||(l.onOpenChange(!0),b()),j&&(l.triggerPointerDownPosRef.current={x:Math.round(j.pageX),y:Math.round(j.pageY)})};return e.jsx(P3,{asChild:!0,...o,children:e.jsx(qs.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":NOe(l.value)?"":void 0,...a,ref:d,onClick:bs(a.onClick,j=>{j.currentTarget.focus(),g.current!=="mouse"&&N(j)}),onPointerDown:bs(a.onPointerDown,j=>{g.current=j.pointerType;const S=j.target;S.hasPointerCapture(j.pointerId)&&S.releasePointerCapture(j.pointerId),j.button===0&&j.ctrlKey===!1&&j.pointerType==="mouse"&&(N(j),j.preventDefault())}),onKeyDown:bs(a.onKeyDown,j=>{const S=y.current!=="";!(j.ctrlKey||j.altKey||j.metaKey)&&j.key.length===1&&v(j.key),!(S&&j.key===" ")&&_ct.includes(j.key)&&(N(),j.preventDefault())})})})});rOe.displayName=tOe;var sOe="SelectValue",nOe=E.forwardRef((t,r)=>{const{__scopeSelect:s,className:n,style:a,children:o,placeholder:l="",...i}=t,d=Av(sOe,s),{onValueNodeHasChildrenChange:m}=d,g=o!==void 0,y=ga(r,d.onValueNodeChange);return mc(()=>{m(g)},[m,g]),e.jsx(qs.span,{...i,ref:y,style:{pointerEvents:"none"},children:NOe(d.value)?e.jsx(e.Fragment,{children:l}):o})});nOe.displayName=sOe;var Sct="SelectIcon",aOe=E.forwardRef((t,r)=>{const{__scopeSelect:s,children:n,...a}=t;return e.jsx(qs.span,{"aria-hidden":!0,...a,ref:r,children:n||"▼"})});aOe.displayName=Sct;var Cct="SelectPortal",iOe=t=>e.jsx(M3,{asChild:!0,...t});iOe.displayName=Cct;var bk="SelectContent",oOe=E.forwardRef((t,r)=>{const s=Av(bk,t.__scopeSelect),[n,a]=E.useState();if(mc(()=>{a(new DocumentFragment)},[]),!s.open){const o=n;return o?Ph.createPortal(e.jsx(lOe,{scope:t.__scopeSelect,children:e.jsx(Vne.Slot,{scope:t.__scopeSelect,children:e.jsx("div",{children:t.children})})}),o):null}return e.jsx(cOe,{...t,ref:r})});oOe.displayName=bk;var pf=10,[lOe,Ev]=V3(bk),Mct="SelectContentImpl",Tct=fv("SelectContent.RemoveScroll"),cOe=E.forwardRef((t,r)=>{const{__scopeSelect:s,position:n="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:l,side:i,sideOffset:d,align:m,alignOffset:g,arrowPadding:y,collisionBoundary:v,collisionPadding:b,sticky:N,hideWhenDetached:j,avoidCollisions:S,...A}=t,M=Av(bk,s),[I,F]=E.useState(null),[O,B]=E.useState(null),$=ga(r,Ue=>F(Ue)),[H,W]=E.useState(null),[X,se]=E.useState(null),ae=Hne(s),[le,ne]=E.useState(!1),fe=E.useRef(!1);E.useEffect(()=>{if(I)return One(I)},[I]),Lne();const oe=E.useCallback(Ue=>{const[Ye,...Ie]=ae().map(Pe=>Pe.ref.current),[et]=Ie.slice(-1),It=document.activeElement;for(const Pe of Ue)if(Pe===It||(Pe==null||Pe.scrollIntoView({block:"nearest"}),Pe===Ye&&O&&(O.scrollTop=0),Pe===et&&O&&(O.scrollTop=O.scrollHeight),Pe==null||Pe.focus(),document.activeElement!==It))return},[ae,O]),de=E.useCallback(()=>oe([H,I]),[oe,H,I]);E.useEffect(()=>{le&&de()},[le,de]);const{onOpenChange:ue,triggerPointerDownPosRef:xe}=M;E.useEffect(()=>{if(I){let Ue={x:0,y:0};const Ye=et=>{var It,Pe;Ue={x:Math.abs(Math.round(et.pageX)-(((It=xe.current)==null?void 0:It.x)??0)),y:Math.abs(Math.round(et.pageY)-(((Pe=xe.current)==null?void 0:Pe.y)??0))}},Ie=et=>{Ue.x<=10&&Ue.y<=10?et.preventDefault():I.contains(et.target)||ue(!1),document.removeEventListener("pointermove",Ye),xe.current=null};return xe.current!==null&&(document.addEventListener("pointermove",Ye),document.addEventListener("pointerup",Ie,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Ye),document.removeEventListener("pointerup",Ie,{capture:!0})}}},[I,ue,xe]),E.useEffect(()=>{const Ue=()=>ue(!1);return window.addEventListener("blur",Ue),window.addEventListener("resize",Ue),()=>{window.removeEventListener("blur",Ue),window.removeEventListener("resize",Ue)}},[ue]);const[Te,be]=SOe(Ue=>{const Ye=ae().filter(It=>!It.disabled),Ie=Ye.find(It=>It.ref.current===document.activeElement),et=COe(Ye,Ue,Ie);et&&setTimeout(()=>et.ref.current.focus())}),we=E.useCallback((Ue,Ye,Ie)=>{const et=!fe.current&&!Ie;(M.value!==void 0&&M.value===Ye||et)&&(W(Ue),et&&(fe.current=!0))},[M.value]),ve=E.useCallback(()=>I==null?void 0:I.focus(),[I]),tt=E.useCallback((Ue,Ye,Ie)=>{const et=!fe.current&&!Ie;(M.value!==void 0&&M.value===Ye||et)&&se(Ue)},[M.value]),Ae=n==="popper"?fme:dOe,Le=Ae===fme?{side:i,sideOffset:d,align:m,alignOffset:g,arrowPadding:y,collisionBoundary:v,collisionPadding:b,sticky:N,hideWhenDetached:j,avoidCollisions:S}:{};return e.jsx(lOe,{scope:s,content:I,viewport:O,onViewportChange:B,itemRefCallback:we,selectedItem:H,onItemLeave:ve,itemTextRefCallback:tt,focusSelectedItem:de,selectedItemText:X,position:n,isPositioned:le,searchRef:Te,children:e.jsx(xP,{as:Tct,allowPinchZoom:!0,children:e.jsx(fP,{asChild:!0,trapped:M.open,onMountAutoFocus:Ue=>{Ue.preventDefault()},onUnmountAutoFocus:bs(a,Ue=>{var Ye;(Ye=M.trigger)==null||Ye.focus({preventScroll:!0}),Ue.preventDefault()}),children:e.jsx(Sv,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:Ue=>Ue.preventDefault(),onDismiss:()=>M.onOpenChange(!1),children:e.jsx(Ae,{role:"listbox",id:M.contentId,"data-state":M.open?"open":"closed",dir:M.dir,onContextMenu:Ue=>Ue.preventDefault(),...A,...Le,onPlaced:()=>ne(!0),ref:$,style:{display:"flex",flexDirection:"column",outline:"none",...A.style},onKeyDown:bs(A.onKeyDown,Ue=>{const Ye=Ue.ctrlKey||Ue.altKey||Ue.metaKey;if(Ue.key==="Tab"&&Ue.preventDefault(),!Ye&&Ue.key.length===1&&be(Ue.key),["ArrowUp","ArrowDown","Home","End"].includes(Ue.key)){let et=ae().filter(It=>!It.disabled).map(It=>It.ref.current);if(["ArrowUp","End"].includes(Ue.key)&&(et=et.slice().reverse()),["ArrowUp","ArrowDown"].includes(Ue.key)){const It=Ue.target,Pe=et.indexOf(It);et=et.slice(Pe+1)}setTimeout(()=>oe(et)),Ue.preventDefault()}})})})})})})});cOe.displayName=Mct;var Act="SelectItemAlignedPosition",dOe=E.forwardRef((t,r)=>{const{__scopeSelect:s,onPlaced:n,...a}=t,o=Av(bk,s),l=Ev(bk,s),[i,d]=E.useState(null),[m,g]=E.useState(null),y=ga(r,$=>g($)),v=Hne(s),b=E.useRef(!1),N=E.useRef(!0),{viewport:j,selectedItem:S,selectedItemText:A,focusSelectedItem:M}=l,I=E.useCallback(()=>{if(o.trigger&&o.valueNode&&i&&m&&j&&S&&A){const $=o.trigger.getBoundingClientRect(),H=m.getBoundingClientRect(),W=o.valueNode.getBoundingClientRect(),X=A.getBoundingClientRect();if(o.dir!=="rtl"){const It=X.left-H.left,Pe=W.left-It,at=$.left-Pe,ce=$.width+at,$e=Math.max(ce,H.width),Ge=window.innerWidth-pf,rt=YE(Pe,[pf,Math.max(pf,Ge-$e)]);i.style.minWidth=ce+"px",i.style.left=rt+"px"}else{const It=H.right-X.right,Pe=window.innerWidth-W.right-It,at=window.innerWidth-$.right-Pe,ce=$.width+at,$e=Math.max(ce,H.width),Ge=window.innerWidth-pf,rt=YE(Pe,[pf,Math.max(pf,Ge-$e)]);i.style.minWidth=ce+"px",i.style.right=rt+"px"}const se=v(),ae=window.innerHeight-pf*2,le=j.scrollHeight,ne=window.getComputedStyle(m),fe=parseInt(ne.borderTopWidth,10),oe=parseInt(ne.paddingTop,10),de=parseInt(ne.borderBottomWidth,10),ue=parseInt(ne.paddingBottom,10),xe=fe+oe+le+ue+de,Te=Math.min(S.offsetHeight*5,xe),be=window.getComputedStyle(j),we=parseInt(be.paddingTop,10),ve=parseInt(be.paddingBottom,10),tt=$.top+$.height/2-pf,Ae=ae-tt,Le=S.offsetHeight/2,Ue=S.offsetTop+Le,Ye=fe+oe+Ue,Ie=xe-Ye;if(Ye<=tt){const It=se.length>0&&S===se[se.length-1].ref.current;i.style.bottom="0px";const Pe=m.clientHeight-j.offsetTop-j.offsetHeight,at=Math.max(Ae,Le+(It?ve:0)+Pe+de),ce=Ye+at;i.style.height=ce+"px"}else{const It=se.length>0&&S===se[0].ref.current;i.style.top="0px";const at=Math.max(tt,fe+j.offsetTop+(It?we:0)+Le)+Ie;i.style.height=at+"px",j.scrollTop=Ye-tt+j.offsetTop}i.style.margin=`${pf}px 0`,i.style.minHeight=Te+"px",i.style.maxHeight=ae+"px",n==null||n(),requestAnimationFrame(()=>b.current=!0)}},[v,o.trigger,o.valueNode,i,m,j,S,A,o.dir,n]);mc(()=>I(),[I]);const[F,O]=E.useState();mc(()=>{m&&O(window.getComputedStyle(m).zIndex)},[m]);const B=E.useCallback($=>{$&&N.current===!0&&(I(),M==null||M(),N.current=!1)},[I,M]);return e.jsx(Ict,{scope:s,contentWrapper:i,shouldExpandOnScrollRef:b,onScrollButtonChange:B,children:e.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:F},children:e.jsx(qs.div,{...a,ref:y,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});dOe.displayName=Act;var Ect="SelectPopperPosition",fme=E.forwardRef((t,r)=>{const{__scopeSelect:s,align:n="start",collisionPadding:a=pf,...o}=t,l=Wne(s);return e.jsx(hP,{...l,...o,ref:r,align:n,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)"}})});fme.displayName=Ect;var[Ict,oye]=V3(bk,{}),gme="SelectViewport",uOe=E.forwardRef((t,r)=>{const{__scopeSelect:s,nonce:n,...a}=t,o=Ev(gme,s),l=oye(gme,s),i=ga(r,o.onViewportChange),d=E.useRef(0);return e.jsxs(e.Fragment,{children:[e.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:n}),e.jsx(Vne.Slot,{scope:s,children:e.jsx(qs.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:i,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:bs(a.onScroll,m=>{const g=m.currentTarget,{contentWrapper:y,shouldExpandOnScrollRef:v}=l;if(v!=null&&v.current&&y){const b=Math.abs(d.current-g.scrollTop);if(b>0){const N=window.innerHeight-pf*2,j=parseFloat(y.style.minHeight),S=parseFloat(y.style.height),A=Math.max(j,S);if(A0?F:0,y.style.justifyContent="flex-end")}}}d.current=g.scrollTop})})})]})});uOe.displayName=gme;var hOe="SelectGroup",[Pct,Lct]=V3(hOe),Oct=E.forwardRef((t,r)=>{const{__scopeSelect:s,...n}=t,a=bd();return e.jsx(Pct,{scope:s,id:a,children:e.jsx(qs.div,{role:"group","aria-labelledby":a,...n,ref:r})})});Oct.displayName=hOe;var mOe="SelectLabel",pOe=E.forwardRef((t,r)=>{const{__scopeSelect:s,...n}=t,a=Lct(mOe,s);return e.jsx(qs.div,{id:a.id,...n,ref:r})});pOe.displayName=mOe;var Gte="SelectItem",[Dct,fOe]=V3(Gte),gOe=E.forwardRef((t,r)=>{const{__scopeSelect:s,value:n,disabled:a=!1,textValue:o,...l}=t,i=Av(Gte,s),d=Ev(Gte,s),m=i.value===n,[g,y]=E.useState(o??""),[v,b]=E.useState(!1),N=ga(r,M=>{var I;return(I=d.itemRefCallback)==null?void 0:I.call(d,M,n,a)}),j=bd(),S=E.useRef("touch"),A=()=>{a||(i.onValueChange(n),i.onOpenChange(!1))};if(n==="")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 e.jsx(Dct,{scope:s,value:n,disabled:a,textId:j,isSelected:m,onItemTextChange:E.useCallback(M=>{y(I=>I||((M==null?void 0:M.textContent)??"").trim())},[]),children:e.jsx(Vne.ItemSlot,{scope:s,value:n,disabled:a,textValue:g,children:e.jsx(qs.div,{role:"option","aria-labelledby":j,"data-highlighted":v?"":void 0,"aria-selected":m&&v,"data-state":m?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...l,ref:N,onFocus:bs(l.onFocus,()=>b(!0)),onBlur:bs(l.onBlur,()=>b(!1)),onClick:bs(l.onClick,()=>{S.current!=="mouse"&&A()}),onPointerUp:bs(l.onPointerUp,()=>{S.current==="mouse"&&A()}),onPointerDown:bs(l.onPointerDown,M=>{S.current=M.pointerType}),onPointerMove:bs(l.onPointerMove,M=>{var I;S.current=M.pointerType,a?(I=d.onItemLeave)==null||I.call(d):S.current==="mouse"&&M.currentTarget.focus({preventScroll:!0})}),onPointerLeave:bs(l.onPointerLeave,M=>{var I;M.currentTarget===document.activeElement&&((I=d.onItemLeave)==null||I.call(d))}),onKeyDown:bs(l.onKeyDown,M=>{var F;((F=d.searchRef)==null?void 0:F.current)!==""&&M.key===" "||(bct.includes(M.key)&&A(),M.key===" "&&M.preventDefault())})})})})});gOe.displayName=Gte;var KT="SelectItemText",xOe=E.forwardRef((t,r)=>{const{__scopeSelect:s,className:n,style:a,...o}=t,l=Av(KT,s),i=Ev(KT,s),d=fOe(KT,s),m=Nct(KT,s),[g,y]=E.useState(null),v=ga(r,A=>y(A),d.onItemTextChange,A=>{var M;return(M=i.itemTextRefCallback)==null?void 0:M.call(i,A,d.value,d.disabled)}),b=g==null?void 0:g.textContent,N=E.useMemo(()=>e.jsx("option",{value:d.value,disabled:d.disabled,children:b},d.value),[d.disabled,d.value,b]),{onNativeOptionAdd:j,onNativeOptionRemove:S}=m;return mc(()=>(j(N),()=>S(N)),[j,S,N]),e.jsxs(e.Fragment,{children:[e.jsx(qs.span,{id:d.textId,...o,ref:v}),d.isSelected&&l.valueNode&&!l.valueNodeHasChildren?Ph.createPortal(o.children,l.valueNode):null]})});xOe.displayName=KT;var yOe="SelectItemIndicator",vOe=E.forwardRef((t,r)=>{const{__scopeSelect:s,...n}=t;return fOe(yOe,s).isSelected?e.jsx(qs.span,{"aria-hidden":!0,...n,ref:r}):null});vOe.displayName=yOe;var xme="SelectScrollUpButton",_Oe=E.forwardRef((t,r)=>{const s=Ev(xme,t.__scopeSelect),n=oye(xme,t.__scopeSelect),[a,o]=E.useState(!1),l=ga(r,n.onScrollButtonChange);return mc(()=>{if(s.viewport&&s.isPositioned){let i=function(){const m=d.scrollTop>0;o(m)};const d=s.viewport;return i(),d.addEventListener("scroll",i),()=>d.removeEventListener("scroll",i)}},[s.viewport,s.isPositioned]),a?e.jsx(wOe,{...t,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:d}=s;i&&d&&(i.scrollTop=i.scrollTop-d.offsetHeight)}}):null});_Oe.displayName=xme;var yme="SelectScrollDownButton",bOe=E.forwardRef((t,r)=>{const s=Ev(yme,t.__scopeSelect),n=oye(yme,t.__scopeSelect),[a,o]=E.useState(!1),l=ga(r,n.onScrollButtonChange);return mc(()=>{if(s.viewport&&s.isPositioned){let i=function(){const m=d.scrollHeight-d.clientHeight,g=Math.ceil(d.scrollTop)d.removeEventListener("scroll",i)}},[s.viewport,s.isPositioned]),a?e.jsx(wOe,{...t,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:d}=s;i&&d&&(i.scrollTop=i.scrollTop+d.offsetHeight)}}):null});bOe.displayName=yme;var wOe=E.forwardRef((t,r)=>{const{__scopeSelect:s,onAutoScroll:n,...a}=t,o=Ev("SelectScrollButton",s),l=E.useRef(null),i=Hne(s),d=E.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return E.useEffect(()=>()=>d(),[d]),mc(()=>{var g;const m=i().find(y=>y.ref.current===document.activeElement);(g=m==null?void 0:m.ref.current)==null||g.scrollIntoView({block:"nearest"})},[i]),e.jsx(qs.div,{"aria-hidden":!0,...a,ref:r,style:{flexShrink:0,...a.style},onPointerDown:bs(a.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(n,50))}),onPointerMove:bs(a.onPointerMove,()=>{var m;(m=o.onItemLeave)==null||m.call(o),l.current===null&&(l.current=window.setInterval(n,50))}),onPointerLeave:bs(a.onPointerLeave,()=>{d()})})}),Rct="SelectSeparator",jOe=E.forwardRef((t,r)=>{const{__scopeSelect:s,...n}=t;return e.jsx(qs.div,{"aria-hidden":!0,...n,ref:r})});jOe.displayName=Rct;var vme="SelectArrow",Fct=E.forwardRef((t,r)=>{const{__scopeSelect:s,...n}=t,a=Wne(s),o=Av(vme,s),l=Ev(vme,s);return o.open&&l.position==="popper"?e.jsx(mP,{...a,...n,ref:r}):null});Fct.displayName=vme;var zct="SelectBubbleInput",kOe=E.forwardRef(({__scopeSelect:t,value:r,...s},n)=>{const a=E.useRef(null),o=ga(n,a),l=wP(r);return E.useEffect(()=>{const i=a.current;if(!i)return;const d=window.HTMLSelectElement.prototype,g=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==r&&g){const y=new Event("change",{bubbles:!0});g.call(i,r),i.dispatchEvent(y)}},[l,r]),e.jsx(qs.select,{...s,style:{...bIe,...s.style},ref:o,defaultValue:r})});kOe.displayName=zct;function NOe(t){return t===""||t===void 0}function SOe(t){const r=cc(t),s=E.useRef(""),n=E.useRef(0),a=E.useCallback(l=>{const i=s.current+l;r(i),function d(m){s.current=m,window.clearTimeout(n.current),m!==""&&(n.current=window.setTimeout(()=>d(""),1e3))}(i)},[r]),o=E.useCallback(()=>{s.current="",window.clearTimeout(n.current)},[]);return E.useEffect(()=>()=>window.clearTimeout(n.current),[]),[s,a,o]}function COe(t,r,s){const a=r.length>1&&Array.from(r).every(m=>m===r[0])?r[0]:r,o=s?t.indexOf(s):-1;let l=Bct(t,Math.max(o,0));a.length===1&&(l=l.filter(m=>m!==s));const d=l.find(m=>m.textValue.toLowerCase().startsWith(a.toLowerCase()));return d!==s?d:void 0}function Bct(t,r){return t.map((s,n)=>t[(r+n)%t.length])}var $ct=eOe,MOe=rOe,Uct=nOe,qct=aOe,Vct=iOe,TOe=oOe,Hct=uOe,AOe=pOe,EOe=gOe,Wct=xOe,Gct=vOe,IOe=_Oe,POe=bOe,LOe=jOe;const ds=$ct,us=Uct,ls=E.forwardRef(({className:t,children:r,...s},n)=>e.jsxs(MOe,{ref:n,className:qt("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...s,children:[r,e.jsx(qct,{asChild:!0,children:e.jsx(Jc,{className:"h-4 w-4 opacity-50"})})]}));ls.displayName=MOe.displayName;const OOe=E.forwardRef(({className:t,...r},s)=>e.jsx(IOe,{ref:s,className:qt("flex cursor-default items-center justify-center py-1",t),...r,children:e.jsx(Hg,{className:"h-4 w-4"})}));OOe.displayName=IOe.displayName;const DOe=E.forwardRef(({className:t,...r},s)=>e.jsx(POe,{ref:s,className:qt("flex cursor-default items-center justify-center py-1",t),...r,children:e.jsx(Jc,{className:"h-4 w-4"})}));DOe.displayName=POe.displayName;const cs=E.forwardRef(({className:t,children:r,position:s="popper",...n},a)=>e.jsx(Vct,{children:e.jsxs(TOe,{ref:a,className:qt("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",s==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:s,...n,children:[e.jsx(OOe,{}),e.jsx(Hct,{className:qt("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),e.jsx(DOe,{})]})}));cs.displayName=TOe.displayName;const Kct=E.forwardRef(({className:t,...r},s)=>e.jsx(AOe,{ref:s,className:qt("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...r}));Kct.displayName=AOe.displayName;const Ut=E.forwardRef(({className:t,children:r,...s},n)=>e.jsxs(EOe,{ref:n,className:qt("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t),...s,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Gct,{children:e.jsx(li,{className:"h-4 w-4"})})}),e.jsx(Wct,{children:r})]}));Ut.displayName=EOe.displayName;const Zct=E.forwardRef(({className:t,...r},s)=>e.jsx(LOe,{ref:s,className:qt("-mx-1 my-1 h-px bg-muted",t),...r}));Zct.displayName=LOe.displayName;const Yct=t=>Ht({queryKey:["public-listings",t],queryFn:async()=>{let r=Z.from("listings").select(` id, slug, agent_id, property_address, city, state, neighborhood, price, property_type, status, bedrooms, bathrooms, square_footage, lot_size, year_built, has_hoa, description, latitude, longitude, created_at, updated_at, photos:listing_photos(id, photo_url, is_primary), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage:brokerages(name)) `).eq("is_approved",!0).eq("is_public",!0).order("created_at",{ascending:!1});t!=null&&t.status&&(r=r.eq("status",t.status)),t!=null&&t.propertyType&&(r=r.eq("property_type",t.propertyType)),t!=null&&t.city&&(r=r.ilike("city",`%${t.city}%`)),t!=null&&t.minPrice&&(r=r.gte("price",t.minPrice)),t!=null&&t.maxPrice&&(r=r.lte("price",t.maxPrice));const{data:s,error:n}=await r;if(n)throw n;return s}}),ROe=t=>Ht({queryKey:["public-listing",t],queryFn:async()=>{const r=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t);let s=Z.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);r?s=s.eq("id",t):s=s.eq("slug",t);const{data:n,error:a}=await s.single();if(a)throw a;return n},enabled:!!t}),FOe=()=>Jt({mutationFn:async({listingId:t,agentId:r,firstName:s,lastName:n,email:a,phone:o,shareToken:l})=>{let i=null,d=null;if(l){const{data:v}=await Z.from("listing_shares").select("id, sharing_agent_id").eq("share_token",l).eq("listing_id",t).maybeSingle();v&&(i=v.id,d=v.sharing_agent_id)}const{data:m,error:g}=await Z.from("listing_leads").insert({listing_id:t,agent_id:d||r,first_name:s,last_name:n,email:a,phone:o,share_id:i,referred_by_agent_id:d}).select().single();if(g)throw g;const{error:y}=await Z.functions.invoke("process-listing-lead",{body:{leadId:m.id}});return y&&console.error("Error processing lead:",y),m}}),Xct=()=>Jt({mutationFn:async t=>{const{error:r}=await Z.rpc("increment_listing_share_click",{p_share_token:t});if(r)throw r}}),Qct={active:"bg-emerald-500",coming_soon:"bg-blue-600",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},iNe={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},Jct={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function zOe(){const[t,r]=E.useState(""),[s,n]=E.useState(!1),[a,o]=E.useState({status:"",propertyType:"",minPrice:"",maxPrice:""}),{data:l,isLoading:i}=Yct({city:t||void 0,status:a.status||void 0,propertyType:a.propertyType||void 0,minPrice:a.minPrice?Number(a.minPrice):void 0,maxPrice:a.maxPrice?Number(a.maxPrice):void 0}),d=y=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(y),m=()=>{o({status:"",propertyType:"",minPrice:"",maxPrice:""}),r("")},g=t||a.status||a.propertyType||a.minPrice||a.maxPrice;return e.jsxs(e.Fragment,{children:[e.jsxs(qh,{children:[e.jsx("title",{children:"LevelUp Listings - Find Your Dream Home | Real Estate for Sale"}),e.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."}),e.jsx("link",{rel:"canonical",href:"https://listings.relevelup.com"}),e.jsx("meta",{property:"og:title",content:"LevelUp Listings - Find Your Dream Home"}),e.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."}),e.jsx("meta",{property:"og:type",content:"website"}),e.jsx("meta",{property:"og:url",content:"https://listings.relevelup.com"}),e.jsx("meta",{property:"og:site_name",content:"LevelUp Listings"}),e.jsx("meta",{property:"og:locale",content:"en_US"}),e.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),e.jsx("meta",{name:"twitter:title",content:"LevelUp Listings - Find Your Dream Home"}),e.jsx("meta",{name:"twitter:description",content:"Browse exclusive property listings from LevelUp real estate agents."}),e.jsx("meta",{name:"robots",content:"index, follow"}),e.jsx("meta",{name:"keywords",content:"homes for sale, real estate, property listings, houses, condos, townhouses, luxury homes, LevelUp"}),e.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"}})}),e.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"})})]}),e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx("header",{className:"bg-white border-b border-gray-200 sticky top-0 z-50",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(go,{to:"/public/listings",className:"flex items-center",children:e.jsx("img",{src:X8e,alt:"LevelUp",className:"h-8"})}),e.jsx("nav",{className:"hidden md:flex items-center gap-6",children:e.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"})})]})})}),e.jsxs("section",{className:"relative bg-cover bg-center py-20 md:py-32",style:{backgroundImage:`url(${gct})`},children:[e.jsx("div",{className:"absolute inset-0 bg-black/40"}),e.jsxs("div",{className:"relative max-w-7xl mx-auto px-4",children:[e.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"}),e.jsx("p",{className:"text-white/90 text-center mb-10 text-lg md:text-xl drop-shadow",children:"Exclusive listings from LevelUp agents"}),e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsxs("div",{className:"flex gap-0 shadow-2xl rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"relative flex-1 bg-white",children:[e.jsx(Qn,{className:"absolute left-4 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-400"}),e.jsx(Qe,{placeholder:"Enter an address, neighborhood, city, or ZIP code",value:t,onChange:y=>r(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"})]}),e.jsx(Q,{className:"h-14 md:h-16 px-6 md:px-8 rounded-none bg-blue-600 hover:bg-blue-700",children:e.jsx(Qn,{className:"h-5 w-5 md:h-6 md:w-6"})})]}),e.jsx("div",{className:"flex justify-center mt-6",children:e.jsxs(Q,{variant:"secondary",size:"sm",onClick:()=>n(!s),className:"gap-2 bg-white/90 hover:bg-white text-gray-700 shadow-lg",children:[e.jsx(BA,{className:"h-4 w-4"}),s?"Hide Filters":"More Filters"]})}),s&&e.jsxs("div",{className:"mt-4 p-6 bg-white rounded-lg shadow-xl",children:[e.jsxs("div",{className:"grid sm:grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Status"}),e.jsxs(ds,{value:a.status||"all",onValueChange:y=>o({...a,status:y==="all"?"":y}),children:[e.jsx(ls,{className:"bg-white",children:e.jsx(us,{placeholder:"Any status"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"Any status"}),Object.entries(iNe).map(([y,v])=>e.jsx(Ut,{value:y,children:v},y))]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Property Type"}),e.jsxs(ds,{value:a.propertyType||"all",onValueChange:y=>o({...a,propertyType:y==="all"?"":y}),children:[e.jsx(ls,{className:"bg-white",children:e.jsx(us,{placeholder:"Any type"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"Any type"}),Object.entries(Jct).map(([y,v])=>e.jsx(Ut,{value:y,children:v},y))]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Min Price"}),e.jsx(Qe,{type:"number",placeholder:"No min",value:a.minPrice,onChange:y=>o({...a,minPrice:y.target.value}),className:"bg-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Max Price"}),e.jsx(Qe,{type:"number",placeholder:"No max",value:a.maxPrice,onChange:y=>o({...a,maxPrice:y.target.value}),className:"bg-white"})]})]}),g&&e.jsx("div",{className:"flex justify-end mt-4",children:e.jsxs(Q,{variant:"ghost",size:"sm",onClick:m,className:"gap-1 text-gray-500",children:[e.jsx(rn,{className:"h-4 w-4"}),"Clear all"]})})]})]})]})]}),l&&l.length>0&&e.jsx("section",{className:"py-8 bg-white border-b border-gray-200",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-4",children:"Explore on Map"}),e.jsx(vct,{listings:l,isLoading:i})]})}),e.jsx("section",{className:"py-8",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4",children:i?e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5",children:[...Array(8)].map((y,v)=>e.jsxs("div",{className:"bg-white rounded-lg overflow-hidden shadow-sm",children:[e.jsx(fr,{className:"aspect-[4/3]"}),e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsx(fr,{className:"h-7 w-28"}),e.jsx(fr,{className:"h-4 w-full"}),e.jsx(fr,{className:"h-4 w-3/4"})]})]},v))}):l&&l.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex items-center justify-between mb-6",children:e.jsxs("h2",{className:"text-xl font-semibold text-gray-900",children:[l.length," ",l.length===1?"Home":"Homes"," Available"]})}),e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5",children:l.map(y=>{var j,S,A;const v=((j=y.photos)==null?void 0:j.find(M=>M.is_primary))||((S=y.photos)==null?void 0:S[0]),N=window.location.hostname==="listings.relevelup.com"||window.location.hostname.startsWith("listings.")?`/${y.slug||y.id}`:`/public/listing/${y.slug||y.id}`;return e.jsx(go,{to:N,children:e.jsxs("div",{className:"bg-white rounded-lg overflow-hidden shadow-sm hover:shadow-lg transition-shadow cursor-pointer group border border-gray-100",children:[e.jsxs("div",{className:"aspect-[4/3] relative overflow-hidden bg-gray-100",children:[v?e.jsx("img",{src:v.photo_url,alt:y.property_address||y.city,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(Wn,{className:"h-12 w-12 text-gray-300"})}),e.jsx(bt,{className:`absolute top-2 left-2 ${Qct[y.status]} text-white border-0 text-xs font-medium px-2 py-0.5`,children:iNe[y.status]}),e.jsx("button",{className:"absolute top-2 right-2 p-2 rounded-full bg-white/80 hover:bg-white transition-colors",onClick:M=>M.preventDefault(),children:e.jsx(Ci,{className:"h-5 w-5 text-gray-600"})})]}),e.jsxs("div",{className:"p-4",children:[e.jsx("p",{className:"text-xl font-bold text-gray-900 mb-1",children:d(y.price)}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-gray-700 mb-2",children:[y.bedrooms&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-semibold",children:y.bedrooms}),e.jsx("span",{className:"text-gray-500",children:"bds"}),e.jsx("span",{className:"text-gray-300 mx-1",children:"|"})]}),y.bathrooms&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-semibold",children:y.bathrooms}),e.jsx("span",{className:"text-gray-500",children:"ba"}),e.jsx("span",{className:"text-gray-300 mx-1",children:"|"})]}),y.square_footage&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-semibold",children:y.square_footage.toLocaleString()}),e.jsx("span",{className:"text-gray-500",children:"sqft"})]})]}),y.property_address&&e.jsx("p",{className:"text-sm text-gray-700 truncate",children:y.property_address}),e.jsxs("p",{className:"text-sm text-gray-500 truncate",children:[y.city,", ",y.state]}),y.agent&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-100",children:[e.jsx("p",{className:"text-xs text-gray-500 truncate",children:y.agent.name}),((A=y.agent.brokerage)==null?void 0:A.name)&&e.jsx("p",{className:"text-xs text-gray-400 truncate",children:y.agent.brokerage.name})]})]})]})},y.id)})})]}):e.jsxs("div",{className:"text-center py-16",children:[e.jsx("div",{className:"w-20 h-20 mx-auto mb-4 rounded-full bg-gray-100 flex items-center justify-center",children:e.jsx(Wn,{className:"h-10 w-10 text-gray-400"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"No listings found"}),e.jsx("p",{className:"text-gray-500 mb-6",children:g?"Try adjusting your search or filters":"Check back soon for new listings"}),g&&e.jsx(Q,{variant:"outline",onClick:m,children:"Clear filters"})]})})}),e.jsx("footer",{className:"bg-gray-900 text-white py-10 mt-auto",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4",children:e.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("img",{src:iye,alt:"LevelUp",className:"h-6"})}),e.jsxs("p",{className:"text-gray-400 text-sm",children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),e.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:t,...r},s)=>e.jsx("div",{ref:s,className:qt("rounded-lg border bg-card text-card-foreground shadow-sm",t),...r}));ze.displayName="Card";const Wt=E.forwardRef(({className:t,...r},s)=>e.jsx("div",{ref:s,className:qt("flex flex-col space-y-1.5 p-6",t),...r}));Wt.displayName="CardHeader";const Zt=E.forwardRef(({className:t,...r},s)=>e.jsx("h3",{ref:s,className:qt("text-2xl font-semibold leading-none tracking-tight",t),...r}));Zt.displayName="CardTitle";const Ss=E.forwardRef(({className:t,...r},s)=>e.jsx("p",{ref:s,className:qt("text-sm text-muted-foreground",t),...r}));Ss.displayName="CardDescription";const qe=E.forwardRef(({className:t,...r},s)=>e.jsx("div",{ref:s,className:qt("p-6 pt-0",t),...r}));qe.displayName="CardContent";const XA=E.forwardRef(({className:t,...r},s)=>e.jsx("div",{ref:s,className:qt("flex items-center p-6 pt-0",t),...r}));XA.displayName="CardFooter";var edt="Label",BOe=E.forwardRef((t,r)=>e.jsx(qs.label,{...t,ref:r,onMouseDown:s=>{var a;s.target.closest("button, input, select, textarea")||((a=t.onMouseDown)==null||a.call(t,s),!s.defaultPrevented&&s.detail>1&&s.preventDefault())}}));BOe.displayName=edt;var $Oe=BOe;const tdt=T3("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ee=E.forwardRef(({className:t,...r},s)=>e.jsx($Oe,{ref:s,className:qt(tdt(),t),...r}));Ee.displayName=$Oe.displayName;const Kte="/assets/levelup-logo-color-D3mY9gCJ.png";function rdt(){const t=Uh(),r=window.location.hostname;if(!(r==="listings.relevelup.com"||r.startsWith("listings.")))return null;const n=t.pathname.slice(1);return!n||n===""?e.jsx(zOe,{}):n.startsWith("public/")?null:e.jsx(sdt,{slug:n})}function sdt({slug:t}){return e.jsx(idt,{slug:t})}const ndt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},adt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},oNe={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function idt({slug:t}){var W,X;const{data:r,isLoading:s}=ROe(t),n=FOe(),[a,o]=E.useState(""),[l,i]=E.useState(""),[d,m]=E.useState(""),[g,y]=E.useState(""),[v,b]=E.useState(!1),[N,j]=E.useState(!1),[S,A]=E.useState(null),M=se=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(se),I=async se=>{if(se.preventDefault(),!(!a.trim()||!d.trim()||!r)){b(!0);try{await n.mutateAsync({listingId:r.id,agentId:r.agent_id,firstName:a.trim(),lastName:l.trim(),email:d.trim(),phone:g.trim()}),j(!0),Se.success("Thanks! The agent will be in touch soon.")}catch(ae){console.error("Lead submission error:",ae),Se.error(`Failed to submit: ${ae.message||"Please try again"}`)}finally{b(!1)}}},F=(r==null?void 0:r.photos)||[],O=F.find(se=>se.is_primary)||F[0],B=()=>{S!==null&&A(S===0?F.length-1:S-1)},$=()=>{S!==null&&A(S===F.length-1?0:S+1)};if(s)return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("header",{className:"border-b bg-card",children:e.jsx("div",{className:"container mx-auto px-4 py-4",children:e.jsx(fr,{className:"h-8 w-32"})})}),e.jsxs("div",{className:"container mx-auto px-4 py-8",children:[e.jsx(fr,{className:"h-10 w-48 mb-6"}),e.jsx(fr,{className:"aspect-video mb-6"}),e.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"md:col-span-2 space-y-4",children:[e.jsx(fr,{className:"h-12 w-48"}),e.jsx(fr,{className:"h-6 w-full"}),e.jsx(fr,{className:"h-6 w-3/4"})]}),e.jsx(fr,{className:"h-64"})]})]})]});if(!r)return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("header",{className:"border-b bg-card",children:e.jsx("div",{className:"container mx-auto px-4 py-4",children:e.jsx("a",{href:"/",className:"flex items-center gap-2",children:e.jsx("img",{src:Kte,alt:"LevelUp",className:"h-8"})})})}),e.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[e.jsx(Wn,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Listing Not Found"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing may no longer be available."}),e.jsx(Q,{asChild:!0,children:e.jsx("a",{href:"/",children:"Browse All Listings"})})]})]});const H=r.property_address?`${r.property_address} - ${r.city}, ${r.state}`:`${r.city}, ${r.state} Home for Sale`;return e.jsxs(e.Fragment,{children:[e.jsxs(qh,{children:[e.jsxs("title",{children:[H," | LevelUp Listings"]}),e.jsx("meta",{name:"description",content:`${M(r.price)} - ${r.bedrooms||""}BD ${r.bathrooms||""}BA ${r.square_footage?r.square_footage.toLocaleString()+" sqft":""} ${oNe[r.property_type]} in ${r.city}, ${r.state}. ${((W=r.description)==null?void 0:W.slice(0,150))||""}`}),e.jsx("meta",{property:"og:title",content:H}),e.jsx("meta",{property:"og:description",content:`${M(r.price)} - ${r.bedrooms||""}BD ${r.bathrooms||""}BA in ${r.city}, ${r.state}`}),e.jsx("meta",{property:"og:type",content:"website"}),O&&e.jsx("meta",{property:"og:image",content:O.photo_url})]}),e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("header",{className:"border-b bg-card sticky top-0 z-50",children:e.jsx("div",{className:"container mx-auto px-4 py-4",children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("a",{href:"/",className:"flex items-center gap-2",children:e.jsx("img",{src:Kte,alt:"LevelUp",className:"h-8"})})})})}),e.jsxs("div",{className:"container mx-auto px-4 py-6",children:[e.jsxs("a",{href:"/",className:"inline-flex items-center text-muted-foreground hover:text-foreground mb-6",children:[e.jsx(_i,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),F.length>0&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-8",children:[e.jsx("div",{className:"md:col-span-2",children:e.jsx("div",{className:"aspect-[16/10] rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>A(0),children:e.jsx("img",{src:O==null?void 0:O.photo_url,alt:"Primary",className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"})})}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:F.slice(1,5).map((se,ae)=>e.jsxs("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer relative",onClick:()=>A(ae+1),children:[e.jsx("img",{src:se.photo_url,alt:`Photo ${ae+2}`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"}),ae===3&&F.length>5&&e.jsxs("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center text-white font-semibold",children:["+",F.length-5," more"]})]},se.id))})]}),e.jsxs("div",{className:"grid md:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"md:col-span-2 space-y-6",children:[e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center gap-2 mb-3",children:e.jsx(bt,{className:`${ndt[r.status]} text-white border-0`,children:adt[r.status]})}),e.jsx("h1",{className:"text-4xl font-bold text-primary mb-2",children:M(r.price)}),r.property_address&&e.jsx("p",{className:"text-xl font-medium",children:r.property_address}),e.jsxs("p",{className:"text-muted-foreground flex items-center gap-1",children:[e.jsx(eo,{className:"h-4 w-4"}),r.city,", ",r.state,r.neighborhood&&` • ${r.neighborhood}`]})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 py-4 border-y",children:[r.bedrooms&&e.jsxs("div",{className:"text-center",children:[e.jsx(H1,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),e.jsx("p",{className:"text-xl font-semibold",children:r.bedrooms}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Beds"})]}),r.bathrooms&&e.jsxs("div",{className:"text-center",children:[e.jsx(V1,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),e.jsx("p",{className:"text-xl font-semibold",children:r.bathrooms}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Baths"})]}),r.square_footage&&e.jsxs("div",{className:"text-center",children:[e.jsx(Yg,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),e.jsx("p",{className:"text-xl font-semibold",children:r.square_footage.toLocaleString()}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Sq Ft"})]}),r.year_built&&e.jsxs("div",{className:"text-center",children:[e.jsx(Mn,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),e.jsx("p",{className:"text-xl font-semibold",children:r.year_built}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Built"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(bt,{variant:"secondary",children:[e.jsx(bi,{className:"h-3 w-3 mr-1"}),oNe[r.property_type]]}),r.lot_size&&e.jsxs(bt,{variant:"secondary",children:["Lot: ",r.lot_size]}),r.has_hoa&&e.jsx(bt,{variant:"secondary",children:"HOA"})]}),r.description&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold mb-2",children:"About This Property"}),e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:r.description})]}),r.agent_notes&&r.agent_notes_public&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Agent Notes"}),e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:r.agent_notes})]}),r.mls_link&&e.jsx(Q,{variant:"outline",asChild:!0,children:e.jsxs("a",{href:r.mls_link,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(En,{className:"h-4 w-4 mr-2"}),"View on MLS"]})})]})]}),e.jsxs("div",{className:"space-y-6",children:[r.agent&&e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:[e.jsx(Kl,{className:"h-5 w-5"}),"Listing Agent"]})}),e.jsxs(qe,{children:[e.jsx("p",{className:"font-semibold text-lg",children:r.agent.name}),((X=r.agent.brokerage)==null?void 0:X.name)&&e.jsx("p",{className:"text-sm text-muted-foreground",children:r.agent.brokerage.name})]})]}),e.jsxs(ze,{className:"border-primary",children:[e.jsx(Wt,{children:e.jsx(Zt,{className:"text-lg",children:"Interested in this property?"})}),e.jsx(qe,{children:N?e.jsxs("div",{className:"text-center py-4",children:[e.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-3",children:e.jsx(mn,{className:"h-6 w-6 text-primary"})}),e.jsx("p",{className:"font-medium",children:"Thanks for your interest!"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"The listing agent will contact you soon."})]}):e.jsxs("form",{onSubmit:I,className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"firstName",children:"First Name *"}),e.jsx(Qe,{id:"firstName",type:"text",placeholder:"John",value:a,onChange:se=>o(se.target.value),required:!0})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"lastName",children:"Last Name"}),e.jsx(Qe,{id:"lastName",type:"text",placeholder:"Doe",value:l,onChange:se=>i(se.target.value)})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"email",children:"Email *"}),e.jsx(Qe,{id:"email",type:"email",placeholder:"you@example.com",value:d,onChange:se=>m(se.target.value),required:!0})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"phone",children:"Phone"}),e.jsx(Qe,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:g,onChange:se=>y(se.target.value)})]}),e.jsx(Q,{type:"submit",className:"w-full",disabled:v,children:v?"Submitting...":"Get More Info"}),e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"The listing agent will reach out to you directly."})]})})]})]})]})]}),e.jsx(Dr,{open:S!==null,onOpenChange:()=>A(null),children:e.jsxs(Lr,{className:"max-w-5xl p-0 bg-black/95",children:[e.jsx(Ur,{className:"sr-only",children:e.jsx(Br,{children:"Photo Gallery"})}),e.jsx("button",{onClick:()=>A(null),className:"absolute right-4 top-4 z-50 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:e.jsx(rn,{className:"h-5 w-5"})}),S!==null&&F[S]&&e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:F[S].photo_url,alt:`Photo ${S+1}`,className:"w-full max-h-[80vh] object-contain"}),F.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:B,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:e.jsx(uc,{className:"h-6 w-6"})}),e.jsx("button",{onClick:$,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:e.jsx(Wi,{className:"h-6 w-6"})}),e.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:[S+1," / ",F.length]})]})]})]})}),e.jsx("footer",{className:"border-t py-8 mt-16",children:e.jsxs("div",{className:"container mx-auto px-4 text-center text-sm text-muted-foreground",children:[e.jsxs("p",{children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),e.jsx("p",{className:"mt-2",children:e.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground",children:"relevelup.com"})})]})})]})]})}function Gne({card:t,variant:r}){const s=t.brokerage_display_name||t.brokerage_logo_url,n=t.team_name||t.team_logo_url;if(!s&&!n)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]"}}[r];return e.jsx("div",{className:`rounded-2xl p-4 mb-6 ${a.container}`,children:e.jsxs("div",{className:`flex flex-col items-center gap-3 ${s&&n?"divide-y divide-current/10":""}`,children:[s&&e.jsxs("div",{className:"flex flex-col items-center gap-1.5 w-full",children:[t.brokerage_logo_url&&e.jsx("img",{src:t.brokerage_logo_url,alt:t.brokerage_display_name||"Brokerage",style:{height:`${t.brokerage_logo_size||56}px`},className:"max-w-[280px] object-contain"}),t.brokerage_display_name&&!t.brokerage_logo_url&&e.jsx("p",{className:`text-sm font-medium ${a.text}`,children:t.brokerage_display_name})]}),n&&e.jsxs("div",{className:`flex flex-col items-center gap-1.5 w-full ${s?"pt-3":""}`,children:[t.team_logo_url&&e.jsx("img",{src:t.team_logo_url,alt:t.team_name||"Team",style:{height:`${t.team_logo_size||56}px`},className:"max-w-[280px] object-contain"}),t.team_name&&!t.team_logo_url&&e.jsx("p",{className:`text-sm font-medium ${a.text}`,children:t.team_name})]})]})})}const UOe=t=>Ht({queryKey:["agent-card-public",t],queryFn:async()=>{if(!t)throw new Error("No slug provided");const{data:r,error:s}=await Z.from("agent_cards").select("*").eq("slug",t).eq("is_published",!0).single();if(s)throw s;const{data:n}=await Z.from("profiles").select("name, email, phone, brokerage_id").eq("id",r.user_id).single();let a=null;if(n!=null&&n.brokerage_id){const{data:i}=await Z.from("brokerages").select("name").eq("id",n.brokerage_id).single();a=(i==null?void 0:i.name)||null}let o=null;try{const{data:i}=await Z.from("profiles").select("avatar_url").eq("id",r.user_id).single();if(i!=null&&i.avatar_url)o=i.avatar_url;else{const{data:d}=await Z.storage.from("avatars").list(`${r.user_id}`);if(d&&d.length>0){const{data:m}=Z.storage.from("avatars").getPublicUrl(`${r.user_id}/${d[0].name}`);o=`${m.publicUrl}?t=${Date.now()}`}}}catch{}const l={...n||{name:null,email:null,phone:null,brokerage_id:null},email:r.display_email||(n==null?void 0:n.email)||null};return{...r,social_links:r.social_links||[],profile:l,brokerage_name:r.brokerage_display_name||a,avatar_url:o}},enabled:!!t}),odt=()=>Ht({queryKey:["agent-cards-admin"],queryFn:async()=>{const{data:t,error:r}=await Z.from("agent_cards").select("*").order("created_at",{ascending:!1});if(r)throw r;return t}}),ldt=t=>Ht({queryKey:["agent-card",t],queryFn:async()=>{if(!t)return null;const{data:r,error:s}=await Z.from("agent_cards").select("*").eq("user_id",t).maybeSingle();if(s)throw s;return r},enabled:!!t}),qOe=()=>{const t=qr();return Jt({mutationFn:async r=>{const{data:s,error:n}=await Z.from("agent_cards").insert(r).select().single();if(n)throw n;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["agent-cards-admin"]}),t.invalidateQueries({queryKey:["agent-card"]}),Se.success("Agent card created")},onError:r=>Se.error(r.message)})},VOe=()=>{const t=qr();return Jt({mutationFn:async({id:r,...s})=>{const{data:n,error:a}=await Z.from("agent_cards").update(s).eq("id",r).select().single();if(a)throw a;return n},onSuccess:(r,s)=>{t.invalidateQueries({queryKey:["agent-cards-admin"]}),t.invalidateQueries({queryKey:["agent-card"]}),Se.success("Agent card updated")},onError:r=>Se.error(r.message)})},Vi=async(t,r,s,n)=>{const a=new URLSearchParams(window.location.search);await Z.from("agent_card_interactions").insert({card_id:t,interaction_type:r,interaction_detail:s||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:{}})},cdt=async(t,r)=>{const{error:s}=await Z.from("agent_card_leads").insert({card_id:t,...r});if(s)throw s},HOe=t=>Ht({queryKey:["agent-card-analytics",t],queryFn:async()=>{if(!t)return null;const{data:r,error:s}=await Z.from("agent_card_interactions").select("interaction_type, interaction_detail, created_at").eq("card_id",t).order("created_at",{ascending:!1}).limit(500);if(s)throw s;const{data:n,error:a}=await Z.from("agent_card_leads").select("*").eq("card_id",t).order("created_at",{ascending:!1});if(a)throw a;const o=(r==null?void 0:r.filter(d=>d.interaction_type==="card_view").length)||0,l=(r==null?void 0:r.filter(d=>d.interaction_type==="button_click").length)||0,i=(r==null?void 0:r.filter(d=>d.interaction_type==="contact_saved").length)||0;return{views:o,clicks:l,saves:i,leads:n||[],interactions:r||[]}},enabled:!!t});function Kne({open:t,onOpenChange:r,cardId:s,type:n,agentName:a}){const[o,l]=E.useState(""),[i,d]=E.useState(""),[m,g]=E.useState(""),[y,v]=E.useState(""),[b,N]=E.useState(""),[j,S]=E.useState(!1),A=async M=>{if(M.preventDefault(),!o.trim()){Se.error("Please enter your name");return}S(!0);try{await cdt(s,{lead_type:n,name:o.trim(),email:i.trim()||void 0,phone:m.trim()||void 0,message:b.trim()||void 0,intent:y||void 0}),Vi(s,"lead_submitted",n),Z.functions.invoke("card-lead-notify",{body:{cardId:s,leadType:n,name:o.trim(),email:i.trim()||void 0,phone:m.trim()||void 0,message:b.trim()||void 0,intent:y||void 0}}).catch(I=>console.error("Card lead notify failed:",I)),Se.success(n==="booking"?"Request sent! They'll be in touch soon.":n==="connect"?"Info shared! They'll be in touch soon.":"Referral submitted! Thank you."),r(!1),l(""),d(""),g(""),v(""),N("")}catch{Se.error("Something went wrong. Please try again.")}finally{S(!1)}};return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"sm:max-w-md rounded-2xl",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:n==="booking"?"Book a Call":n==="connect"?"Connect with Me":"Refer a Friend"}),e.jsx(Gs,{children:n==="booking"?`Let ${a} know you'd like to connect.`:n==="connect"?`Share your info and ${a} will reach out.`:`Know someone who could use ${a}'s help?`})]}),e.jsxs("form",{onSubmit:A,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"lead-name",children:"Name *"}),e.jsx(Qe,{id:"lead-name",value:o,onChange:M=>l(M.target.value),placeholder:"Your name",required:!0})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"lead-phone",children:"Phone"}),e.jsx(Qe,{id:"lead-phone",type:"tel",value:m,onChange:M=>g(M.target.value),placeholder:"(555) 123-4567"})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"lead-email",children:"Email"}),e.jsx(Qe,{id:"lead-email",type:"email",value:i,onChange:M=>d(M.target.value),placeholder:"you@example.com"})]}),n==="booking"&&e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"lead-intent",children:"I'm looking to..."}),e.jsxs(ds,{value:y,onValueChange:v,children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Select one"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"buy",children:"Buy a home"}),e.jsx(Ut,{value:"sell",children:"Sell my home"}),e.jsx(Ut,{value:"both",children:"Buy & Sell"}),e.jsx(Ut,{value:"other",children:"Something else"})]})]})]}),n!=="connect"&&e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"lead-message",children:n==="referral"?"Tell us about them":"Message (optional)"}),e.jsx(Qe,{id:"lead-message",value:b,onChange:M=>N(M.target.value),placeholder:n==="referral"?"Their name, phone, situation...":"Anything you'd like us to know"})]}),e.jsx(Q,{type:"submit",className:"w-full rounded-2xl",disabled:j,children:j?"Sending...":"Submit"})]})]})})}const ddt=t=>Ht({queryKey:["card-blocks",t],queryFn:async()=>{if(!t)return[];const{data:r,error:s}=await Z.from("card_blocks").select("*").eq("card_id",t).eq("is_visible",!0).order("sort_order",{ascending:!0});if(s)throw s;return r||[]},enabled:!!t}),udt=t=>Ht({queryKey:["card-blocks-all",t],queryFn:async()=>{if(!t)return[];const{data:r,error:s}=await Z.from("card_blocks").select("*").eq("card_id",t).order("sort_order",{ascending:!0});if(s)throw s;return r||[]},enabled:!!t}),hdt=()=>{const t=qr();return Jt({mutationFn:async r=>{const{data:s,error:n}=await Z.from("card_blocks").insert(r).select().single();if(n)throw n;return s},onSuccess:(r,s)=>{t.invalidateQueries({queryKey:["card-blocks",s.card_id]}),t.invalidateQueries({queryKey:["card-blocks-all",s.card_id]}),Se.success("Block added")},onError:r=>Se.error(r.message)})},mdt=()=>{const t=qr();return Jt({mutationFn:async({id:r,...s})=>{const{data:n,error:a}=await Z.from("card_blocks").update(s).eq("id",r).select().single();if(a)throw a;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["card-blocks"]}),t.invalidateQueries({queryKey:["card-blocks-all"]}),Se.success("Block updated")},onError:r=>Se.error(r.message)})},pdt=()=>{const t=qr();return Jt({mutationFn:async r=>{const{error:s}=await Z.from("card_blocks").delete().eq("id",r);if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["card-blocks"]}),t.invalidateQueries({queryKey:["card-blocks-all"]}),Se.success("Block removed")},onError:r=>Se.error(r.message)})};function fdt(t){const r=t.match(/(?:iframe\.mediadelivery\.net\/embed\/|video\.bunnycdn\.com\/play\/)(\d+)\/([a-f0-9-]+)/i);return r?`https://iframe.mediadelivery.net/embed/${r[1]}/${r[2]}?autoplay=false&responsive=true`:(t.includes("iframe.mediadelivery.net"),t)}function gdt(t){const r=t.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/);return r?`https://www.youtube.com/embed/${r[1]}`:null}const xdt={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 ydt({block:t,variant:r}){const s=t.config;if(!s.video_url)return null;const n=s.video_url.includes("mediadelivery.net")||s.video_url.includes("bunnycdn.com"),a=gdt(s.video_url),o=n||!!a,l=n?fdt(s.video_url):a||s.video_url;return e.jsx("div",{className:xdt[r],children:o?e.jsx("div",{style:{position:"relative",paddingTop:"56.25%"},children:e.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})}):e.jsx("video",{src:s.video_url,controls:!0,className:"w-full",preload:"metadata"})})}const vdt={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 _dt({block:t,variant:r}){const n=t.config.testimonials||[],[a,o]=E.useState(0);if(n.length===0)return null;const l=vdt[r],i=n[a];return e.jsxs("div",{className:l.container,children:[e.jsxs("div",{className:l.card,children:[e.jsx(LA,{className:"h-4 w-4 mb-2 opacity-30"}),e.jsxs("p",{className:`${l.quote} mb-3`,children:['"',i.quote,'"']}),e.jsxs("div",{children:[e.jsx("p",{className:l.name,children:i.name}),i.role&&e.jsx("p",{className:l.role,children:i.role})]})]}),n.length>1&&e.jsxs("div",{className:"flex items-center justify-center gap-3 mt-3",children:[e.jsx("button",{onClick:()=>o(d=>(d-1+n.length)%n.length),className:l.nav,children:e.jsx(uc,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex gap-1.5",children:n.map((d,m)=>e.jsx("div",{className:`h-1.5 w-1.5 rounded-full transition-colors cursor-pointer ${m===a?l.dot:l.dotInactive}`,onClick:()=>o(m)},m))}),e.jsx("button",{onClick:()=>o(d=>(d+1)%n.length),className:l.nav,children:e.jsx(Wi,{className:"h-4 w-4"})})]})]})}const bdt={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 wdt({block:t,variant:r}){const n=t.config.tags||[];if(n.length===0)return null;const a=bdt[r];return e.jsx("div",{className:a.container,children:n.map((o,l)=>e.jsx("span",{className:a.tag,children:o},l))})}const jdt={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 kdt({block:t,cardId:r,variant:s}){const a=t.config.links||[];if(a.length===0)return null;const o=jdt[s];return e.jsx("div",{className:o.container,children:a.map((l,i)=>e.jsxs("a",{href:l.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Vi(r,"button_click",`custom_link_${l.label}`),className:o.link,children:[e.jsx("span",{children:l.label}),e.jsx(En,{className:`h-4 w-4 ${o.icon}`})]},i))})}const _me={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 Ndt({path:t,color:r,size:s=20}){return e.jsx("svg",{viewBox:"0 0 24 24",width:s,height:s,fill:r,children:e.jsx("path",{d:t})})}const Sdt={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 Cdt({block:t,cardId:r,variant:s}){const a=t.config.platforms||[],o=Sdt[s];return a.length===0?null:e.jsxs("div",{className:o.container,children:[e.jsx("h3",{className:o.title,children:"Follow Me"}),e.jsx("div",{className:"flex flex-wrap gap-3 justify-center",children:a.map((l,i)=>{const d=_me[l.platform.toLowerCase()];return!d||!l.url?null:e.jsx("a",{href:l.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Vi(r,"button_click",`social_${l.platform}`),className:o.linkClass,title:d.label,children:e.jsx(Ndt,{path:d.icon,color:d.color})},i)})})]})}function Zne({cardId:t,variant:r}){const{data:s}=ddt(t);if(!s||s.length===0)return null;const n=s.filter(l=>l.block_type==="social_media"&&l.is_visible),a=s.filter(l=>l.block_type!=="social_media"),o=n.length>0?{...n[0],config:{platforms:n.flatMap(l=>l.config.platforms||[])}}:null;return s.findIndex(l=>l.block_type==="social_media"),e.jsxs(e.Fragment,{children:[a.map(l=>{switch(l.block_type){case"video_intro":return e.jsx(ydt,{block:l,variant:r},l.id);case"testimonials":return e.jsx(_dt,{block:l,variant:r},l.id);case"specialties":return e.jsx(wdt,{block:l,variant:r},l.id);case"custom_links":return e.jsx(kdt,{block:l,cardId:t,variant:r},l.id);default:return null}}),o&&e.jsx(Cdt,{block:o,cardId:t,variant:r})]})}async function Mdt(t){try{const r=await fetch(t);if(!r.ok)return null;const s=await r.blob(),n=s.type||"image/jpeg";return new Promise(a=>{const o=new FileReader;o.onloadend=()=>{const i=o.result.split(",")[1];a({base64:i,mimeType:n})},o.onerror=()=>a(null),o.readAsDataURL(s)})}catch{return null}}function Tdt(t){const r=t.trim().split(/\s+/);if(r.length<=1)return{first:r[0]||"",last:""};const s=r.pop();return{first:r.join(" "),last:s}}async function Yne(t){const{first:r,last:s}=Tdt(t.name),n=["BEGIN:VCARD","VERSION:3.0",`FN:${t.name}`,`N:${s};${r};;;`];if(t.phone&&n.push(`TEL;TYPE=CELL:${t.phone}`),t.email&&n.push(`EMAIL;TYPE=INTERNET:${t.email}`),t.brokerage&&n.push(`ORG:${t.brokerage}`),n.push(`URL:${t.cardUrl}`),t.avatarUrl){const i=await Mdt(t.avatarUrl);if(i){const m={"image/jpeg":"JPEG","image/jpg":"JPEG","image/png":"PNG","image/gif":"GIF","image/webp":"JPEG"}[i.mimeType]||"JPEG";n.push(`PHOTO;ENCODING=b;TYPE=${m}:${i.base64}`)}}n.push("END:VCARD");const a=new Blob([n.join(`\r `)],{type:"text/vcard"}),o=URL.createObjectURL(a),l=document.createElement("a");l.href=o,l.download=`${t.name.replace(/\s+/g,"_")}.vcf`,l.click(),URL.revokeObjectURL(o),Se.success("Contact saved!")}function Adt({card:t}){var A;const[r,s]=E.useState(!1),[n,a]=E.useState("booking"),o=((A=t.profile)==null?void 0:A.name)||"Agent",l=o.split(" ").map(M=>M[0]).join("").toUpperCase().slice(0,2),i=(M,I)=>{Vi(t.id,"button_click",M),I()},d=()=>i("call",()=>{var M;(M=t.profile)!=null&&M.phone?window.location.href=`tel:${t.profile.phone}`:Se.error("Phone number not available")}),m=()=>i("text",()=>{var M;(M=t.profile)!=null&&M.phone?window.location.href=`sms:${t.profile.phone}`:Se.error("Phone number not available")}),g=()=>i("email",()=>{var M;(M=t.profile)!=null&&M.email?window.location.href=`mailto:${t.profile.email}`:Se.error("Email not available")}),y=()=>{t.booking_url?i("book",()=>window.open(t.booking_url,"_blank")):(a("booking"),s(!0),Vi(t.id,"button_click","book"))},v=()=>{var M,I;Vi(t.id,"contact_saved"),Yne({name:o,phone:(M=t.profile)==null?void 0:M.phone,email:(I=t.profile)==null?void 0:I.email,brokerage:t.brokerage_name,avatarUrl:t.avatar_url,cardUrl:window.location.href})},b=async()=>{if(Vi(t.id,"share_event"),navigator.share)try{await navigator.share({title:`${o} - Real Estate Agent`,text:t.positioning_statement||`Connect with ${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),Se.success("Link copied!")},N=()=>{a("referral"),s(!0),Vi(t.id,"button_click","refer")},j=()=>{a("connect"),s(!0),Vi(t.id,"button_click","connect")},S={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return e.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 via-white to-slate-50",children:[e.jsxs("div",{className:"max-w-md mx-auto px-5 py-10",children:[e.jsxs("div",{className:"text-center mb-8",children:[t.show_photo&&e.jsxs(ln,{className:"h-28 w-28 mx-auto mb-4 ring-4 ring-white shadow-lg",children:[e.jsx(pa,{src:t.avatar_url||void 0,alt:o}),e.jsx(cn,{className:"text-2xl font-semibold bg-primary text-primary-foreground",children:l})]}),e.jsx("h1",{className:"text-2xl font-bold text-slate-900 mb-0.5",children:o}),t.title&&e.jsx("p",{className:"text-sm font-medium text-primary mb-1",children:t.title}),t.brokerage_name&&!t.brokerage_logo_url&&e.jsx("p",{className:"text-sm font-medium text-slate-500 mb-1",children:t.brokerage_name}),t.team_name&&!t.team_logo_url&&e.jsx("p",{className:"text-xs font-medium text-slate-400 mb-3",children:t.team_name}),t.positioning_statement&&e.jsxs("p",{className:"text-base text-slate-600 italic leading-relaxed max-w-xs mx-auto",children:['"',t.positioning_statement,'"']})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[e.jsxs(Q,{onClick:d,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:[e.jsx(wi,{className:"h-5 w-5"}),e.jsx("span",{className:"text-xs font-medium",children:"Call"})]}),e.jsxs(Q,{onClick:m,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:[e.jsx($o,{className:"h-5 w-5"}),e.jsx("span",{className:"text-xs font-medium",children:"Text"})]}),e.jsxs(Q,{onClick:g,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:[e.jsx(mn,{className:"h-5 w-5"}),e.jsx("span",{className:"text-xs font-medium",children:"Email"})]})]}),e.jsxs(Q,{onClick:y,className:"w-full h-12 text-base font-semibold rounded-2xl shadow-sm mb-6",variant:"outline",children:[e.jsx(Mn,{className:"h-5 w-5 mr-2"}),t.custom_cta_label||"Book a Call"]}),t.show_credentials&&t.review_snippet&&e.jsx("div",{className:"flex items-center justify-center gap-4 mb-6 text-sm text-slate-600",children:e.jsxs("div",{className:"text-center flex items-center gap-1",children:[e.jsx(Ln,{className:"h-4 w-4 text-amber-500 fill-amber-500"}),e.jsx("span",{className:"font-bold text-slate-900",children:"5.0"})]})}),t.review_snippet&&e.jsx("div",{className:"bg-slate-50 rounded-2xl p-4 mb-6 border border-slate-100",children:e.jsxs("p",{className:"text-sm text-slate-600 italic text-center",children:['"',t.review_snippet,'"']})}),t.show_bio&&t.bio&&e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"text-sm font-semibold text-slate-800 mb-2",children:"About Me"}),e.jsx("p",{className:"text-sm text-slate-600 leading-relaxed",children:t.bio})]}),e.jsx(Gne,{card:t,variant:"standard"}),e.jsx(Zne,{cardId:t.id,variant:"standard"}),e.jsxs("div",{className:"space-y-2 mb-6",children:[t.show_save_contact&&e.jsxs(Q,{variant:"ghost",onClick:v,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[e.jsx(Oi,{className:"h-4 w-4 mr-3 text-primary"}),"Save Contact"]}),t.show_leave_review&&t.review_source_url&&e.jsxs(Q,{variant:"ghost",onClick:()=>{Vi(t.id,"button_click","review"),window.open(t.review_source_url,"_blank")},className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[e.jsx(Ln,{className:"h-4 w-4 mr-3 text-amber-500"}),"Leave a Review"]}),t.show_refer_friend&&e.jsxs(Q,{variant:"ghost",onClick:N,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[e.jsx(ws,{className:"h-4 w-4 mr-3 text-primary"}),"Refer a Friend"]}),e.jsxs(Q,{variant:"ghost",onClick:j,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[e.jsx($d,{className:"h-4 w-4 mr-3 text-primary"}),"Connect with Me"]}),e.jsxs(Q,{variant:"ghost",onClick:b,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[e.jsx(Oc,{className:"h-4 w-4 mr-3 text-primary"}),"Share My Card"]})]}),t.show_social_links&&t.social_links&&t.social_links.length>0&&e.jsx("div",{className:"flex justify-center gap-4 mb-8",children:t.social_links.slice(0,3).map((M,I)=>e.jsx("a",{href:M.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Vi(t.id,"button_click",`social_${M.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:S[M.platform.toLowerCase()]||"🔗"},I))}),e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-xs text-slate-400",children:"Powered by LevelUp"})})]}),e.jsx(Kne,{open:r,onOpenChange:s,cardId:t.id,type:n,agentName:o})]})}function Edt({card:t}){var A;const[r,s]=E.useState(!1),[n,a]=E.useState("booking"),o=((A=t.profile)==null?void 0:A.name)||"Agent",l=o.split(" ").map(M=>M[0]).join("").toUpperCase().slice(0,2),i=(M,I)=>{Vi(t.id,"button_click",M),I()},d=()=>i("call",()=>{var M;(M=t.profile)!=null&&M.phone?window.location.href=`tel:${t.profile.phone}`:Se.error("Phone number not available")}),m=()=>i("text",()=>{var M;(M=t.profile)!=null&&M.phone?window.location.href=`sms:${t.profile.phone}`:Se.error("Phone number not available")}),g=()=>i("email",()=>{var M;(M=t.profile)!=null&&M.email?window.location.href=`mailto:${t.profile.email}`:Se.error("Email not available")}),y=()=>{t.booking_url?i("book",()=>window.open(t.booking_url,"_blank")):(a("booking"),s(!0),Vi(t.id,"button_click","book"))},v=()=>{var M,I;Vi(t.id,"contact_saved"),Yne({name:o,phone:(M=t.profile)==null?void 0:M.phone,email:(I=t.profile)==null?void 0:I.email,brokerage:t.brokerage_name,avatarUrl:t.avatar_url,cardUrl:window.location.href})},b=async()=>{if(Vi(t.id,"share_event"),navigator.share)try{await navigator.share({title:`${o} - Real Estate Agent`,text:t.positioning_statement||`Connect with ${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),Se.success("Link copied!")},N=()=>{a("referral"),s(!0),Vi(t.id,"button_click","refer")},j=()=>{a("connect"),s(!0),Vi(t.id,"button_click","connect")},S={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return e.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-[#0f1419] via-[#1a1f2e] to-[#0f1419]",children:[e.jsxs("div",{className:"max-w-md mx-auto px-5 py-10",children:[e.jsx("div",{className:"w-16 h-0.5 bg-gradient-to-r from-[#c9a84c] to-[#e8d48b] mx-auto mb-8"}),e.jsxs("div",{className:"text-center mb-8",children:[t.show_photo&&e.jsxs(ln,{className:"h-32 w-32 mx-auto mb-5 ring-2 ring-[#c9a84c]/40 shadow-2xl",children:[e.jsx(pa,{src:t.avatar_url||void 0,alt:o}),e.jsx(cn,{className:"text-2xl font-serif bg-[#c9a84c]/20 text-[#e8d48b]",children:l})]}),e.jsx("h1",{className:"text-2xl font-serif font-bold text-white tracking-wide mb-0.5",children:o}),t.title&&e.jsx("p",{className:"text-sm font-medium text-[#e8d48b] mb-1",children:t.title}),t.brokerage_name&&!t.brokerage_logo_url&&e.jsx("p",{className:"text-sm font-medium text-[#c9a84c] tracking-widest uppercase mb-1",children:t.brokerage_name}),t.team_name&&!t.team_logo_url&&e.jsx("p",{className:"text-xs font-medium text-[#a0aec0] mb-3",children:t.team_name}),t.positioning_statement&&e.jsxs("p",{className:"text-base text-[#a0aec0] italic leading-relaxed max-w-xs mx-auto font-serif",children:['"',t.positioning_statement,'"']})]}),e.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[{icon:wi,label:"Call",handler:d},{icon:$o,label:"Text",handler:m},{icon:mn,label:"Email",handler:g}].map(({icon:M,label:I,handler:F})=>e.jsxs("button",{onClick:F,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:[e.jsx(M,{className:"h-5 w-5 text-[#c9a84c]"}),e.jsx("span",{className:"text-xs font-medium text-[#e2e8f0]",children:I})]},I))}),e.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:[e.jsx(Mn,{className:"h-5 w-5"}),t.custom_cta_label||"Book a Call"]}),t.show_credentials&&t.review_snippet&&e.jsx("div",{className:"flex items-center justify-center gap-4 mb-6 text-sm",children:e.jsxs("div",{className:"text-center flex items-center gap-1",children:[e.jsx(Ln,{className:"h-4 w-4 text-[#c9a84c] fill-[#c9a84c]"}),e.jsx("span",{className:"font-bold text-white",children:"5.0"})]})}),t.review_snippet&&e.jsx("div",{className:"bg-[#1e2636] rounded-xl p-4 mb-6 border border-[#c9a84c]/10",children:e.jsxs("p",{className:"text-sm text-[#a0aec0] italic text-center font-serif",children:['"',t.review_snippet,'"']})}),t.show_bio&&t.bio&&e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"text-sm font-semibold text-[#c9a84c] mb-2 tracking-wide uppercase",children:"About"}),e.jsx("p",{className:"text-sm text-[#a0aec0] leading-relaxed",children:t.bio})]}),e.jsx(Gne,{card:t,variant:"luxury"}),e.jsx(Zne,{cardId:t.id,variant:"luxury"}),e.jsxs("div",{className:"space-y-1 mb-6",children:[t.show_save_contact&&e.jsxs("button",{onClick:v,className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[e.jsx(Oi,{className:"h-4 w-4 text-[#c9a84c]"})," Save Contact"]}),t.show_leave_review&&t.review_source_url&&e.jsxs("button",{onClick:()=>{Vi(t.id,"button_click","review"),window.open(t.review_source_url,"_blank")},className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[e.jsx(Ln,{className:"h-4 w-4 text-[#c9a84c]"})," Leave a Review"]}),t.show_refer_friend&&e.jsxs("button",{onClick:N,className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[e.jsx(ws,{className:"h-4 w-4 text-[#c9a84c]"})," Refer a Friend"]}),e.jsxs("button",{onClick:j,className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[e.jsx($d,{className:"h-4 w-4 text-[#c9a84c]"})," Connect with Me"]}),e.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:[e.jsx(Oc,{className:"h-4 w-4 text-[#c9a84c]"})," Share My Card"]})]}),t.show_social_links&&t.social_links&&t.social_links.length>0&&e.jsx("div",{className:"flex justify-center gap-4 mb-8",children:t.social_links.slice(0,3).map((M,I)=>e.jsx("a",{href:M.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Vi(t.id,"button_click",`social_${M.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:S[M.platform.toLowerCase()]||"🔗"},I))}),e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-xs text-[#4a5568]",children:"Powered by LevelUp"})})]}),e.jsx(Kne,{open:r,onOpenChange:s,cardId:t.id,type:n,agentName:o})]})}function Idt({card:t}){var I,F,O,B;const[r,s]=E.useState(!1),[n,a]=E.useState("booking"),o=((I=t.profile)==null?void 0:I.name)||"Agent",l=o.split(" ").map($=>$[0]).join("").toUpperCase().slice(0,2),i={accent:((F=t.bold_theme_colors)==null?void 0:F.accent)||"#ff5722",dark:((O=t.bold_theme_colors)==null?void 0:O.dark)||"#1a1a2e",button:((B=t.bold_theme_colors)==null?void 0:B.button)||"#ff5722"},d=($,H)=>{const W=parseInt($.replace("#",""),16),X=Math.max(0,(W>>16)-H),se=Math.max(0,(W>>8&255)-H),ae=Math.max(0,(W&255)-H);return`#${(X<<16|se<<8|ae).toString(16).padStart(6,"0")}`};d(i.accent,25),d(i.dark,-20),d(i.button,25);const m=($,H)=>{Vi(t.id,"button_click",$),H()},g=()=>m("call",()=>{var $;($=t.profile)!=null&&$.phone?window.location.href=`tel:${t.profile.phone}`:Se.error("Phone number not available")}),y=()=>m("text",()=>{var $;($=t.profile)!=null&&$.phone?window.location.href=`sms:${t.profile.phone}`:Se.error("Phone number not available")}),v=()=>m("email",()=>{var $;($=t.profile)!=null&&$.email?window.location.href=`mailto:${t.profile.email}`:Se.error("Email not available")}),b=()=>{t.booking_url?m("book",()=>window.open(t.booking_url,"_blank")):(a("booking"),s(!0),Vi(t.id,"button_click","book"))},N=()=>{var $,H;Vi(t.id,"contact_saved"),Yne({name:o,phone:($=t.profile)==null?void 0:$.phone,email:(H=t.profile)==null?void 0:H.email,brokerage:t.brokerage_name,avatarUrl:t.avatar_url,cardUrl:window.location.href})},j=async()=>{if(Vi(t.id,"share_event"),navigator.share)try{await navigator.share({title:`${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),Se.success("Link copied!")},S=()=>{a("referral"),s(!0),Vi(t.id,"button_click","refer")},A=()=>{a("connect"),s(!0),Vi(t.id,"button_click","connect")},M={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return e.jsxs("div",{className:"min-h-screen",style:{backgroundColor:i.accent},children:[e.jsxs("div",{className:"px-5 pt-10 pb-14 text-center relative",style:{backgroundColor:i.dark},children:[t.show_photo&&e.jsxs(ln,{className:"h-28 w-28 mx-auto mb-4 shadow-2xl",style:{boxShadow:`0 0 0 4px ${i.accent}`},children:[e.jsx(pa,{src:t.avatar_url||void 0,alt:o}),e.jsx(cn,{className:"text-2xl font-black text-white",style:{backgroundColor:i.accent},children:l})]}),e.jsx("h1",{className:"text-3xl font-black text-white tracking-tight mb-0.5",children:o}),t.title&&e.jsx("p",{className:"text-sm font-bold mb-1",style:{color:`${i.accent}cc`},children:t.title}),t.brokerage_name&&!t.brokerage_logo_url&&e.jsx("p",{className:"text-sm font-bold uppercase tracking-wider mb-1",style:{color:i.accent},children:t.brokerage_name}),t.team_name&&!t.team_logo_url&&e.jsx("p",{className:"text-xs font-bold text-white/60 uppercase tracking-wider",children:t.team_name})]}),e.jsxs("div",{className:"max-w-md mx-auto px-5 -mt-6",children:[e.jsxs("div",{className:"bg-white rounded-3xl shadow-2xl px-5 py-8",children:[t.positioning_statement&&e.jsx("p",{className:"text-center font-bold text-lg leading-snug mb-6 max-w-xs mx-auto",style:{color:i.dark},children:t.positioning_statement}),e.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[{icon:wi,label:"Call",handler:g},{icon:$o,label:"Text",handler:y},{icon:mn,label:"Email",handler:v}].map(({icon:$,label:H,handler:W})=>e.jsxs("button",{onClick:W,className:"flex flex-col items-center gap-1.5 py-4 text-white rounded-2xl transition-opacity font-bold hover:opacity-85",style:{backgroundColor:i.dark},children:[e.jsx($,{className:"h-5 w-5"}),e.jsx("span",{className:"text-xs",children:H})]},H))}),e.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:[e.jsx(Mn,{className:"h-5 w-5"}),t.custom_cta_label||"Book a Call"]}),t.show_credentials&&t.review_snippet&&e.jsx("div",{className:"flex items-center justify-center gap-5 mb-6",children:t.review_snippet&&e.jsxs("div",{className:"text-center flex items-center gap-1",children:[e.jsx(Ln,{className:"h-5 w-5",style:{color:i.accent,fill:i.accent}}),e.jsx("span",{className:"font-black text-2xl",style:{color:i.dark},children:"5.0"})]})}),t.review_snippet&&e.jsx("div",{className:"rounded-2xl p-4 mb-6",style:{backgroundColor:`${i.accent}15`},children:e.jsxs("p",{className:"text-sm font-medium text-center",style:{color:i.dark},children:['"',t.review_snippet,'"']})}),t.show_bio&&t.bio&&e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"text-xs font-black mb-2 uppercase tracking-wider",style:{color:i.accent},children:"About Me"}),e.jsx("p",{className:"text-sm text-gray-600 leading-relaxed",children:t.bio})]}),e.jsx(Gne,{card:t,variant:"bold"}),e.jsx(Zne,{cardId:t.id,variant:"bold"}),e.jsxs("div",{className:"space-y-1 mb-6",children:[t.show_save_contact&&e.jsxs("button",{onClick:N,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl hover:bg-gray-100 transition-colors text-sm font-bold",style:{color:i.dark},children:[e.jsx(Oi,{className:"h-4 w-4",style:{color:i.accent}})," Save Contact"]}),t.show_leave_review&&t.review_source_url&&e.jsxs("button",{onClick:()=>{Vi(t.id,"button_click","review"),window.open(t.review_source_url,"_blank")},className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl hover:bg-gray-100 transition-colors text-sm font-bold",style:{color:i.dark},children:[e.jsx(Ln,{className:"h-4 w-4",style:{color:i.accent}})," Leave a Review"]}),t.show_refer_friend&&e.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:[e.jsx(ws,{className:"h-4 w-4",style:{color:i.accent}})," Refer a Friend"]}),e.jsxs("button",{onClick:A,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl hover:bg-gray-100 transition-colors text-sm font-bold",style:{color:i.dark},children:[e.jsx($d,{className:"h-4 w-4",style:{color:i.accent}})," Connect with Me"]}),e.jsxs("button",{onClick:j,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:[e.jsx(Oc,{className:"h-4 w-4",style:{color:i.accent}})," Share My Card"]})]}),t.show_social_links&&t.social_links&&t.social_links.length>0&&e.jsx("div",{className:"flex justify-center gap-4 mb-6",children:t.social_links.slice(0,3).map(($,H)=>e.jsx("a",{href:$.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Vi(t.id,"button_click",`social_${$.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:M[$.platform.toLowerCase()]||"🔗"},H))})]}),e.jsx("div",{className:"text-center py-6",children:e.jsx("p",{className:"text-xs text-white/50",children:"Powered by LevelUp"})})]}),e.jsx(Kne,{open:r,onOpenChange:s,cardId:t.id,type:n,agentName:o})]})}function Pdt({card:t}){var A;const[r,s]=E.useState(!1),[n,a]=E.useState("booking"),o=((A=t.profile)==null?void 0:A.name)||"Agent",l=o.split(" ").map(M=>M[0]).join("").toUpperCase().slice(0,2),i=(M,I)=>{Vi(t.id,"button_click",M),I()},d=()=>i("call",()=>{var M;(M=t.profile)!=null&&M.phone?window.location.href=`tel:${t.profile.phone}`:Se.error("Phone number not available")}),m=()=>i("text",()=>{var M;(M=t.profile)!=null&&M.phone?window.location.href=`sms:${t.profile.phone}`:Se.error("Phone number not available")}),g=()=>i("email",()=>{var M;(M=t.profile)!=null&&M.email?window.location.href=`mailto:${t.profile.email}`:Se.error("Email not available")}),y=()=>{t.booking_url?i("book",()=>window.open(t.booking_url,"_blank")):(a("booking"),s(!0),Vi(t.id,"button_click","book"))},v=()=>{var M,I;Vi(t.id,"contact_saved"),Yne({name:o,phone:(M=t.profile)==null?void 0:M.phone,email:(I=t.profile)==null?void 0:I.email,brokerage:t.brokerage_name,avatarUrl:t.avatar_url,cardUrl:window.location.href})},b=async()=>{if(Vi(t.id,"share_event"),navigator.share)try{await navigator.share({title:`${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),Se.success("Link copied!")},N=()=>{a("referral"),s(!0),Vi(t.id,"button_click","refer")},j=()=>{a("connect"),s(!0),Vi(t.id,"button_click","connect")},S={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return e.jsxs("div",{className:"min-h-screen bg-[#f5f1eb]",children:[e.jsx("div",{className:"bg-[#1b3a4b] h-2"}),e.jsxs("div",{className:"max-w-md mx-auto px-5 py-10",children:[e.jsxs("div",{className:"text-center mb-8",children:[t.show_photo&&e.jsxs(ln,{className:"h-28 w-28 mx-auto mb-4 ring-4 ring-white shadow-lg",children:[e.jsx(pa,{src:t.avatar_url||void 0,alt:o}),e.jsx(cn,{className:"text-2xl font-serif bg-[#1b3a4b] text-white",children:l})]}),e.jsx("h1",{className:"text-2xl font-serif font-bold text-[#1b3a4b] mb-0.5",children:o}),t.title&&e.jsx("p",{className:"text-sm font-medium text-[#5a7a6f] mb-1",children:t.title}),t.brokerage_name&&!t.brokerage_logo_url&&e.jsx("p",{className:"text-sm font-medium text-[#5a7a6f] mb-1",children:t.brokerage_name}),t.team_name&&!t.team_logo_url&&e.jsx("p",{className:"text-xs font-medium text-[#a0aec0] mb-3",children:t.team_name}),t.positioning_statement&&e.jsxs("p",{className:"text-base text-[#4a5568] italic leading-relaxed max-w-xs mx-auto font-serif",children:['"',t.positioning_statement,'"']})]}),e.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[{icon:wi,label:"Call",handler:d},{icon:$o,label:"Text",handler:m},{icon:mn,label:"Email",handler:g}].map(({icon:M,label:I,handler:F})=>e.jsxs("button",{onClick:F,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:[e.jsx(M,{className:"h-5 w-5 text-[#1b3a4b]"}),e.jsx("span",{className:"text-xs font-semibold text-[#1b3a4b]",children:I})]},I))}),e.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:[e.jsx(Mn,{className:"h-5 w-5"}),t.custom_cta_label||"Book a Call"]}),t.show_credentials&&t.review_snippet&&e.jsx("div",{className:"bg-white rounded-lg border border-[#d4cfc5] p-4 mb-6 shadow-sm",children:e.jsx("div",{className:"flex items-center justify-center gap-6",children:e.jsxs("div",{className:"text-center flex items-center gap-1",children:[e.jsx(Ln,{className:"h-4 w-4 text-[#d4a843] fill-[#d4a843]"}),e.jsx("span",{className:"font-bold text-[#1b3a4b] font-serif",children:"5.0"})]})})}),t.review_snippet&&e.jsx("div",{className:"bg-white rounded-lg border border-[#d4cfc5] p-4 mb-6 shadow-sm",children:e.jsxs("p",{className:"text-sm text-[#4a5568] italic text-center font-serif",children:['"',t.review_snippet,'"']})}),t.show_bio&&t.bio&&e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"text-sm font-semibold text-[#1b3a4b] mb-2 font-serif",children:"About"}),e.jsx("p",{className:"text-sm text-[#4a5568] leading-relaxed",children:t.bio})]}),e.jsx(Gne,{card:t,variant:"classic"}),e.jsx(Zne,{cardId:t.id,variant:"classic"}),e.jsxs("div",{className:"bg-white rounded-lg border border-[#d4cfc5] shadow-sm divide-y divide-[#e8e3db] mb-6",children:[t.show_save_contact&&e.jsxs("button",{onClick:v,className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[e.jsx(Oi,{className:"h-4 w-4 text-[#5a7a6f]"})," Save Contact"]}),t.show_leave_review&&t.review_source_url&&e.jsxs("button",{onClick:()=>{Vi(t.id,"button_click","review"),window.open(t.review_source_url,"_blank")},className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[e.jsx(Ln,{className:"h-4 w-4 text-[#d4a843]"})," Leave a Review"]}),t.show_refer_friend&&e.jsxs("button",{onClick:N,className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[e.jsx(ws,{className:"h-4 w-4 text-[#5a7a6f]"})," Refer a Friend"]}),e.jsxs("button",{onClick:j,className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[e.jsx($d,{className:"h-4 w-4 text-[#5a7a6f]"})," Connect with Me"]}),e.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:[e.jsx(Oc,{className:"h-4 w-4 text-[#5a7a6f]"})," Share My Card"]})]}),t.show_social_links&&t.social_links&&t.social_links.length>0&&e.jsx("div",{className:"flex justify-center gap-4 mb-8",children:t.social_links.slice(0,3).map((M,I)=>e.jsx("a",{href:M.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Vi(t.id,"button_click",`social_${M.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:S[M.platform.toLowerCase()]||"🔗"},I))}),e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-xs text-[#a0aec0]",children:"Powered by LevelUp"})})]}),e.jsx(Kne,{open:r,onOpenChange:s,cardId:t.id,type:n,agentName:o})]})}function lye({card:t}){switch(t.theme){case"luxury":return e.jsx(Edt,{card:t});case"bold":return e.jsx(Idt,{card:t});case"classic":return e.jsx(Pdt,{card:t});case"standard":default:return e.jsx(Adt,{card:t})}}function Ldt(){const t=Uh();E.useEffect(()=>(document.body.classList.add("agent-card-page"),()=>{document.body.classList.remove("agent-card-page")}),[]);const r=t.pathname.slice(1);return!r||r===""?e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center p-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-bold text-slate-800 mb-2",children:"Agent Cards"}),e.jsx("p",{className:"text-slate-500",children:"Visit a specific agent's card URL to view their digital business card."})]})}):e.jsx(Odt,{slug:r})}function Odt({slug:t}){return e.jsx(Ddt,{slug:t})}function Ddt({slug:t}){var o;const{data:r,isLoading:s,error:n}=UOe(t);if(E.useEffect(()=>{r!=null&&r.id&&Vi(r.id,"card_view")},[r==null?void 0:r.id]),s)return e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center",children:e.jsxs("div",{className:"w-full max-w-md mx-auto p-6 space-y-6",children:[e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx(fr,{className:"h-28 w-28 rounded-full"}),e.jsx(fr,{className:"h-6 w-48"}),e.jsx(fr,{className:"h-4 w-36"})]}),e.jsx(fr,{className:"h-12 w-full"}),e.jsx(fr,{className:"h-12 w-full"})]})});if(n||!r)return e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center p-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-bold text-slate-800 mb-2",children:"Card Not Found"}),e.jsx("p",{className:"text-slate-500",children:"This agent card doesn't exist or isn't published yet."})]})});const a=((o=r.profile)==null?void 0:o.name)||"Agent";return e.jsxs(e.Fragment,{children:[e.jsxs(qh,{children:[e.jsxs("title",{children:[a," | Real Estate Agent"]}),e.jsx("meta",{name:"description",content:r.positioning_statement||`Connect with ${a}, your trusted real estate professional.`}),e.jsx("meta",{property:"og:title",content:`${a} | Real Estate Agent`}),e.jsx("meta",{property:"og:description",content:r.positioning_statement||`Connect with ${a}`}),r.avatar_url&&e.jsx("meta",{property:"og:image",content:r.avatar_url})]}),e.jsx(lye,{card:r})]})}function WOe({presentationId:t,ctaLabel:r,agentName:s,prefillName:n,prefillEmail:a,prefillPhone:o}){const[l,i]=E.useState(n||""),[d,m]=E.useState(a||""),[g,y]=E.useState(o||""),[v,b]=E.useState(""),[N,j]=E.useState(""),[S,A]=E.useState(!1),[M,I]=E.useState(!1),F=async O=>{if(O.preventDefault(),!l.trim()){Se.error("Please enter your name");return}A(!0);try{const{error:B}=await Z.from("smart_presentation_leads").insert({presentation_id:t,name:l.trim(),email:d.trim()||null,phone:g.trim()||null,intent:v||null,message:N.trim()||null});if(B)throw B;try{await Z.rpc("log_presentation_view",{p_presentation_id:t,p_section_index:null,p_cta_clicked:!0,p_ip_hash:null,p_user_agent:navigator.userAgent,p_referrer:null})}catch{}Z.functions.invoke("presentation-lead-notify",{body:{presentationId:t,name:l.trim(),email:d.trim()||void 0,phone:g.trim()||void 0,intent:v||void 0,message:N.trim()||void 0}}).catch($=>console.error("Presentation lead notify failed:",$)),I(!0)}catch{Se.error("Something went wrong. Please try again.")}finally{A(!1)}};return M?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-emerald-100 flex items-center justify-center mx-auto mb-4",children:e.jsx(li,{className:"h-8 w-8 text-emerald-600"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Thank you!"}),e.jsx("p",{className:"text-gray-500",children:s?`${s} will be in touch soon.`:"We'll be in touch soon."})]}):e.jsxs("form",{onSubmit:F,className:"space-y-4 max-w-md mx-auto",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"pres-lead-name",children:"Name *"}),e.jsx(Qe,{id:"pres-lead-name",value:l,onChange:O=>i(O.target.value),placeholder:"Your name",required:!0})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"pres-lead-phone",children:"Phone"}),e.jsx(Qe,{id:"pres-lead-phone",type:"tel",value:g,onChange:O=>y(O.target.value),placeholder:"(555) 123-4567"})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"pres-lead-email",children:"Email"}),e.jsx(Qe,{id:"pres-lead-email",type:"email",value:d,onChange:O=>m(O.target.value),placeholder:"you@example.com"})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"pres-lead-intent",children:"I'm looking to..."}),e.jsxs(ds,{value:v,onValueChange:b,children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Select one"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"buy",children:"Buy a home"}),e.jsx(Ut,{value:"sell",children:"Sell my home"}),e.jsx(Ut,{value:"both",children:"Buy & Sell"}),e.jsx(Ut,{value:"other",children:"Something else"})]})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"pres-lead-message",children:"Message (optional)"}),e.jsx(Qe,{id:"pres-lead-message",value:N,onChange:O=>j(O.target.value),placeholder:"Anything you'd like us to know"})]}),e.jsx(Q,{type:"submit",className:"w-full text-lg py-6 rounded-xl bg-blue-600 hover:bg-blue-700 text-white shadow-lg",disabled:S,children:S?"Sending...":r})]})}function Rdt(){const t=Uh();E.useEffect(()=>(document.body.classList.add("presentation-page"),()=>{document.body.classList.remove("presentation-page")}),[]);const r=t.pathname.slice(1);return!r||r===""?e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center p-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-bold text-slate-800 mb-2",children:"Smart Presentations"}),e.jsx("p",{className:"text-slate-500",children:"Visit a specific presentation URL to view it."})]})}):e.jsx(Fdt,{shareToken:r})}function Fdt({shareToken:t}){var N;const[r,s]=E.useState(null),[n,a]=E.useState(!0),[o,l]=E.useState(0),[i,d]=E.useState(!1);E.useEffect(()=>{m()},[t]);const m=async()=>{const{data:j,error:S}=await Z.from("smart_presentations").select("*").eq("share_token",t).eq("status","published").single();if(S||!j){d(!0),a(!1);return}const{data:A}=await Z.from("profiles").select("name, email, phone, avatar_url, title, brokerage_id").eq("id",j.owner_user_id).single();let M;if(A!=null&&A.brokerage_id){const{data:F}=await Z.from("brokerages").select("name").eq("id",A.brokerage_id).single();M=(F==null?void 0:F.name)||void 0}let I=null;if(j.contact_id){const{data:F}=await Z.from("innercircle_contacts").select("first_name, last_name, email, phone").eq("id",j.contact_id).single();I=F}s({...j,owner_name:A==null?void 0:A.name,owner_email:A==null?void 0:A.email,owner_phone:A==null?void 0:A.phone,owner_avatar:A==null?void 0:A.avatar_url,owner_title:(A==null?void 0:A.title)||void 0,brokerage_name:M,contact_name:I?[I.first_name,I.last_name].filter(Boolean).join(" "):void 0,contact_email:(I==null?void 0:I.email)||void 0,contact_phone:(I==null?void 0:I.phone)||void 0}),a(!1);try{await Z.rpc("log_presentation_view",{p_presentation_id:j.id,p_section_index:0,p_cta_clicked:!1,p_ip_hash:null,p_user_agent:navigator.userAgent,p_referrer:document.referrer||null})}catch{}},g=async()=>{if(r){try{await Z.rpc("log_presentation_view",{p_presentation_id:r.id,p_section_index:null,p_cta_clicked:!0,p_ip_hash:null,p_user_agent:navigator.userAgent,p_referrer:null})}catch{}r.cta_url&&window.open(r.cta_url,"_blank")}},y=j=>{const S=j.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]+)/);if(S)return`https://www.youtube.com/embed/${S[1]}?rel=0`;if(j.includes("iframe.mediadelivery.net/play/")){const I=j.replace("/play/","/embed/"),F=I.includes("?")?"&":"?";return`${I}${F}responsive=true`}if(j.includes("iframe.mediadelivery.net")){const I=j.includes("?")?"&":"?";return`${j}${I}responsive=true`}const A=j.match(/loom\.com\/share\/([a-zA-Z0-9]+)/);if(A)return`https://www.loom.com/embed/${A[1]}`;const M=j.match(/video\.bunnycdn\.com\/play\/(\d+)\/([a-f0-9-]+)/);return M?`https://iframe.mediadelivery.net/embed/${M[1]}/${M[2]}?responsive=true`:j};if(n)return e.jsx("div",{className:"min-h-screen bg-white flex items-center justify-center",children:e.jsxs("div",{className:"space-y-4 w-full max-w-2xl px-4",children:[e.jsx(fr,{className:"h-12 w-3/4 mx-auto"}),e.jsx(fr,{className:"h-64 w-full"}),e.jsx(fr,{className:"h-8 w-1/2 mx-auto"})]})});if(i||!r)return e.jsx("div",{className:"min-h-screen bg-white flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Presentation Not Found"}),e.jsx("p",{className:"text-gray-500",children:"This presentation may have been removed or is no longer available."})]})});const v=r.sections.filter(j=>j.is_visible!==!1),b=v[o];return e.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white",children:[e.jsx("header",{className:"bg-white border-b border-gray-100 sticky top-0 z-10",children:e.jsx("div",{className:"max-w-5xl mx-auto px-4 py-3 flex items-center justify-end",children:e.jsxs("div",{className:"flex items-center gap-3",children:[r.owner_avatar&&e.jsx("img",{src:r.owner_avatar,alt:r.owner_name||"Agent",className:"h-10 w-10 rounded-full object-cover border border-gray-200"}),e.jsxs("div",{className:"text-right text-sm",children:[e.jsx("p",{className:"font-semibold text-gray-900",children:r.owner_name}),r.owner_title&&e.jsx("p",{className:"text-gray-500 text-xs",children:r.owner_title}),r.brokerage_name&&!r.owner_title&&e.jsx("p",{className:"text-gray-500 text-xs",children:r.brokerage_name})]})]})})}),e.jsxs("main",{className:"max-w-5xl mx-auto px-4 py-8",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("h1",{className:"text-3xl md:text-4xl font-bold text-gray-900 mb-2",children:r.heading||(r.client_name?`Welcome, ${r.client_name}!`:r.title)}),r.property_address&&e.jsxs("p",{className:"text-lg text-gray-600",children:["Here's the plan for your home at ",e.jsx("strong",{children:r.property_address}),"."]})]}),e.jsxs("div",{className:"grid md:grid-cols-5 gap-8",children:[e.jsxs("div",{className:"md:col-span-3",children:[b!=null&&b.video_url?e.jsx("div",{className:"relative w-full rounded-xl overflow-hidden shadow-lg bg-gray-900",style:{paddingTop:"56.25%"},children:e.jsx("iframe",{src:y(b.video_url),className:"absolute inset-0 w-full h-full border-0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,loading:"lazy"})}):b!=null&&b.image_url?e.jsx("div",{className:"rounded-xl overflow-hidden shadow-lg",children:e.jsx("img",{src:b.image_url,alt:b.title,className:"w-full h-auto object-cover",loading:"lazy"})}):e.jsxs("div",{className:"aspect-video bg-gradient-to-br from-blue-50 to-slate-100 rounded-xl flex flex-col items-center justify-center shadow-lg",children:[e.jsx("span",{className:"text-5xl mb-3",children:b==null?void 0:b.icon}),e.jsx("h3",{className:"text-xl font-semibold text-gray-800",children:b==null?void 0:b.title}),e.jsx("p",{className:"text-gray-500 mt-1 text-sm",children:b==null?void 0:b.description})]}),(b==null?void 0:b.text)&&e.jsx("div",{className:"mt-4 p-4 bg-white rounded-lg border text-gray-700 text-sm leading-relaxed prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:b.text}})]}),e.jsx("div",{className:"md:col-span-2 space-y-3",children:v.map((j,S)=>e.jsx("button",{onClick:()=>l(S),className:qt("w-full text-left p-4 rounded-xl border transition-all",o===S?"border-blue-500 bg-blue-50 shadow-sm":"border-gray-200 bg-white hover:border-blue-200 hover:bg-blue-50/50"),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("span",{className:"text-blue-600 font-bold text-sm mt-0.5",children:[String(S+1).padStart(2,"0"),"."]}),e.jsxs("div",{children:[e.jsx("span",{className:"mr-2",children:j.icon}),e.jsx("span",{className:"font-semibold text-gray-900",children:j.title}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:j.description})]})]})},S))})]}),e.jsxs("div",{className:"mt-12 max-w-md mx-auto bg-white rounded-2xl border border-gray-200 shadow-sm p-6 text-center",children:[r.owner_avatar&&e.jsx("img",{src:r.owner_avatar,alt:r.owner_name||"Agent",className:"h-20 w-20 rounded-full object-cover mx-auto mb-3 border-2 border-gray-100"}),e.jsx("h3",{className:"text-lg font-bold text-gray-900",children:r.owner_name}),r.owner_title&&e.jsx("p",{className:"text-sm text-gray-500",children:r.owner_title}),r.brokerage_name&&e.jsx("p",{className:"text-sm text-gray-500",children:r.brokerage_name}),e.jsxs("div",{className:"mt-3 flex flex-col items-center gap-1 text-sm text-gray-600",children:[r.owner_phone&&e.jsx("a",{href:`tel:${r.owner_phone}`,className:"hover:text-blue-600 transition-colors",children:r.owner_phone}),r.owner_email&&e.jsx("a",{href:`mailto:${r.owner_email}`,className:"hover:text-blue-600 transition-colors",children:r.owner_email})]})]}),r.cta_label&&e.jsxs("div",{className:"text-center mt-8 py-8",children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Ready to Get Started?"}),(N=r.cta_url)!=null&&N.trim()?e.jsxs(Q,{size:"lg",onClick:g,className:"text-lg px-8 py-6 rounded-xl bg-blue-600 hover:bg-blue-700 text-white shadow-lg",children:[r.cta_label,e.jsx(En,{className:"h-5 w-5 ml-2"})]}):e.jsx("div",{className:"max-w-md mx-auto bg-white rounded-2xl border border-gray-200 shadow-sm p-6",children:e.jsx(WOe,{presentationId:r.id,ctaLabel:r.cta_label,agentName:r.owner_name||void 0,prefillName:r.contact_name,prefillEmail:r.contact_email,prefillPhone:r.contact_phone})})]})]}),e.jsx("footer",{className:"border-t border-gray-100 bg-white mt-12 py-6 text-center text-xs text-gray-400",children:"Powered by LevelUp"})]})}function zdt(){const{user:t}=Gr();return Ht({queryKey:["open-houses",t==null?void 0:t.id],queryFn:async()=>{const{data:r,error:s}=await Z.from("open_houses").select("*").order("event_date",{ascending:!1});if(s)throw s;return r},enabled:!!t})}function Bdt(t){const{user:r}=Gr(),s=qr();return E.useEffect(()=>{if(!t)return;const n=Z.channel(`visitors-${t}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"open_house_visitors",filter:`open_house_id=eq.${t}`},()=>{s.invalidateQueries({queryKey:["open-house-visitors",t]}),s.invalidateQueries({queryKey:["open-houses"]})}).subscribe();return()=>{Z.removeChannel(n)}},[t,s]),Ht({queryKey:["open-house-visitors",t],queryFn:async()=>{const{data:n,error:a}=await Z.from("open_house_visitors").select("*").eq("open_house_id",t).order("created_at",{ascending:!1});if(a)throw a;return n},enabled:!!r&&!!t})}function $dt(){const t=qr(),{user:r}=Gr();return Jt({mutationFn:async s=>{const{data:n,error:a}=await Z.from("open_houses").insert({...s,agent_id:r.id}).select().single();if(a)throw a;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["open-houses"]}),Jn({title:"Open house created!"})},onError:s=>{Jn({title:"Error",description:s.message,variant:"destructive"})}})}function Udt(){const t=qr();return Jt({mutationFn:async({id:r,...s})=>{const{error:n}=await Z.from("open_houses").update(s).eq("id",r);if(n)throw n},onSuccess:(r,s)=>{t.invalidateQueries({queryKey:["open-houses"]}),t.invalidateQueries({queryKey:["open-house",s.id]})}})}function qdt(){const t=qr();return Jt({mutationFn:async r=>{const{error:s}=await Z.from("open_houses").delete().eq("id",r);if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["open-houses"]}),Jn({title:"Open house deleted"})}})}function GOe(t){return Ht({queryKey:["public-open-house",t],queryFn:async()=>{const{data:r,error:s}=await Z.from("open_houses").select("*, profiles:agent_id(name, avatar_url, title)").eq("slug",t).eq("is_active",!0).single();if(s)throw s;let n=null;if(r.agent_id){const{data:a}=await Z.from("agent_cards").select("slug").eq("user_id",r.agent_id).eq("is_published",!0).maybeSingle();a&&(n=a.slug)}return{...r,agent_card_slug:n}},enabled:!!t})}function KOe(){return Jt({mutationFn:async t=>{const{error:r}=await Z.from("open_house_visitors").insert(t);if(r)throw r}})}function $n(t){const r=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&r==="[object Date]"?new t.constructor(+t):typeof t=="number"||r==="[object Number]"||typeof t=="string"||r==="[object String]"?new Date(t):new Date(NaN)}function Ro(t,r){return t instanceof Date?new t.constructor(r):new Date(r)}function sc(t,r){const s=$n(t);return isNaN(r)?Ro(t,NaN):(r&&s.setDate(s.getDate()+r),s)}function $h(t,r){const s=$n(t);if(isNaN(r))return Ro(t,NaN);if(!r)return s;const n=s.getDate(),a=Ro(t,s.getTime());a.setMonth(s.getMonth()+r+1,0);const o=a.getDate();return n>=o?a:(s.setFullYear(a.getFullYear(),a.getMonth(),n),s)}function ZOe(t,r){const s=+$n(t);return Ro(t,s+r)}const cye=6048e5,Vdt=864e5,YOe=6e4,XOe=36e5,Hdt=1e3,b8=43200,lNe=1440;function cNe(t,r){return ZOe(t,r*XOe)}let Wdt={};function Iv(){return Wdt}function Am(t,r){var i,d,m,g;const s=Iv(),n=(r==null?void 0:r.weekStartsOn)??((d=(i=r==null?void 0:r.locale)==null?void 0:i.options)==null?void 0:d.weekStartsOn)??s.weekStartsOn??((g=(m=s.locale)==null?void 0:m.options)==null?void 0:g.weekStartsOn)??0,a=$n(t),o=a.getDay(),l=(o=a.getTime()?s+1:r.getTime()>=l.getTime()?s:s-1}function Em(t){const r=$n(t);return r.setHours(0,0,0,0),r}function yv(t){const r=$n(t),s=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()));return s.setUTCFullYear(r.getFullYear()),+t-+s}function Ef(t,r){const s=Em(t),n=Em(r),a=+s-yv(s),o=+n-yv(n);return Math.round((a-o)/Vdt)}function Gdt(t){const r=QOe(t),s=Ro(t,0);return s.setFullYear(r,0,4),s.setHours(0,0,0,0),Oy(s)}function dNe(t,r){return ZOe(t,r*YOe)}function hj(t,r){const s=r*7;return sc(t,s)}function Kdt(t,r){return $h(t,r*12)}function Zdt(t){let r;return t.forEach(function(s){const n=$n(s);(r===void 0||r{const n=$n(s);(!r||r>n||isNaN(+n))&&(r=n)}),r||new Date(NaN)}function Gee(t,r){const s=$n(t),n=$n(r),a=s.getTime()-n.getTime();return a<0?-1:a>0?1:a}function JOe(t){return Ro(t,Date.now())}function Vl(t,r){const s=Em(t),n=Em(r);return+s==+n}function dye(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function bme(t){if(!dye(t)&&typeof t!="number")return!1;const r=$n(t);return!isNaN(Number(r))}function $C(t,r){const s=$n(t),n=$n(r),a=s.getFullYear()-n.getFullYear(),o=s.getMonth()-n.getMonth();return a*12+o}function Xdt(t,r,s){const n=Am(t,s),a=Am(r,s),o=+n-yv(n),l=+a-yv(a);return Math.round((o-l)/cye)}function Dy(t,r){const s=$n(t),n=$n(r),a=uNe(s,n),o=Math.abs(Ef(s,n));s.setDate(s.getDate()-a*o);const l=+(uNe(s,n)===-a),i=a*(o-l);return i===0?0:i}function uNe(t,r){const s=t.getFullYear()-r.getFullYear()||t.getMonth()-r.getMonth()||t.getDate()-r.getDate()||t.getHours()-r.getHours()||t.getMinutes()-r.getMinutes()||t.getSeconds()-r.getSeconds()||t.getMilliseconds()-r.getMilliseconds();return s<0?-1:s>0?1:s}function Qdt(t){return r=>{const n=(t?Math[t]:Math.trunc)(r);return n===0?0:n}}function Jdt(t,r){return+$n(t)-+$n(r)}function eut(t){const r=$n(t);return r.setHours(23,59,59,999),r}function Xne(t){const r=$n(t),s=r.getMonth();return r.setFullYear(r.getFullYear(),s+1,0),r.setHours(23,59,59,999),r}function tut(t){const r=$n(t);return+eut(r)==+Xne(r)}function rut(t,r){const s=$n(t),n=$n(r),a=Gee(s,n),o=Math.abs($C(s,n));let l;if(o<1)l=0;else{s.getMonth()===1&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-a*o);let i=Gee(s,n)===-a;tut($n(t))&&o===1&&Gee(t,n)===1&&(i=!1),l=a*(o-Number(i))}return l===0?0:l}function sut(t,r,s){const n=Jdt(t,r)/1e3;return Qdt(s==null?void 0:s.roundingMethod)(n)}function zh(t){const r=$n(t);return r.setDate(1),r.setHours(0,0,0,0),r}function eDe(t){const r=$n(t),s=Ro(t,0);return s.setFullYear(r.getFullYear(),0,1),s.setHours(0,0,0,0),s}function uye(t,r){var i,d,m,g;const s=Iv(),n=(r==null?void 0:r.weekStartsOn)??((d=(i=r==null?void 0:r.locale)==null?void 0:i.options)==null?void 0:d.weekStartsOn)??s.weekStartsOn??((g=(m=s.locale)==null?void 0:m.options)==null?void 0:g.weekStartsOn)??0,a=$n(t),o=a.getDay(),l=(o{let n;const a=nut[t];return typeof a=="string"?n=a:r===1?n=a.one:n=a.other.replace("{{count}}",r.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+n:n+" ago":n};function Kce(t){return(r={})=>{const s=r.width?String(r.width):t.defaultWidth;return t.formats[s]||t.formats[t.defaultWidth]}}const iut={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},out={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},lut={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},cut={date:Kce({formats:iut,defaultWidth:"full"}),time:Kce({formats:out,defaultWidth:"full"}),dateTime:Kce({formats:lut,defaultWidth:"full"})},dut={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},uut=(t,r,s,n)=>dut[t];function vT(t){return(r,s)=>{const n=s!=null&&s.context?String(s.context):"standalone";let a;if(n==="formatting"&&t.formattingValues){const l=t.defaultFormattingWidth||t.defaultWidth,i=s!=null&&s.width?String(s.width):l;a=t.formattingValues[i]||t.formattingValues[l]}else{const l=t.defaultWidth,i=s!=null&&s.width?String(s.width):t.defaultWidth;a=t.values[i]||t.values[l]}const o=t.argumentCallback?t.argumentCallback(r):r;return a[o]}}const hut={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},mut={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},put={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"]},fut={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"]},gut={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"}},xut={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"}},yut=(t,r)=>{const s=Number(t),n=s%100;if(n>20||n<10)switch(n%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},vut={ordinalNumber:yut,era:vT({values:hut,defaultWidth:"wide"}),quarter:vT({values:mut,defaultWidth:"wide",argumentCallback:t=>t-1}),month:vT({values:put,defaultWidth:"wide"}),day:vT({values:fut,defaultWidth:"wide"}),dayPeriod:vT({values:gut,defaultWidth:"wide",formattingValues:xut,defaultFormattingWidth:"wide"})};function _T(t){return(r,s={})=>{const n=s.width,a=n&&t.matchPatterns[n]||t.matchPatterns[t.defaultMatchWidth],o=r.match(a);if(!o)return null;const l=o[0],i=n&&t.parsePatterns[n]||t.parsePatterns[t.defaultParseWidth],d=Array.isArray(i)?but(i,y=>y.test(l)):_ut(i,y=>y.test(l));let m;m=t.valueCallback?t.valueCallback(d):d,m=s.valueCallback?s.valueCallback(m):m;const g=r.slice(l.length);return{value:m,rest:g}}}function _ut(t,r){for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&r(t[s]))return s}function but(t,r){for(let s=0;s{const n=r.match(t.matchPattern);if(!n)return null;const a=n[0],o=r.match(t.parsePattern);if(!o)return null;let l=t.valueCallback?t.valueCallback(o[0]):o[0];l=s.valueCallback?s.valueCallback(l):l;const i=r.slice(a.length);return{value:l,rest:i}}}const jut=/^(\d+)(th|st|nd|rd)?/i,kut=/\d+/i,Nut={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},Sut={any:[/^b/i,/^(a|c)/i]},Cut={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Mut={any:[/1/i,/2/i,/3/i,/4/i]},Tut={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},Aut={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]},Eut={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},Iut={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]},Put={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},Lut={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}},Out={ordinalNumber:wut({matchPattern:jut,parsePattern:kut,valueCallback:t=>parseInt(t,10)}),era:_T({matchPatterns:Nut,defaultMatchWidth:"wide",parsePatterns:Sut,defaultParseWidth:"any"}),quarter:_T({matchPatterns:Cut,defaultMatchWidth:"wide",parsePatterns:Mut,defaultParseWidth:"any",valueCallback:t=>t+1}),month:_T({matchPatterns:Tut,defaultMatchWidth:"wide",parsePatterns:Aut,defaultParseWidth:"any"}),day:_T({matchPatterns:Eut,defaultMatchWidth:"wide",parsePatterns:Iut,defaultParseWidth:"any"}),dayPeriod:_T({matchPatterns:Put,defaultMatchWidth:"any",parsePatterns:Lut,defaultParseWidth:"any"})},Qne={code:"en-US",formatDistance:aut,formatLong:cut,formatRelative:uut,localize:vut,match:Out,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Dut(t){const r=$n(t);return Ef(r,eDe(r))+1}function hye(t){const r=$n(t),s=+Oy(r)-+Gdt(r);return Math.round(s/cye)+1}function mye(t,r){var g,y,v,b;const s=$n(t),n=s.getFullYear(),a=Iv(),o=(r==null?void 0:r.firstWeekContainsDate)??((y=(g=r==null?void 0:r.locale)==null?void 0:g.options)==null?void 0:y.firstWeekContainsDate)??a.firstWeekContainsDate??((b=(v=a.locale)==null?void 0:v.options)==null?void 0:b.firstWeekContainsDate)??1,l=Ro(t,0);l.setFullYear(n+1,0,o),l.setHours(0,0,0,0);const i=Am(l,r),d=Ro(t,0);d.setFullYear(n,0,o),d.setHours(0,0,0,0);const m=Am(d,r);return s.getTime()>=i.getTime()?n+1:s.getTime()>=m.getTime()?n:n-1}function Rut(t,r){var i,d,m,g;const s=Iv(),n=(r==null?void 0:r.firstWeekContainsDate)??((d=(i=r==null?void 0:r.locale)==null?void 0:i.options)==null?void 0:d.firstWeekContainsDate)??s.firstWeekContainsDate??((g=(m=s.locale)==null?void 0:m.options)==null?void 0:g.firstWeekContainsDate)??1,a=mye(t,r),o=Ro(t,0);return o.setFullYear(a,0,n),o.setHours(0,0,0,0),Am(o,r)}function pye(t,r){const s=$n(t),n=+Am(s,r)-+Rut(s,r);return Math.round(n/cye)+1}function Oo(t,r){const s=t<0?"-":"",n=Math.abs(t).toString().padStart(r,"0");return s+n}const q0={y(t,r){const s=t.getFullYear(),n=s>0?s:1-s;return Oo(r==="yy"?n%100:n,r.length)},M(t,r){const s=t.getMonth();return r==="M"?String(s+1):Oo(s+1,2)},d(t,r){return Oo(t.getDate(),r.length)},a(t,r){const s=t.getHours()/12>=1?"pm":"am";switch(r){case"a":case"aa":return s.toUpperCase();case"aaa":return s;case"aaaaa":return s[0];case"aaaa":default:return s==="am"?"a.m.":"p.m."}},h(t,r){return Oo(t.getHours()%12||12,r.length)},H(t,r){return Oo(t.getHours(),r.length)},m(t,r){return Oo(t.getMinutes(),r.length)},s(t,r){return Oo(t.getSeconds(),r.length)},S(t,r){const s=r.length,n=t.getMilliseconds(),a=Math.trunc(n*Math.pow(10,s-3));return Oo(a,r.length)}},B4={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},hNe={G:function(t,r,s){const n=t.getFullYear()>0?1:0;switch(r){case"G":case"GG":case"GGG":return s.era(n,{width:"abbreviated"});case"GGGGG":return s.era(n,{width:"narrow"});case"GGGG":default:return s.era(n,{width:"wide"})}},y:function(t,r,s){if(r==="yo"){const n=t.getFullYear(),a=n>0?n:1-n;return s.ordinalNumber(a,{unit:"year"})}return q0.y(t,r)},Y:function(t,r,s,n){const a=mye(t,n),o=a>0?a:1-a;if(r==="YY"){const l=o%100;return Oo(l,2)}return r==="Yo"?s.ordinalNumber(o,{unit:"year"}):Oo(o,r.length)},R:function(t,r){const s=QOe(t);return Oo(s,r.length)},u:function(t,r){const s=t.getFullYear();return Oo(s,r.length)},Q:function(t,r,s){const n=Math.ceil((t.getMonth()+1)/3);switch(r){case"Q":return String(n);case"QQ":return Oo(n,2);case"Qo":return s.ordinalNumber(n,{unit:"quarter"});case"QQQ":return s.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return s.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(n,{width:"wide",context:"formatting"})}},q:function(t,r,s){const n=Math.ceil((t.getMonth()+1)/3);switch(r){case"q":return String(n);case"qq":return Oo(n,2);case"qo":return s.ordinalNumber(n,{unit:"quarter"});case"qqq":return s.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return s.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(n,{width:"wide",context:"standalone"})}},M:function(t,r,s){const n=t.getMonth();switch(r){case"M":case"MM":return q0.M(t,r);case"Mo":return s.ordinalNumber(n+1,{unit:"month"});case"MMM":return s.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return s.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(n,{width:"wide",context:"formatting"})}},L:function(t,r,s){const n=t.getMonth();switch(r){case"L":return String(n+1);case"LL":return Oo(n+1,2);case"Lo":return s.ordinalNumber(n+1,{unit:"month"});case"LLL":return s.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return s.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(n,{width:"wide",context:"standalone"})}},w:function(t,r,s,n){const a=pye(t,n);return r==="wo"?s.ordinalNumber(a,{unit:"week"}):Oo(a,r.length)},I:function(t,r,s){const n=hye(t);return r==="Io"?s.ordinalNumber(n,{unit:"week"}):Oo(n,r.length)},d:function(t,r,s){return r==="do"?s.ordinalNumber(t.getDate(),{unit:"date"}):q0.d(t,r)},D:function(t,r,s){const n=Dut(t);return r==="Do"?s.ordinalNumber(n,{unit:"dayOfYear"}):Oo(n,r.length)},E:function(t,r,s){const n=t.getDay();switch(r){case"E":case"EE":case"EEE":return s.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return s.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(n,{width:"short",context:"formatting"});case"EEEE":default:return s.day(n,{width:"wide",context:"formatting"})}},e:function(t,r,s,n){const a=t.getDay(),o=(a-n.weekStartsOn+8)%7||7;switch(r){case"e":return String(o);case"ee":return Oo(o,2);case"eo":return s.ordinalNumber(o,{unit:"day"});case"eee":return s.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return s.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(a,{width:"short",context:"formatting"});case"eeee":default:return s.day(a,{width:"wide",context:"formatting"})}},c:function(t,r,s,n){const a=t.getDay(),o=(a-n.weekStartsOn+8)%7||7;switch(r){case"c":return String(o);case"cc":return Oo(o,r.length);case"co":return s.ordinalNumber(o,{unit:"day"});case"ccc":return s.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return s.day(a,{width:"narrow",context:"standalone"});case"cccccc":return s.day(a,{width:"short",context:"standalone"});case"cccc":default:return s.day(a,{width:"wide",context:"standalone"})}},i:function(t,r,s){const n=t.getDay(),a=n===0?7:n;switch(r){case"i":return String(a);case"ii":return Oo(a,r.length);case"io":return s.ordinalNumber(a,{unit:"day"});case"iii":return s.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return s.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return s.day(n,{width:"short",context:"formatting"});case"iiii":default:return s.day(n,{width:"wide",context:"formatting"})}},a:function(t,r,s){const a=t.getHours()/12>=1?"pm":"am";switch(r){case"a":case"aa":return s.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return s.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return s.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(t,r,s){const n=t.getHours();let a;switch(n===12?a=B4.noon:n===0?a=B4.midnight:a=n/12>=1?"pm":"am",r){case"b":case"bb":return s.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return s.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return s.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(t,r,s){const n=t.getHours();let a;switch(n>=17?a=B4.evening:n>=12?a=B4.afternoon:n>=4?a=B4.morning:a=B4.night,r){case"B":case"BB":case"BBB":return s.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return s.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(t,r,s){if(r==="ho"){let n=t.getHours()%12;return n===0&&(n=12),s.ordinalNumber(n,{unit:"hour"})}return q0.h(t,r)},H:function(t,r,s){return r==="Ho"?s.ordinalNumber(t.getHours(),{unit:"hour"}):q0.H(t,r)},K:function(t,r,s){const n=t.getHours()%12;return r==="Ko"?s.ordinalNumber(n,{unit:"hour"}):Oo(n,r.length)},k:function(t,r,s){let n=t.getHours();return n===0&&(n=24),r==="ko"?s.ordinalNumber(n,{unit:"hour"}):Oo(n,r.length)},m:function(t,r,s){return r==="mo"?s.ordinalNumber(t.getMinutes(),{unit:"minute"}):q0.m(t,r)},s:function(t,r,s){return r==="so"?s.ordinalNumber(t.getSeconds(),{unit:"second"}):q0.s(t,r)},S:function(t,r){return q0.S(t,r)},X:function(t,r,s){const n=t.getTimezoneOffset();if(n===0)return"Z";switch(r){case"X":return pNe(n);case"XXXX":case"XX":return Jw(n);case"XXXXX":case"XXX":default:return Jw(n,":")}},x:function(t,r,s){const n=t.getTimezoneOffset();switch(r){case"x":return pNe(n);case"xxxx":case"xx":return Jw(n);case"xxxxx":case"xxx":default:return Jw(n,":")}},O:function(t,r,s){const n=t.getTimezoneOffset();switch(r){case"O":case"OO":case"OOO":return"GMT"+mNe(n,":");case"OOOO":default:return"GMT"+Jw(n,":")}},z:function(t,r,s){const n=t.getTimezoneOffset();switch(r){case"z":case"zz":case"zzz":return"GMT"+mNe(n,":");case"zzzz":default:return"GMT"+Jw(n,":")}},t:function(t,r,s){const n=Math.trunc(t.getTime()/1e3);return Oo(n,r.length)},T:function(t,r,s){const n=t.getTime();return Oo(n,r.length)}};function mNe(t,r=""){const s=t>0?"-":"+",n=Math.abs(t),a=Math.trunc(n/60),o=n%60;return o===0?s+String(a):s+String(a)+r+Oo(o,2)}function pNe(t,r){return t%60===0?(t>0?"-":"+")+Oo(Math.abs(t)/60,2):Jw(t,r)}function Jw(t,r=""){const s=t>0?"-":"+",n=Math.abs(t),a=Oo(Math.trunc(n/60),2),o=Oo(n%60,2);return s+a+r+o}const fNe=(t,r)=>{switch(t){case"P":return r.date({width:"short"});case"PP":return r.date({width:"medium"});case"PPP":return r.date({width:"long"});case"PPPP":default:return r.date({width:"full"})}},rDe=(t,r)=>{switch(t){case"p":return r.time({width:"short"});case"pp":return r.time({width:"medium"});case"ppp":return r.time({width:"long"});case"pppp":default:return r.time({width:"full"})}},Fut=(t,r)=>{const s=t.match(/(P+)(p+)?/)||[],n=s[1],a=s[2];if(!a)return fNe(t,r);let o;switch(n){case"P":o=r.dateTime({width:"short"});break;case"PP":o=r.dateTime({width:"medium"});break;case"PPP":o=r.dateTime({width:"long"});break;case"PPPP":default:o=r.dateTime({width:"full"});break}return o.replace("{{date}}",fNe(n,r)).replace("{{time}}",rDe(a,r))},wme={p:rDe,P:Fut},zut=/^D+$/,But=/^Y+$/,$ut=["D","DD","YY","YYYY"];function sDe(t){return zut.test(t)}function nDe(t){return But.test(t)}function jme(t,r,s){const n=Uut(t,r,s);if(console.warn(n),$ut.includes(t))throw new RangeError(n)}function Uut(t,r,s){const n=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${r}\`) for formatting ${n} to the input \`${s}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const qut=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Vut=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Hut=/^'([^]*?)'?$/,Wut=/''/g,Gut=/[a-zA-Z]/;function Xr(t,r,s){var g,y,v,b,N,j,S,A;const n=Iv(),a=(s==null?void 0:s.locale)??n.locale??Qne,o=(s==null?void 0:s.firstWeekContainsDate)??((y=(g=s==null?void 0:s.locale)==null?void 0:g.options)==null?void 0:y.firstWeekContainsDate)??n.firstWeekContainsDate??((b=(v=n.locale)==null?void 0:v.options)==null?void 0:b.firstWeekContainsDate)??1,l=(s==null?void 0:s.weekStartsOn)??((j=(N=s==null?void 0:s.locale)==null?void 0:N.options)==null?void 0:j.weekStartsOn)??n.weekStartsOn??((A=(S=n.locale)==null?void 0:S.options)==null?void 0:A.weekStartsOn)??0,i=$n(t);if(!bme(i))throw new RangeError("Invalid time value");let d=r.match(Vut).map(M=>{const I=M[0];if(I==="p"||I==="P"){const F=wme[I];return F(M,a.formatLong)}return M}).join("").match(qut).map(M=>{if(M==="''")return{isToken:!1,value:"'"};const I=M[0];if(I==="'")return{isToken:!1,value:Kut(M)};if(hNe[I])return{isToken:!0,value:M};if(I.match(Gut))throw new RangeError("Format string contains an unescaped latin alphabet character `"+I+"`");return{isToken:!1,value:M}});a.localize.preprocessor&&(d=a.localize.preprocessor(i,d));const m={firstWeekContainsDate:o,weekStartsOn:l,locale:a};return d.map(M=>{if(!M.isToken)return M.value;const I=M.value;(!(s!=null&&s.useAdditionalWeekYearTokens)&&nDe(I)||!(s!=null&&s.useAdditionalDayOfYearTokens)&&sDe(I))&&jme(I,r,String(t));const F=hNe[I[0]];return F(i,I,a.localize,m)}).join("")}function Kut(t){const r=t.match(Hut);return r?r[1].replace(Wut,"'"):t}function Zut(t,r,s){const n=Iv(),a=(s==null?void 0:s.locale)??n.locale??Qne,o=2520,l=Gee(t,r);if(isNaN(l))throw new RangeError("Invalid time value");const i=Object.assign({},s,{addSuffix:s==null?void 0:s.addSuffix,comparison:l});let d,m;l>0?(d=$n(r),m=$n(t)):(d=$n(t),m=$n(r));const g=sut(m,d),y=(yv(m)-yv(d))/1e3,v=Math.round((g-y)/60);let b;if(v<2)return s!=null&&s.includeSeconds?g<5?a.formatDistance("lessThanXSeconds",5,i):g<10?a.formatDistance("lessThanXSeconds",10,i):g<20?a.formatDistance("lessThanXSeconds",20,i):g<40?a.formatDistance("halfAMinute",0,i):g<60?a.formatDistance("lessThanXMinutes",1,i):a.formatDistance("xMinutes",1,i):v===0?a.formatDistance("lessThanXMinutes",1,i):a.formatDistance("xMinutes",v,i);if(v<45)return a.formatDistance("xMinutes",v,i);if(v<90)return a.formatDistance("aboutXHours",1,i);if(vn.getTime()}function Jne(t,r){const s=$n(t),n=$n(r);return+s<+n}function rht(t){return+$n(t)>Date.now()}function sht(t,r){const s=r instanceof Date?Ro(r,0):new r(0);return s.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),s.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()),s}const nht=10;class aDe{constructor(){an(this,"subPriority",0)}validate(r,s){return!0}}class aht extends aDe{constructor(r,s,n,a,o){super(),this.value=r,this.validateValue=s,this.setValue=n,this.priority=a,o&&(this.subPriority=o)}validate(r,s){return this.validateValue(r,this.value,s)}set(r,s,n){return this.setValue(r,s,this.value,n)}}class iht extends aDe{constructor(){super(...arguments);an(this,"priority",nht);an(this,"subPriority",-1)}set(s,n){return n.timestampIsSet?s:Ro(s,sht(s,Date))}}class Co{run(r,s,n,a){const o=this.parse(r,s,n,a);return o?{setter:new aht(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}validate(r,s,n){return!0}}class oht extends Co{constructor(){super(...arguments);an(this,"priority",140);an(this,"incompatibleTokens",["R","u","t","T"])}parse(s,n,a){switch(n){case"G":case"GG":case"GGG":return a.era(s,{width:"abbreviated"})||a.era(s,{width:"narrow"});case"GGGGG":return a.era(s,{width:"narrow"});case"GGGG":default:return a.era(s,{width:"wide"})||a.era(s,{width:"abbreviated"})||a.era(s,{width:"narrow"})}}set(s,n,a){return n.era=a,s.setFullYear(a,0,1),s.setHours(0,0,0,0),s}}const Cc={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}/},Og={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 Mc(t,r){return t&&{value:r(t.value),rest:t.rest}}function Ul(t,r){const s=r.match(t);return s?{value:parseInt(s[0],10),rest:r.slice(s[0].length)}:null}function Dg(t,r){const s=r.match(t);if(!s)return null;if(s[0]==="Z")return{value:0,rest:r.slice(1)};const n=s[1]==="+"?1:-1,a=s[2]?parseInt(s[2],10):0,o=s[3]?parseInt(s[3],10):0,l=s[5]?parseInt(s[5],10):0;return{value:n*(a*XOe+o*YOe+l*Hdt),rest:r.slice(s[0].length)}}function iDe(t){return Ul(Cc.anyDigitsSigned,t)}function pc(t,r){switch(t){case 1:return Ul(Cc.singleDigit,r);case 2:return Ul(Cc.twoDigits,r);case 3:return Ul(Cc.threeDigits,r);case 4:return Ul(Cc.fourDigits,r);default:return Ul(new RegExp("^\\d{1,"+t+"}"),r)}}function Yte(t,r){switch(t){case 1:return Ul(Cc.singleDigitSigned,r);case 2:return Ul(Cc.twoDigitsSigned,r);case 3:return Ul(Cc.threeDigitsSigned,r);case 4:return Ul(Cc.fourDigitsSigned,r);default:return Ul(new RegExp("^-?\\d{1,"+t+"}"),r)}}function fye(t){switch(t){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function oDe(t,r){const s=r>0,n=s?r:1-r;let a;if(n<=50)a=t||100;else{const o=n+50,l=Math.trunc(o/100)*100,i=t>=o%100;a=t+l-(i?100:0)}return s?a:1-a}function lDe(t){return t%400===0||t%4===0&&t%100!==0}class lht extends Co{constructor(){super(...arguments);an(this,"priority",130);an(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(s,n,a){const o=l=>({year:l,isTwoDigitYear:n==="yy"});switch(n){case"y":return Mc(pc(4,s),o);case"yo":return Mc(a.ordinalNumber(s,{unit:"year"}),o);default:return Mc(pc(n.length,s),o)}}validate(s,n){return n.isTwoDigitYear||n.year>0}set(s,n,a){const o=s.getFullYear();if(a.isTwoDigitYear){const i=oDe(a.year,o);return s.setFullYear(i,0,1),s.setHours(0,0,0,0),s}const l=!("era"in n)||n.era===1?a.year:1-a.year;return s.setFullYear(l,0,1),s.setHours(0,0,0,0),s}}class cht extends Co{constructor(){super(...arguments);an(this,"priority",130);an(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(s,n,a){const o=l=>({year:l,isTwoDigitYear:n==="YY"});switch(n){case"Y":return Mc(pc(4,s),o);case"Yo":return Mc(a.ordinalNumber(s,{unit:"year"}),o);default:return Mc(pc(n.length,s),o)}}validate(s,n){return n.isTwoDigitYear||n.year>0}set(s,n,a,o){const l=mye(s,o);if(a.isTwoDigitYear){const d=oDe(a.year,l);return s.setFullYear(d,0,o.firstWeekContainsDate),s.setHours(0,0,0,0),Am(s,o)}const i=!("era"in n)||n.era===1?a.year:1-a.year;return s.setFullYear(i,0,o.firstWeekContainsDate),s.setHours(0,0,0,0),Am(s,o)}}class dht extends Co{constructor(){super(...arguments);an(this,"priority",130);an(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(s,n){return Yte(n==="R"?4:n.length,s)}set(s,n,a){const o=Ro(s,0);return o.setFullYear(a,0,4),o.setHours(0,0,0,0),Oy(o)}}class uht extends Co{constructor(){super(...arguments);an(this,"priority",130);an(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(s,n){return Yte(n==="u"?4:n.length,s)}set(s,n,a){return s.setFullYear(a,0,1),s.setHours(0,0,0,0),s}}class hht extends Co{constructor(){super(...arguments);an(this,"priority",120);an(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(s,n,a){switch(n){case"Q":case"QQ":return pc(n.length,s);case"Qo":return a.ordinalNumber(s,{unit:"quarter"});case"QQQ":return a.quarter(s,{width:"abbreviated",context:"formatting"})||a.quarter(s,{width:"narrow",context:"formatting"});case"QQQQQ":return a.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return a.quarter(s,{width:"wide",context:"formatting"})||a.quarter(s,{width:"abbreviated",context:"formatting"})||a.quarter(s,{width:"narrow",context:"formatting"})}}validate(s,n){return n>=1&&n<=4}set(s,n,a){return s.setMonth((a-1)*3,1),s.setHours(0,0,0,0),s}}class mht extends Co{constructor(){super(...arguments);an(this,"priority",120);an(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(s,n,a){switch(n){case"q":case"qq":return pc(n.length,s);case"qo":return a.ordinalNumber(s,{unit:"quarter"});case"qqq":return a.quarter(s,{width:"abbreviated",context:"standalone"})||a.quarter(s,{width:"narrow",context:"standalone"});case"qqqqq":return a.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return a.quarter(s,{width:"wide",context:"standalone"})||a.quarter(s,{width:"abbreviated",context:"standalone"})||a.quarter(s,{width:"narrow",context:"standalone"})}}validate(s,n){return n>=1&&n<=4}set(s,n,a){return s.setMonth((a-1)*3,1),s.setHours(0,0,0,0),s}}class pht extends Co{constructor(){super(...arguments);an(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);an(this,"priority",110)}parse(s,n,a){const o=l=>l-1;switch(n){case"M":return Mc(Ul(Cc.month,s),o);case"MM":return Mc(pc(2,s),o);case"Mo":return Mc(a.ordinalNumber(s,{unit:"month"}),o);case"MMM":return a.month(s,{width:"abbreviated",context:"formatting"})||a.month(s,{width:"narrow",context:"formatting"});case"MMMMM":return a.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return a.month(s,{width:"wide",context:"formatting"})||a.month(s,{width:"abbreviated",context:"formatting"})||a.month(s,{width:"narrow",context:"formatting"})}}validate(s,n){return n>=0&&n<=11}set(s,n,a){return s.setMonth(a,1),s.setHours(0,0,0,0),s}}class fht extends Co{constructor(){super(...arguments);an(this,"priority",110);an(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(s,n,a){const o=l=>l-1;switch(n){case"L":return Mc(Ul(Cc.month,s),o);case"LL":return Mc(pc(2,s),o);case"Lo":return Mc(a.ordinalNumber(s,{unit:"month"}),o);case"LLL":return a.month(s,{width:"abbreviated",context:"standalone"})||a.month(s,{width:"narrow",context:"standalone"});case"LLLLL":return a.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return a.month(s,{width:"wide",context:"standalone"})||a.month(s,{width:"abbreviated",context:"standalone"})||a.month(s,{width:"narrow",context:"standalone"})}}validate(s,n){return n>=0&&n<=11}set(s,n,a){return s.setMonth(a,1),s.setHours(0,0,0,0),s}}function ght(t,r,s){const n=$n(t),a=pye(n,s)-r;return n.setDate(n.getDate()-a*7),n}class xht extends Co{constructor(){super(...arguments);an(this,"priority",100);an(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(s,n,a){switch(n){case"w":return Ul(Cc.week,s);case"wo":return a.ordinalNumber(s,{unit:"week"});default:return pc(n.length,s)}}validate(s,n){return n>=1&&n<=53}set(s,n,a,o){return Am(ght(s,a,o),o)}}function yht(t,r){const s=$n(t),n=hye(s)-r;return s.setDate(s.getDate()-n*7),s}class vht extends Co{constructor(){super(...arguments);an(this,"priority",100);an(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(s,n,a){switch(n){case"I":return Ul(Cc.week,s);case"Io":return a.ordinalNumber(s,{unit:"week"});default:return pc(n.length,s)}}validate(s,n){return n>=1&&n<=53}set(s,n,a){return Oy(yht(s,a))}}const _ht=[31,28,31,30,31,30,31,31,30,31,30,31],bht=[31,29,31,30,31,30,31,31,30,31,30,31];class wht extends Co{constructor(){super(...arguments);an(this,"priority",90);an(this,"subPriority",1);an(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(s,n,a){switch(n){case"d":return Ul(Cc.date,s);case"do":return a.ordinalNumber(s,{unit:"date"});default:return pc(n.length,s)}}validate(s,n){const a=s.getFullYear(),o=lDe(a),l=s.getMonth();return o?n>=1&&n<=bht[l]:n>=1&&n<=_ht[l]}set(s,n,a){return s.setDate(a),s.setHours(0,0,0,0),s}}class jht extends Co{constructor(){super(...arguments);an(this,"priority",90);an(this,"subpriority",1);an(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(s,n,a){switch(n){case"D":case"DD":return Ul(Cc.dayOfYear,s);case"Do":return a.ordinalNumber(s,{unit:"date"});default:return pc(n.length,s)}}validate(s,n){const a=s.getFullYear();return lDe(a)?n>=1&&n<=366:n>=1&&n<=365}set(s,n,a){return s.setMonth(0,a),s.setHours(0,0,0,0),s}}function gye(t,r,s){var y,v,b,N;const n=Iv(),a=(s==null?void 0:s.weekStartsOn)??((v=(y=s==null?void 0:s.locale)==null?void 0:y.options)==null?void 0:v.weekStartsOn)??n.weekStartsOn??((N=(b=n.locale)==null?void 0:b.options)==null?void 0:N.weekStartsOn)??0,o=$n(t),l=o.getDay(),d=(r%7+7)%7,m=7-a,g=r<0||r>6?r-(l+m)%7:(d+m)%7-(l+m)%7;return sc(o,g)}class kht extends Co{constructor(){super(...arguments);an(this,"priority",90);an(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(s,n,a){switch(n){case"E":case"EE":case"EEE":return a.day(s,{width:"abbreviated",context:"formatting"})||a.day(s,{width:"short",context:"formatting"})||a.day(s,{width:"narrow",context:"formatting"});case"EEEEE":return a.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return a.day(s,{width:"short",context:"formatting"})||a.day(s,{width:"narrow",context:"formatting"});case"EEEE":default:return a.day(s,{width:"wide",context:"formatting"})||a.day(s,{width:"abbreviated",context:"formatting"})||a.day(s,{width:"short",context:"formatting"})||a.day(s,{width:"narrow",context:"formatting"})}}validate(s,n){return n>=0&&n<=6}set(s,n,a,o){return s=gye(s,a,o),s.setHours(0,0,0,0),s}}class Nht extends Co{constructor(){super(...arguments);an(this,"priority",90);an(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(s,n,a,o){const l=i=>{const d=Math.floor((i-1)/7)*7;return(i+o.weekStartsOn+6)%7+d};switch(n){case"e":case"ee":return Mc(pc(n.length,s),l);case"eo":return Mc(a.ordinalNumber(s,{unit:"day"}),l);case"eee":return a.day(s,{width:"abbreviated",context:"formatting"})||a.day(s,{width:"short",context:"formatting"})||a.day(s,{width:"narrow",context:"formatting"});case"eeeee":return a.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return a.day(s,{width:"short",context:"formatting"})||a.day(s,{width:"narrow",context:"formatting"});case"eeee":default:return a.day(s,{width:"wide",context:"formatting"})||a.day(s,{width:"abbreviated",context:"formatting"})||a.day(s,{width:"short",context:"formatting"})||a.day(s,{width:"narrow",context:"formatting"})}}validate(s,n){return n>=0&&n<=6}set(s,n,a,o){return s=gye(s,a,o),s.setHours(0,0,0,0),s}}class Sht extends Co{constructor(){super(...arguments);an(this,"priority",90);an(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(s,n,a,o){const l=i=>{const d=Math.floor((i-1)/7)*7;return(i+o.weekStartsOn+6)%7+d};switch(n){case"c":case"cc":return Mc(pc(n.length,s),l);case"co":return Mc(a.ordinalNumber(s,{unit:"day"}),l);case"ccc":return a.day(s,{width:"abbreviated",context:"standalone"})||a.day(s,{width:"short",context:"standalone"})||a.day(s,{width:"narrow",context:"standalone"});case"ccccc":return a.day(s,{width:"narrow",context:"standalone"});case"cccccc":return a.day(s,{width:"short",context:"standalone"})||a.day(s,{width:"narrow",context:"standalone"});case"cccc":default:return a.day(s,{width:"wide",context:"standalone"})||a.day(s,{width:"abbreviated",context:"standalone"})||a.day(s,{width:"short",context:"standalone"})||a.day(s,{width:"narrow",context:"standalone"})}}validate(s,n){return n>=0&&n<=6}set(s,n,a,o){return s=gye(s,a,o),s.setHours(0,0,0,0),s}}function Cht(t,r){const s=$n(t),n=Qut(s),a=r-n;return sc(s,a)}class Mht extends Co{constructor(){super(...arguments);an(this,"priority",90);an(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(s,n,a){const o=l=>l===0?7:l;switch(n){case"i":case"ii":return pc(n.length,s);case"io":return a.ordinalNumber(s,{unit:"day"});case"iii":return Mc(a.day(s,{width:"abbreviated",context:"formatting"})||a.day(s,{width:"short",context:"formatting"})||a.day(s,{width:"narrow",context:"formatting"}),o);case"iiiii":return Mc(a.day(s,{width:"narrow",context:"formatting"}),o);case"iiiiii":return Mc(a.day(s,{width:"short",context:"formatting"})||a.day(s,{width:"narrow",context:"formatting"}),o);case"iiii":default:return Mc(a.day(s,{width:"wide",context:"formatting"})||a.day(s,{width:"abbreviated",context:"formatting"})||a.day(s,{width:"short",context:"formatting"})||a.day(s,{width:"narrow",context:"formatting"}),o)}}validate(s,n){return n>=1&&n<=7}set(s,n,a){return s=Cht(s,a),s.setHours(0,0,0,0),s}}class Tht extends Co{constructor(){super(...arguments);an(this,"priority",80);an(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(s,n,a){switch(n){case"a":case"aa":case"aaa":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"})||a.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaaa":return a.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return a.dayPeriod(s,{width:"wide",context:"formatting"})||a.dayPeriod(s,{width:"abbreviated",context:"formatting"})||a.dayPeriod(s,{width:"narrow",context:"formatting"})}}set(s,n,a){return s.setHours(fye(a),0,0,0),s}}class Aht extends Co{constructor(){super(...arguments);an(this,"priority",80);an(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(s,n,a){switch(n){case"b":case"bb":case"bbb":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"})||a.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbbb":return a.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return a.dayPeriod(s,{width:"wide",context:"formatting"})||a.dayPeriod(s,{width:"abbreviated",context:"formatting"})||a.dayPeriod(s,{width:"narrow",context:"formatting"})}}set(s,n,a){return s.setHours(fye(a),0,0,0),s}}class Eht extends Co{constructor(){super(...arguments);an(this,"priority",80);an(this,"incompatibleTokens",["a","b","t","T"])}parse(s,n,a){switch(n){case"B":case"BB":case"BBB":return a.dayPeriod(s,{width:"abbreviated",context:"formatting"})||a.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBBB":return a.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return a.dayPeriod(s,{width:"wide",context:"formatting"})||a.dayPeriod(s,{width:"abbreviated",context:"formatting"})||a.dayPeriod(s,{width:"narrow",context:"formatting"})}}set(s,n,a){return s.setHours(fye(a),0,0,0),s}}class Iht extends Co{constructor(){super(...arguments);an(this,"priority",70);an(this,"incompatibleTokens",["H","K","k","t","T"])}parse(s,n,a){switch(n){case"h":return Ul(Cc.hour12h,s);case"ho":return a.ordinalNumber(s,{unit:"hour"});default:return pc(n.length,s)}}validate(s,n){return n>=1&&n<=12}set(s,n,a){const o=s.getHours()>=12;return o&&a<12?s.setHours(a+12,0,0,0):!o&&a===12?s.setHours(0,0,0,0):s.setHours(a,0,0,0),s}}class Pht extends Co{constructor(){super(...arguments);an(this,"priority",70);an(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(s,n,a){switch(n){case"H":return Ul(Cc.hour23h,s);case"Ho":return a.ordinalNumber(s,{unit:"hour"});default:return pc(n.length,s)}}validate(s,n){return n>=0&&n<=23}set(s,n,a){return s.setHours(a,0,0,0),s}}class Lht extends Co{constructor(){super(...arguments);an(this,"priority",70);an(this,"incompatibleTokens",["h","H","k","t","T"])}parse(s,n,a){switch(n){case"K":return Ul(Cc.hour11h,s);case"Ko":return a.ordinalNumber(s,{unit:"hour"});default:return pc(n.length,s)}}validate(s,n){return n>=0&&n<=11}set(s,n,a){return s.getHours()>=12&&a<12?s.setHours(a+12,0,0,0):s.setHours(a,0,0,0),s}}class Oht extends Co{constructor(){super(...arguments);an(this,"priority",70);an(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(s,n,a){switch(n){case"k":return Ul(Cc.hour24h,s);case"ko":return a.ordinalNumber(s,{unit:"hour"});default:return pc(n.length,s)}}validate(s,n){return n>=1&&n<=24}set(s,n,a){const o=a<=24?a%24:a;return s.setHours(o,0,0,0),s}}class Dht extends Co{constructor(){super(...arguments);an(this,"priority",60);an(this,"incompatibleTokens",["t","T"])}parse(s,n,a){switch(n){case"m":return Ul(Cc.minute,s);case"mo":return a.ordinalNumber(s,{unit:"minute"});default:return pc(n.length,s)}}validate(s,n){return n>=0&&n<=59}set(s,n,a){return s.setMinutes(a,0,0),s}}class Rht extends Co{constructor(){super(...arguments);an(this,"priority",50);an(this,"incompatibleTokens",["t","T"])}parse(s,n,a){switch(n){case"s":return Ul(Cc.second,s);case"so":return a.ordinalNumber(s,{unit:"second"});default:return pc(n.length,s)}}validate(s,n){return n>=0&&n<=59}set(s,n,a){return s.setSeconds(a,0),s}}class Fht extends Co{constructor(){super(...arguments);an(this,"priority",30);an(this,"incompatibleTokens",["t","T"])}parse(s,n){const a=o=>Math.trunc(o*Math.pow(10,-n.length+3));return Mc(pc(n.length,s),a)}set(s,n,a){return s.setMilliseconds(a),s}}class zht extends Co{constructor(){super(...arguments);an(this,"priority",10);an(this,"incompatibleTokens",["t","T","x"])}parse(s,n){switch(n){case"X":return Dg(Og.basicOptionalMinutes,s);case"XX":return Dg(Og.basic,s);case"XXXX":return Dg(Og.basicOptionalSeconds,s);case"XXXXX":return Dg(Og.extendedOptionalSeconds,s);case"XXX":default:return Dg(Og.extended,s)}}set(s,n,a){return n.timestampIsSet?s:Ro(s,s.getTime()-yv(s)-a)}}class Bht extends Co{constructor(){super(...arguments);an(this,"priority",10);an(this,"incompatibleTokens",["t","T","X"])}parse(s,n){switch(n){case"x":return Dg(Og.basicOptionalMinutes,s);case"xx":return Dg(Og.basic,s);case"xxxx":return Dg(Og.basicOptionalSeconds,s);case"xxxxx":return Dg(Og.extendedOptionalSeconds,s);case"xxx":default:return Dg(Og.extended,s)}}set(s,n,a){return n.timestampIsSet?s:Ro(s,s.getTime()-yv(s)-a)}}class $ht extends Co{constructor(){super(...arguments);an(this,"priority",40);an(this,"incompatibleTokens","*")}parse(s){return iDe(s)}set(s,n,a){return[Ro(s,a*1e3),{timestampIsSet:!0}]}}class Uht extends Co{constructor(){super(...arguments);an(this,"priority",20);an(this,"incompatibleTokens","*")}parse(s){return iDe(s)}set(s,n,a){return[Ro(s,a),{timestampIsSet:!0}]}}const qht={G:new oht,y:new lht,Y:new cht,R:new dht,u:new uht,Q:new hht,q:new mht,M:new pht,L:new fht,w:new xht,I:new vht,d:new wht,D:new jht,E:new kht,e:new Nht,c:new Sht,i:new Mht,a:new Tht,b:new Aht,B:new Eht,h:new Iht,H:new Pht,K:new Lht,k:new Oht,m:new Dht,s:new Rht,S:new Fht,X:new zht,x:new Bht,t:new $ht,T:new Uht},Vht=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Hht=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Wht=/^'([^]*?)'?$/,Ght=/''/g,Kht=/\S/,Zht=/[a-zA-Z]/;function xye(t,r,s,n){var j,S,A,M;const a=Xut(),o=a.locale??Qne,l=a.firstWeekContainsDate??((S=(j=a.locale)==null?void 0:j.options)==null?void 0:S.firstWeekContainsDate)??1,i=a.weekStartsOn??((M=(A=a.locale)==null?void 0:A.options)==null?void 0:M.weekStartsOn)??0;if(r==="")return t===""?$n(s):Ro(s,NaN);const d={firstWeekContainsDate:l,weekStartsOn:i,locale:o},m=[new iht],g=r.match(Hht).map(I=>{const F=I[0];if(F in wme){const O=wme[F];return O(I,o.formatLong)}return I}).join("").match(Vht),y=[];for(let I of g){nDe(I)&&jme(I,r,t),sDe(I)&&jme(I,r,t);const F=I[0],O=qht[F];if(O){const{incompatibleTokens:B}=O;if(Array.isArray(B)){const H=y.find(W=>B.includes(W.token)||W.token===F);if(H)throw new RangeError(`The format string mustn't contain \`${H.fullToken}\` and \`${I}\` at the same time`)}else if(O.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:F,fullToken:I});const $=O.run(t,I,o.match,d);if(!$)return Ro(s,NaN);m.push($.setter),t=$.rest}else{if(F.match(Zht))throw new RangeError("Format string contains an unescaped latin alphabet character `"+F+"`");if(I==="''"?I="'":F==="'"&&(I=Yht(I)),t.indexOf(I)===0)t=t.slice(I.length);else return Ro(s,NaN)}}if(t.length>0&&Kht.test(t))return Ro(s,NaN);const v=m.map(I=>I.priority).sort((I,F)=>F-I).filter((I,F,O)=>O.indexOf(I)===F).map(I=>m.filter(F=>F.priority===I).sort((F,O)=>O.subPriority-F.subPriority)).map(I=>I[0]);let b=$n(s);if(isNaN(b.getTime()))return Ro(s,NaN);const N={};for(const I of v){if(!I.validate(b,d))return Ro(s,NaN);const F=I.set(b,N,d);Array.isArray(F)?(b=F[0],Object.assign(N,F[1])):b=F}return Ro(s,b)}function Yht(t){return t.match(Wht)[1].replace(Ght,"'")}function cDe(t){return+$n(t)o-l);return s>=n&&s<=a}function Zce(t,r){return sc(t,-r)}function Yce(t,r){const s=$n(t),n=s.getFullYear(),a=s.getDate(),o=Ro(t,0);o.setFullYear(n,r,15),o.setHours(0,0,0,0);const l=Yut(o);return s.setMonth(r,Math.min(a,l)),s}function dDe(t,r){const s=$n(t);return s.setHours(r),s}function uDe(t,r){const s=$n(t);return s.setMinutes(r),s}function vNe(t,r){const s=$n(t);return isNaN(+s)?Ro(t,NaN):(s.setFullYear(r),s)}function Qht(t,r){return $h(t,-12)}var bo;(function(t){t.assertEqual=a=>{};function r(a){}t.assertIs=r;function s(a){throw new Error}t.assertNever=s,t.arrayToEnum=a=>{const o={};for(const l of a)o[l]=l;return o},t.getValidEnumValues=a=>{const o=t.objectKeys(a).filter(i=>typeof a[a[i]]!="number"),l={};for(const i of o)l[i]=a[i];return t.objectValues(l)},t.objectValues=a=>t.objectKeys(a).map(function(o){return a[o]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const o=[];for(const l in a)Object.prototype.hasOwnProperty.call(a,l)&&o.push(l);return o},t.find=(a,o)=>{for(const l of a)if(o(l))return l},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,o=" | "){return a.map(l=>typeof l=="string"?`'${l}'`:l).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(bo||(bo={}));var _Ne;(function(t){t.mergeShapes=(r,s)=>({...r,...s})})(_Ne||(_Ne={}));const Hn=bo.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),t1=t=>{switch(typeof t){case"undefined":return Hn.undefined;case"string":return Hn.string;case"number":return Number.isNaN(t)?Hn.nan:Hn.number;case"boolean":return Hn.boolean;case"function":return Hn.function;case"bigint":return Hn.bigint;case"symbol":return Hn.symbol;case"object":return Array.isArray(t)?Hn.array:t===null?Hn.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Hn.promise:typeof Map<"u"&&t instanceof Map?Hn.map:typeof Set<"u"&&t instanceof Set?Hn.set:typeof Date<"u"&&t instanceof Date?Hn.date:Hn.object;default:return Hn.unknown}},$s=bo.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 nx extends Error{get errors(){return this.issues}constructor(r){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=r}format(r){const s=r||function(o){return o.message},n={_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)n._errors.push(s(l));else{let i=n,d=0;for(;ds.message){const s={},n=[];for(const a of this.issues)if(a.path.length>0){const o=a.path[0];s[o]=s[o]||[],s[o].push(r(a))}else n.push(r(a));return{formErrors:n,fieldErrors:s}}get formErrors(){return this.flatten()}}nx.create=t=>new nx(t);const kme=(t,r)=>{let s;switch(t.code){case $s.invalid_type:t.received===Hn.undefined?s="Required":s=`Expected ${t.expected}, received ${t.received}`;break;case $s.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(t.expected,bo.jsonStringifyReplacer)}`;break;case $s.unrecognized_keys:s=`Unrecognized key(s) in object: ${bo.joinValues(t.keys,", ")}`;break;case $s.invalid_union:s="Invalid input";break;case $s.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${bo.joinValues(t.options)}`;break;case $s.invalid_enum_value:s=`Invalid enum value. Expected ${bo.joinValues(t.options)}, received '${t.received}'`;break;case $s.invalid_arguments:s="Invalid function arguments";break;case $s.invalid_return_type:s="Invalid function return type";break;case $s.invalid_date:s="Invalid date";break;case $s.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(s=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?s=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?s=`Invalid input: must end with "${t.validation.endsWith}"`:bo.assertNever(t.validation):t.validation!=="regex"?s=`Invalid ${t.validation}`:s="Invalid";break;case $s.too_small:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:s="Invalid input";break;case $s.too_big:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?s=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:s="Invalid input";break;case $s.custom:s="Invalid input";break;case $s.invalid_intersection_types:s="Intersection results could not be merged";break;case $s.not_multiple_of:s=`Number must be a multiple of ${t.multipleOf}`;break;case $s.not_finite:s="Number must be finite";break;default:s=r.defaultError,bo.assertNever(t)}return{message:s}};let Jht=kme;function emt(){return Jht}const tmt=t=>{const{data:r,path:s,errorMaps:n,issueData:a}=t,o=[...s,...a.path||[]],l={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let i="";const d=n.filter(m=>!!m).slice().reverse();for(const m of d)i=m(l,{data:r,defaultError:i}).message;return{...a,path:o,message:i}};function Cn(t,r){const s=emt(),n=tmt({issueData:r,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,s,s===kme?void 0:kme].filter(a=>!!a)});t.common.issues.push(n)}class Im{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(r,s){const n=[];for(const a of s){if(a.status==="aborted")return ii;a.status==="dirty"&&r.dirty(),n.push(a.value)}return{status:r.value,value:n}}static async mergeObjectAsync(r,s){const n=[];for(const a of s){const o=await a.key,l=await a.value;n.push({key:o,value:l})}return Im.mergeObjectSync(r,n)}static mergeObjectSync(r,s){const n={};for(const a of s){const{key:o,value:l}=a;if(o.status==="aborted"||l.status==="aborted")return ii;o.status==="dirty"&&r.dirty(),l.status==="dirty"&&r.dirty(),o.value!=="__proto__"&&(typeof l.value<"u"||a.alwaysSet)&&(n[o.value]=l.value)}return{status:r.value,value:n}}}const ii=Object.freeze({status:"aborted"}),ZT=t=>({status:"dirty",value:t}),Ap=t=>({status:"valid",value:t}),bNe=t=>t.status==="aborted",wNe=t=>t.status==="dirty",UC=t=>t.status==="valid",Xte=t=>typeof Promise<"u"&&t instanceof Promise;var sa;(function(t){t.errToObj=r=>typeof r=="string"?{message:r}:r||{},t.toString=r=>typeof r=="string"?r:r==null?void 0:r.message})(sa||(sa={}));class vv{constructor(r,s,n,a){this._cachedPath=[],this.parent=r,this.data=s,this._path=n,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 jNe=(t,r)=>{if(UC(r))return{success:!0,data:r.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const s=new nx(t.common.issues);return this._error=s,this._error}}};function Di(t){if(!t)return{};const{errorMap:r,invalid_type_error:s,required_error:n,description:a}=t;if(r&&(s||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return r?{errorMap:r,description:a}:{errorMap:(l,i)=>{const{message:d}=t;return l.code==="invalid_enum_value"?{message:d??i.defaultError}:typeof i.data>"u"?{message:d??n??i.defaultError}:l.code!=="invalid_type"?{message:i.defaultError}:{message:d??s??i.defaultError}},description:a}}class yo{get description(){return this._def.description}_getType(r){return t1(r.data)}_getOrReturnCtx(r,s){return s||{common:r.parent.common,data:r.data,parsedType:t1(r.data),schemaErrorMap:this._def.errorMap,path:r.path,parent:r.parent}}_processInputParams(r){return{status:new Im,ctx:{common:r.parent.common,data:r.data,parsedType:t1(r.data),schemaErrorMap:this._def.errorMap,path:r.path,parent:r.parent}}}_parseSync(r){const s=this._parse(r);if(Xte(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(r){const s=this._parse(r);return Promise.resolve(s)}parse(r,s){const n=this.safeParse(r,s);if(n.success)return n.data;throw n.error}safeParse(r,s){const n={common:{issues:[],async:(s==null?void 0:s.async)??!1,contextualErrorMap:s==null?void 0:s.errorMap},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:t1(r)},a=this._parseSync({data:r,path:n.path,parent:n});return jNe(n,a)}"~validate"(r){var n,a;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:t1(r)};if(!this["~standard"].async)try{const o=this._parseSync({data:r,path:[],parent:s});return UC(o)?{value:o.value}:{issues:s.common.issues}}catch(o){(a=(n=o==null?void 0:o.message)==null?void 0:n.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:r,path:[],parent:s}).then(o=>UC(o)?{value:o.value}:{issues:s.common.issues})}async parseAsync(r,s){const n=await this.safeParseAsync(r,s);if(n.success)return n.data;throw n.error}async safeParseAsync(r,s){const n={common:{issues:[],contextualErrorMap:s==null?void 0:s.errorMap,async:!0},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:t1(r)},a=this._parse({data:r,path:n.path,parent:n}),o=await(Xte(a)?a:Promise.resolve(a));return jNe(n,o)}refine(r,s){const n=a=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(a):s;return this._refinement((a,o)=>{const l=r(a),i=()=>o.addIssue({code:$s.custom,...n(a)});return typeof Promise<"u"&&l instanceof Promise?l.then(d=>d?!0:(i(),!1)):l?!0:(i(),!1)})}refinement(r,s){return this._refinement((n,a)=>r(n)?!0:(a.addIssue(typeof s=="function"?s(n,a):s),!1))}_refinement(r){return new HC({schema:this,typeName:oi.ZodEffects,effect:{type:"refinement",refinement:r}})}superRefine(r){return this._refinement(r)}constructor(r){this.spa=this.safeParseAsync,this._def=r,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:s=>this["~validate"](s)}}optional(){return av.create(this,this._def)}nullable(){return WC.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ex.create(this)}promise(){return tre.create(this,this._def)}or(r){return Jte.create([this,r],this._def)}and(r){return ere.create(this,r,this._def)}transform(r){return new HC({...Di(this._def),schema:this,typeName:oi.ZodEffects,effect:{type:"transform",transform:r}})}default(r){const s=typeof r=="function"?r:()=>r;return new Mme({...Di(this._def),innerType:this,defaultValue:s,typeName:oi.ZodDefault})}brand(){return new kmt({typeName:oi.ZodBranded,type:this,...Di(this._def)})}catch(r){const s=typeof r=="function"?r:()=>r;return new Tme({...Di(this._def),innerType:this,catchValue:s,typeName:oi.ZodCatch})}describe(r){const s=this.constructor;return new s({...this._def,description:r})}pipe(r){return vye.create(this,r)}readonly(){return Ame.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const rmt=/^c[^\s-]{8,}$/i,smt=/^[0-9a-z]+$/,nmt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,amt=/^[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,imt=/^[a-z0-9_-]{21}$/i,omt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,lmt=/^[-+]?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)?)??$/,cmt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,dmt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Xce;const umt=/^(?:(?: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])$/,hmt=/^(?:(?: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])$/,mmt=/^(([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]))$/,pmt=/^(([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])$/,fmt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,gmt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hDe="((\\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])))",xmt=new RegExp(`^${hDe}$`);function mDe(t){let r="[0-5]\\d";t.precision?r=`${r}\\.\\d{${t.precision}}`:t.precision==null&&(r=`${r}(\\.\\d+)?`);const s=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${r})${s}`}function ymt(t){return new RegExp(`^${mDe(t)}$`)}function vmt(t){let r=`${hDe}T${mDe(t)}`;const s=[];return s.push(t.local?"Z?":"Z"),t.offset&&s.push("([+-]\\d{2}:?\\d{2})"),r=`${r}(${s.join("|")})`,new RegExp(`^${r}$`)}function _mt(t,r){return!!((r==="v4"||!r)&&umt.test(t)||(r==="v6"||!r)&&mmt.test(t))}function bmt(t,r){if(!omt.test(t))return!1;try{const[s]=t.split(".");if(!s)return!1;const n=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||r&&a.alg!==r)}catch{return!1}}function wmt(t,r){return!!((r==="v4"||!r)&&hmt.test(t)||(r==="v6"||!r)&&pmt.test(t))}class E1 extends yo{_parse(r){if(this._def.coerce&&(r.data=String(r.data)),this._getType(r)!==Hn.string){const o=this._getOrReturnCtx(r);return Cn(o,{code:$s.invalid_type,expected:Hn.string,received:o.parsedType}),ii}const n=new Im;let a;for(const o of this._def.checks)if(o.kind==="min")r.data.lengtho.value&&(a=this._getOrReturnCtx(r,a),Cn(a,{code:$s.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){const l=r.data.length>o.value,i=r.data.lengthr.test(a),{validation:s,code:$s.invalid_string,...sa.errToObj(n)})}_addCheck(r){return new E1({...this._def,checks:[...this._def.checks,r]})}email(r){return this._addCheck({kind:"email",...sa.errToObj(r)})}url(r){return this._addCheck({kind:"url",...sa.errToObj(r)})}emoji(r){return this._addCheck({kind:"emoji",...sa.errToObj(r)})}uuid(r){return this._addCheck({kind:"uuid",...sa.errToObj(r)})}nanoid(r){return this._addCheck({kind:"nanoid",...sa.errToObj(r)})}cuid(r){return this._addCheck({kind:"cuid",...sa.errToObj(r)})}cuid2(r){return this._addCheck({kind:"cuid2",...sa.errToObj(r)})}ulid(r){return this._addCheck({kind:"ulid",...sa.errToObj(r)})}base64(r){return this._addCheck({kind:"base64",...sa.errToObj(r)})}base64url(r){return this._addCheck({kind:"base64url",...sa.errToObj(r)})}jwt(r){return this._addCheck({kind:"jwt",...sa.errToObj(r)})}ip(r){return this._addCheck({kind:"ip",...sa.errToObj(r)})}cidr(r){return this._addCheck({kind:"cidr",...sa.errToObj(r)})}datetime(r){return typeof r=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:r}):this._addCheck({kind:"datetime",precision:typeof(r==null?void 0:r.precision)>"u"?null:r==null?void 0:r.precision,offset:(r==null?void 0:r.offset)??!1,local:(r==null?void 0:r.local)??!1,...sa.errToObj(r==null?void 0:r.message)})}date(r){return this._addCheck({kind:"date",message:r})}time(r){return typeof r=="string"?this._addCheck({kind:"time",precision:null,message:r}):this._addCheck({kind:"time",precision:typeof(r==null?void 0:r.precision)>"u"?null:r==null?void 0:r.precision,...sa.errToObj(r==null?void 0:r.message)})}duration(r){return this._addCheck({kind:"duration",...sa.errToObj(r)})}regex(r,s){return this._addCheck({kind:"regex",regex:r,...sa.errToObj(s)})}includes(r,s){return this._addCheck({kind:"includes",value:r,position:s==null?void 0:s.position,...sa.errToObj(s==null?void 0:s.message)})}startsWith(r,s){return this._addCheck({kind:"startsWith",value:r,...sa.errToObj(s)})}endsWith(r,s){return this._addCheck({kind:"endsWith",value:r,...sa.errToObj(s)})}min(r,s){return this._addCheck({kind:"min",value:r,...sa.errToObj(s)})}max(r,s){return this._addCheck({kind:"max",value:r,...sa.errToObj(s)})}length(r,s){return this._addCheck({kind:"length",value:r,...sa.errToObj(s)})}nonempty(r){return this.min(1,sa.errToObj(r))}trim(){return new E1({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new E1({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new E1({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(r=>r.kind==="datetime")}get isDate(){return!!this._def.checks.find(r=>r.kind==="date")}get isTime(){return!!this._def.checks.find(r=>r.kind==="time")}get isDuration(){return!!this._def.checks.find(r=>r.kind==="duration")}get isEmail(){return!!this._def.checks.find(r=>r.kind==="email")}get isURL(){return!!this._def.checks.find(r=>r.kind==="url")}get isEmoji(){return!!this._def.checks.find(r=>r.kind==="emoji")}get isUUID(){return!!this._def.checks.find(r=>r.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(r=>r.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(r=>r.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(r=>r.kind==="cuid2")}get isULID(){return!!this._def.checks.find(r=>r.kind==="ulid")}get isIP(){return!!this._def.checks.find(r=>r.kind==="ip")}get isCIDR(){return!!this._def.checks.find(r=>r.kind==="cidr")}get isBase64(){return!!this._def.checks.find(r=>r.kind==="base64")}get isBase64url(){return!!this._def.checks.find(r=>r.kind==="base64url")}get minLength(){let r=null;for(const s of this._def.checks)s.kind==="min"&&(r===null||s.value>r)&&(r=s.value);return r}get maxLength(){let r=null;for(const s of this._def.checks)s.kind==="max"&&(r===null||s.valuenew E1({checks:[],typeName:oi.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Di(t)});function jmt(t,r){const s=(t.toString().split(".")[1]||"").length,n=(r.toString().split(".")[1]||"").length,a=s>n?s:n,o=Number.parseInt(t.toFixed(a).replace(".","")),l=Number.parseInt(r.toFixed(a).replace(".",""));return o%l/10**a}class qC extends yo{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(r){if(this._def.coerce&&(r.data=Number(r.data)),this._getType(r)!==Hn.number){const o=this._getOrReturnCtx(r);return Cn(o,{code:$s.invalid_type,expected:Hn.number,received:o.parsedType}),ii}let n;const a=new Im;for(const o of this._def.checks)o.kind==="int"?bo.isInteger(r.data)||(n=this._getOrReturnCtx(r,n),Cn(n,{code:$s.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?r.datao.value:r.data>=o.value)&&(n=this._getOrReturnCtx(r,n),Cn(n,{code:$s.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?jmt(r.data,o.value)!==0&&(n=this._getOrReturnCtx(r,n),Cn(n,{code:$s.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(r.data)||(n=this._getOrReturnCtx(r,n),Cn(n,{code:$s.not_finite,message:o.message}),a.dirty()):bo.assertNever(o);return{status:a.value,value:r.data}}gte(r,s){return this.setLimit("min",r,!0,sa.toString(s))}gt(r,s){return this.setLimit("min",r,!1,sa.toString(s))}lte(r,s){return this.setLimit("max",r,!0,sa.toString(s))}lt(r,s){return this.setLimit("max",r,!1,sa.toString(s))}setLimit(r,s,n,a){return new qC({...this._def,checks:[...this._def.checks,{kind:r,value:s,inclusive:n,message:sa.toString(a)}]})}_addCheck(r){return new qC({...this._def,checks:[...this._def.checks,r]})}int(r){return this._addCheck({kind:"int",message:sa.toString(r)})}positive(r){return this._addCheck({kind:"min",value:0,inclusive:!1,message:sa.toString(r)})}negative(r){return this._addCheck({kind:"max",value:0,inclusive:!1,message:sa.toString(r)})}nonpositive(r){return this._addCheck({kind:"max",value:0,inclusive:!0,message:sa.toString(r)})}nonnegative(r){return this._addCheck({kind:"min",value:0,inclusive:!0,message:sa.toString(r)})}multipleOf(r,s){return this._addCheck({kind:"multipleOf",value:r,message:sa.toString(s)})}finite(r){return this._addCheck({kind:"finite",message:sa.toString(r)})}safe(r){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:sa.toString(r)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:sa.toString(r)})}get minValue(){let r=null;for(const s of this._def.checks)s.kind==="min"&&(r===null||s.value>r)&&(r=s.value);return r}get maxValue(){let r=null;for(const s of this._def.checks)s.kind==="max"&&(r===null||s.valuer.kind==="int"||r.kind==="multipleOf"&&bo.isInteger(r.value))}get isFinite(){let r=null,s=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(s===null||n.value>s)&&(s=n.value):n.kind==="max"&&(r===null||n.valuenew qC({checks:[],typeName:oi.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Di(t)});class XE extends yo{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(r){if(this._def.coerce)try{r.data=BigInt(r.data)}catch{return this._getInvalidInput(r)}if(this._getType(r)!==Hn.bigint)return this._getInvalidInput(r);let n;const a=new Im;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?r.datao.value:r.data>=o.value)&&(n=this._getOrReturnCtx(r,n),Cn(n,{code:$s.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?r.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(r,n),Cn(n,{code:$s.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):bo.assertNever(o);return{status:a.value,value:r.data}}_getInvalidInput(r){const s=this._getOrReturnCtx(r);return Cn(s,{code:$s.invalid_type,expected:Hn.bigint,received:s.parsedType}),ii}gte(r,s){return this.setLimit("min",r,!0,sa.toString(s))}gt(r,s){return this.setLimit("min",r,!1,sa.toString(s))}lte(r,s){return this.setLimit("max",r,!0,sa.toString(s))}lt(r,s){return this.setLimit("max",r,!1,sa.toString(s))}setLimit(r,s,n,a){return new XE({...this._def,checks:[...this._def.checks,{kind:r,value:s,inclusive:n,message:sa.toString(a)}]})}_addCheck(r){return new XE({...this._def,checks:[...this._def.checks,r]})}positive(r){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:sa.toString(r)})}negative(r){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:sa.toString(r)})}nonpositive(r){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:sa.toString(r)})}nonnegative(r){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:sa.toString(r)})}multipleOf(r,s){return this._addCheck({kind:"multipleOf",value:r,message:sa.toString(s)})}get minValue(){let r=null;for(const s of this._def.checks)s.kind==="min"&&(r===null||s.value>r)&&(r=s.value);return r}get maxValue(){let r=null;for(const s of this._def.checks)s.kind==="max"&&(r===null||s.valuenew XE({checks:[],typeName:oi.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Di(t)});class Nme extends yo{_parse(r){if(this._def.coerce&&(r.data=!!r.data),this._getType(r)!==Hn.boolean){const n=this._getOrReturnCtx(r);return Cn(n,{code:$s.invalid_type,expected:Hn.boolean,received:n.parsedType}),ii}return Ap(r.data)}}Nme.create=t=>new Nme({typeName:oi.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Di(t)});class Qte extends yo{_parse(r){if(this._def.coerce&&(r.data=new Date(r.data)),this._getType(r)!==Hn.date){const o=this._getOrReturnCtx(r);return Cn(o,{code:$s.invalid_type,expected:Hn.date,received:o.parsedType}),ii}if(Number.isNaN(r.data.getTime())){const o=this._getOrReturnCtx(r);return Cn(o,{code:$s.invalid_date}),ii}const n=new Im;let a;for(const o of this._def.checks)o.kind==="min"?r.data.getTime()o.value&&(a=this._getOrReturnCtx(r,a),Cn(a,{code:$s.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):bo.assertNever(o);return{status:n.value,value:new Date(r.data.getTime())}}_addCheck(r){return new Qte({...this._def,checks:[...this._def.checks,r]})}min(r,s){return this._addCheck({kind:"min",value:r.getTime(),message:sa.toString(s)})}max(r,s){return this._addCheck({kind:"max",value:r.getTime(),message:sa.toString(s)})}get minDate(){let r=null;for(const s of this._def.checks)s.kind==="min"&&(r===null||s.value>r)&&(r=s.value);return r!=null?new Date(r):null}get maxDate(){let r=null;for(const s of this._def.checks)s.kind==="max"&&(r===null||s.valuenew Qte({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:oi.ZodDate,...Di(t)});class kNe extends yo{_parse(r){if(this._getType(r)!==Hn.symbol){const n=this._getOrReturnCtx(r);return Cn(n,{code:$s.invalid_type,expected:Hn.symbol,received:n.parsedType}),ii}return Ap(r.data)}}kNe.create=t=>new kNe({typeName:oi.ZodSymbol,...Di(t)});class NNe extends yo{_parse(r){if(this._getType(r)!==Hn.undefined){const n=this._getOrReturnCtx(r);return Cn(n,{code:$s.invalid_type,expected:Hn.undefined,received:n.parsedType}),ii}return Ap(r.data)}}NNe.create=t=>new NNe({typeName:oi.ZodUndefined,...Di(t)});class SNe extends yo{_parse(r){if(this._getType(r)!==Hn.null){const n=this._getOrReturnCtx(r);return Cn(n,{code:$s.invalid_type,expected:Hn.null,received:n.parsedType}),ii}return Ap(r.data)}}SNe.create=t=>new SNe({typeName:oi.ZodNull,...Di(t)});class CNe extends yo{constructor(){super(...arguments),this._any=!0}_parse(r){return Ap(r.data)}}CNe.create=t=>new CNe({typeName:oi.ZodAny,...Di(t)});class MNe extends yo{constructor(){super(...arguments),this._unknown=!0}_parse(r){return Ap(r.data)}}MNe.create=t=>new MNe({typeName:oi.ZodUnknown,...Di(t)});class _v extends yo{_parse(r){const s=this._getOrReturnCtx(r);return Cn(s,{code:$s.invalid_type,expected:Hn.never,received:s.parsedType}),ii}}_v.create=t=>new _v({typeName:oi.ZodNever,...Di(t)});class TNe extends yo{_parse(r){if(this._getType(r)!==Hn.undefined){const n=this._getOrReturnCtx(r);return Cn(n,{code:$s.invalid_type,expected:Hn.void,received:n.parsedType}),ii}return Ap(r.data)}}TNe.create=t=>new TNe({typeName:oi.ZodVoid,...Di(t)});class ex extends yo{_parse(r){const{ctx:s,status:n}=this._processInputParams(r),a=this._def;if(s.parsedType!==Hn.array)return Cn(s,{code:$s.invalid_type,expected:Hn.array,received:s.parsedType}),ii;if(a.exactLength!==null){const l=s.data.length>a.exactLength.value,i=s.data.lengtha.maxLength.value&&(Cn(s,{code:$s.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),s.common.async)return Promise.all([...s.data].map((l,i)=>a.type._parseAsync(new vv(s,l,s.path,i)))).then(l=>Im.mergeArray(n,l));const o=[...s.data].map((l,i)=>a.type._parseSync(new vv(s,l,s.path,i)));return Im.mergeArray(n,o)}get element(){return this._def.type}min(r,s){return new ex({...this._def,minLength:{value:r,message:sa.toString(s)}})}max(r,s){return new ex({...this._def,maxLength:{value:r,message:sa.toString(s)}})}length(r,s){return new ex({...this._def,exactLength:{value:r,message:sa.toString(s)}})}nonempty(r){return this.min(1,r)}}ex.create=(t,r)=>new ex({type:t,minLength:null,maxLength:null,exactLength:null,typeName:oi.ZodArray,...Di(r)});function J4(t){if(t instanceof Zc){const r={};for(const s in t.shape){const n=t.shape[s];r[s]=av.create(J4(n))}return new Zc({...t._def,shape:()=>r})}else return t instanceof ex?new ex({...t._def,type:J4(t.element)}):t instanceof av?av.create(J4(t.unwrap())):t instanceof WC?WC.create(J4(t.unwrap())):t instanceof wk?wk.create(t.items.map(r=>J4(r))):t}class Zc extends yo{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const r=this._def.shape(),s=bo.objectKeys(r);return this._cached={shape:r,keys:s},this._cached}_parse(r){if(this._getType(r)!==Hn.object){const m=this._getOrReturnCtx(r);return Cn(m,{code:$s.invalid_type,expected:Hn.object,received:m.parsedType}),ii}const{status:n,ctx:a}=this._processInputParams(r),{shape:o,keys:l}=this._getCached(),i=[];if(!(this._def.catchall instanceof _v&&this._def.unknownKeys==="strip"))for(const m in a.data)l.includes(m)||i.push(m);const d=[];for(const m of l){const g=o[m],y=a.data[m];d.push({key:{status:"valid",value:m},value:g._parse(new vv(a,y,a.path,m)),alwaysSet:m in a.data})}if(this._def.catchall instanceof _v){const m=this._def.unknownKeys;if(m==="passthrough")for(const g of i)d.push({key:{status:"valid",value:g},value:{status:"valid",value:a.data[g]}});else if(m==="strict")i.length>0&&(Cn(a,{code:$s.unrecognized_keys,keys:i}),n.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const m=this._def.catchall;for(const g of i){const y=a.data[g];d.push({key:{status:"valid",value:g},value:m._parse(new vv(a,y,a.path,g)),alwaysSet:g in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const m=[];for(const g of d){const y=await g.key,v=await g.value;m.push({key:y,value:v,alwaysSet:g.alwaysSet})}return m}).then(m=>Im.mergeObjectSync(n,m)):Im.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(r){return sa.errToObj,new Zc({...this._def,unknownKeys:"strict",...r!==void 0?{errorMap:(s,n)=>{var o,l;const a=((l=(o=this._def).errorMap)==null?void 0:l.call(o,s,n).message)??n.defaultError;return s.code==="unrecognized_keys"?{message:sa.errToObj(r).message??a}:{message:a}}}:{}})}strip(){return new Zc({...this._def,unknownKeys:"strip"})}passthrough(){return new Zc({...this._def,unknownKeys:"passthrough"})}extend(r){return new Zc({...this._def,shape:()=>({...this._def.shape(),...r})})}merge(r){return new Zc({unknownKeys:r._def.unknownKeys,catchall:r._def.catchall,shape:()=>({...this._def.shape(),...r._def.shape()}),typeName:oi.ZodObject})}setKey(r,s){return this.augment({[r]:s})}catchall(r){return new Zc({...this._def,catchall:r})}pick(r){const s={};for(const n of bo.objectKeys(r))r[n]&&this.shape[n]&&(s[n]=this.shape[n]);return new Zc({...this._def,shape:()=>s})}omit(r){const s={};for(const n of bo.objectKeys(this.shape))r[n]||(s[n]=this.shape[n]);return new Zc({...this._def,shape:()=>s})}deepPartial(){return J4(this)}partial(r){const s={};for(const n of bo.objectKeys(this.shape)){const a=this.shape[n];r&&!r[n]?s[n]=a:s[n]=a.optional()}return new Zc({...this._def,shape:()=>s})}required(r){const s={};for(const n of bo.objectKeys(this.shape))if(r&&!r[n])s[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof av;)o=o._def.innerType;s[n]=o}return new Zc({...this._def,shape:()=>s})}keyof(){return pDe(bo.objectKeys(this.shape))}}Zc.create=(t,r)=>new Zc({shape:()=>t,unknownKeys:"strip",catchall:_v.create(),typeName:oi.ZodObject,...Di(r)});Zc.strictCreate=(t,r)=>new Zc({shape:()=>t,unknownKeys:"strict",catchall:_v.create(),typeName:oi.ZodObject,...Di(r)});Zc.lazycreate=(t,r)=>new Zc({shape:t,unknownKeys:"strip",catchall:_v.create(),typeName:oi.ZodObject,...Di(r)});class Jte extends yo{_parse(r){const{ctx:s}=this._processInputParams(r),n=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 s.common.issues.push(...i.ctx.common.issues),i.result;const l=o.map(i=>new nx(i.ctx.common.issues));return Cn(s,{code:$s.invalid_union,unionErrors:l}),ii}if(s.common.async)return Promise.all(n.map(async o=>{const l={...s,common:{...s.common,issues:[]},parent:null};return{result:await o._parseAsync({data:s.data,path:s.path,parent:l}),ctx:l}})).then(a);{let o;const l=[];for(const d of n){const m={...s,common:{...s.common,issues:[]},parent:null},g=d._parseSync({data:s.data,path:s.path,parent:m});if(g.status==="valid")return g;g.status==="dirty"&&!o&&(o={result:g,ctx:m}),m.common.issues.length&&l.push(m.common.issues)}if(o)return s.common.issues.push(...o.ctx.common.issues),o.result;const i=l.map(d=>new nx(d));return Cn(s,{code:$s.invalid_union,unionErrors:i}),ii}}get options(){return this._def.options}}Jte.create=(t,r)=>new Jte({options:t,typeName:oi.ZodUnion,...Di(r)});function Sme(t,r){const s=t1(t),n=t1(r);if(t===r)return{valid:!0,data:t};if(s===Hn.object&&n===Hn.object){const a=bo.objectKeys(r),o=bo.objectKeys(t).filter(i=>a.indexOf(i)!==-1),l={...t,...r};for(const i of o){const d=Sme(t[i],r[i]);if(!d.valid)return{valid:!1};l[i]=d.data}return{valid:!0,data:l}}else if(s===Hn.array&&n===Hn.array){if(t.length!==r.length)return{valid:!1};const a=[];for(let o=0;o{if(bNe(o)||bNe(l))return ii;const i=Sme(o.value,l.value);return i.valid?((wNe(o)||wNe(l))&&s.dirty(),{status:s.value,value:i.data}):(Cn(n,{code:$s.invalid_intersection_types}),ii)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,l])=>a(o,l)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ere.create=(t,r,s)=>new ere({left:t,right:r,typeName:oi.ZodIntersection,...Di(s)});class wk extends yo{_parse(r){const{status:s,ctx:n}=this._processInputParams(r);if(n.parsedType!==Hn.array)return Cn(n,{code:$s.invalid_type,expected:Hn.array,received:n.parsedType}),ii;if(n.data.lengththis._def.items.length&&(Cn(n,{code:$s.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());const o=[...n.data].map((l,i)=>{const d=this._def.items[i]||this._def.rest;return d?d._parse(new vv(n,l,n.path,i)):null}).filter(l=>!!l);return n.common.async?Promise.all(o).then(l=>Im.mergeArray(s,l)):Im.mergeArray(s,o)}get items(){return this._def.items}rest(r){return new wk({...this._def,rest:r})}}wk.create=(t,r)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new wk({items:t,typeName:oi.ZodTuple,rest:null,...Di(r)})};class ANe extends yo{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(r){const{status:s,ctx:n}=this._processInputParams(r);if(n.parsedType!==Hn.map)return Cn(n,{code:$s.invalid_type,expected:Hn.map,received:n.parsedType}),ii;const a=this._def.keyType,o=this._def.valueType,l=[...n.data.entries()].map(([i,d],m)=>({key:a._parse(new vv(n,i,n.path,[m,"key"])),value:o._parse(new vv(n,d,n.path,[m,"value"]))}));if(n.common.async){const i=new Map;return Promise.resolve().then(async()=>{for(const d of l){const m=await d.key,g=await d.value;if(m.status==="aborted"||g.status==="aborted")return ii;(m.status==="dirty"||g.status==="dirty")&&s.dirty(),i.set(m.value,g.value)}return{status:s.value,value:i}})}else{const i=new Map;for(const d of l){const m=d.key,g=d.value;if(m.status==="aborted"||g.status==="aborted")return ii;(m.status==="dirty"||g.status==="dirty")&&s.dirty(),i.set(m.value,g.value)}return{status:s.value,value:i}}}}ANe.create=(t,r,s)=>new ANe({valueType:r,keyType:t,typeName:oi.ZodMap,...Di(s)});class QE extends yo{_parse(r){const{status:s,ctx:n}=this._processInputParams(r);if(n.parsedType!==Hn.set)return Cn(n,{code:$s.invalid_type,expected:Hn.set,received:n.parsedType}),ii;const a=this._def;a.minSize!==null&&n.data.sizea.maxSize.value&&(Cn(n,{code:$s.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),s.dirty());const o=this._def.valueType;function l(d){const m=new Set;for(const g of d){if(g.status==="aborted")return ii;g.status==="dirty"&&s.dirty(),m.add(g.value)}return{status:s.value,value:m}}const i=[...n.data.values()].map((d,m)=>o._parse(new vv(n,d,n.path,m)));return n.common.async?Promise.all(i).then(d=>l(d)):l(i)}min(r,s){return new QE({...this._def,minSize:{value:r,message:sa.toString(s)}})}max(r,s){return new QE({...this._def,maxSize:{value:r,message:sa.toString(s)}})}size(r,s){return this.min(r,s).max(r,s)}nonempty(r){return this.min(1,r)}}QE.create=(t,r)=>new QE({valueType:t,minSize:null,maxSize:null,typeName:oi.ZodSet,...Di(r)});class ENe extends yo{get schema(){return this._def.getter()}_parse(r){const{ctx:s}=this._processInputParams(r);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}}ENe.create=(t,r)=>new ENe({getter:t,typeName:oi.ZodLazy,...Di(r)});class Cme extends yo{_parse(r){if(r.data!==this._def.value){const s=this._getOrReturnCtx(r);return Cn(s,{received:s.data,code:$s.invalid_literal,expected:this._def.value}),ii}return{status:"valid",value:r.data}}get value(){return this._def.value}}Cme.create=(t,r)=>new Cme({value:t,typeName:oi.ZodLiteral,...Di(r)});function pDe(t,r){return new VC({values:t,typeName:oi.ZodEnum,...Di(r)})}class VC extends yo{_parse(r){if(typeof r.data!="string"){const s=this._getOrReturnCtx(r),n=this._def.values;return Cn(s,{expected:bo.joinValues(n),received:s.parsedType,code:$s.invalid_type}),ii}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(r.data)){const s=this._getOrReturnCtx(r),n=this._def.values;return Cn(s,{received:s.data,code:$s.invalid_enum_value,options:n}),ii}return Ap(r.data)}get options(){return this._def.values}get enum(){const r={};for(const s of this._def.values)r[s]=s;return r}get Values(){const r={};for(const s of this._def.values)r[s]=s;return r}get Enum(){const r={};for(const s of this._def.values)r[s]=s;return r}extract(r,s=this._def){return VC.create(r,{...this._def,...s})}exclude(r,s=this._def){return VC.create(this.options.filter(n=>!r.includes(n)),{...this._def,...s})}}VC.create=pDe;class INe extends yo{_parse(r){const s=bo.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(r);if(n.parsedType!==Hn.string&&n.parsedType!==Hn.number){const a=bo.objectValues(s);return Cn(n,{expected:bo.joinValues(a),received:n.parsedType,code:$s.invalid_type}),ii}if(this._cache||(this._cache=new Set(bo.getValidEnumValues(this._def.values))),!this._cache.has(r.data)){const a=bo.objectValues(s);return Cn(n,{received:n.data,code:$s.invalid_enum_value,options:a}),ii}return Ap(r.data)}get enum(){return this._def.values}}INe.create=(t,r)=>new INe({values:t,typeName:oi.ZodNativeEnum,...Di(r)});class tre extends yo{unwrap(){return this._def.type}_parse(r){const{ctx:s}=this._processInputParams(r);if(s.parsedType!==Hn.promise&&s.common.async===!1)return Cn(s,{code:$s.invalid_type,expected:Hn.promise,received:s.parsedType}),ii;const n=s.parsedType===Hn.promise?s.data:Promise.resolve(s.data);return Ap(n.then(a=>this._def.type.parseAsync(a,{path:s.path,errorMap:s.common.contextualErrorMap})))}}tre.create=(t,r)=>new tre({type:t,typeName:oi.ZodPromise,...Di(r)});class HC extends yo{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===oi.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(r){const{status:s,ctx:n}=this._processInputParams(r),a=this._def.effect||null,o={addIssue:l=>{Cn(n,l),l.fatal?s.abort():s.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){const l=a.transform(n.data,o);if(n.common.async)return Promise.resolve(l).then(async i=>{if(s.value==="aborted")return ii;const d=await this._def.schema._parseAsync({data:i,path:n.path,parent:n});return d.status==="aborted"?ii:d.status==="dirty"||s.value==="dirty"?ZT(d.value):d});{if(s.value==="aborted")return ii;const i=this._def.schema._parseSync({data:l,path:n.path,parent:n});return i.status==="aborted"?ii:i.status==="dirty"||s.value==="dirty"?ZT(i.value):i}}if(a.type==="refinement"){const l=i=>{const d=a.refinement(i,o);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ii:(i.status==="dirty"&&s.dirty(),l(i.value),{status:s.value,value:i.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>i.status==="aborted"?ii:(i.status==="dirty"&&s.dirty(),l(i.value).then(()=>({status:s.value,value:i.value}))))}if(a.type==="transform")if(n.common.async===!1){const l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!UC(l))return ii;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:s.value,value:i}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>UC(l)?Promise.resolve(a.transform(l.value,o)).then(i=>({status:s.value,value:i})):ii);bo.assertNever(a)}}HC.create=(t,r,s)=>new HC({schema:t,typeName:oi.ZodEffects,effect:r,...Di(s)});HC.createWithPreprocess=(t,r,s)=>new HC({schema:r,effect:{type:"preprocess",transform:t},typeName:oi.ZodEffects,...Di(s)});class av extends yo{_parse(r){return this._getType(r)===Hn.undefined?Ap(void 0):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}}av.create=(t,r)=>new av({innerType:t,typeName:oi.ZodOptional,...Di(r)});class WC extends yo{_parse(r){return this._getType(r)===Hn.null?Ap(null):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}}WC.create=(t,r)=>new WC({innerType:t,typeName:oi.ZodNullable,...Di(r)});class Mme extends yo{_parse(r){const{ctx:s}=this._processInputParams(r);let n=s.data;return s.parsedType===Hn.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:s.path,parent:s})}removeDefault(){return this._def.innerType}}Mme.create=(t,r)=>new Mme({innerType:t,typeName:oi.ZodDefault,defaultValue:typeof r.default=="function"?r.default:()=>r.default,...Di(r)});class Tme extends yo{_parse(r){const{ctx:s}=this._processInputParams(r),n={...s,common:{...s.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Xte(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new nx(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new nx(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Tme.create=(t,r)=>new Tme({innerType:t,typeName:oi.ZodCatch,catchValue:typeof r.catch=="function"?r.catch:()=>r.catch,...Di(r)});class PNe extends yo{_parse(r){if(this._getType(r)!==Hn.nan){const n=this._getOrReturnCtx(r);return Cn(n,{code:$s.invalid_type,expected:Hn.nan,received:n.parsedType}),ii}return{status:"valid",value:r.data}}}PNe.create=t=>new PNe({typeName:oi.ZodNaN,...Di(t)});class kmt extends yo{_parse(r){const{ctx:s}=this._processInputParams(r),n=s.data;return this._def.type._parse({data:n,path:s.path,parent:s})}unwrap(){return this._def.type}}class vye extends yo{_parse(r){const{status:s,ctx:n}=this._processInputParams(r);if(n.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ii:o.status==="dirty"?(s.dirty(),ZT(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ii:a.status==="dirty"?(s.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(r,s){return new vye({in:r,out:s,typeName:oi.ZodPipeline})}}class Ame extends yo{_parse(r){const s=this._def.innerType._parse(r),n=a=>(UC(a)&&(a.value=Object.freeze(a.value)),a);return Xte(s)?s.then(a=>n(a)):n(s)}unwrap(){return this._def.innerType}}Ame.create=(t,r)=>new Ame({innerType:t,typeName:oi.ZodReadonly,...Di(r)});var oi;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(oi||(oi={}));const Do=E1.create,QA=qC.create,Nmt=Nme.create;_v.create;ex.create;const Pv=Zc.create;Jte.create;ere.create;wk.create;const GC=Cme.create,fDe=VC.create;tre.create;av.create;WC.create;function Smt(){const r=Uh().pathname.slice(1);return E.useEffect(()=>(document.body.classList.add("guestbook-page"),()=>{document.body.classList.remove("guestbook-page")}),[]),!r||r===""?e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center p-6",children:e.jsxs("div",{className:"text-center text-white",children:[e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Guest Book"}),e.jsx("p",{className:"text-white/60",children:"The modern open house sign-in experience."}),e.jsx("p",{className:"text-white/40 text-sm mt-2",children:"Visit a specific open house link to sign in."})]})}):e.jsx(Cmt,{slug:r})}function Cmt({slug:t}){return e.jsx(Amt,{slug:t})}const Mmt=Pv({first_name:Do().trim().min(1,"First name is required").max(50),last_name:Do().trim().max(50).optional(),email:Do().trim().email("Please enter a valid email").max(255).optional().or(GC("")),phone:Do().trim().max(20).optional().or(GC(""))}),Tmt=[{value:"buying",label:"Looking to Buy",emoji:"🏠"},{value:"selling",label:"Thinking of Selling",emoji:"📋"},{value:"browsing",label:"Just Browsing",emoji:"👀"},{value:"neighbor",label:"I'm a Neighbor",emoji:"👋"}];function Amt({slug:t}){var M;const{data:r,isLoading:s,error:n}=GOe(t),a=KOe(),[o,l]=E.useState("welcome"),[i,d]=E.useState({first_name:"",last_name:"",email:"",phone:""}),[m,g]=E.useState(!1),[y,v]=E.useState(""),b=I=>{if(!I)return"";const[F,O]=I.split(":"),B=parseInt(F),$=B>=12?"PM":"AM";return`${B>12?B-12:B||12}:${O} ${$}`},N=()=>{v("");const I=Mmt.safeParse(i);if(!I.success){v(I.error.issues[0].message);return}if(!i.email&&!i.phone){v("Please provide either an email or phone number");return}l("intent")},j=async I=>{try{await a.mutateAsync({open_house_id:r.id,first_name:i.first_name.trim(),last_name:i.last_name.trim()||void 0,email:i.email.trim()||void 0,phone:i.phone.trim()||void 0,visitor_intent:I,wants_market_updates:m}),l("done")}catch{v("Something went wrong. Please try again.")}};if(s)return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center",children:e.jsx("div",{className:"w-10 h-10 border-4 border-white/20 border-t-white rounded-full animate-spin"})});if(n||!r)return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center p-6",children:e.jsxs("div",{className:"text-center text-white",children:[e.jsx(Wn,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Open House Not Found"}),e.jsx("p",{className:"text-white/60",children:"This sign-in page doesn't exist or is no longer active."})]})});const S=r.profiles,A=((M=S==null?void 0:S.name)==null?void 0:M.split(" ").map(I=>I[0]).join("").slice(0,2))||"?";return e.jsxs(e.Fragment,{children:[e.jsxs(qh,{children:[e.jsxs("title",{children:["Open House | ",r.property_address]}),e.jsx("meta",{name:"robots",content:"noindex, nofollow"})]}),e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-md",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsxs(ln,{className:"h-16 w-16 mx-auto mb-3 ring-2 ring-white/20",children:[e.jsx(pa,{src:(S==null?void 0:S.avatar_url)||"",alt:(S==null?void 0:S.name)||""}),e.jsx(cn,{className:"bg-white/10 text-white text-lg",children:A})]}),e.jsx("p",{className:"text-white/60 text-sm",children:S==null?void 0:S.name}),(S==null?void 0:S.title)&&e.jsx("p",{className:"text-white/40 text-xs",children:S.title})]}),e.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl overflow-hidden",children:[r.photo_url&&e.jsxs("div",{className:"relative w-full h-48 overflow-hidden",children:[e.jsx("img",{src:r.photo_url,alt:r.property_address,className:"w-full h-full object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-slate-900/60 to-transparent"})]}),e.jsx("div",{className:`${r.photo_url?"px-6 py-4":"px-6 py-5"} bg-gradient-to-r from-slate-800 to-slate-700`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-white/10 flex items-center justify-center shrink-0 mt-0.5",children:e.jsx(Wn,{className:"h-5 w-5 text-white"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-white font-bold text-lg leading-tight",children:r.property_address}),e.jsxs("div",{className:"flex flex-wrap gap-3 mt-2 text-white/60 text-xs",children:[r.city&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(eo,{className:"h-3 w-3"}),r.city,r.state?`, ${r.state}`:""," ",r.zip]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Mn,{className:"h-3 w-3"}),Xr(new Date(r.event_date+"T00:00:00"),"MMM d, yyyy")]}),r.start_time&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ea,{className:"h-3 w-3"}),b(r.start_time),r.end_time?` – ${b(r.end_time)}`:""]})]})]})]})}),e.jsxs("div",{className:"p-6",children:[o==="welcome"&&e.jsxs("div",{className:"text-center space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-slate-900 mb-2",children:"Welcome!"}),e.jsx("p",{className:"text-slate-500 text-sm",children:r.agent_greeting||"Please sign in below."})]}),e.jsxs(Q,{onClick:()=>l("info"),className:"w-full h-14 text-base bg-slate-900 hover:bg-slate-800 text-white rounded-xl",children:["Sign In ",e.jsx(Hi,{className:"h-5 w-5 ml-2"})]}),e.jsx("p",{className:"text-xs text-slate-400",children:"Quick & easy — takes 30 seconds"})]}),o==="info"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("button",{onClick:()=>l("welcome"),className:"text-slate-400 hover:text-slate-600",children:e.jsx(_i,{className:"h-4 w-4"})}),e.jsx("h2",{className:"text-lg font-bold text-slate-900",children:"Your Info"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(Ee,{className:"text-slate-600 text-xs",children:"First Name *"}),e.jsx(Qe,{value:i.first_name,onChange:I=>d(F=>({...F,first_name:I.target.value})),placeholder:"First",className:"mt-1 h-12 rounded-xl border-slate-200 text-base",autoFocus:!0})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-slate-600 text-xs",children:"Last Name"}),e.jsx(Qe,{value:i.last_name,onChange:I=>d(F=>({...F,last_name:I.target.value})),placeholder:"Last",className:"mt-1 h-12 rounded-xl border-slate-200 text-base"})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-slate-600 text-xs",children:"Email"}),e.jsx(Qe,{type:"email",value:i.email,onChange:I=>d(F=>({...F,email:I.target.value})),placeholder:"your@email.com",className:"mt-1 h-12 rounded-xl border-slate-200 text-base"})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-slate-600 text-xs",children:"Phone"}),e.jsx(Qe,{type:"tel",value:i.phone,onChange:I=>d(F=>({...F,phone:I.target.value})),placeholder:"(555) 123-4567",className:"mt-1 h-12 rounded-xl border-slate-200 text-base"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer pt-1",children:[e.jsx("input",{type:"checkbox",checked:m,onChange:I=>g(I.target.checked),className:"rounded border-slate-300"}),e.jsx("span",{className:"text-sm text-slate-600",children:"Send me market updates for this area"})]}),y&&e.jsx("p",{className:"text-red-500 text-sm",children:y}),e.jsxs(Q,{onClick:N,className:"w-full h-14 text-base bg-slate-900 hover:bg-slate-800 text-white rounded-xl",children:["Continue ",e.jsx(Hi,{className:"h-5 w-5 ml-2"})]})]}),o==="intent"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("button",{onClick:()=>l("info"),className:"text-slate-400 hover:text-slate-600",children:e.jsx(_i,{className:"h-4 w-4"})}),e.jsx("h2",{className:"text-lg font-bold text-slate-900",children:"What brings you here?"})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:Tmt.map(I=>e.jsxs("button",{onClick:()=>j(I.value),disabled:a.isPending,className:"flex flex-col items-center gap-2 p-5 rounded-xl border-2 border-slate-200 hover:border-slate-900 hover:bg-slate-50 transition-all text-center group",children:[e.jsx("span",{className:"text-2xl",children:I.emoji}),e.jsx("span",{className:"text-sm font-medium text-slate-700 group-hover:text-slate-900",children:I.label})]},I.value))}),y&&e.jsx("p",{className:"text-red-500 text-sm text-center",children:y})]}),o==="done"&&e.jsx(Emt,{firstName:i.first_name,agentName:S==null?void 0:S.name,agentCardSlug:r.agent_card_slug})]})]}),e.jsx("p",{className:"text-center text-white/30 text-xs mt-6",children:"Powered by LevelUp Guest Book"})]})})]})}function Emt({firstName:t,agentName:r,agentCardSlug:s}){const[n,a]=E.useState(3);return E.useEffect(()=>{if(!s)return;const o=setInterval(()=>{a(l=>l<=1?(clearInterval(o),window.location.href=`https://cards.relevelup.com/${s}`,0):l-1)},1e3);return()=>clearInterval(o)},[s]),e.jsxs("div",{className:"text-center space-y-4 py-4",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-green-100 flex items-center justify-center mx-auto",children:e.jsx(Li,{className:"h-8 w-8 text-green-600"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-slate-900",children:"You're all set!"}),e.jsxs("p",{className:"text-slate-500 text-sm mt-1",children:["Thanks for signing in, ",t,". Enjoy the open house!"]})]}),r&&e.jsxs("p",{className:"text-sm text-slate-400",children:["Your host today: ",e.jsx("strong",{className:"text-slate-600",children:r})]}),s&&e.jsxs("p",{className:"text-xs text-slate-400 animate-pulse",children:["Redirecting to ",r?`${r}'s`:"your agent's"," card in ",n,"s…"]})]})}function Imt({dealData:t,agentProfile:r,welcomeMessage:s,isWon:n}){var o;const a=t!=null&&t.property_address?`${t.property_address}, ${t.city||""}, ${t.state||""}`.replace(/,\s*,/g,",").replace(/,\s*$/,""):null;return e.jsxs("div",{className:"relative overflow-hidden",children:[e.jsxs("div",{className:"bg-gradient-to-br from-[#2a4c64] via-[#345e7a] to-[#406E71] text-white px-4 pt-10 pb-16",children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.04]",style:{backgroundImage:"radial-gradient(circle at 25% 25%, white 1px, transparent 1px)",backgroundSize:"24px 24px"}}),e.jsxs("div",{className:"relative text-center max-w-lg mx-auto",children:[r&&e.jsxs("div",{className:"mb-6",children:[r.avatar_url?e.jsx("img",{src:r.avatar_url,alt:r.name,className:"w-20 h-20 rounded-full border-[3px] border-white/30 shadow-xl mx-auto mb-3 object-cover"}):e.jsx("div",{className:"w-20 h-20 rounded-full border-[3px] border-white/30 shadow-xl mx-auto mb-3 bg-white/10 flex items-center justify-center",children:e.jsx("span",{className:"text-2xl font-bold text-white/70",children:((o=r.name)==null?void 0:o.charAt(0))||"?"})}),e.jsx("p",{className:"text-sm font-medium text-white/90",children:r.name}),e.jsx("p",{className:"text-xs text-white/50 mt-0.5",children:"Your Real Estate Agent"})]}),e.jsxs("div",{className:"inline-flex items-center gap-1.5 bg-white/10 backdrop-blur-sm rounded-full px-3 py-1 text-xs font-medium text-white/80 mb-3",children:[e.jsx(Wn,{className:"w-3 h-3"}),(t==null?void 0:t.deal_type)==="listing"?"Listing":(t==null?void 0:t.deal_type)==="buy-side"?"Purchase":"Transaction"]}),e.jsx("h1",{className:"text-2xl font-bold tracking-tight mb-1.5 font-serif",children:(t==null?void 0:t.deal_name)||"Your Transaction Portal"}),a&&e.jsxs("div",{className:"flex items-center justify-center gap-1 text-white/60 text-sm",children:[e.jsx(eo,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:a})]}),s&&e.jsx("p",{className:"mt-4 text-sm text-white/70 leading-relaxed max-w-sm mx-auto",children:s})]})]}),r&&e.jsx("div",{className:"max-w-lg mx-auto px-4 -mt-8 relative z-10",children:e.jsx("div",{className:"bg-white rounded-2xl shadow-lg border border-slate-100 p-4",children:e.jsxs("div",{className:"flex items-center justify-center gap-3",children:[r.phone&&e.jsxs("a",{href:`tel:${r.phone}`,className:"flex items-center gap-2 px-4 py-2.5 rounded-xl bg-[#406E71]/10 hover:bg-[#406E71]/20 transition-colors",children:[e.jsx(wi,{className:"w-4 h-4 text-[#406E71]"}),e.jsx("span",{className:"text-sm font-medium text-[#406E71]",children:"Call"})]}),r.email&&e.jsxs("a",{href:`mailto:${r.email}`,className:"flex items-center gap-2 px-4 py-2.5 rounded-xl bg-[#406E71]/10 hover:bg-[#406E71]/20 transition-colors",children:[e.jsx(mn,{className:"w-4 h-4 text-[#406E71]"}),e.jsx("span",{className:"text-sm font-medium text-[#406E71]",children:"Email"})]}),r.phone&&e.jsxs("a",{href:`sms:${r.phone}`,className:"flex items-center gap-2 px-4 py-2.5 rounded-xl bg-[#406E71]/10 hover:bg-[#406E71]/20 transition-colors",children:[e.jsx(Pl,{className:"w-4 h-4 text-[#406E71]"}),e.jsx("span",{className:"text-sm font-medium text-[#406E71]",children:"Text"})]})]})})})]})}function Pmt({journeyStages:t,currentIndex:r}){return t.length===0?null:e.jsxs("div",{className:"bg-white rounded-2xl p-5 shadow-sm border border-slate-100",children:[e.jsx("h2",{className:"text-base font-semibold text-slate-800 mb-1",children:"Your Home Journey"}),e.jsx("p",{className:"text-xs text-slate-400 mb-5",children:"Follow along as your transaction progresses"}),e.jsx("div",{className:"relative",children:t.map((s,n)=>{const a=nr;return e.jsxs("div",{className:"flex items-start gap-3.5 relative",children:[n{var l,i;if(o.includes("youtube.com/watch")){const d=new URL(o).searchParams.get("v");return d?`https://www.youtube.com/embed/${d}`:null}if(o.includes("youtu.be/")){const d=(l=o.split("youtu.be/")[1])==null?void 0:l.split("?")[0];return d?`https://www.youtube.com/embed/${d}`:null}if(o.includes("loom.com/share/")){const d=(i=o.split("loom.com/share/")[1])==null?void 0:i.split("?")[0];return d?`https://www.loom.com/embed/${d}`:null}return o};return e.jsxs("div",{className:"bg-gradient-to-br from-[#406E71]/5 via-white to-[#406E71]/5 rounded-2xl border border-[#406E71]/15 overflow-hidden",children:[e.jsx("div",{className:"bg-[#406E71] px-5 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Hi,{className:"w-4 h-4 text-white/80"}),e.jsx("h3",{className:"text-sm font-semibold text-white",children:"Current Stage"})]})}),e.jsxs("div",{className:"p-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"text-lg font-bold text-slate-800",children:t.label}),e.jsx("p",{className:"text-sm text-slate-500 mt-1 leading-relaxed",children:t.description})]}),r&&e.jsxs("div",{className:"bg-slate-50 rounded-xl p-4 border border-slate-100",children:[e.jsx("p",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wider mb-1.5",children:"Update from your agent"}),e.jsx("p",{className:"text-sm text-slate-700 leading-relaxed",children:r})]}),s&&e.jsxs("div",{className:"bg-blue-50/60 rounded-xl p-4 border border-blue-100",children:[e.jsx("p",{className:"text-xs font-semibold text-blue-600 uppercase tracking-wider mb-1.5",children:"What's Next"}),e.jsx("p",{className:"text-sm text-blue-800 leading-relaxed",children:s})]}),n&&e.jsx("div",{className:"rounded-xl overflow-hidden bg-slate-900 aspect-video shadow-md",children:e.jsx("iframe",{src:a(n)||n,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,title:"Next step video"})})]})]})}function Omt({targetCloseDate:t,contractDate:r,inspectionDate:s,appraisalDate:n,actualCloseDate:a}){const o=[{label:"Contract Date",date:r,icon:DS,color:"text-blue-600 bg-blue-50"},{label:"Inspection",date:s,icon:Qn,color:"text-amber-600 bg-amber-50"},{label:"Appraisal",date:n,icon:Wn,color:"text-purple-600 bg-purple-50"},{label:a?"Closed":"Target Close",date:a||t,icon:Mn,color:"text-emerald-600 bg-emerald-50"}].filter(l=>l.date);return o.length===0?null:e.jsxs("div",{className:"bg-white rounded-2xl p-5 shadow-sm border border-slate-100",children:[e.jsx("h2",{className:"text-sm font-semibold text-slate-800 mb-3",children:"Key Dates"}),e.jsx("div",{className:"space-y-3",children:o.map(({label:l,date:i,icon:d,color:m})=>{const g=new Date(i),y=cDe(g)&&!xNe(g),v=xNe(g);return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center ${m}`,children:e.jsx(d,{className:"w-4 h-4"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-xs text-slate-500",children:l}),e.jsxs("p",{className:`text-sm font-medium ${v?"text-emerald-600":y?"text-slate-400":"text-slate-800"}`,children:[Xr(g,"MMM d, yyyy"),v&&e.jsx("span",{className:"ml-1.5 text-xs bg-emerald-100 text-emerald-700 px-1.5 py-0.5 rounded-full",children:"Today"})]})]}),y&&e.jsx("span",{className:"text-xs text-slate-400",children:"✓"})]},l)})})]})}function Dmt({documents:t}){const r=n=>n<1024?`${n} B`:n<1048576?`${(n/1024).toFixed(0)} KB`:`${(n/1048576).toFixed(1)} MB`,s=async n=>{const{data:a}=await Z.storage.from("deal-files").createSignedUrl(n.storage_path,300);a!=null&&a.signedUrl&&window.open(a.signedUrl,"_blank")};return e.jsxs("div",{className:"bg-white rounded-2xl p-5 shadow-sm border border-slate-100",children:[e.jsx("h2",{className:"text-sm font-semibold text-slate-800 mb-3",children:"Documents"}),e.jsx("div",{className:"space-y-2",children:t.map(n=>e.jsxs("button",{onClick:()=>s(n),className:"w-full flex items-center gap-3 p-3 rounded-xl hover:bg-slate-50 transition-colors text-left group",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-slate-100 flex items-center justify-center flex-shrink-0 group-hover:bg-blue-50 transition-colors",children:e.jsx(fa,{className:"w-4 h-4 text-slate-500 group-hover:text-blue-600"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-slate-700 truncate",children:n.file_name}),e.jsx("p",{className:"text-xs text-slate-400",children:r(n.file_size)})]}),e.jsx(Oi,{className:"w-4 h-4 text-slate-300 group-hover:text-blue-500 transition-colors"})]},n.id))})]})}function Rmt({updates:t}){const r=s=>{var n,a;if(s.includes("youtube.com/watch")){const o=new URL(s).searchParams.get("v");return o?`https://www.youtube.com/embed/${o}`:null}if(s.includes("youtu.be/")){const o=(n=s.split("youtu.be/")[1])==null?void 0:n.split("?")[0];return o?`https://www.youtube.com/embed/${o}`:null}if(s.includes("loom.com/share/")){const o=(a=s.split("loom.com/share/")[1])==null?void 0:a.split("?")[0];return o?`https://www.loom.com/embed/${o}`:null}return s};return e.jsxs("div",{className:"bg-white rounded-2xl p-5 shadow-sm border border-slate-100",children:[e.jsx("h2",{className:"text-sm font-semibold text-slate-800 mb-4",children:"Updates from Your Agent"}),e.jsx("div",{className:"space-y-4",children:t.map((s,n)=>e.jsx("div",{className:`${n>0?"pt-4 border-t border-slate-100":""}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0 ${s.is_stage_change?"bg-emerald-100":"bg-blue-100"}`,children:s.is_stage_change?e.jsx(Of,{className:"w-3.5 h-3.5 text-emerald-600"}):e.jsx(Df,{className:"w-3.5 h-3.5 text-blue-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[e.jsx("h3",{className:"text-sm font-medium text-slate-800",children:s.title}),e.jsx("span",{className:"text-xs text-slate-400 flex-shrink-0",children:Xr(new Date(s.created_at),"MMM d")})]}),s.content&&e.jsx("p",{className:"text-sm text-slate-500 mt-1 leading-relaxed",children:s.content}),s.video_url&&e.jsx("div",{className:"mt-3 rounded-xl overflow-hidden bg-slate-900 aspect-video",children:e.jsx("iframe",{src:r(s.video_url)||s.video_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,title:s.title})})]})]})},s.id))})]})}function Fmt({portal:t,dealData:r,agentProfile:s,customQuestions:n,deviceFingerprint:a,onComplete:o}){var N,j;const[l,i]=E.useState({first_name:((N=t.client_name)==null?void 0:N.split(" ")[0])||"",last_name:((j=t.client_name)==null?void 0:j.split(" ").slice(1).join(" "))||"",email:t.client_email||"",phone:t.client_phone||"",preferred_contact_method:"email",client_role:"buyer",notes:"",spouse_first_name:"",spouse_last_name:"",spouse_email:"",spouse_phone:""}),[d,m]=E.useState({}),[g,y]=E.useState(!1),v=Jt({mutationFn:async()=>{const{error:S}=await Z.from("portal_onboarding_submissions").insert({portal_id:t.id,first_name:l.first_name,last_name:l.last_name||null,email:l.email||null,phone:l.phone||null,preferred_contact_method:l.preferred_contact_method,client_role:l.client_role,notes:l.notes||null,device_fingerprint:a,custom_answers:Object.keys(d).length>0?d:null,spouse_first_name:g&&l.spouse_first_name||null,spouse_last_name:g&&l.spouse_last_name||null,spouse_email:g&&l.spouse_email||null,spouse_phone:g&&l.spouse_phone||null});if(S)throw S},onSuccess:o}),b=r!=null&&r.property_address?`${r.property_address}, ${r.city||""}, ${r.state||""}`:null;return e.jsxs("div",{className:"max-w-md mx-auto px-4 py-10",children:[e.jsxs("div",{className:"text-center mb-8",children:[(s==null?void 0:s.avatar_url)&&e.jsx("img",{src:s.avatar_url,alt:s.name,className:"w-14 h-14 rounded-full border-2 border-slate-200 mx-auto mb-3 object-cover"}),e.jsx("h1",{className:"text-xl font-bold text-slate-800",children:"Welcome to Your Portal"}),b&&e.jsxs("div",{className:"flex items-center justify-center gap-1 text-slate-500 text-sm mt-1",children:[e.jsx(eo,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:b.replace(/,\s*,/g,",").replace(/,\s*$/,"")})]}),e.jsx("p",{className:"text-sm text-slate-500 mt-2",children:"Please fill in your details to access your transaction portal."})]}),e.jsxs("form",{onSubmit:S=>{S.preventDefault(),v.mutate()},className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(Ee,{className:"text-xs text-slate-600",children:"First Name *"}),e.jsx(Qe,{required:!0,value:l.first_name,onChange:S=>i(A=>({...A,first_name:S.target.value})),className:"mt-1 rounded-xl",placeholder:"John"})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-xs text-slate-600",children:"Last Name"}),e.jsx(Qe,{value:l.last_name,onChange:S=>i(A=>({...A,last_name:S.target.value})),className:"mt-1 rounded-xl",placeholder:"Doe"})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-xs text-slate-600",children:"Email"}),e.jsx(Qe,{type:"email",value:l.email,onChange:S=>i(A=>({...A,email:S.target.value})),className:"mt-1 rounded-xl",placeholder:"john@example.com"})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-xs text-slate-600",children:"Phone"}),e.jsx(Qe,{type:"tel",value:l.phone,onChange:S=>i(A=>({...A,phone:S.target.value})),className:"mt-1 rounded-xl",placeholder:"(555) 123-4567"})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-xs text-slate-600",children:"Preferred Contact Method"}),e.jsx("div",{className:"flex gap-2 mt-1.5",children:["email","phone","text"].map(S=>e.jsx("button",{type:"button",onClick:()=>i(A=>({...A,preferred_contact_method:S})),className:`px-3.5 py-1.5 rounded-full text-xs font-medium border transition-colors ${l.preferred_contact_method===S?"bg-slate-800 text-white border-slate-800":"bg-white text-slate-600 border-slate-200 hover:border-slate-300"}`,children:S.charAt(0).toUpperCase()+S.slice(1)},S))})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-xs text-slate-600",children:"Your Role"}),e.jsx("div",{className:"flex gap-2 mt-1.5",children:["buyer","seller","both"].map(S=>e.jsx("button",{type:"button",onClick:()=>i(A=>({...A,client_role:S})),className:`px-3.5 py-1.5 rounded-full text-xs font-medium border transition-colors ${l.client_role===S?"bg-slate-800 text-white border-slate-800":"bg-white text-slate-600 border-slate-200 hover:border-slate-300"}`,children:S.charAt(0).toUpperCase()+S.slice(1)},S))})]}),n.map(S=>e.jsxs("div",{children:[e.jsxs(Ee,{className:"text-xs text-slate-600",children:[S.question_text," ",S.is_required&&"*"]}),S.field_type==="text"&&e.jsx(Qe,{required:S.is_required,value:d[S.id]||"",onChange:A=>m(M=>({...M,[S.id]:A.target.value})),className:"mt-1 rounded-xl"}),S.field_type==="textarea"&&e.jsx("textarea",{required:S.is_required,value:d[S.id]||"",onChange:A=>m(M=>({...M,[S.id]:A.target.value})),className:"mt-1 w-full rounded-xl border border-input bg-background px-3 py-2 text-sm min-h-[80px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"}),S.field_type==="dropdown"&&e.jsxs("select",{required:S.is_required,value:d[S.id]||"",onChange:A=>m(M=>({...M,[S.id]:A.target.value})),className:"mt-1 w-full rounded-xl border border-input bg-background px-3 py-2 text-sm h-10",children:[e.jsx("option",{value:"",children:"Select..."}),(S.options||[]).map(A=>e.jsx("option",{value:A,children:A},A))]}),S.field_type==="toggle"&&e.jsx("div",{className:"mt-1.5 flex gap-2",children:["Yes","No"].map(A=>e.jsx("button",{type:"button",onClick:()=>m(M=>({...M,[S.id]:A})),className:`px-3.5 py-1.5 rounded-full text-xs font-medium border transition-colors ${d[S.id]===A?"bg-slate-800 text-white border-slate-800":"bg-white text-slate-600 border-slate-200"}`,children:A},A))})]},S.id)),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-xs text-slate-600",children:"Notes for your agent"}),e.jsx("textarea",{value:l.notes,onChange:S=>i(A=>({...A,notes:S.target.value})),className:"mt-1 w-full rounded-xl border border-input bg-background px-3 py-2 text-sm min-h-[60px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",placeholder:"Anything you'd like your agent to know..."})]}),t.allow_spouse&&e.jsxs("div",{children:[e.jsx("button",{type:"button",onClick:()=>y(!g),className:"text-sm text-blue-600 hover:text-blue-700 font-medium",children:g?"− Remove spouse/partner":"+ Add spouse/partner"}),g&&e.jsxs("div",{className:"mt-3 p-4 bg-slate-50 rounded-xl space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(Ee,{className:"text-xs text-slate-600",children:"First Name"}),e.jsx(Qe,{value:l.spouse_first_name,onChange:S=>i(A=>({...A,spouse_first_name:S.target.value})),className:"mt-1 rounded-xl"})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-xs text-slate-600",children:"Last Name"}),e.jsx(Qe,{value:l.spouse_last_name,onChange:S=>i(A=>({...A,spouse_last_name:S.target.value})),className:"mt-1 rounded-xl"})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-xs text-slate-600",children:"Email"}),e.jsx(Qe,{type:"email",value:l.spouse_email,onChange:S=>i(A=>({...A,spouse_email:S.target.value})),className:"mt-1 rounded-xl"})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-xs text-slate-600",children:"Phone"}),e.jsx(Qe,{type:"tel",value:l.spouse_phone,onChange:S=>i(A=>({...A,spouse_phone:S.target.value})),className:"mt-1 rounded-xl"})]})]})]}),e.jsx(Q,{type:"submit",disabled:v.isPending||!l.first_name,className:"w-full h-12 rounded-full text-sm font-semibold bg-slate-900 hover:bg-slate-800",children:v.isPending?"Submitting...":"Access My Portal"})]})]})}function zmt(t){return t==="buy-side"?"Home Search in Progress":t==="listing"?"Your Home Is On The Market":"Active Phase"}function Bmt(t){return t==="buy-side"?"We're actively searching for homes that match your criteria.":t==="listing"?"Your property is now being marketed to potential buyers.":"Your transaction is actively moving forward."}const $mt={Lead:{label:"Getting Started",description:"We're beginning your home journey and preparing the next steps."},Consultation:{label:"Planning Your Move",description:"We're discussing your goals and building a plan for buying or selling."},"Agreement Signed":{label:"Officially Working Together",description:"We've signed the agreement and are moving forward together."},"Under Contract":{label:"Under Contract",description:"Your offer has been accepted and we are now moving through inspections and due diligence."},Closing:{label:"Final Steps to Closing",description:"We're finalizing documents and preparing for closing day."},"Closed Won":{label:"Closing Day",description:"Congratulations! Your transaction is complete. 🎉"}},gDe=["Lead","Consultation","Agreement Signed","Active","Under Contract","Closing","Closed Won"];function xDe(t){return gDe.map(r=>{if(r==="Active")return{key:"Active",label:zmt(t),description:Bmt(t)};const s=$mt[r];return{key:r,label:s.label,description:s.description}})}function Umt(t){if(!t)return 0;const r=gDe.indexOf(t);return r>=0?r:0}function yDe({slug:t}){var X,se;const[r,s]=E.useState(!1),[n]=E.useState(()=>{const ae=`portal_fp_${t}`;let le=localStorage.getItem(ae);return le||(le=localStorage.getItem("portal_fp"),le?localStorage.setItem(ae,le):(le=crypto.randomUUID(),localStorage.setItem(ae,le),localStorage.setItem("portal_fp",le))),le});E.useEffect(()=>(document.body.classList.add("client-portal-page"),()=>document.body.classList.remove("client-portal-page")),[]);const{data:a,isLoading:o,error:l}=Ht({queryKey:["client-portal-public",t],queryFn:async()=>{const{data:ae,error:le}=await Z.from("client_portals").select(` *, deal_pipeline ( id, deal_name, property_address, city, state, deal_type, target_close_date, contract_date, expected_price, actual_close_date, stage_id, owner_user_id, deal_pipeline_stages (id, name, color, icon, sort_order, is_won_stage, is_lost_stage) ) `).eq("slug",t).eq("is_enabled",!0).maybeSingle();if(le)throw le;return ae}}),i=(X=a==null?void 0:a.deal_pipeline)==null?void 0:X.owner_user_id,{data:d}=Ht({queryKey:["portal-stages",i],queryFn:async()=>{const{data:ae,error:le}=await Z.from("deal_pipeline_stages").select("*").eq("owner_user_id",i).order("sort_order",{ascending:!0});if(le)throw le;return ae},enabled:!!i}),{data:m}=Ht({queryKey:["portal-agent",i],queryFn:async()=>{const{data:ae,error:le}=await Z.from("profiles").select("id, name, avatar_url, phone, email").eq("id",i).single();if(le)throw le;return ae},enabled:!!i}),g=a==null?void 0:a.id,{data:y}=Ht({queryKey:["portal-updates-public",g],queryFn:async()=>{const{data:ae,error:le}=await Z.from("portal_updates").select("*").eq("portal_id",g).order("created_at",{ascending:!1});if(le)throw le;return ae},enabled:!!g}),v=(se=a==null?void 0:a.deal_pipeline)==null?void 0:se.id,{data:b}=Ht({queryKey:["portal-documents",v],queryFn:async()=>{const{data:ae,error:le}=await Z.from("deal_files").select("*").eq("deal_id",v).eq("visible_on_portal",!0).order("created_at",{ascending:!1});if(le)throw le;return ae},enabled:!!v}),{data:N,isLoading:j}=Ht({queryKey:["portal-onboarding-check",g,n],queryFn:async()=>{const{data:ae,error:le}=await Z.from("portal_onboarding_submissions").select("id").eq("portal_id",g).eq("device_fingerprint",n).maybeSingle();if(le)throw le;return ae},enabled:!!g&&!!(a!=null&&a.require_onboarding)}),{data:S}=Ht({queryKey:["portal-custom-questions-public",i],queryFn:async()=>{const{data:ae,error:le}=await Z.from("portal_custom_questions").select("*").eq("owner_user_id",i).eq("is_active",!0).order("sort_order",{ascending:!0});if(le)throw le;return ae},enabled:!!i&&!!(a!=null&&a.require_onboarding)}),A=!!N||r||!(a!=null&&a.require_onboarding);if(o||a!=null&&a.require_onboarding&&j)return e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center",children:e.jsxs("div",{className:"w-full max-w-lg mx-auto p-6 space-y-6",children:[e.jsx(fr,{className:"h-48 w-full rounded-2xl"}),e.jsx(fr,{className:"h-10 w-48 mx-auto"}),e.jsx(fr,{className:"h-32 w-full rounded-2xl"}),e.jsx(fr,{className:"h-24 w-full rounded-2xl"})]})});if(l||!a)return e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center p-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-slate-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx("span",{className:"text-2xl",children:"🔒"})}),e.jsx("h1",{className:"text-2xl font-bold text-slate-800 mb-2",children:"Portal Not Available"}),e.jsx("p",{className:"text-slate-500",children:"This portal is no longer active or doesn't exist."})]})});const M=a,I=M==null?void 0:M.deal_pipeline,F=I==null?void 0:I.deal_pipeline_stages,O=F==null?void 0:F.is_won_stage,B=I==null?void 0:I.deal_type,$=xDe(B),H=Umt(F==null?void 0:F.name),W=$[H];return y==null||y.find(ae=>!ae.is_stage_change),A?e.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white pb-12",children:[e.jsx(Imt,{dealData:I,agentProfile:m,welcomeMessage:a.welcome_message,isWon:O}),e.jsxs("div",{className:"max-w-lg mx-auto px-4 space-y-5 mt-6",children:[e.jsx(Pmt,{journeyStages:$,currentIndex:H}),W&&e.jsx(Lmt,{currentStage:W,nextStepText:a.next_step_text,nextStepVideoUrl:a.next_step_video_url}),e.jsx(Omt,{targetCloseDate:I==null?void 0:I.target_close_date,contractDate:I==null?void 0:I.contract_date,inspectionDate:a.inspection_date,appraisalDate:a.appraisal_date,actualCloseDate:I==null?void 0:I.actual_close_date}),b&&b.length>0&&e.jsx(Dmt,{documents:b}),y&&y.length>0&&e.jsx(Rmt,{updates:y}),O&&a.show_post_close_tips&&e.jsxs("div",{className:"bg-gradient-to-br from-emerald-50 to-teal-50 rounded-2xl p-6 border border-emerald-100 text-center",children:[e.jsx("span",{className:"text-4xl mb-3 block",children:"🎉"}),e.jsx("h3",{className:"text-lg font-bold text-emerald-900 mb-2",children:"Congratulations!"}),e.jsx("p",{className:"text-sm text-emerald-700",children:"Your transaction has been completed. Welcome to your new home!"}),a.review_url&&e.jsx("a",{href:a.review_url,target:"_blank",rel:"noopener noreferrer",className:"mt-4 inline-block bg-emerald-600 text-white text-sm font-medium px-6 py-2.5 rounded-full hover:bg-emerald-700 transition-colors",children:"Leave a Review ⭐"})]}),e.jsxs("div",{className:"text-center pt-6 pb-2 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-slate-400",children:[e.jsx(Nu,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"text-xs",children:"Secure Client Portal"})]}),m&&e.jsxs("p",{className:"text-xs text-slate-400",children:["Managed by ",e.jsx("span",{className:"font-medium text-slate-500",children:m.name})]}),e.jsx("p",{className:"text-[10px] text-slate-300",children:"Powered by ReLevelUp"})]})]})]}):e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white",children:e.jsx(Fmt,{portal:a,dealData:I,agentProfile:m,customQuestions:S||[],deviceFingerprint:n,onComplete:()=>s(!0)})})}function qmt(){const r=Uh().pathname.slice(1);return!r||r===""?e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center p-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-bold text-slate-800 mb-2",children:"Client Portal"}),e.jsx("p",{className:"text-slate-500",children:"Visit your personalized portal link to view your transaction details."})]})}):e.jsx(yDe,{slug:r})}const Eme="levelup_affiliate_ref",Vmt=30,Hmt=()=>{const[t]=Bc();E.useEffect(()=>{const r=t.get("ref");if(r){const s={code:r.toUpperCase(),timestamp:Date.now()};localStorage.setItem(Eme,JSON.stringify(s)),console.log("[Affiliate] Stored referral code:",r)}},[t])},Wmt=()=>{try{const t=localStorage.getItem(Eme);if(!t)return null;const r=JSON.parse(t),s=Vmt*24*60*60*1e3;return Date.now()-r.timestamp>s?(localStorage.removeItem(Eme),console.log("[Affiliate] Referral code expired"),null):r.code}catch{return null}},rre="/assets/levelup-logo-header-_ZX7DvlA.png",Gmt="/assets/scale-your-team-ku4MPatU.png";function Kmt({open:t,onOpenChange:r}){return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[e.jsx(Ur,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-[#4a6b6d]/10 rounded-lg",children:e.jsx(bi,{className:"h-5 w-5 text-[#4a6b6d]"})}),e.jsxs("div",{children:[e.jsx(Br,{children:"Schedule a Brokerage Interest Meeting"}),e.jsx(Gs,{children:"Learn how LevelUp can empower your entire team"})]})]})}),t&&e.jsx("iframe",{src:"https://tidycal.com/jeremycollins/brokerinterestmeeting",className:"w-full border-0 rounded-lg",style:{height:"600px",minHeight:"500px"},title:"Schedule Brokerage Interest Meeting"})]})})}const Id={individual_agent:{name:"Individual Agent",price:"$39",period:"/month",description:"Perfect for independent agents ready to level up",features:["Full dashboard access","300+ professional templates","Academy training library","Community & networking","Live events & workshops","Social media content","Newsletter resources","Email support"],trial:"7-day free trial"},brokerage_under_25:{name:"Brokerage",subtitle:"Under 25 Agents",price:"$299",period:"/month",description:"Empower your entire team to succeed",features:["Everything in Individual","Brokerage manager dashboard","Invite & manage up to 25 agents","Exclusive brokerage resources","Team performance analytics","Agent onboarding tools","Resource sharing","Priority support"]},brokerage_over_25:{name:"Brokerage",subtitle:"Over 25 Agents",price:"$499",period:"/month",description:"Scale your brokerage without limits",features:["Everything in Brokerage","Unlimited agents","Advanced team analytics","Dedicated account manager","Custom onboarding sessions","White-glove support"]}},Zmt=[{icon:lp,title:"Academy Training",description:"Access a library of on-demand video training covering lead generation, marketing, technology, and more."},{icon:ed,title:"300+ Templates",description:"Professional Canva templates for social media, flyers, postcards, and marketing materials."},{icon:Mn,title:"Live Events",description:"Weekly live training sessions, workshops, and Q&A events with industry experts."},{icon:Pl,title:"Agent Community",description:"Connect with fellow agents, share wins, ask questions, and network in our private community."},{icon:fa,title:"Resource Kits",description:"Downloadable toolkits with scripts, checklists, guides, and everything you need to close more deals."},{icon:uo,title:"Social Swag",description:"Fresh social media content and designs updated regularly to help you stand out online."}],Ymt=[{icon:ws,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:An,title:"Smart Touchpoint Plans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:wi,title:"One-Tap Actions",description:"Call, text, or email contacts directly with pre-written scripts tailored to each relationship."},{icon:vm,title:"Birthday & Anniversary Alerts",description:"Never miss an important date—get reminders for birthdays and home anniversaries."},{icon:eo,title:"Pop-by Map",description:"See all your contacts on a map and plan efficient pop-by routes in your area."},{icon:Nc,title:"Momentum Tracking",description:"Track your touch streaks, weekly goals, and relationship health scores."},{icon:Ci,title:"Relationship Health",description:"Visual dashboard showing which contacts need attention based on last touch date."},{icon:Qg,title:"Daily Action Cards",description:"Wake up to a prioritized list of exactly who to reach out to today."}],Xmt=[{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."}],Qmt=()=>{const{user:t,loading:r}=Gr(),s=Ws(),[n]=Bc();E.useEffect(()=>{const $=window.location.host==="listings.relevelup.com",H=window.location.pathname==="/";if($&&H){s("/public/listings",{replace:!0});return}},[s]);const[a,o]=E.useState(null),[l,i]=E.useState(null),[d,m]=E.useState(!1),[g,y]=E.useState(""),[v,b]=E.useState(""),[N,j]=E.useState(""),[S,A]=E.useState(!1),[M,I]=E.useState(!1),F=($,H=!1)=>{i({tier:$,skipTrial:H}),m(!0)};Hmt(),E.useEffect(()=>{const $=window.location.host==="listings.relevelup.com",H=location.pathname.startsWith("/public/");!r&&t&&!$&&!H&&s("/dashboard")},[t,r,s,location.pathname]),E.useEffect(()=>{n.get("canceled")==="true"&&Se.error("Checkout was canceled. Feel free to try again when you're ready!")},[n]);const O=async($,H=!1)=>{if(!g){Se.error("Please enter your email address");return}if(!v.trim()){Se.error("Please enter your full name");return}A(!0),o($+(H?"_direct":""));const W=Wmt();try{const{data:X,error:se}=await Z.functions.invoke("create-checkout",{body:{tier:$,email:g,name:v.trim(),couponCode:N.trim()||void 0,skipTrial:H,referralCode:W}});if(se)throw se;if(X!=null&&X.url)window.open(X.url,"_blank","noopener,noreferrer"),Se.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(X){console.error("Checkout error:",X),Se.error(X.message||"Failed to start checkout. Please try again.")}finally{A(!1),o(null),m(!1),i(null)}},B=()=>{l&&O(l.tier,l.skipTrial)};return r?e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-[#4a6b6d]",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-white border-t-transparent"})}):e.jsxs("div",{className:"min-h-screen bg-background overflow-hidden",children:[e.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-[#4a6b6d] shadow-md",children:e.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center",children:e.jsx("img",{src:rre,alt:"LevelUp",className:"h-8 md:h-10"})}),e.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[e.jsx(Q,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var $;return($=document.getElementById("features"))==null?void 0:$.scrollIntoView({behavior:"smooth"})},children:"Features"}),e.jsx(Q,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var $;return($=document.getElementById("pricing"))==null?void 0:$.scrollIntoView({behavior:"smooth"})},children:"Pricing"}),e.jsx(Q,{onClick:()=>s("/auth"),className:"bg-white text-[#4a6b6d] hover:bg-gray-100 font-medium shadow-md",children:"Sign In"})]})]})}),e.jsxs("section",{className:"relative pt-24 pb-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 opacity-10",children:e.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),e.jsx("div",{className:"container mx-auto px-4 relative",children:e.jsxs("div",{className:"max-w-5xl mx-auto text-center space-y-8",children:[e.jsx("div",{className:"flex justify-center mb-8",children:e.jsx("img",{alt:"LevelUp Consulting Group",className:"h-[136px] md:h-[164px] drop-shadow-lg",src:"/lovable-uploads/3a0c7ef9-9e79-411f-a9af-6f2a99e8bd7b.webp"})}),e.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.",e.jsx("br",{}),e.jsx("em",{children:"The platform you need to keep it going."})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center items-center pt-4",children:[e.jsxs(Q,{size:"lg",onClick:()=>{var $;return($=document.getElementById("free-trial"))==null?void 0:$.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",e.jsx(Hi,{className:"ml-2 w-5 h-5 group-hover:translate-x-1 transition-transform"})]}),e.jsx(Q,{size:"lg",variant:"outline",onClick:()=>{var $;return($=document.getElementById("features"))==null?void 0:$.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"})]})]})})]}),e.jsx("section",{className:"py-20 bg-background",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"max-w-4xl mx-auto text-center space-y-8",children:[e.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."}),e.jsxs("div",{className:"space-y-2 text-lg text-muted-foreground",children:[e.jsx("p",{children:"Agents get weekly coaching + plug-and-play marketing."}),e.jsx("p",{children:"Brokerages get higher adoption, consistency, and real engagement."})]}),e.jsx("p",{className:"text-2xl md:text-4xl text-[#4a6b6d] pt-4 font-sans font-bold",children:"LEVELUP EQUIPS BOTH TO THRIVE."}),e.jsx("p",{className:"text-lg text-muted-foreground",children:"Learn how we support agents and empower brokerages to grow—together."}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center pt-4",children:[e.jsxs(Q,{size:"lg",variant:"outline",onClick:()=>{var $;return($=document.getElementById("brokerage"))==null?void 0:$.scrollIntoView({behavior:"smooth"})},className:"border-[#4a6b6d] text-[#4a6b6d] hover:bg-[#4a6b6d]/5",children:[e.jsx(bi,{className:"mr-2 h-5 w-5"}),"Brokerage Partnership"]}),e.jsxs(Q,{size:"lg",onClick:()=>{var $;return($=document.getElementById("pricing"))==null?void 0:$.scrollIntoView({behavior:"smooth"})},className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:[e.jsx(Kl,{className:"mr-2 h-5 w-5"}),"Individual Membership"]})]})]})})}),e.jsx("section",{id:"features",className:"py-20 bg-muted/30",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[e.jsx("h2",{className:"text-3xl md:text-4xl mb-6 font-sans font-bold",children:"What's inside our members only portal?"}),e.jsx("p",{className:"text-lg text-muted-foreground",children:"Everything you need to grow your business, all in one place."})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 max-w-6xl mx-auto",children:Zmt.map(($,H)=>e.jsxs(ze,{className:"group relative overflow-hidden border hover:border-[#4a6b6d]/50 transition-all duration-300 hover:shadow-lg bg-background",children:[e.jsxs(Wt,{children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#4a6b6d]/10 flex items-center justify-center mb-4",children:e.jsx($.icon,{className:"w-7 h-7 text-[#4a6b6d]"})}),e.jsx(Zt,{className:"text-xl font-sans",children:$.title})]}),e.jsx(qe,{children:e.jsx("p",{className:"text-muted-foreground leading-relaxed",children:$.description})})]},H))})]})}),e.jsxs("section",{id:"agent-os",className:"py-20 bg-gradient-to-br from-[#4a6b6d] to-[#3d5a5c] relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 opacity-10",children:e.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),e.jsxs("div",{className:"container mx-auto px-4 relative",children:[e.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[e.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:[e.jsx(An,{className:"w-4 h-4"}),"Included with Membership"]}),e.jsxs("h2",{className:"text-3xl mb-6 text-white font-sans font-bold md:text-6xl",children:["Meet ",e.jsx("span",{className:"italic",children:"Agent OS"})]}),e.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."})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 max-w-6xl mx-auto",children:Ymt.map(($,H)=>e.jsxs(ze,{className:"group relative overflow-hidden border-0 bg-white/10 backdrop-blur-sm hover:bg-white/20 transition-all duration-300",children:[e.jsxs(Wt,{className:"pb-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-white/20 flex items-center justify-center mb-3",children:e.jsx($.icon,{className:"w-6 h-6 text-white"})}),e.jsx(Zt,{className:"text-lg font-semibold text-white",children:$.title})]}),e.jsx(qe,{children:e.jsx("p",{className:"text-white/70 text-sm leading-relaxed",children:$.description})})]},H))}),e.jsx("div",{className:"text-center mt-12",children:e.jsxs(Q,{size:"lg",onClick:()=>{var $;return($=document.getElementById("pricing"))==null?void 0:$.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",e.jsx(Hi,{className:"ml-2 w-5 h-5"})]})})]})]}),e.jsx("section",{id:"brokerage",className:"py-20 bg-[#4a6b6d]/5",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsx("div",{className:"max-w-6xl mx-auto",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-center",children:[e.jsxs("div",{className:"space-y-6",children:[e.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:[e.jsx(bi,{className:"w-4 h-4"}),"For Brokerages"]}),e.jsxs("h2",{className:"text-3xl font-sans font-bold md:text-6xl",children:["Empower Your"," ",e.jsx("span",{className:"italic text-[#4a6b6d]",children:"Entire Team"})]}),e.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."}),e.jsx("ul",{className:"space-y-4",children:["Dedicated brokerage manager dashboard","Invite and manage agents with one click","Exclusive brokerage-only resources","Team analytics and performance tracking","Simplified agent onboarding","Share resources across your team"].map(($,H)=>e.jsxs("li",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center flex-shrink-0",children:e.jsx(li,{className:"w-4 h-4 text-[#4a6b6d]"})}),e.jsx("span",{className:"text-foreground",children:$})]},H))}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-4",children:[e.jsxs(Q,{size:"lg",onClick:()=>{var $;return($=document.getElementById("pricing"))==null?void 0:$.scrollIntoView({behavior:"smooth"})},className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:["See Brokerage Plans",e.jsx(Wi,{className:"ml-2 w-5 h-5"})]}),e.jsxs(Q,{size:"lg",variant:"outline",onClick:()=>I(!0),className:"border-[#4a6b6d] text-[#4a6b6d] hover:bg-[#4a6b6d]/10",children:[e.jsx(Mn,{className:"mr-2 w-5 h-5"}),"Schedule Info Session"]})]})]}),e.jsx("div",{className:"relative hidden md:block",children:e.jsx("img",{src:Gmt,alt:"Scale Your Team from 5 to 500 Agents",className:"w-full rounded-3xl shadow-lg"})})]})})})}),e.jsx("section",{className:"py-20 bg-background",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[e.jsxs("h2",{className:"text-3xl mb-6 font-sans md:text-5xl font-bold",children:["Agents Love ",e.jsx("span",{className:"italic text-[#4a6b6d]",children:"LevelUp"})]}),e.jsx("p",{className:"text-lg text-muted-foreground",children:"See what top producers are saying about the platform."})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8 max-w-6xl mx-auto",children:Xmt.map(($,H)=>e.jsx(ze,{className:"bg-muted/30 border-0",children:e.jsxs(qe,{className:"pt-8",children:[e.jsx("div",{className:"flex gap-1 mb-4",children:[1,2,3,4,5].map(W=>e.jsx(Ln,{className:"w-5 h-5 fill-yellow-400 text-yellow-400"},W))}),e.jsxs("p",{className:"text-lg mb-6 italic text-muted-foreground",children:['"',$.quote,'"']}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:$.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:$.role})]})]})},H))})]})}),e.jsxs("section",{id:"free-trial",className:"py-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 opacity-10",children:e.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),e.jsx("div",{className:"container mx-auto px-4 relative",children:e.jsxs("div",{className:"max-w-3xl mx-auto text-center space-y-8",children:[e.jsxs("h2",{className:"text-3xl md:text-5xl font-bold text-white",children:["Start Your Free Trial ",e.jsx("span",{className:"italic",children:"Today"})]}),e.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."}),e.jsx("div",{className:"pt-4",children:e.jsxs(Q,{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:()=>F("individual_agent"),children:["Start Free Trial",e.jsx(Hi,{className:"ml-2 w-5 h-5 group-hover:translate-x-1 transition-transform"})]})})]})})]}),e.jsx("section",{id:"pricing",className:"py-20 bg-muted/30",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsxs("h2",{className:"text-3xl mb-6 font-sans md:text-5xl font-bold",children:["Simple, Transparent ",e.jsx("span",{className:"italic text-[#4a6b6d]",children:"Pricing"})]}),e.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."})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8 max-w-6xl mx-auto",children:[e.jsxs(ze,{className:"relative flex flex-col border hover:border-[#4a6b6d]/50 transition-all hover:shadow-xl bg-background",children:[e.jsxs(Wt,{className:"pb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#4a6b6d]/10 flex items-center justify-center",children:e.jsx(Kl,{className:"w-5 h-5 text-[#4a6b6d]"})}),e.jsx(Zt,{className:"text-xl font-sans",children:Id.individual_agent.name})]}),e.jsxs("div",{className:"flex items-baseline gap-1 mt-4",children:[e.jsx("span",{className:"text-5xl font-bold",children:Id.individual_agent.price}),e.jsx("span",{className:"text-muted-foreground text-lg",children:Id.individual_agent.period})]}),e.jsx(Ss,{className:"text-base mt-2",children:Id.individual_agent.description}),e.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:[e.jsx(Ea,{className:"w-4 h-4"}),Id.individual_agent.trial]})]}),e.jsx(qe,{className:"flex-1 pt-0",children:e.jsx("ul",{className:"space-y-3",children:Id.individual_agent.features.map(($,H)=>e.jsxs("li",{className:"flex items-center gap-3",children:[e.jsx(li,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),e.jsx("span",{children:$})]},H))})}),e.jsxs(XA,{className:"flex flex-col gap-3 pt-4",children:[e.jsx(Q,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>F("individual_agent"),children:"Start Free Trial"}),e.jsx(Q,{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:()=>F("individual_agent",!0),children:"Skip Trial, Subscribe Now"})]})]}),e.jsxs(ze,{className:"relative flex flex-col border-2 border-[#4a6b6d] shadow-2xl scale-105 bg-background",children:[e.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"}),e.jsxs(Wt,{className:"pb-4 pt-8",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#4a6b6d]/20 flex items-center justify-center",children:e.jsx(bi,{className:"w-5 h-5 text-[#4a6b6d]"})}),e.jsxs("div",{children:[e.jsx(Zt,{className:"text-xl font-sans",children:Id.brokerage_under_25.name}),e.jsx("span",{className:"text-sm text-muted-foreground",children:Id.brokerage_under_25.subtitle})]})]}),e.jsxs("div",{className:"flex items-baseline gap-1 mt-4",children:[e.jsx("span",{className:"text-5xl font-bold",children:Id.brokerage_under_25.price}),e.jsx("span",{className:"text-muted-foreground text-lg",children:Id.brokerage_under_25.period})]}),e.jsx(Ss,{className:"text-base mt-2",children:Id.brokerage_under_25.description})]}),e.jsx(qe,{className:"flex-1 pt-0",children:e.jsx("ul",{className:"space-y-3",children:Id.brokerage_under_25.features.map(($,H)=>e.jsxs("li",{className:"flex items-center gap-3",children:[e.jsx(li,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),e.jsx("span",{children:$})]},H))})}),e.jsx(XA,{className:"pt-4",children:e.jsx(Q,{className:"w-full py-6 text-lg shadow-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>F("brokerage_under_25"),children:"Get Started"})})]}),e.jsxs(ze,{className:"relative flex flex-col border hover:border-[#4a6b6d]/50 transition-all hover:shadow-xl bg-background",children:[e.jsxs(Wt,{className:"pb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#4a6b6d]/10 flex items-center justify-center",children:e.jsx(bi,{className:"w-5 h-5 text-[#4a6b6d]"})}),e.jsxs("div",{children:[e.jsx(Zt,{className:"text-xl font-sans",children:Id.brokerage_over_25.name}),e.jsx("span",{className:"text-sm text-muted-foreground",children:Id.brokerage_over_25.subtitle})]})]}),e.jsxs("div",{className:"flex items-baseline gap-1 mt-4",children:[e.jsx("span",{className:"text-5xl font-bold",children:Id.brokerage_over_25.price}),e.jsx("span",{className:"text-muted-foreground text-lg",children:Id.brokerage_over_25.period})]}),e.jsx(Ss,{className:"text-base mt-2",children:Id.brokerage_over_25.description})]}),e.jsx(qe,{className:"flex-1 pt-0",children:e.jsx("ul",{className:"space-y-3",children:Id.brokerage_over_25.features.map(($,H)=>e.jsxs("li",{className:"flex items-center gap-3",children:[e.jsx(li,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),e.jsx("span",{children:$})]},H))})}),e.jsx(XA,{className:"pt-4",children:e.jsx(Q,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>F("brokerage_over_25"),children:"Get Started"})})]})]})]})}),e.jsxs("section",{className:"py-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 opacity-10",children:e.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),e.jsx("div",{className:"container mx-auto px-4 relative",children:e.jsxs("div",{className:"max-w-4xl mx-auto text-center space-y-8",children:[e.jsx("h2",{className:"text-3xl text-white font-sans md:text-5xl",children:"Ready to Level Up?"}),e.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."}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[e.jsxs(Q,{size:"lg",onClick:()=>{var $;return($=document.getElementById("pricing"))==null?void 0:$.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",e.jsx(Hi,{className:"ml-2 w-5 h-5"})]}),e.jsx(Q,{size:"lg",onClick:()=>s("/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"})]})]})})]}),e.jsx("footer",{className:"py-12 bg-[#3d5a5c] text-white/80",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4",children:[e.jsx("img",{src:rre,alt:"LevelUp",className:"h-8"}),e.jsxs("p",{className:"text-sm",children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsx("a",{href:"/privacy-policy",className:"text-white/60 hover:text-white transition-colors text-sm",children:"Privacy Policy"}),e.jsx("a",{href:"mailto:support@relevelup.com",className:"text-white/60 hover:text-white transition-colors text-sm",children:"Contact Support"})]})]})})}),e.jsx(Kmt,{open:M,onOpenChange:I}),e.jsx(Dr,{open:d,onOpenChange:m,children:e.jsxs(Lr,{className:"sm:max-w-md",children:[e.jsxs(Ur,{children:[e.jsx(Br,{className:"text-xl font-sans font-semibold",children:"Enter your details to get started"}),e.jsx(Gs,{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)"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{children:[e.jsxs(Ee,{htmlFor:"dialog-name",children:["Full Name ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(Qe,{id:"dialog-name",type:"text",placeholder:"John Smith",value:v,onChange:$=>b($.target.value),className:"mt-1",required:!0})]}),e.jsxs("div",{children:[e.jsxs(Ee,{htmlFor:"dialog-email",children:["Email Address ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx(Qe,{id:"dialog-email",type:"email",placeholder:"you@example.com",value:g,onChange:$=>y($.target.value),className:"mt-1",required:!0})]}),e.jsxs("div",{children:[e.jsxs(Ee,{htmlFor:"dialog-coupon",children:["Discount Code ",e.jsx("span",{className:"text-muted-foreground",children:"(Optional)"})]}),e.jsx(Qe,{id:"dialog-coupon",type:"text",placeholder:"Enter discount code",value:N,onChange:$=>j($.target.value),className:"mt-1"})]})]}),e.jsx(Q,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:B,disabled:S,children:S?"Loading...":"Continue to Checkout"})]})})]})},Jmt=()=>e.jsxs(e.Fragment,{children:[e.jsxs(qh,{children:[e.jsx("title",{children:"Privacy Policy | LevelUp"}),e.jsx("meta",{name:"description",content:"Privacy Policy for LevelUp platform"})]}),e.jsx("div",{className:"min-h-screen bg-background py-12 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsx("h1",{className:"text-3xl font-bold text-foreground mb-8",children:"Privacy Policy"}),e.jsxs("div",{className:"prose prose-sm max-w-none text-muted-foreground space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Last updated: January 17, 2026"}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"1. Introduction"}),e.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.'})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"2. Information We Collect"}),e.jsx("p",{children:"We collect information that you provide directly to us, including:"}),e.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[e.jsx("li",{children:"Name and contact information (email address, phone number)"}),e.jsx("li",{children:"Account credentials"}),e.jsx("li",{children:"Profile information"}),e.jsx("li",{children:"Transaction and billing information"}),e.jsx("li",{children:"Communications you send to us"})]})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"3. How We Use Your Information"}),e.jsx("p",{children:"We use the information we collect to:"}),e.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[e.jsx("li",{children:"Provide, maintain, and improve our services"}),e.jsx("li",{children:"Process transactions and send related information"}),e.jsx("li",{children:"Send you technical notices and support messages"}),e.jsx("li",{children:"Respond to your comments and questions"}),e.jsx("li",{children:"Communicate with you about products, services, and events"})]})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"4. Information Sharing"}),e.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."})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"5. Data Security"}),e.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."})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"6. Your Rights"}),e.jsx("p",{children:"You have the right to:"}),e.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[e.jsx("li",{children:"Access your personal information"}),e.jsx("li",{children:"Correct inaccurate data"}),e.jsx("li",{children:"Request deletion of your data"}),e.jsx("li",{children:"Opt-out of marketing communications"})]})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"7. Third-Party Services"}),e.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."})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"8. Contact Us"}),e.jsxs("p",{children:["If you have questions about this Privacy Policy, please contact us at"," ",e.jsx("a",{href:"mailto:support@relevelup.com",className:"text-primary hover:underline",children:"support@relevelup.com"})]})]})]})]})})]}),ept=()=>e.jsxs(e.Fragment,{children:[e.jsxs(qh,{children:[e.jsx("title",{children:"Terms of Service | LevelUp"}),e.jsx("meta",{name:"description",content:"Terms of Service for LevelUp platform"})]}),e.jsx("div",{className:"min-h-screen bg-background py-12 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsx("h1",{className:"text-3xl font-bold text-foreground mb-8",children:"Terms of Service"}),e.jsxs("div",{className:"prose prose-sm max-w-none text-muted-foreground space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Last updated: January 17, 2026"}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"1. Acceptance of Terms"}),e.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.'})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"2. Description of Service"}),e.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."})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"3. User Accounts"}),e.jsx("p",{children:"To use certain features, you must create an account. You agree to:"}),e.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[e.jsx("li",{children:"Provide accurate and complete information"}),e.jsx("li",{children:"Maintain the security of your account credentials"}),e.jsx("li",{children:"Notify us immediately of any unauthorized access"}),e.jsx("li",{children:"Accept responsibility for all activities under your account"})]})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"4. Acceptable Use"}),e.jsx("p",{children:"You agree not to:"}),e.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[e.jsx("li",{children:"Violate any applicable laws or regulations"}),e.jsx("li",{children:"Infringe on the rights of others"}),e.jsx("li",{children:"Upload malicious code or interfere with the Service"}),e.jsx("li",{children:"Attempt to gain unauthorized access to any part of the Service"}),e.jsx("li",{children:"Use the Service for any unlawful purpose"})]})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"5. Intellectual Property"}),e.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."})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"6. Third-Party Integrations"}),e.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."})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"7. Payment Terms"}),e.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."})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"8. Limitation of Liability"}),e.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."})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"9. Termination"}),e.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."})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"10. Changes to Terms"}),e.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."})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"11. Contact Us"}),e.jsxs("p",{children:["If you have questions about these Terms, please contact us at"," ",e.jsx("a",{href:"mailto:support@relevelup.com",className:"text-primary hover:underline",children:"support@relevelup.com"})]})]})]})]})})]}),tpt=()=>e.jsxs(e.Fragment,{children:[e.jsxs(qh,{children:[e.jsx("title",{children:"Data Deletion | LevelUp"}),e.jsx("meta",{name:"description",content:"Data deletion instructions for LevelUp platform"})]}),e.jsx("div",{className:"min-h-screen bg-background py-12 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsx("h1",{className:"text-3xl font-bold text-foreground mb-8",children:"Data Deletion Instructions"}),e.jsxs("div",{className:"prose prose-sm max-w-none text-muted-foreground space-y-6",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Last updated: January 17, 2026"}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"How to Request Data Deletion"}),e.jsx("p",{children:"If you wish to have your data deleted from LevelUp, you can request deletion through one of the following methods:"})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Option 1: Email Request"}),e.jsxs("p",{children:["Send an email to"," ",e.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:']}),e.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[e.jsx("li",{children:"Your full name"}),e.jsx("li",{children:"The email address associated with your account"}),e.jsx("li",{children:"A clear statement requesting deletion of your data"})]})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Option 2: Account Settings"}),e.jsx("p",{children:"If you have an active account, you can request data deletion through your account settings:"}),e.jsxs("ol",{className:"list-decimal pl-6 mt-2 space-y-1",children:[e.jsx("li",{children:"Log in to your LevelUp account"}),e.jsx("li",{children:"Navigate to your Profile settings"}),e.jsx("li",{children:"Contact support through the Support page to request account deletion"})]})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"What Data Will Be Deleted"}),e.jsx("p",{children:"Upon a valid deletion request, we will delete:"}),e.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[e.jsx("li",{children:"Your account information (name, email, profile data)"}),e.jsx("li",{children:"Any content you have created or uploaded"}),e.jsx("li",{children:"Your activity history and preferences"}),e.jsx("li",{children:"Connected social media account tokens and data"})]})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Data Retention"}),e.jsx("p",{children:"Some data may be retained for legal or legitimate business purposes, such as:"}),e.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[e.jsx("li",{children:"Transaction records required for financial reporting"}),e.jsx("li",{children:"Data necessary to comply with legal obligations"}),e.jsx("li",{children:"Anonymized or aggregated data that cannot identify you"})]})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Facebook/Instagram Data"}),e.jsx("p",{children:"If you have connected your Facebook or Instagram account to LevelUp, you can also manage your data through Facebook's settings:"}),e.jsxs("ol",{className:"list-decimal pl-6 mt-2 space-y-1",children:[e.jsx("li",{children:"Go to your Facebook Settings & Privacy → Settings"}),e.jsx("li",{children:'Click on "Apps and Websites"'}),e.jsx("li",{children:'Find LevelUp and click "Remove"'}),e.jsx("li",{children:"This will revoke our access to your Facebook/Instagram data"})]})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Processing Time"}),e.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."})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Contact Us"}),e.jsxs("p",{children:["If you have questions about data deletion, please contact us at"," ",e.jsx("a",{href:"mailto:support@relevelup.com",className:"text-primary hover:underline",children:"support@relevelup.com"})]})]})]})]})})]}),rpt=Pv({email:Do().email("Invalid email address"),password:Do().min(6,"Password must be at least 6 characters")}),spt=()=>{const{signIn:t,user:r}=Gr(),s=Ws(),[n,a]=E.useState(!1),[o,l]=E.useState({}),[i,d]=E.useState(""),[m,g]=E.useState(!1),[y,v]=E.useState(!1);E.useEffect(()=>{r&&s("/dashboard")},[r,s]);const b=async j=>{j.preventDefault(),l({}),a(!0);const S=new FormData(j.currentTarget),A=S.get("email"),M=S.get("password");try{rpt.parse({email:A,password:M}),await t(A,M)}catch(I){if(I instanceof nx){const F={};I.errors.forEach(O=>{O.path[0]&&(F[O.path[0]]=O.message)}),l(F)}}finally{a(!1)}},N=async()=>{if(!i){Se.error("Please enter your email address");return}g(!0);try{const{error:j}=await Z.functions.invoke("send-password-reset",{body:{email:i,redirectTo:"https://dashboard.relevelup.com/profile?reset=true"}});if(j)throw j;Se.success("Password reset email sent! Check your inbox."),v(!1),d("")}catch(j){Se.error(j.message||"Failed to send reset email")}finally{g(!1)}};return e.jsxs("div",{className:"min-h-screen relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-[#4a6b6d] via-[#3d5a5c] to-[#2a4347]",children:e.jsxs("div",{className:"absolute inset-0 opacity-30",children:[e.jsx("div",{className:"absolute top-0 left-0 w-96 h-96 bg-white/10 rounded-full blur-3xl animate-pulse"}),e.jsx("div",{className:"absolute bottom-0 right-0 w-96 h-96 bg-white/5 rounded-full blur-3xl animate-pulse",style:{animationDelay:"1s"}}),e.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"}})]})}),e.jsxs("div",{className:"relative z-10 flex flex-col min-h-screen",children:[e.jsx("header",{className:"p-6",children:e.jsxs(go,{to:"/",className:"inline-flex items-center gap-2 text-sm text-white/80 hover:text-white transition-colors",children:[e.jsx(_i,{className:"h-4 w-4"}),"Back to Home"]})}),e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-md",children:[e.jsx("div",{className:"flex justify-center mb-8",children:e.jsx("div",{className:"bg-white rounded-xl p-4 shadow-2xl",children:e.jsx("img",{src:X8e,alt:"LevelUp",className:"h-12 w-auto"})})}),e.jsxs(ze,{className:"border-0 shadow-2xl bg-white/95 backdrop-blur-sm",children:[e.jsxs(Wt,{className:"space-y-1 text-center pb-4",children:[e.jsx(Zt,{className:"text-3xl font-bold text-[#2a4347]",style:{fontFamily:"'Libre Baskerville', serif"},children:"Welcome Back"}),e.jsx(Ss,{className:"text-gray-600",children:"Sign in to access your dashboard"})]}),e.jsx(qe,{children:e.jsxs("form",{onSubmit:b,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"signin-email",className:"text-gray-700",children:"Email"}),e.jsx(Qe,{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&&e.jsx("p",{className:"text-sm text-red-600",children:o.email})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"signin-password",className:"text-gray-700",children:"Password"}),e.jsx(Qe,{id:"signin-password",name:"password",type:"password",required:!0,className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"}),o.password&&e.jsx("p",{className:"text-sm text-red-600",children:o.password})]}),e.jsx(Q,{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:n,children:n?"Signing in...":"Sign In"}),e.jsxs(Dr,{open:y,onOpenChange:v,children:[e.jsx(xo,{asChild:!0,children:e.jsx(Q,{variant:"link",className:"w-full text-sm text-[#4a6b6d] hover:text-[#3d5a5c]",children:"Forgot password?"})}),e.jsxs(Lr,{className:"bg-white",children:[e.jsxs(Ur,{children:[e.jsx(Br,{className:"text-[#2a4347]",style:{fontFamily:"'Libre Baskerville', serif"},children:"Reset Password"}),e.jsx(Gs,{className:"text-gray-600",children:"Enter your email address and we'll send you a link to reset your password."})]}),e.jsxs("div",{className:"space-y-4 pt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"reset-email",className:"text-gray-700",children:"Email"}),e.jsx(Qe,{id:"reset-email",type:"email",placeholder:"your@email.com",value:i,onChange:j=>d(j.target.value),className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"})]}),e.jsx(Q,{onClick:N,className:"w-full bg-[#4a6b6d] hover:bg-[#3d5a5c] text-white",disabled:m,children:m?"Sending...":"Send Reset Link"})]})]})]})]})})]}),e.jsxs("p",{className:"text-center text-white/70 text-sm mt-6",children:["Don't have an account?"," ",e.jsx(go,{to:"/",className:"text-white hover:underline font-medium",children:"View Plans"})]})]})})]})]})},npt=()=>{const[t]=Bc(),r=t.get("tier"),s=r==null?void 0:r.includes("brokerage");return e.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:e.jsxs(ze,{className:"max-w-lg w-full",children:[e.jsxs(Wt,{className:"text-center",children:[e.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-green-500/10 flex items-center justify-center mb-4",children:e.jsx(ui,{className:"w-10 h-10 text-green-500"})}),e.jsx(Zt,{className:"text-2xl",children:"Welcome to LevelUp!"}),e.jsx(Ss,{className:"text-lg",children:"Your subscription has been activated successfully."})]}),e.jsxs(qe,{className:"space-y-6",children:[e.jsxs("div",{className:"p-4 rounded-lg bg-primary/10 border border-primary/20 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[e.jsx(mn,{className:"w-5 h-5"}),e.jsx("span",{className:"font-semibold",children:"Check your email to sign in"})]}),e.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."})]}),s?e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"font-semibold",children:"What's next?"}),e.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"font-bold text-primary",children:"1."}),"Click the link in your email to sign in"]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"font-bold text-primary",children:"2."}),"Create and name your brokerage"]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"font-bold text-primary",children:"3."}),"Set your password and complete your profile"]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"font-bold text-primary",children:"4."}),"Start inviting agents to join your team"]})]})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"font-semibold",children:"What's next?"}),e.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"font-bold text-primary",children:"1."}),"Click the link in your email to sign in"]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"font-bold text-primary",children:"2."}),"Set your password and complete your profile"]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"font-bold text-primary",children:"3."}),"Start exploring templates, training videos, and more!"]})]}),e.jsx("p",{className:"text-sm text-green-600 font-medium mt-4",children:"🎉 Your 7-day free trial has started!"})]}),e.jsx("div",{className:"p-3 rounded-lg bg-muted/50 text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Didn't receive the email? Check your spam folder or contact support."})})]})]})})},vDe=t=>{const[r,s]=E.useState(null),[n,a]=E.useState(!0);return E.useEffect(()=>{if(!t){a(!1);return}(async()=>{try{const{data:i}=await Z.storage.from("avatars").list(`${t}`);if(i&&i.length>0){const{data:d}=Z.storage.from("avatars").getPublicUrl(`${t}/${i[0].name}`);s(`${d.publicUrl}?t=${Date.now()}`)}else s(null)}catch(i){console.error("Error fetching avatar:",i),s(null)}finally{a(!1)}})()},[t]),{avatarUrl:r,loading:n,refreshAvatar:async()=>{if(t)try{const{data:l}=await Z.storage.from("avatars").list(`${t}`);if(l&&l.length>0){const{data:i}=Z.storage.from("avatars").getPublicUrl(`${t}/${l[0].name}`);s(`${i.publicUrl}?t=${Date.now()}`)}}catch(l){console.error("Error refreshing avatar:",l)}}}},_De=async t=>{const r=new Map;return await Promise.all(t.map(async s=>{try{const{data:n}=await Z.storage.from("avatars").list(`${s}`);if(n&&n.length>0){const{data:a}=Z.storage.from("avatars").getPublicUrl(`${s}/${n[0].name}`);r.set(s,a.publicUrl)}}catch{}})),r},apt=t=>{const[r,s]=E.useState({isTrial:!1,isExpired:!1,expiresAt:null,daysLeft:null,loading:!0});return E.useEffect(()=>{if(!t){s(a=>({...a,loading:!1}));return}(async()=>{try{const{data:a,error:o}=await Z.from("profiles").select("is_trial, trial_expires_at, subscription_status, subscription_end_date").eq("id",t).single();if(o){console.error("Error fetching trial status:",o),s(d=>({...d,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 d=new Date().getTime(),m=new Date(a.subscription_end_date).getTime(),g=Math.ceil((m-d)/(1e3*60*60*24)),y=g<=0;s({isTrial:!0,isExpired:y,expiresAt:a.subscription_end_date,daysLeft:y?0:g,loading:!1})}else if(i){const d=new Date().getTime(),m=new Date(a.trial_expires_at).getTime(),g=Math.ceil((m-d)/(1e3*60*60*24)),y=g<=0;s({isTrial:!0,isExpired:y,expiresAt:a.trial_expires_at,daysLeft:y?0:g,loading:!1})}else s({isTrial:!1,isExpired:!1,expiresAt:null,daysLeft:null,loading:!1})}catch(a){console.error("Error in useTrialStatus:",a),s(o=>({...o,loading:!1}))}})()},[t]),r},bDe=()=>{const{data:t,isLoading:r}=Ht({queryKey:["feature-flags"],queryFn:async()=>{const{data:n,error:a}=await Z.from("feature_flags").select("*");if(a)throw a;return n}}),s=n=>{if(!t)return!1;const a=t.find(o=>o.key===n);return(a==null?void 0:a.enabled)??!1};return{flags:t,isLoading:r,isFeatureEnabled:s,isAgentOSEnabled:s("agent_os_enabled"),isInnerCircleEnabled:s("innercircle_enabled"),isMarketplaceEnabled:s("marketplace")}},LNe="community_last_seen_post_at";function ipt(){const{user:t}=Gr(),r=Uh(),[s,n]=E.useState(0),[a,o]=E.useState(null);E.useEffect(()=>{if(!t)return;const i=localStorage.getItem(`${LNe}_${t.id}`);o(i)},[t]),E.useEffect(()=>{if(!t)return;(async()=>{let d=Z.from("community_posts").select("id",{count:"exact",head:!0});a&&(d=d.gt("created_at",a));const{data:m}=await Z.from("profiles").select("brokerage_id").eq("id",t.id).single(),{count:g,error:y}=await d;!y&&g!==null&&n(g)})()},[t,a]),E.useEffect(()=>{if(!t)return;const i=Z.channel("community-new-posts").on("postgres_changes",{event:"INSERT",schema:"public",table:"community_posts"},async d=>{const m=d.new;if(m.user_id===t.id)return;const g=r.pathname==="/community";g||n(N=>N+1);const{data:y}=await Z.from("profiles").select("name").eq("id",m.user_id).single(),v=(y==null?void 0:y.name)||"Someone",b=m.content.length>50?m.content.substring(0,50)+"...":m.content;g||Se("New Community Post",{description:`${v}: ${b}`,action:{label:"View",onClick:()=>{window.location.href="/community"}}})}).subscribe();return()=>{Z.removeChannel(i)}},[t,r.pathname]);const l=E.useCallback(()=>{if(!t)return;const i=new Date().toISOString();localStorage.setItem(`${LNe}_${t.id}`,i),o(i),n(0)},[t]);return E.useEffect(()=>{r.pathname==="/community"&&s>0&&l()},[r.pathname,s,l]),{unreadCount:s,markAsRead:l}}function opt(){const{isAdmin:t}=Gr(),{data:r=0}=Ht({queryKey:["wishlist-open-count"],queryFn:async()=>{const{count:s,error:n}=await Z.from("wishlist_items").select("*",{count:"exact",head:!0}).eq("status","open");if(n)throw n;return s||0},enabled:t,staleTime:6e4});return{openCount:t?r:0}}const Lv=()=>{const{user:t}=Gr();return Ht({queryKey:["user-team",t==null?void 0:t.id],queryFn:async()=>{const{data:r,error:s}=await Z.from("team_members").select("id, team_id, role").eq("user_id",t.id).maybeSingle();if(console.log("[useUserTeam] membership query:",{userId:t.id,membership:r,error:s}),s)throw s;if(!r)return null;const{data:n,error:a}=await Z.from("teams").select("*").eq("id",r.team_id).single();if(a)throw a;return{membershipId:r.id,teamId:r.team_id,role:r.role,team:n}},enabled:!!t,staleTime:5*60*1e3})},eae=$ne,_ye=aye,lpt=Une,wDe=E.forwardRef(({className:t,...r},s)=>e.jsx(U3,{className:qt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r,ref:s}));wDe.displayName=U3.displayName;const cpt=T3("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"}}),jP=E.forwardRef(({side:t="right",className:r,children:s,...n},a)=>e.jsxs(lpt,{children:[e.jsx(wDe,{}),e.jsxs(q3,{ref:a,className:qt(cpt({side:t}),r),...n,children:[s,e.jsxs(qne,{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:[e.jsx(rn,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));jP.displayName=q3.displayName;const tae=({className:t,...r})=>e.jsx("div",{className:qt("flex flex-col space-y-2 text-center sm:text-left",t),...r});tae.displayName="SheetHeader";const rae=E.forwardRef(({className:t,...r},s)=>e.jsx(_P,{ref:s,className:qt("text-lg font-semibold text-foreground",t),...r}));rae.displayName=_P.displayName;const dpt=E.forwardRef(({className:t,...r},s)=>e.jsx(bP,{ref:s,className:qt("text-sm text-muted-foreground",t),...r}));dpt.displayName=bP.displayName;function upt(t,r){return E.useReducer((s,n)=>r[s][n]??s,t)}var bye="ScrollArea",[jDe]=fc(bye),[hpt,Ep]=jDe(bye),kDe=E.forwardRef((t,r)=>{const{__scopeScrollArea:s,type:n="hover",dir:a,scrollHideDelay:o=600,...l}=t,[i,d]=E.useState(null),[m,g]=E.useState(null),[y,v]=E.useState(null),[b,N]=E.useState(null),[j,S]=E.useState(null),[A,M]=E.useState(0),[I,F]=E.useState(0),[O,B]=E.useState(!1),[$,H]=E.useState(!1),W=ga(r,se=>d(se)),X=Bk(a);return e.jsx(hpt,{scope:s,type:n,dir:X,scrollHideDelay:o,scrollArea:i,viewport:m,onViewportChange:g,content:y,onContentChange:v,scrollbarX:b,onScrollbarXChange:N,scrollbarXEnabled:O,onScrollbarXEnabledChange:B,scrollbarY:j,onScrollbarYChange:S,scrollbarYEnabled:$,onScrollbarYEnabledChange:H,onCornerWidthChange:M,onCornerHeightChange:F,children:e.jsx(qs.div,{dir:X,...l,ref:W,style:{position:"relative","--radix-scroll-area-corner-width":A+"px","--radix-scroll-area-corner-height":I+"px",...t.style}})})});kDe.displayName=bye;var NDe="ScrollAreaViewport",SDe=E.forwardRef((t,r)=>{const{__scopeScrollArea:s,children:n,nonce:a,...o}=t,l=Ep(NDe,s),i=E.useRef(null),d=ga(r,i,l.onViewportChange);return e.jsxs(e.Fragment,{children:[e.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}),e.jsx(qs.div,{"data-radix-scroll-area-viewport":"",...o,ref:d,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...t.style},children:e.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});SDe.displayName=NDe;var mx="ScrollAreaScrollbar",wye=E.forwardRef((t,r)=>{const{forceMount:s,...n}=t,a=Ep(mx,t.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:l}=a,i=t.orientation==="horizontal";return E.useEffect(()=>(i?o(!0):l(!0),()=>{i?o(!1):l(!1)}),[i,o,l]),a.type==="hover"?e.jsx(mpt,{...n,ref:r,forceMount:s}):a.type==="scroll"?e.jsx(ppt,{...n,ref:r,forceMount:s}):a.type==="auto"?e.jsx(CDe,{...n,ref:r,forceMount:s}):a.type==="always"?e.jsx(jye,{...n,ref:r}):null});wye.displayName=mx;var mpt=E.forwardRef((t,r)=>{const{forceMount:s,...n}=t,a=Ep(mx,t.__scopeScrollArea),[o,l]=E.useState(!1);return E.useEffect(()=>{const i=a.scrollArea;let d=0;if(i){const m=()=>{window.clearTimeout(d),l(!0)},g=()=>{d=window.setTimeout(()=>l(!1),a.scrollHideDelay)};return i.addEventListener("pointerenter",m),i.addEventListener("pointerleave",g),()=>{window.clearTimeout(d),i.removeEventListener("pointerenter",m),i.removeEventListener("pointerleave",g)}}},[a.scrollArea,a.scrollHideDelay]),e.jsx(zc,{present:s||o,children:e.jsx(CDe,{"data-state":o?"visible":"hidden",...n,ref:r})})}),ppt=E.forwardRef((t,r)=>{const{forceMount:s,...n}=t,a=Ep(mx,t.__scopeScrollArea),o=t.orientation==="horizontal",l=nae(()=>d("SCROLL_END"),100),[i,d]=upt("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 m=window.setTimeout(()=>d("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(m)}},[i,a.scrollHideDelay,d]),E.useEffect(()=>{const m=a.viewport,g=o?"scrollLeft":"scrollTop";if(m){let y=m[g];const v=()=>{const b=m[g];y!==b&&(d("SCROLL"),l()),y=b};return m.addEventListener("scroll",v),()=>m.removeEventListener("scroll",v)}},[a.viewport,o,d,l]),e.jsx(zc,{present:s||i!=="hidden",children:e.jsx(jye,{"data-state":i==="hidden"?"hidden":"visible",...n,ref:r,onPointerEnter:bs(t.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:bs(t.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),CDe=E.forwardRef((t,r)=>{const s=Ep(mx,t.__scopeScrollArea),{forceMount:n,...a}=t,[o,l]=E.useState(!1),i=t.orientation==="horizontal",d=nae(()=>{if(s.viewport){const m=s.viewport.offsetWidth{const{orientation:s="vertical",...n}=t,a=Ep(mx,t.__scopeScrollArea),o=E.useRef(null),l=E.useRef(0),[i,d]=E.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),m=IDe(i.viewport,i.content),g={...n,sizes:i,onSizesChange:d,hasThumb:m>0&&m<1,onThumbChange:v=>o.current=v,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:v=>l.current=v};function y(v,b){return _pt(v,l.current,i,b)}return s==="horizontal"?e.jsx(fpt,{...g,ref:r,onThumbPositionChange:()=>{if(a.viewport&&o.current){const v=a.viewport.scrollLeft,b=ONe(v,i,a.dir);o.current.style.transform=`translate3d(${b}px, 0, 0)`}},onWheelScroll:v=>{a.viewport&&(a.viewport.scrollLeft=v)},onDragScroll:v=>{a.viewport&&(a.viewport.scrollLeft=y(v,a.dir))}}):s==="vertical"?e.jsx(gpt,{...g,ref:r,onThumbPositionChange:()=>{if(a.viewport&&o.current){const v=a.viewport.scrollTop,b=ONe(v,i);o.current.style.transform=`translate3d(0, ${b}px, 0)`}},onWheelScroll:v=>{a.viewport&&(a.viewport.scrollTop=v)},onDragScroll:v=>{a.viewport&&(a.viewport.scrollTop=y(v))}}):null}),fpt=E.forwardRef((t,r)=>{const{sizes:s,onSizesChange:n,...a}=t,o=Ep(mx,t.__scopeScrollArea),[l,i]=E.useState(),d=E.useRef(null),m=ga(r,d,o.onScrollbarXChange);return E.useEffect(()=>{d.current&&i(getComputedStyle(d.current))},[d]),e.jsx(TDe,{"data-orientation":"horizontal",...a,ref:m,sizes:s,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":sae(s)+"px",...t.style},onThumbPointerDown:g=>t.onThumbPointerDown(g.x),onDragScroll:g=>t.onDragScroll(g.x),onWheelScroll:(g,y)=>{if(o.viewport){const v=o.viewport.scrollLeft+g.deltaX;t.onWheelScroll(v),LDe(v,y)&&g.preventDefault()}},onResize:()=>{d.current&&o.viewport&&l&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:nre(l.paddingLeft),paddingEnd:nre(l.paddingRight)}})}})}),gpt=E.forwardRef((t,r)=>{const{sizes:s,onSizesChange:n,...a}=t,o=Ep(mx,t.__scopeScrollArea),[l,i]=E.useState(),d=E.useRef(null),m=ga(r,d,o.onScrollbarYChange);return E.useEffect(()=>{d.current&&i(getComputedStyle(d.current))},[d]),e.jsx(TDe,{"data-orientation":"vertical",...a,ref:m,sizes:s,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":sae(s)+"px",...t.style},onThumbPointerDown:g=>t.onThumbPointerDown(g.y),onDragScroll:g=>t.onDragScroll(g.y),onWheelScroll:(g,y)=>{if(o.viewport){const v=o.viewport.scrollTop+g.deltaY;t.onWheelScroll(v),LDe(v,y)&&g.preventDefault()}},onResize:()=>{d.current&&o.viewport&&l&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:nre(l.paddingTop),paddingEnd:nre(l.paddingBottom)}})}})}),[xpt,MDe]=jDe(mx),TDe=E.forwardRef((t,r)=>{const{__scopeScrollArea:s,sizes:n,hasThumb:a,onThumbChange:o,onThumbPointerUp:l,onThumbPointerDown:i,onThumbPositionChange:d,onDragScroll:m,onWheelScroll:g,onResize:y,...v}=t,b=Ep(mx,s),[N,j]=E.useState(null),S=ga(r,W=>j(W)),A=E.useRef(null),M=E.useRef(""),I=b.viewport,F=n.content-n.viewport,O=cc(g),B=cc(d),$=nae(y,10);function H(W){if(A.current){const X=W.clientX-A.current.left,se=W.clientY-A.current.top;m({x:X,y:se})}}return E.useEffect(()=>{const W=X=>{const se=X.target;(N==null?void 0:N.contains(se))&&O(X,F)};return document.addEventListener("wheel",W,{passive:!1}),()=>document.removeEventListener("wheel",W,{passive:!1})},[I,N,F,O]),E.useEffect(B,[n,B]),KC(N,$),KC(b.content,$),e.jsx(xpt,{scope:s,scrollbar:N,hasThumb:a,onThumbChange:cc(o),onThumbPointerUp:cc(l),onThumbPositionChange:B,onThumbPointerDown:cc(i),children:e.jsx(qs.div,{...v,ref:S,style:{position:"absolute",...v.style},onPointerDown:bs(t.onPointerDown,W=>{W.button===0&&(W.target.setPointerCapture(W.pointerId),A.current=N.getBoundingClientRect(),M.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",b.viewport&&(b.viewport.style.scrollBehavior="auto"),H(W))}),onPointerMove:bs(t.onPointerMove,H),onPointerUp:bs(t.onPointerUp,W=>{const X=W.target;X.hasPointerCapture(W.pointerId)&&X.releasePointerCapture(W.pointerId),document.body.style.webkitUserSelect=M.current,b.viewport&&(b.viewport.style.scrollBehavior=""),A.current=null})})})}),sre="ScrollAreaThumb",ADe=E.forwardRef((t,r)=>{const{forceMount:s,...n}=t,a=MDe(sre,t.__scopeScrollArea);return e.jsx(zc,{present:s||a.hasThumb,children:e.jsx(ypt,{ref:r,...n})})}),ypt=E.forwardRef((t,r)=>{const{__scopeScrollArea:s,style:n,...a}=t,o=Ep(sre,s),l=MDe(sre,s),{onThumbPositionChange:i}=l,d=ga(r,y=>l.onThumbChange(y)),m=E.useRef(void 0),g=nae(()=>{m.current&&(m.current(),m.current=void 0)},100);return E.useEffect(()=>{const y=o.viewport;if(y){const v=()=>{if(g(),!m.current){const b=bpt(y,i);m.current=b,i()}};return i(),y.addEventListener("scroll",v),()=>y.removeEventListener("scroll",v)}},[o.viewport,g,i]),e.jsx(qs.div,{"data-state":l.hasThumb?"visible":"hidden",...a,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:bs(t.onPointerDownCapture,y=>{const b=y.target.getBoundingClientRect(),N=y.clientX-b.left,j=y.clientY-b.top;l.onThumbPointerDown({x:N,y:j})}),onPointerUp:bs(t.onPointerUp,l.onThumbPointerUp)})});ADe.displayName=sre;var kye="ScrollAreaCorner",EDe=E.forwardRef((t,r)=>{const s=Ep(kye,t.__scopeScrollArea),n=!!(s.scrollbarX&&s.scrollbarY);return s.type!=="scroll"&&n?e.jsx(vpt,{...t,ref:r}):null});EDe.displayName=kye;var vpt=E.forwardRef((t,r)=>{const{__scopeScrollArea:s,...n}=t,a=Ep(kye,s),[o,l]=E.useState(0),[i,d]=E.useState(0),m=!!(o&&i);return KC(a.scrollbarX,()=>{var y;const g=((y=a.scrollbarX)==null?void 0:y.offsetHeight)||0;a.onCornerHeightChange(g),d(g)}),KC(a.scrollbarY,()=>{var y;const g=((y=a.scrollbarY)==null?void 0:y.offsetWidth)||0;a.onCornerWidthChange(g),l(g)}),m?e.jsx(qs.div,{...n,ref:r,style:{width:o,height:i,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function nre(t){return t?parseInt(t,10):0}function IDe(t,r){const s=t/r;return isNaN(s)?0:s}function sae(t){const r=IDe(t.viewport,t.content),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-s)*r;return Math.max(n,18)}function _pt(t,r,s,n="ltr"){const a=sae(s),o=a/2,l=r||o,i=a-l,d=s.scrollbar.paddingStart+l,m=s.scrollbar.size-s.scrollbar.paddingEnd-i,g=s.content-s.viewport,y=n==="ltr"?[0,g]:[g*-1,0];return PDe([d,m],y)(t)}function ONe(t,r,s="ltr"){const n=sae(r),a=r.scrollbar.paddingStart+r.scrollbar.paddingEnd,o=r.scrollbar.size-a,l=r.content-r.viewport,i=o-n,d=s==="ltr"?[0,l]:[l*-1,0],m=YE(t,d);return PDe([0,l],[0,i])(m)}function PDe(t,r){return s=>{if(t[0]===t[1]||r[0]===r[1])return r[0];const n=(r[1]-r[0])/(t[1]-t[0]);return r[0]+n*(s-t[0])}}function LDe(t,r){return t>0&&t{})=>{let s={left:t.scrollLeft,top:t.scrollTop},n=0;return function a(){const o={left:t.scrollLeft,top:t.scrollTop},l=s.left!==o.left,i=s.top!==o.top;(l||i)&&r(),s=o,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function nae(t,r){const s=cc(t),n=E.useRef(0);return E.useEffect(()=>()=>window.clearTimeout(n.current),[]),E.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(s,r)},[s,r])}function KC(t,r){const s=cc(r);mc(()=>{let n=0;if(t){const a=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(s)});return a.observe(t),()=>{window.cancelAnimationFrame(n),a.unobserve(t)}}},[t,s])}var ODe=kDe,wpt=SDe,jpt=EDe;const Eo=E.forwardRef(({className:t,children:r,...s},n)=>e.jsxs(ODe,{ref:n,className:qt("relative overflow-hidden",t),...s,children:[e.jsx(wpt,{className:"h-full w-full rounded-[inherit]",children:r}),e.jsx(Nye,{}),e.jsx(jpt,{})]}));Eo.displayName=ODe.displayName;const Nye=E.forwardRef(({className:t,orientation:r="vertical",...s},n)=>e.jsx(wye,{ref:n,orientation:r,className:qt("flex touch-none select-none transition-colors",r==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",r==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...s,children:e.jsx(ADe,{className:"relative flex-1 rounded-full bg-border"})}));Nye.displayName=wye.displayName;var aae="Collapsible",[kpt]=fc(aae),[Npt,Sye]=kpt(aae),DDe=E.forwardRef((t,r)=>{const{__scopeCollapsible:s,open:n,defaultOpen:a,disabled:o,onOpenChange:l,...i}=t,[d,m]=oh({prop:n,defaultProp:a??!1,onChange:l,caller:aae});return e.jsx(Npt,{scope:s,disabled:o,contentId:bd(),open:d,onOpenToggle:E.useCallback(()=>m(g=>!g),[m]),children:e.jsx(qs.div,{"data-state":Mye(d),"data-disabled":o?"":void 0,...i,ref:r})})});DDe.displayName=aae;var RDe="CollapsibleTrigger",FDe=E.forwardRef((t,r)=>{const{__scopeCollapsible:s,...n}=t,a=Sye(RDe,s);return e.jsx(qs.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":Mye(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...n,ref:r,onClick:bs(t.onClick,a.onOpenToggle)})});FDe.displayName=RDe;var Cye="CollapsibleContent",zDe=E.forwardRef((t,r)=>{const{forceMount:s,...n}=t,a=Sye(Cye,t.__scopeCollapsible);return e.jsx(zc,{present:s||a.open,children:({present:o})=>e.jsx(Spt,{...n,ref:r,present:o})})});zDe.displayName=Cye;var Spt=E.forwardRef((t,r)=>{const{__scopeCollapsible:s,present:n,children:a,...o}=t,l=Sye(Cye,s),[i,d]=E.useState(n),m=E.useRef(null),g=ga(r,m),y=E.useRef(0),v=y.current,b=E.useRef(0),N=b.current,j=l.open||i,S=E.useRef(j),A=E.useRef(void 0);return E.useEffect(()=>{const M=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(M)},[]),mc(()=>{const M=m.current;if(M){A.current=A.current||{transitionDuration:M.style.transitionDuration,animationName:M.style.animationName},M.style.transitionDuration="0s",M.style.animationName="none";const I=M.getBoundingClientRect();y.current=I.height,b.current=I.width,S.current||(M.style.transitionDuration=A.current.transitionDuration,M.style.animationName=A.current.animationName),d(n)}},[l.open,n]),e.jsx(qs.div,{"data-state":Mye(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!j,...o,ref:g,style:{"--radix-collapsible-content-height":v?`${v}px`:void 0,"--radix-collapsible-content-width":N?`${N}px`:void 0,...t.style},children:j&&a})});function Mye(t){return t?"open":"closed"}var Cpt=DDe;const ek=Cpt,tk=FDe,rk=zDe,Mpt="/assets/levelup-logo-Eif24dqY.png",Tpt="/assets/levelup-logo-icon-C-7iromj.png",Apt="/assets/levelup-logo-mobile-B9skSjUG.png";var kP=t=>t.type==="checkbox",mj=t=>t instanceof Date,Xu=t=>t==null;const BDe=t=>typeof t=="object";var Rc=t=>!Xu(t)&&!Array.isArray(t)&&BDe(t)&&!mj(t),$De=t=>Rc(t)&&t.target?kP(t.target)?t.target.checked:t.target.value:t,Ept=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,UDe=(t,r)=>t.has(Ept(r)),Ipt=t=>{const r=t.constructor&&t.constructor.prototype;return Rc(r)&&r.hasOwnProperty("isPrototypeOf")},Tye=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ud(t){let r;const s=Array.isArray(t),n=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)r=new Date(t);else if(!(Tye&&(t instanceof Blob||n))&&(s||Rc(t)))if(r=s?[]:{},!s&&!Ipt(t))r=t;else for(const a in t)t.hasOwnProperty(a)&&(r[a]=ud(t[a]));else return t;return r}var iae=t=>/^\w*$/.test(t),jc=t=>t===void 0,Aye=t=>Array.isArray(t)?t.filter(Boolean):[],Eye=t=>Aye(t.replace(/["|']|\]/g,"").split(/\.|\[/)),on=(t,r,s)=>{if(!r||!Rc(t))return s;const n=(iae(r)?[r]:Eye(r)).reduce((a,o)=>Xu(a)?a:a[o],t);return jc(n)||n===t?jc(t[r])?s:t[r]:n},cm=t=>typeof t=="boolean",Lo=(t,r,s)=>{let n=-1;const a=iae(r)?[r]:Eye(r),o=a.length,l=o-1;for(;++nlt.useContext(Iye),Ppt=t=>{const{children:r,...s}=t;return lt.createElement(Iye.Provider,{value:s},r)};var qDe=(t,r,s,n=!0)=>{const a={defaultValues:r._defaultValues};for(const o in t)Object.defineProperty(a,o,{get:()=>{const l=o;return r._proxyFormState[l]!==Nf.all&&(r._proxyFormState[l]=!n||Nf.all),s&&(s[l]=!0),t[l]}});return a};const Pye=typeof window<"u"?lt.useLayoutEffect:lt.useEffect;function Lpt(t){const r=oae(),{control:s=r.control,disabled:n,name:a,exact:o}=t||{},[l,i]=lt.useState(s._formState),d=lt.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Pye(()=>s._subscribe({name:a,formState:d.current,exact:o,callback:m=>{!n&&i({...s._formState,...m})}}),[a,n,o]),lt.useEffect(()=>{d.current.isValid&&s._setValid(!0)},[s]),lt.useMemo(()=>qDe(l,s,d.current,!1),[l,s])}var Fg=t=>typeof t=="string",VDe=(t,r,s,n,a)=>Fg(t)?(n&&r.watch.add(t),on(s,t,a)):Array.isArray(t)?t.map(o=>(n&&r.watch.add(o),on(s,o))):(n&&(r.watchAll=!0),s),Ime=t=>Xu(t)||!BDe(t);function sy(t,r,s=new WeakSet){if(Ime(t)||Ime(r))return t===r;if(mj(t)&&mj(r))return t.getTime()===r.getTime();const n=Object.keys(t),a=Object.keys(r);if(n.length!==a.length)return!1;if(s.has(t)||s.has(r))return!0;s.add(t),s.add(r);for(const o of n){const l=t[o];if(!a.includes(o))return!1;if(o!=="ref"){const i=r[o];if(mj(l)&&mj(i)||Rc(l)&&Rc(i)||Array.isArray(l)&&Array.isArray(i)?!sy(l,i,s):l!==i)return!1}}return!0}function Opt(t){const r=oae(),{control:s=r.control,name:n,defaultValue:a,disabled:o,exact:l,compute:i}=t||{},d=lt.useRef(a),m=lt.useRef(i),g=lt.useRef(void 0);m.current=i;const y=lt.useMemo(()=>s._getWatch(n,d.current),[s,n]),[v,b]=lt.useState(m.current?m.current(y):y);return Pye(()=>s._subscribe({name:n,formState:{values:!0},exact:l,callback:N=>{if(!o){const j=VDe(n,s._names,N.values||s._formValues,!1,d.current);if(m.current){const S=m.current(j);sy(S,g.current)||(b(S),g.current=S)}else b(j)}}}),[s,o,n,l]),lt.useEffect(()=>s._removeUnmounted()),v}function Dpt(t){const r=oae(),{name:s,disabled:n,control:a=r.control,shouldUnregister:o,defaultValue:l}=t,i=UDe(a._names.array,s),d=lt.useMemo(()=>on(a._formValues,s,on(a._defaultValues,s,l)),[a,s,l]),m=Opt({control:a,name:s,defaultValue:d,exact:!0}),g=Lpt({control:a,name:s,exact:!0}),y=lt.useRef(t),v=lt.useRef(a.register(s,{...t.rules,value:m,...cm(t.disabled)?{disabled:t.disabled}:{}}));y.current=t;const b=lt.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!on(g.errors,s)},isDirty:{enumerable:!0,get:()=>!!on(g.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!on(g.touchedFields,s)},isValidating:{enumerable:!0,get:()=>!!on(g.validatingFields,s)},error:{enumerable:!0,get:()=>on(g.errors,s)}}),[g,s]),N=lt.useCallback(M=>v.current.onChange({target:{value:$De(M),name:s},type:are.CHANGE}),[s]),j=lt.useCallback(()=>v.current.onBlur({target:{value:on(a._formValues,s),name:s},type:are.BLUR}),[s,a._formValues]),S=lt.useCallback(M=>{const I=on(a._fields,s);I&&M&&(I._f.ref={focus:()=>M.focus&&M.focus(),select:()=>M.select&&M.select(),setCustomValidity:F=>M.setCustomValidity(F),reportValidity:()=>M.reportValidity()})},[a._fields,s]),A=lt.useMemo(()=>({name:s,value:m,...cm(n)||g.disabled?{disabled:g.disabled||n}:{},onChange:N,onBlur:j,ref:S}),[s,n,g.disabled,N,j,S,m]);return lt.useEffect(()=>{const M=a._options.shouldUnregister||o;a.register(s,{...y.current.rules,...cm(y.current.disabled)?{disabled:y.current.disabled}:{}});const I=(F,O)=>{const B=on(a._fields,F);B&&B._f&&(B._f.mount=O)};if(I(s,!0),M){const F=ud(on(a._options.defaultValues,s));Lo(a._defaultValues,s,F),jc(on(a._formValues,s))&&Lo(a._formValues,s,F)}return!i&&a.register(s),()=>{(i?M&&!a._state.action:M)?a.unregister(s):I(s,!1)}},[s,a,i,o]),lt.useEffect(()=>{a._setDisabledField({disabled:n,name:s})},[n,s,a]),lt.useMemo(()=>({field:A,formState:g,fieldState:b}),[A,g,b])}const Rpt=t=>t.render(Dpt(t));var HDe=(t,r,s,n,a)=>r?{...s[t],types:{...s[t]&&s[t].types?s[t].types:{},[n]:a||!0}}:{},JA=t=>Array.isArray(t)?t:[t],DNe=()=>{let t=[];return{get observers(){return t},next:a=>{for(const o of t)o.next&&o.next(a)},subscribe:a=>(t.push(a),{unsubscribe:()=>{t=t.filter(o=>o!==a)}}),unsubscribe:()=>{t=[]}}},Ch=t=>Rc(t)&&!Object.keys(t).length,Lye=t=>t.type==="file",Sf=t=>typeof t=="function",ire=t=>{if(!Tye)return!1;const r=t?t.ownerDocument:0;return t instanceof(r&&r.defaultView?r.defaultView.HTMLElement:HTMLElement)},WDe=t=>t.type==="select-multiple",Oye=t=>t.type==="radio",Fpt=t=>Oye(t)||kP(t),Qce=t=>ire(t)&&t.isConnected;function zpt(t,r){const s=r.slice(0,-1).length;let n=0;for(;n{for(const r in t)if(Sf(t[r]))return!0;return!1};function ore(t,r={}){const s=Array.isArray(t);if(Rc(t)||s)for(const n in t)Array.isArray(t[n])||Rc(t[n])&&!GDe(t[n])?(r[n]=Array.isArray(t[n])?[]:{},ore(t[n],r[n])):Xu(t[n])||(r[n]=!0);return r}function KDe(t,r,s){const n=Array.isArray(t);if(Rc(t)||n)for(const a in t)Array.isArray(t[a])||Rc(t[a])&&!GDe(t[a])?jc(r)||Ime(s[a])?s[a]=Array.isArray(t[a])?ore(t[a],[]):{...ore(t[a])}:KDe(t[a],Xu(r)?{}:r[a],s[a]):s[a]=!sy(t[a],r[a]);return s}var bT=(t,r)=>KDe(t,r,ore(r));const RNe={value:!1,isValid:!1},FNe={value:!0,isValid:!0};var ZDe=t=>{if(Array.isArray(t)){if(t.length>1){const r=t.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:r,isValid:!!r.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!jc(t[0].attributes.value)?jc(t[0].value)||t[0].value===""?FNe:{value:t[0].value,isValid:!0}:FNe:RNe}return RNe},YDe=(t,{valueAsNumber:r,valueAsDate:s,setValueAs:n})=>jc(t)?t:r?t===""?NaN:t&&+t:s&&Fg(t)?new Date(t):n?n(t):t;const zNe={isValid:!1,value:null};var XDe=t=>Array.isArray(t)?t.reduce((r,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:r,zNe):zNe;function BNe(t){const r=t.ref;return Lye(r)?r.files:Oye(r)?XDe(t.refs).value:WDe(r)?[...r.selectedOptions].map(({value:s})=>s):kP(r)?ZDe(t.refs).value:YDe(jc(r.value)?t.ref.value:r.value,t)}var $pt=(t,r,s,n)=>{const a={};for(const o of t){const l=on(r,o);l&&Lo(a,o,l._f)}return{criteriaMode:s,names:[...t],fields:a,shouldUseNativeValidation:n}},lre=t=>t instanceof RegExp,wT=t=>jc(t)?t:lre(t)?t.source:Rc(t)?lre(t.value)?t.value.source:t.value:t,$Ne=t=>({isOnSubmit:!t||t===Nf.onSubmit,isOnBlur:t===Nf.onBlur,isOnChange:t===Nf.onChange,isOnAll:t===Nf.all,isOnTouch:t===Nf.onTouched});const UNe="AsyncFunction";var Upt=t=>!!t&&!!t.validate&&!!(Sf(t.validate)&&t.validate.constructor.name===UNe||Rc(t.validate)&&Object.values(t.validate).find(r=>r.constructor.name===UNe)),qpt=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),qNe=(t,r,s)=>!s&&(r.watchAll||r.watch.has(t)||[...r.watch].some(n=>t.startsWith(n)&&/^\.\w+/.test(t.slice(n.length))));const eE=(t,r,s,n)=>{for(const a of s||Object.keys(t)){const o=on(t,a);if(o){const{_f:l,...i}=o;if(l){if(l.refs&&l.refs[0]&&r(l.refs[0],a)&&!n)return!0;if(l.ref&&r(l.ref,l.name)&&!n)return!0;if(eE(i,r))break}else if(Rc(i)&&eE(i,r))break}}};function VNe(t,r,s){const n=on(t,s);if(n||iae(s))return{error:n,name:s};const a=s.split(".");for(;a.length;){const o=a.join("."),l=on(r,o),i=on(t,o);if(l&&!Array.isArray(l)&&s!==o)return{name:s};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:s}}var Vpt=(t,r,s,n)=>{s(t);const{name:a,...o}=t;return Ch(o)||Object.keys(o).length>=Object.keys(r).length||Object.keys(o).find(l=>r[l]===(!n||Nf.all))},Hpt=(t,r,s)=>!t||!r||t===r||JA(t).some(n=>n&&(s?n===r:n.startsWith(r)||r.startsWith(n))),Wpt=(t,r,s,n,a)=>a.isOnAll?!1:!s&&a.isOnTouch?!(r||t):(s?n.isOnBlur:a.isOnBlur)?!t:(s?n.isOnChange:a.isOnChange)?t:!0,Gpt=(t,r)=>!Aye(on(t,r)).length&&Wc(t,r),Kpt=(t,r,s)=>{const n=JA(on(t,s));return Lo(n,"root",r[s]),Lo(t,s,n),t},Kee=t=>Fg(t);function HNe(t,r,s="validate"){if(Kee(t)||Array.isArray(t)&&t.every(Kee)||cm(t)&&!t)return{type:s,message:Kee(t)?t:"",ref:r}}var $4=t=>Rc(t)&&!lre(t)?t:{value:t,message:""},WNe=async(t,r,s,n,a,o)=>{const{ref:l,refs:i,required:d,maxLength:m,minLength:g,min:y,max:v,pattern:b,validate:N,name:j,valueAsNumber:S,mount:A}=t._f,M=on(s,j);if(!A||r.has(j))return{};const I=i?i[0]:l,F=ae=>{a&&I.reportValidity&&(I.setCustomValidity(cm(ae)?"":ae||""),I.reportValidity())},O={},B=Oye(l),$=kP(l),H=B||$,W=(S||Lye(l))&&jc(l.value)&&jc(M)||ire(l)&&l.value===""||M===""||Array.isArray(M)&&!M.length,X=HDe.bind(null,j,n,O),se=(ae,le,ne,fe=Bx.maxLength,oe=Bx.minLength)=>{const de=ae?le:ne;O[j]={type:ae?fe:oe,message:de,ref:l,...X(ae?fe:oe,de)}};if(o?!Array.isArray(M)||!M.length:d&&(!H&&(W||Xu(M))||cm(M)&&!M||$&&!ZDe(i).isValid||B&&!XDe(i).isValid)){const{value:ae,message:le}=Kee(d)?{value:!!d,message:d}:$4(d);if(ae&&(O[j]={type:Bx.required,message:le,ref:I,...X(Bx.required,le)},!n))return F(le),O}if(!W&&(!Xu(y)||!Xu(v))){let ae,le;const ne=$4(v),fe=$4(y);if(!Xu(M)&&!isNaN(M)){const oe=l.valueAsNumber||M&&+M;Xu(ne.value)||(ae=oe>ne.value),Xu(fe.value)||(le=oenew Date(new Date().toDateString()+" "+Te),ue=l.type=="time",xe=l.type=="week";Fg(ne.value)&&M&&(ae=ue?de(M)>de(ne.value):xe?M>ne.value:oe>new Date(ne.value)),Fg(fe.value)&&M&&(le=ue?de(M)+ae.value,fe=!Xu(le.value)&&M.length<+le.value;if((ne||fe)&&(se(ne,ae.message,le.message),!n))return F(O[j].message),O}if(b&&!W&&Fg(M)){const{value:ae,message:le}=$4(b);if(lre(ae)&&!M.match(ae)&&(O[j]={type:Bx.pattern,message:le,ref:l,...X(Bx.pattern,le)},!n))return F(le),O}if(N){if(Sf(N)){const ae=await N(M,s),le=HNe(ae,I);if(le&&(O[j]={...le,...X(Bx.validate,le.message)},!n))return F(le.message),O}else if(Rc(N)){let ae={};for(const le in N){if(!Ch(ae)&&!n)break;const ne=HNe(await N[le](M,s),I,le);ne&&(ae={...ne,...X(le,ne.message)},F(ne.message),n&&(O[j]=ae))}if(!Ch(ae)&&(O[j]={ref:I,...ae},!n))return O}}return F(!0),O};const Zpt={mode:Nf.onSubmit,reValidateMode:Nf.onChange,shouldFocusError:!0};function Ypt(t={}){let r={...Zpt,...t},s={submitCount:0,isDirty:!1,isReady:!1,isLoading:Sf(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},n={},a=Rc(r.defaultValues)||Rc(r.values)?ud(r.defaultValues||r.values)||{}:{},o=r.shouldUnregister?{}:ud(a),l={action:!1,mount:!1,watch:!1},i={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},d,m=0;const g={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let y={...g};const v={array:DNe(),state:DNe()},b=r.criteriaMode===Nf.all,N=Me=>Je=>{clearTimeout(m),m=setTimeout(Me,Je)},j=async Me=>{if(!r.disabled&&(g.isValid||y.isValid||Me)){const Je=r.resolver?Ch((await $()).errors):await W(n,!0);Je!==s.isValid&&v.state.next({isValid:Je})}},S=(Me,Je)=>{!r.disabled&&(g.isValidating||g.validatingFields||y.isValidating||y.validatingFields)&&((Me||Array.from(i.mount)).forEach(Xe=>{Xe&&(Je?Lo(s.validatingFields,Xe,Je):Wc(s.validatingFields,Xe))}),v.state.next({validatingFields:s.validatingFields,isValidating:!Ch(s.validatingFields)}))},A=(Me,Je=[],Xe,Ve,ot=!0,mt=!0)=>{if(Ve&&Xe&&!r.disabled){if(l.action=!0,mt&&Array.isArray(on(n,Me))){const ft=Xe(on(n,Me),Ve.argA,Ve.argB);ot&&Lo(n,Me,ft)}if(mt&&Array.isArray(on(s.errors,Me))){const ft=Xe(on(s.errors,Me),Ve.argA,Ve.argB);ot&&Lo(s.errors,Me,ft),Gpt(s.errors,Me)}if((g.touchedFields||y.touchedFields)&&mt&&Array.isArray(on(s.touchedFields,Me))){const ft=Xe(on(s.touchedFields,Me),Ve.argA,Ve.argB);ot&&Lo(s.touchedFields,Me,ft)}(g.dirtyFields||y.dirtyFields)&&(s.dirtyFields=bT(a,o)),v.state.next({name:Me,isDirty:se(Me,Je),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else Lo(o,Me,Je)},M=(Me,Je)=>{Lo(s.errors,Me,Je),v.state.next({errors:s.errors})},I=Me=>{s.errors=Me,v.state.next({errors:s.errors,isValid:!1})},F=(Me,Je,Xe,Ve)=>{const ot=on(n,Me);if(ot){const mt=on(o,Me,jc(Xe)?on(a,Me):Xe);jc(mt)||Ve&&Ve.defaultChecked||Je?Lo(o,Me,Je?mt:BNe(ot._f)):ne(Me,mt),l.mount&&j()}},O=(Me,Je,Xe,Ve,ot)=>{let mt=!1,ft=!1;const ct={name:Me};if(!r.disabled){if(!Xe||Ve){(g.isDirty||y.isDirty)&&(ft=s.isDirty,s.isDirty=ct.isDirty=se(),mt=ft!==ct.isDirty);const Mt=sy(on(a,Me),Je);ft=!!on(s.dirtyFields,Me),Mt?Wc(s.dirtyFields,Me):Lo(s.dirtyFields,Me,!0),ct.dirtyFields=s.dirtyFields,mt=mt||(g.dirtyFields||y.dirtyFields)&&ft!==!Mt}if(Xe){const Mt=on(s.touchedFields,Me);Mt||(Lo(s.touchedFields,Me,Xe),ct.touchedFields=s.touchedFields,mt=mt||(g.touchedFields||y.touchedFields)&&Mt!==Xe)}mt&&ot&&v.state.next(ct)}return mt?ct:{}},B=(Me,Je,Xe,Ve)=>{const ot=on(s.errors,Me),mt=(g.isValid||y.isValid)&&cm(Je)&&s.isValid!==Je;if(r.delayError&&Xe?(d=N(()=>M(Me,Xe)),d(r.delayError)):(clearTimeout(m),d=null,Xe?Lo(s.errors,Me,Xe):Wc(s.errors,Me)),(Xe?!sy(ot,Xe):ot)||!Ch(Ve)||mt){const ft={...Ve,...mt&&cm(Je)?{isValid:Je}:{},errors:s.errors,name:Me};s={...s,...ft},v.state.next(ft)}},$=async Me=>{S(Me,!0);const Je=await r.resolver(o,r.context,$pt(Me||i.mount,n,r.criteriaMode,r.shouldUseNativeValidation));return S(Me),Je},H=async Me=>{const{errors:Je}=await $(Me);if(Me)for(const Xe of Me){const Ve=on(Je,Xe);Ve?Lo(s.errors,Xe,Ve):Wc(s.errors,Xe)}else s.errors=Je;return Je},W=async(Me,Je,Xe={valid:!0})=>{for(const Ve in Me){const ot=Me[Ve];if(ot){const{_f:mt,...ft}=ot;if(mt){const ct=i.array.has(mt.name),Mt=ot._f&&Upt(ot._f);Mt&&g.validatingFields&&S([Ve],!0);const Ot=await WNe(ot,i.disabled,o,b,r.shouldUseNativeValidation&&!Je,ct);if(Mt&&g.validatingFields&&S([Ve]),Ot[mt.name]&&(Xe.valid=!1,Je))break;!Je&&(on(Ot,mt.name)?ct?Kpt(s.errors,Ot,mt.name):Lo(s.errors,mt.name,Ot[mt.name]):Wc(s.errors,mt.name))}!Ch(ft)&&await W(ft,Je,Xe)}}return Xe.valid},X=()=>{for(const Me of i.unMount){const Je=on(n,Me);Je&&(Je._f.refs?Je._f.refs.every(Xe=>!Qce(Xe)):!Qce(Je._f.ref))&&Ue(Me)}i.unMount=new Set},se=(Me,Je)=>!r.disabled&&(Me&&Je&&Lo(o,Me,Je),!sy(Te(),a)),ae=(Me,Je,Xe)=>VDe(Me,i,{...l.mount?o:jc(Je)?a:Fg(Me)?{[Me]:Je}:Je},Xe,Je),le=Me=>Aye(on(l.mount?o:a,Me,r.shouldUnregister?on(a,Me,[]):[])),ne=(Me,Je,Xe={})=>{const Ve=on(n,Me);let ot=Je;if(Ve){const mt=Ve._f;mt&&(!mt.disabled&&Lo(o,Me,YDe(Je,mt)),ot=ire(mt.ref)&&Xu(Je)?"":Je,WDe(mt.ref)?[...mt.ref.options].forEach(ft=>ft.selected=ot.includes(ft.value)):mt.refs?kP(mt.ref)?mt.refs.forEach(ft=>{(!ft.defaultChecked||!ft.disabled)&&(Array.isArray(ot)?ft.checked=!!ot.find(ct=>ct===ft.value):ft.checked=ot===ft.value||!!ot)}):mt.refs.forEach(ft=>ft.checked=ft.value===ot):Lye(mt.ref)?mt.ref.value="":(mt.ref.value=ot,mt.ref.type||v.state.next({name:Me,values:ud(o)})))}(Xe.shouldDirty||Xe.shouldTouch)&&O(Me,ot,Xe.shouldTouch,Xe.shouldDirty,!0),Xe.shouldValidate&&xe(Me)},fe=(Me,Je,Xe)=>{for(const Ve in Je){if(!Je.hasOwnProperty(Ve))return;const ot=Je[Ve],mt=Me+"."+Ve,ft=on(n,mt);(i.array.has(Me)||Rc(ot)||ft&&!ft._f)&&!mj(ot)?fe(mt,ot,Xe):ne(mt,ot,Xe)}},oe=(Me,Je,Xe={})=>{const Ve=on(n,Me),ot=i.array.has(Me),mt=ud(Je);Lo(o,Me,mt),ot?(v.array.next({name:Me,values:ud(o)}),(g.isDirty||g.dirtyFields||y.isDirty||y.dirtyFields)&&Xe.shouldDirty&&v.state.next({name:Me,dirtyFields:bT(a,o),isDirty:se(Me,mt)})):Ve&&!Ve._f&&!Xu(mt)?fe(Me,mt,Xe):ne(Me,mt,Xe),qNe(Me,i)&&v.state.next({...s,name:Me}),v.state.next({name:l.mount?Me:void 0,values:ud(o)})},de=async Me=>{l.mount=!0;const Je=Me.target;let Xe=Je.name,Ve=!0;const ot=on(n,Xe),mt=Mt=>{Ve=Number.isNaN(Mt)||mj(Mt)&&isNaN(Mt.getTime())||sy(Mt,on(o,Xe,Mt))},ft=$Ne(r.mode),ct=$Ne(r.reValidateMode);if(ot){let Mt,Ot;const rr=Je.type?BNe(ot._f):$De(Me),Ir=Me.type===are.BLUR||Me.type===are.FOCUS_OUT,cr=!qpt(ot._f)&&!r.resolver&&!on(s.errors,Xe)&&!ot._f.deps||Wpt(Ir,on(s.touchedFields,Xe),s.isSubmitted,ct,ft),Mr=qNe(Xe,i,Ir);Lo(o,Xe,rr),Ir?(ot._f.onBlur&&ot._f.onBlur(Me),d&&d(0)):ot._f.onChange&&ot._f.onChange(Me);const As=O(Xe,rr,Ir),At=!Ch(As)||Mr;if(!Ir&&v.state.next({name:Xe,type:Me.type,values:ud(o)}),cr)return(g.isValid||y.isValid)&&(r.mode==="onBlur"?Ir&&j():Ir||j()),At&&v.state.next({name:Xe,...Mr?{}:As});if(!Ir&&Mr&&v.state.next({...s}),r.resolver){const{errors:Rt}=await $([Xe]);if(mt(rr),Ve){const Cr=VNe(s.errors,n,Xe),fs=VNe(Rt,n,Cr.name||Xe);Mt=fs.error,Xe=fs.name,Ot=Ch(Rt)}}else S([Xe],!0),Mt=(await WNe(ot,i.disabled,o,b,r.shouldUseNativeValidation))[Xe],S([Xe]),mt(rr),Ve&&(Mt?Ot=!1:(g.isValid||y.isValid)&&(Ot=await W(n,!0)));Ve&&(ot._f.deps&&xe(ot._f.deps),B(Xe,Ot,Mt,As))}},ue=(Me,Je)=>{if(on(s.errors,Je)&&Me.focus)return Me.focus(),1},xe=async(Me,Je={})=>{let Xe,Ve;const ot=JA(Me);if(r.resolver){const mt=await H(jc(Me)?Me:ot);Xe=Ch(mt),Ve=Me?!ot.some(ft=>on(mt,ft)):Xe}else Me?(Ve=(await Promise.all(ot.map(async mt=>{const ft=on(n,mt);return await W(ft&&ft._f?{[mt]:ft}:ft)}))).every(Boolean),!(!Ve&&!s.isValid)&&j()):Ve=Xe=await W(n);return v.state.next({...!Fg(Me)||(g.isValid||y.isValid)&&Xe!==s.isValid?{}:{name:Me},...r.resolver||!Me?{isValid:Xe}:{},errors:s.errors}),Je.shouldFocus&&!Ve&&eE(n,ue,Me?ot:i.mount),Ve},Te=Me=>{const Je={...l.mount?o:a};return jc(Me)?Je:Fg(Me)?on(Je,Me):Me.map(Xe=>on(Je,Xe))},be=(Me,Je)=>({invalid:!!on((Je||s).errors,Me),isDirty:!!on((Je||s).dirtyFields,Me),error:on((Je||s).errors,Me),isValidating:!!on(s.validatingFields,Me),isTouched:!!on((Je||s).touchedFields,Me)}),we=Me=>{Me&&JA(Me).forEach(Je=>Wc(s.errors,Je)),v.state.next({errors:Me?s.errors:{}})},ve=(Me,Je,Xe)=>{const Ve=(on(n,Me,{_f:{}})._f||{}).ref,ot=on(s.errors,Me)||{},{ref:mt,message:ft,type:ct,...Mt}=ot;Lo(s.errors,Me,{...Mt,...Je,ref:Ve}),v.state.next({name:Me,errors:s.errors,isValid:!1}),Xe&&Xe.shouldFocus&&Ve&&Ve.focus&&Ve.focus()},tt=(Me,Je)=>Sf(Me)?v.state.subscribe({next:Xe=>"values"in Xe&&Me(ae(void 0,Je),Xe)}):ae(Me,Je,!0),Ae=Me=>v.state.subscribe({next:Je=>{Hpt(Me.name,Je.name,Me.exact)&&Vpt(Je,Me.formState||g,rt,Me.reRenderRoot)&&Me.callback({values:{...o},...s,...Je,defaultValues:a})}}).unsubscribe,Le=Me=>(l.mount=!0,y={...y,...Me.formState},Ae({...Me,formState:y})),Ue=(Me,Je={})=>{for(const Xe of Me?JA(Me):i.mount)i.mount.delete(Xe),i.array.delete(Xe),Je.keepValue||(Wc(n,Xe),Wc(o,Xe)),!Je.keepError&&Wc(s.errors,Xe),!Je.keepDirty&&Wc(s.dirtyFields,Xe),!Je.keepTouched&&Wc(s.touchedFields,Xe),!Je.keepIsValidating&&Wc(s.validatingFields,Xe),!r.shouldUnregister&&!Je.keepDefaultValue&&Wc(a,Xe);v.state.next({values:ud(o)}),v.state.next({...s,...Je.keepDirty?{isDirty:se()}:{}}),!Je.keepIsValid&&j()},Ye=({disabled:Me,name:Je})=>{(cm(Me)&&l.mount||Me||i.disabled.has(Je))&&(Me?i.disabled.add(Je):i.disabled.delete(Je))},Ie=(Me,Je={})=>{let Xe=on(n,Me);const Ve=cm(Je.disabled)||cm(r.disabled);return Lo(n,Me,{...Xe||{},_f:{...Xe&&Xe._f?Xe._f:{ref:{name:Me}},name:Me,mount:!0,...Je}}),i.mount.add(Me),Xe?Ye({disabled:cm(Je.disabled)?Je.disabled:r.disabled,name:Me}):F(Me,!0,Je.value),{...Ve?{disabled:Je.disabled||r.disabled}:{},...r.progressive?{required:!!Je.required,min:wT(Je.min),max:wT(Je.max),minLength:wT(Je.minLength),maxLength:wT(Je.maxLength),pattern:wT(Je.pattern)}:{},name:Me,onChange:de,onBlur:de,ref:ot=>{if(ot){Ie(Me,Je),Xe=on(n,Me);const mt=jc(ot.value)&&ot.querySelectorAll&&ot.querySelectorAll("input,select,textarea")[0]||ot,ft=Fpt(mt),ct=Xe._f.refs||[];if(ft?ct.find(Mt=>Mt===mt):mt===Xe._f.ref)return;Lo(n,Me,{_f:{...Xe._f,...ft?{refs:[...ct.filter(Qce),mt,...Array.isArray(on(a,Me))?[{}]:[]],ref:{type:mt.type,name:Me}}:{ref:mt}}}),F(Me,!1,void 0,mt)}else Xe=on(n,Me,{}),Xe._f&&(Xe._f.mount=!1),(r.shouldUnregister||Je.shouldUnregister)&&!(UDe(i.array,Me)&&l.action)&&i.unMount.add(Me)}}},et=()=>r.shouldFocusError&&eE(n,ue,i.mount),It=Me=>{cm(Me)&&(v.state.next({disabled:Me}),eE(n,(Je,Xe)=>{const Ve=on(n,Xe);Ve&&(Je.disabled=Ve._f.disabled||Me,Array.isArray(Ve._f.refs)&&Ve._f.refs.forEach(ot=>{ot.disabled=Ve._f.disabled||Me}))},0,!1))},Pe=(Me,Je)=>async Xe=>{let Ve;Xe&&(Xe.preventDefault&&Xe.preventDefault(),Xe.persist&&Xe.persist());let ot=ud(o);if(v.state.next({isSubmitting:!0}),r.resolver){const{errors:mt,values:ft}=await $();s.errors=mt,ot=ud(ft)}else await W(n);if(i.disabled.size)for(const mt of i.disabled)Wc(ot,mt);if(Wc(s.errors,"root"),Ch(s.errors)){v.state.next({errors:{}});try{await Me(ot,Xe)}catch(mt){Ve=mt}}else Je&&await Je({...s.errors},Xe),et(),setTimeout(et);if(v.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ch(s.errors)&&!Ve,submitCount:s.submitCount+1,errors:s.errors}),Ve)throw Ve},at=(Me,Je={})=>{on(n,Me)&&(jc(Je.defaultValue)?oe(Me,ud(on(a,Me))):(oe(Me,Je.defaultValue),Lo(a,Me,ud(Je.defaultValue))),Je.keepTouched||Wc(s.touchedFields,Me),Je.keepDirty||(Wc(s.dirtyFields,Me),s.isDirty=Je.defaultValue?se(Me,ud(on(a,Me))):se()),Je.keepError||(Wc(s.errors,Me),g.isValid&&j()),v.state.next({...s}))},ce=(Me,Je={})=>{const Xe=Me?ud(Me):a,Ve=ud(Xe),ot=Ch(Me),mt=ot?a:Ve;if(Je.keepDefaultValues||(a=Xe),!Je.keepValues){if(Je.keepDirtyValues){const ft=new Set([...i.mount,...Object.keys(bT(a,o))]);for(const ct of Array.from(ft))on(s.dirtyFields,ct)?Lo(mt,ct,on(o,ct)):oe(ct,on(mt,ct))}else{if(Tye&&jc(Me))for(const ft of i.mount){const ct=on(n,ft);if(ct&&ct._f){const Mt=Array.isArray(ct._f.refs)?ct._f.refs[0]:ct._f.ref;if(ire(Mt)){const Ot=Mt.closest("form");if(Ot){Ot.reset();break}}}}if(Je.keepFieldsRef)for(const ft of i.mount)oe(ft,on(mt,ft));else n={}}o=r.shouldUnregister?Je.keepDefaultValues?ud(a):{}:ud(mt),v.array.next({values:{...mt}}),v.state.next({values:{...mt}})}i={mount:Je.keepDirtyValues?i.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!g.isValid||!!Je.keepIsValid||!!Je.keepDirtyValues,l.watch=!!r.shouldUnregister,v.state.next({submitCount:Je.keepSubmitCount?s.submitCount:0,isDirty:ot?!1:Je.keepDirty?s.isDirty:!!(Je.keepDefaultValues&&!sy(Me,a)),isSubmitted:Je.keepIsSubmitted?s.isSubmitted:!1,dirtyFields:ot?{}:Je.keepDirtyValues?Je.keepDefaultValues&&o?bT(a,o):s.dirtyFields:Je.keepDefaultValues&&Me?bT(a,Me):Je.keepDirty?s.dirtyFields:{},touchedFields:Je.keepTouched?s.touchedFields:{},errors:Je.keepErrors?s.errors:{},isSubmitSuccessful:Je.keepIsSubmitSuccessful?s.isSubmitSuccessful:!1,isSubmitting:!1})},$e=(Me,Je)=>ce(Sf(Me)?Me(o):Me,Je),Ge=(Me,Je={})=>{const Xe=on(n,Me),Ve=Xe&&Xe._f;if(Ve){const ot=Ve.refs?Ve.refs[0]:Ve.ref;ot.focus&&(ot.focus(),Je.shouldSelect&&Sf(ot.select)&&ot.select())}},rt=Me=>{s={...s,...Me}},it={control:{register:Ie,unregister:Ue,getFieldState:be,handleSubmit:Pe,setError:ve,_subscribe:Ae,_runSchema:$,_focusError:et,_getWatch:ae,_getDirty:se,_setValid:j,_setFieldArray:A,_setDisabledField:Ye,_setErrors:I,_getFieldArray:le,_reset:ce,_resetDefaultValues:()=>Sf(r.defaultValues)&&r.defaultValues().then(Me=>{$e(Me,r.resetOptions),v.state.next({isLoading:!1})}),_removeUnmounted:X,_disableForm:It,_subjects:v,_proxyFormState:g,get _fields(){return n},get _formValues(){return o},get _state(){return l},set _state(Me){l=Me},get _defaultValues(){return a},get _names(){return i},set _names(Me){i=Me},get _formState(){return s},get _options(){return r},set _options(Me){r={...r,...Me}}},subscribe:Le,trigger:xe,register:Ie,handleSubmit:Pe,watch:tt,setValue:oe,getValues:Te,reset:$e,resetField:at,clearErrors:we,unregister:Ue,setError:ve,setFocus:Ge,getFieldState:be};return{...it,formControl:it}}function lae(t={}){const r=lt.useRef(void 0),s=lt.useRef(void 0),[n,a]=lt.useState({isDirty:!1,isValidating:!1,isLoading:Sf(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:Sf(t.defaultValues)?void 0:t.defaultValues});if(!r.current)if(t.formControl)r.current={...t.formControl,formState:n},t.defaultValues&&!Sf(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:l,...i}=Ypt(t);r.current={...i,formState:n}}const o=r.current.control;return o._options=t,Pye(()=>{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(t.disabled),[o,t.disabled]),lt.useEffect(()=>{t.mode&&(o._options.mode=t.mode),t.reValidateMode&&(o._options.reValidateMode=t.reValidateMode)},[o,t.mode,t.reValidateMode]),lt.useEffect(()=>{t.errors&&(o._setErrors(t.errors),o._focusError())},[o,t.errors]),lt.useEffect(()=>{t.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,t.shouldUnregister]),lt.useEffect(()=>{if(o._proxyFormState.isDirty){const l=o._getDirty();l!==n.isDirty&&o._subjects.state.next({isDirty:l})}},[o,n.isDirty]),lt.useEffect(()=>{t.values&&!sy(t.values,s.current)?(o._reset(t.values,{keepFieldsRef:!0,...o._options.resetOptions}),s.current=t.values,a(l=>({...l}))):o._resetDefaultValues()},[o,t.values]),lt.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),r.current.formState=qDe(n,o),r.current}const GNe=(t,r,s)=>{if(t&&"reportValidity"in t){const n=on(s,r);t.setCustomValidity(n&&n.message||""),t.reportValidity()}},QDe=(t,r)=>{for(const s in r.fields){const n=r.fields[s];n&&n.ref&&"reportValidity"in n.ref?GNe(n.ref,s,t):n.refs&&n.refs.forEach(a=>GNe(a,s,t))}},Xpt=(t,r)=>{r.shouldUseNativeValidation&&QDe(t,r);const s={};for(const n in t){const a=on(r.fields,n),o=Object.assign(t[n]||{},{ref:a&&a.ref});if(Qpt(r.names||Object.keys(t),n)){const l=Object.assign({},on(s,n));Lo(l,"root",o),Lo(s,n,l)}else Lo(s,n,o)}return s},Qpt=(t,r)=>t.some(s=>s.startsWith(r+"."));var Jpt=function(t,r){for(var s={};t.length;){var n=t[0],a=n.code,o=n.message,l=n.path.join(".");if(!s[l])if("unionErrors"in n){var i=n.unionErrors[0].errors[0];s[l]={message:i.message,type:i.code}}else s[l]={message:o,type:a};if("unionErrors"in n&&n.unionErrors.forEach(function(g){return g.errors.forEach(function(y){return t.push(y)})}),r){var d=s[l].types,m=d&&d[n.code];s[l]=HDe(l,r,s,a,m?[].concat(m,n.message):n.message)}t.shift()}return s},cae=function(t,r,s){return s===void 0&&(s={}),function(n,a,o){try{return Promise.resolve(function(l,i){try{var d=Promise.resolve(t[s.mode==="sync"?"parse":"parseAsync"](n,r)).then(function(m){return o.shouldUseNativeValidation&&QDe({},o),{errors:{},values:s.raw?n:m}})}catch(m){return i(m)}return d&&d.then?d.then(void 0,i):d}(0,function(l){if(function(i){return Array.isArray(i==null?void 0:i.errors)}(l))return{values:{},errors:Xpt(Jpt(l.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw l}))}catch(l){return Promise.reject(l)}}};const dae=Ppt,JDe=E.createContext({}),zl=({...t})=>e.jsx(JDe.Provider,{value:{name:t.name},children:e.jsx(Rpt,{...t})}),uae=()=>{const t=E.useContext(JDe),r=E.useContext(eRe),{getFieldState:s,formState:n}=oae(),a=s(t.name,n);if(!t)throw new Error("useFormField should be used within ");const{id:o}=r;return{id:o,name:t.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...a}},eRe=E.createContext({}),Cl=E.forwardRef(({className:t,...r},s)=>{const n=E.useId();return e.jsx(eRe.Provider,{value:{id:n},children:e.jsx("div",{ref:s,className:qt("space-y-2",t),...r})})});Cl.displayName="FormItem";const Ml=E.forwardRef(({className:t,...r},s)=>{const{error:n,formItemId:a}=uae();return e.jsx(Ee,{ref:s,className:qt(n&&"text-destructive",t),htmlFor:a,...r})});Ml.displayName="FormLabel";const Tl=E.forwardRef(({...t},r)=>{const{error:s,formItemId:n,formDescriptionId:a,formMessageId:o}=uae();return e.jsx(lxe,{ref:r,id:n,"aria-describedby":s?`${a} ${o}`:`${a}`,"aria-invalid":!!s,...t})});Tl.displayName="FormControl";const Zee=E.forwardRef(({className:t,...r},s)=>{const{formDescriptionId:n}=uae();return e.jsx("p",{ref:s,id:n,className:qt("text-sm text-muted-foreground",t),...r})});Zee.displayName="FormDescription";const Ju=E.forwardRef(({className:t,children:r,...s},n)=>{const{error:a,formMessageId:o}=uae(),l=a?String(a==null?void 0:a.message):r;return l?e.jsx("p",{ref:n,id:o,className:qt("text-sm font-medium text-destructive",t),...s,children:l}):null});Ju.displayName="FormMessage";const Ks=E.forwardRef(({className:t,...r},s)=>e.jsx("textarea",{className:qt("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:s,...r}));Ks.displayName="Textarea";const eft=Pv({category:fDe(["general","technology","crm","marketing"]),subject:Do().min(5,"Subject must be at least 5 characters").max(200),description:Do().min(20,"Please provide more details (at least 20 characters)").max(2e3)}),tft={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function Pme({trigger:t}){const[r,s]=E.useState(!1),[n,a]=E.useState(!1),{user:o}=Gr(),l=lae({resolver:cae(eft),defaultValues:{category:"general",subject:"",description:""}}),i=async d=>{if(!o){Se.error("You must be logged in to submit a ticket");return}a(!0);try{const{error:m}=await Z.from("support_tickets").insert({user_id:o.id,category:d.category,subject:d.subject,description:d.description});if(m)throw m;try{await Z.functions.invoke("support-ticket-notify",{body:{category:tft[d.category],subject:d.subject}})}catch(g){console.log("Notification send attempted:",g)}Se.success("Support ticket submitted successfully!"),l.reset(),s(!1)}catch(m){console.error("Error submitting ticket:",m),Se.error("Failed to submit ticket. Please try again.")}finally{a(!1)}};return e.jsxs(Dr,{open:r,onOpenChange:s,children:[e.jsx(xo,{asChild:!0,children:t||e.jsxs(Q,{variant:"ghost",size:"icon",className:"relative",children:[e.jsx(NA,{className:"h-5 w-5"}),e.jsx("span",{className:"sr-only",children:"Support"})]})}),e.jsxs(Lr,{className:"sm:max-w-[500px]",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Need Help?"}),e.jsx(Gs,{children:"Submit a support ticket and we'll get back to you as soon as possible."})]}),e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-lg mb-4",children:[e.jsx(wi,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["You can also text us at: ",e.jsx("span",{className:"font-medium text-foreground",children:"1-866-527-8668"})]})]}),e.jsx(dae,{...l,children:e.jsxs("form",{onSubmit:l.handleSubmit(i),className:"space-y-4",children:[e.jsx(zl,{control:l.control,name:"category",render:({field:d})=>e.jsxs(Cl,{children:[e.jsx(Ml,{children:"Category"}),e.jsxs(ds,{onValueChange:d.onChange,defaultValue:d.value,children:[e.jsx(Tl,{children:e.jsx(ls,{children:e.jsx(us,{placeholder:"Select a category"})})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"general",children:"General Support"}),e.jsx(Ut,{value:"technology",children:"Technology Support"}),e.jsx(Ut,{value:"crm",children:"CRM Support"}),e.jsx(Ut,{value:"marketing",children:"Marketing Support"})]})]}),e.jsx(Ju,{})]})}),e.jsx(zl,{control:l.control,name:"subject",render:({field:d})=>e.jsxs(Cl,{children:[e.jsx(Ml,{children:"Subject"}),e.jsx(Tl,{children:e.jsx(Qe,{placeholder:"Brief description of your issue",...d})}),e.jsx(Ju,{})]})}),e.jsx(zl,{control:l.control,name:"description",render:({field:d})=>e.jsxs(Cl,{children:[e.jsx(Ml,{children:"Description"}),e.jsx(Tl,{children:e.jsx(Ks,{placeholder:"Please describe your issue in detail...",className:"min-h-[120px]",...d})}),e.jsx(Ju,{})]})}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(Q,{type:"submit",disabled:n,children:n?"Submitting...":"Submit Ticket"})]})]})})]})]})}const rft=()=>{const{user:t}=Gr(),r=Ws(),[s,n]=E.useState([]),[a,o]=E.useState(0),[l,i]=E.useState(!1),[d,m]=E.useState(null);E.useEffect(()=>{if(!t)return;const N=`notification_last_read_${t.id}`;let j=d;if(!j){const M=localStorage.getItem(N);M&&(j=M,m(M))}(async()=>{const{data:M,error:I}=await Z.from("push_notifications").select("*").order("created_at",{ascending:!1}).limit(20);if(!I&&M){n(M);const F=j?new Date(j):null,O=M.filter(B=>F?new Date(B.created_at)>F:!0);o(O.length)}})();const A=Z.channel("push-notifications").on("postgres_changes",{event:"INSERT",schema:"public",table:"push_notifications"},M=>{const I=M.new;n(O=>[I,...O].slice(0,20));const F=j?new Date(j):null;(!F||new Date(I.created_at)>F)&&o(O=>O+1),Notification.permission==="granted"&&new Notification(I.title,{body:I.body,icon:"/favicon.ico"})}).subscribe();return()=>{Z.removeChannel(A)}},[t,d]);const g=N=>{const j=N.toLowerCase();return j.includes("community")||j.includes("post")?$o:j.includes("academy")||j.includes("video")?ya:j.includes("template")?ed:j.includes("event")?Mn:j.includes("newsletter")?_y:j.includes("brokerage")?wu:j.includes("swag")||j.includes("social")?uo:j.includes("toolbox")||j.includes("tool")?wy:j.includes("brief")?An:$o},y=N=>{i(!1),N.url&&N.url!=="/"&&r(N.url)},v=()=>{if(!t)return;const N=new Date().toISOString(),j=`notification_last_read_${t.id}`;localStorage.setItem(j,N),m(N),o(0)},b=N=>{i(N),N&&a>0&&v()};return e.jsxs(mh,{open:l,onOpenChange:b,children:[e.jsx(ph,{asChild:!0,children:e.jsxs(Q,{variant:"ghost",size:"icon",className:"relative",children:[e.jsx(Df,{className:"h-5 w-5"}),a>0&&e.jsx(bt,{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})]})}),e.jsxs(Au,{align:"end",className:"w-80",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b",children:[e.jsx("span",{className:"font-semibold",children:"Notifications"}),s.length>0&&e.jsx(Q,{variant:"ghost",size:"sm",className:"text-xs h-6",onClick:v,children:"Mark all read"})]}),e.jsx(Eo,{className:"h-[300px]",children:s.length===0?e.jsx("div",{className:"p-4 text-center text-muted-foreground text-sm",children:"No notifications yet"}):s.map(N=>{const j=g(N.title);return e.jsxs(Ba,{className:"group flex items-start gap-3 p-3 cursor-pointer data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",onClick:()=>y(N),children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx(j,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[e.jsx("span",{className:"font-medium text-sm",children:N.title}),e.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2 group-data-[highlighted]:text-accent-foreground/80",children:N.body}),e.jsx("span",{className:"text-xs text-muted-foreground group-data-[highlighted]:text-accent-foreground/80",children:Su(new Date(N.created_at),{addSuffix:!0})})]})]},N.id)})})]})]})};var KNe=1,sft=.9,nft=.8,aft=.17,Jce=.1,ede=.999,ift=.9999,oft=.99,lft=/[\\\/_+.#"@\[\(\{&]/,cft=/[\\\/_+.#"@\[\(\{&]/g,dft=/[\s-]/,tRe=/[\s-]/g;function Lme(t,r,s,n,a,o,l){if(o===r.length)return a===t.length?KNe:oft;var i=`${a},${o}`;if(l[i]!==void 0)return l[i];for(var d=n.charAt(o),m=s.indexOf(d,a),g=0,y,v,b,N;m>=0;)y=Lme(t,r,s,n,m+1,o+1,l),y>g&&(m===a?y*=KNe:lft.test(t.charAt(m-1))?(y*=nft,b=t.slice(a,m-1).match(cft),b&&a>0&&(y*=Math.pow(ede,b.length))):dft.test(t.charAt(m-1))?(y*=sft,N=t.slice(a,m-1).match(tRe),N&&a>0&&(y*=Math.pow(ede,N.length))):(y*=aft,a>0&&(y*=Math.pow(ede,m-a))),t.charAt(m)!==r.charAt(o)&&(y*=ift)),(yy&&(y=v*Jce)),y>g&&(g=y),m=s.indexOf(d,m+1);return l[i]=g,g}function ZNe(t){return t.toLowerCase().replace(tRe," ")}function uft(t,r,s){return t=s&&s.length>0?`${t+" "+s.join(" ")}`:t,Lme(t,r,ZNe(t),ZNe(r),0,0,{})}var jT='[cmdk-group=""]',tde='[cmdk-group-items=""]',hft='[cmdk-group-heading=""]',rRe='[cmdk-item=""]',YNe=`${rRe}:not([aria-disabled="true"])`,Ome="cmdk-item-select",eS="data-value",mft=(t,r,s)=>uft(t,r,s),sRe=E.createContext(void 0),NP=()=>E.useContext(sRe),nRe=E.createContext(void 0),Dye=()=>E.useContext(nRe),aRe=E.createContext(void 0),iRe=E.forwardRef((t,r)=>{let s=tS(()=>{var we,ve;return{search:"",value:(ve=(we=t.value)!=null?we:t.defaultValue)!=null?ve:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=tS(()=>new Set),a=tS(()=>new Map),o=tS(()=>new Map),l=tS(()=>new Set),i=oRe(t),{label:d,children:m,value:g,onValueChange:y,filter:v,shouldFilter:b,loop:N,disablePointerSelection:j=!1,vimBindings:S=!0,...A}=t,M=bd(),I=bd(),F=bd(),O=E.useRef(null),B=kft();jk(()=>{if(g!==void 0){let we=g.trim();s.current.value=we,$.emit()}},[g]),jk(()=>{B(6,le)},[]);let $=E.useMemo(()=>({subscribe:we=>(l.current.add(we),()=>l.current.delete(we)),snapshot:()=>s.current,setState:(we,ve,tt)=>{var Ae,Le,Ue,Ye;if(!Object.is(s.current[we],ve)){if(s.current[we]=ve,we==="search")ae(),X(),B(1,se);else if(we==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Ie=document.getElementById(F);Ie?Ie.focus():(Ae=document.getElementById(M))==null||Ae.focus()}if(B(7,()=>{var Ie;s.current.selectedItemId=(Ie=ne())==null?void 0:Ie.id,$.emit()}),tt||B(5,le),((Le=i.current)==null?void 0:Le.value)!==void 0){let Ie=ve??"";(Ye=(Ue=i.current).onValueChange)==null||Ye.call(Ue,Ie);return}}$.emit()}},emit:()=>{l.current.forEach(we=>we())}}),[]),H=E.useMemo(()=>({value:(we,ve,tt)=>{var Ae;ve!==((Ae=o.current.get(we))==null?void 0:Ae.value)&&(o.current.set(we,{value:ve,keywords:tt}),s.current.filtered.items.set(we,W(ve,tt)),B(2,()=>{X(),$.emit()}))},item:(we,ve)=>(n.current.add(we),ve&&(a.current.has(ve)?a.current.get(ve).add(we):a.current.set(ve,new Set([we]))),B(3,()=>{ae(),X(),s.current.value||se(),$.emit()}),()=>{o.current.delete(we),n.current.delete(we),s.current.filtered.items.delete(we);let tt=ne();B(4,()=>{ae(),(tt==null?void 0:tt.getAttribute("id"))===we&&se(),$.emit()})}),group:we=>(a.current.has(we)||a.current.set(we,new Set),()=>{o.current.delete(we),a.current.delete(we)}),filter:()=>i.current.shouldFilter,label:d||t["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:M,inputId:F,labelId:I,listInnerRef:O}),[]);function W(we,ve){var tt,Ae;let Le=(Ae=(tt=i.current)==null?void 0:tt.filter)!=null?Ae:mft;return we?Le(we,s.current.search,ve):0}function X(){if(!s.current.search||i.current.shouldFilter===!1)return;let we=s.current.filtered.items,ve=[];s.current.filtered.groups.forEach(Ae=>{let Le=a.current.get(Ae),Ue=0;Le.forEach(Ye=>{let Ie=we.get(Ye);Ue=Math.max(Ie,Ue)}),ve.push([Ae,Ue])});let tt=O.current;fe().sort((Ae,Le)=>{var Ue,Ye;let Ie=Ae.getAttribute("id"),et=Le.getAttribute("id");return((Ue=we.get(et))!=null?Ue:0)-((Ye=we.get(Ie))!=null?Ye:0)}).forEach(Ae=>{let Le=Ae.closest(tde);Le?Le.appendChild(Ae.parentElement===Le?Ae:Ae.closest(`${tde} > *`)):tt.appendChild(Ae.parentElement===tt?Ae:Ae.closest(`${tde} > *`))}),ve.sort((Ae,Le)=>Le[1]-Ae[1]).forEach(Ae=>{var Le;let Ue=(Le=O.current)==null?void 0:Le.querySelector(`${jT}[${eS}="${encodeURIComponent(Ae[0])}"]`);Ue==null||Ue.parentElement.appendChild(Ue)})}function se(){let we=fe().find(tt=>tt.getAttribute("aria-disabled")!=="true"),ve=we==null?void 0:we.getAttribute(eS);$.setState("value",ve||void 0)}function ae(){var we,ve,tt,Ae;if(!s.current.search||i.current.shouldFilter===!1){s.current.filtered.count=n.current.size;return}s.current.filtered.groups=new Set;let Le=0;for(let Ue of n.current){let Ye=(ve=(we=o.current.get(Ue))==null?void 0:we.value)!=null?ve:"",Ie=(Ae=(tt=o.current.get(Ue))==null?void 0:tt.keywords)!=null?Ae:[],et=W(Ye,Ie);s.current.filtered.items.set(Ue,et),et>0&&Le++}for(let[Ue,Ye]of a.current)for(let Ie of Ye)if(s.current.filtered.items.get(Ie)>0){s.current.filtered.groups.add(Ue);break}s.current.filtered.count=Le}function le(){var we,ve,tt;let Ae=ne();Ae&&(((we=Ae.parentElement)==null?void 0:we.firstChild)===Ae&&((tt=(ve=Ae.closest(jT))==null?void 0:ve.querySelector(hft))==null||tt.scrollIntoView({block:"nearest"})),Ae.scrollIntoView({block:"nearest"}))}function ne(){var we;return(we=O.current)==null?void 0:we.querySelector(`${rRe}[aria-selected="true"]`)}function fe(){var we;return Array.from(((we=O.current)==null?void 0:we.querySelectorAll(YNe))||[])}function oe(we){let ve=fe()[we];ve&&$.setState("value",ve.getAttribute(eS))}function de(we){var ve;let tt=ne(),Ae=fe(),Le=Ae.findIndex(Ye=>Ye===tt),Ue=Ae[Le+we];(ve=i.current)!=null&&ve.loop&&(Ue=Le+we<0?Ae[Ae.length-1]:Le+we===Ae.length?Ae[0]:Ae[Le+we]),Ue&&$.setState("value",Ue.getAttribute(eS))}function ue(we){let ve=ne(),tt=ve==null?void 0:ve.closest(jT),Ae;for(;tt&&!Ae;)tt=we>0?wft(tt,jT):jft(tt,jT),Ae=tt==null?void 0:tt.querySelector(YNe);Ae?$.setState("value",Ae.getAttribute(eS)):de(we)}let xe=()=>oe(fe().length-1),Te=we=>{we.preventDefault(),we.metaKey?xe():we.altKey?ue(1):de(1)},be=we=>{we.preventDefault(),we.metaKey?oe(0):we.altKey?ue(-1):de(-1)};return E.createElement(qs.div,{ref:r,tabIndex:-1,...A,"cmdk-root":"",onKeyDown:we=>{var ve;(ve=A.onKeyDown)==null||ve.call(A,we);let tt=we.nativeEvent.isComposing||we.keyCode===229;if(!(we.defaultPrevented||tt))switch(we.key){case"n":case"j":{S&&we.ctrlKey&&Te(we);break}case"ArrowDown":{Te(we);break}case"p":case"k":{S&&we.ctrlKey&&be(we);break}case"ArrowUp":{be(we);break}case"Home":{we.preventDefault(),oe(0);break}case"End":{we.preventDefault(),xe();break}case"Enter":{we.preventDefault();let Ae=ne();if(Ae){let Le=new Event(Ome);Ae.dispatchEvent(Le)}}}}},E.createElement("label",{"cmdk-label":"",htmlFor:H.inputId,id:H.labelId,style:Sft},d),hae(t,we=>E.createElement(nRe.Provider,{value:$},E.createElement(sRe.Provider,{value:H},we))))}),pft=E.forwardRef((t,r)=>{var s,n;let a=bd(),o=E.useRef(null),l=E.useContext(aRe),i=NP(),d=oRe(t),m=(n=(s=d.current)==null?void 0:s.forceMount)!=null?n:l==null?void 0:l.forceMount;jk(()=>{if(!m)return i.item(a,l==null?void 0:l.id)},[m]);let g=lRe(a,o,[t.value,t.children,o],t.keywords),y=Dye(),v=bv(B=>B.value&&B.value===g.current),b=bv(B=>m||i.filter()===!1?!0:B.search?B.filtered.items.get(a)>0:!0);E.useEffect(()=>{let B=o.current;if(!(!B||t.disabled))return B.addEventListener(Ome,N),()=>B.removeEventListener(Ome,N)},[b,t.onSelect,t.disabled]);function N(){var B,$;j(),($=(B=d.current).onSelect)==null||$.call(B,g.current)}function j(){y.setState("value",g.current,!0)}if(!b)return null;let{disabled:S,value:A,onSelect:M,forceMount:I,keywords:F,...O}=t;return E.createElement(qs.div,{ref:Iy(o,r),...O,id:a,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!v,"data-disabled":!!S,"data-selected":!!v,onPointerMove:S||i.getDisablePointerSelection()?void 0:j,onClick:S?void 0:N},t.children)}),fft=E.forwardRef((t,r)=>{let{heading:s,children:n,forceMount:a,...o}=t,l=bd(),i=E.useRef(null),d=E.useRef(null),m=bd(),g=NP(),y=bv(b=>a||g.filter()===!1?!0:b.search?b.filtered.groups.has(l):!0);jk(()=>g.group(l),[]),lRe(l,i,[t.value,t.heading,d]);let v=E.useMemo(()=>({id:l,forceMount:a}),[a]);return E.createElement(qs.div,{ref:Iy(i,r),...o,"cmdk-group":"",role:"presentation",hidden:y?void 0:!0},s&&E.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:m},s),hae(t,b=>E.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":s?m:void 0},E.createElement(aRe.Provider,{value:v},b))))}),gft=E.forwardRef((t,r)=>{let{alwaysRender:s,...n}=t,a=E.useRef(null),o=bv(l=>!l.search);return!s&&!o?null:E.createElement(qs.div,{ref:Iy(a,r),...n,"cmdk-separator":"",role:"separator"})}),xft=E.forwardRef((t,r)=>{let{onValueChange:s,...n}=t,a=t.value!=null,o=Dye(),l=bv(m=>m.search),i=bv(m=>m.selectedItemId),d=NP();return E.useEffect(()=>{t.value!=null&&o.setState("search",t.value)},[t.value]),E.createElement(qs.input,{ref:r,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":i,id:d.inputId,type:"text",value:a?t.value:l,onChange:m=>{a||o.setState("search",m.target.value),s==null||s(m.target.value)}})}),yft=E.forwardRef((t,r)=>{let{children:s,label:n="Suggestions",...a}=t,o=E.useRef(null),l=E.useRef(null),i=bv(m=>m.selectedItemId),d=NP();return E.useEffect(()=>{if(l.current&&o.current){let m=l.current,g=o.current,y,v=new ResizeObserver(()=>{y=requestAnimationFrame(()=>{let b=m.offsetHeight;g.style.setProperty("--cmdk-list-height",b.toFixed(1)+"px")})});return v.observe(m),()=>{cancelAnimationFrame(y),v.unobserve(m)}}},[]),E.createElement(qs.div,{ref:Iy(o,r),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":n,id:d.listId},hae(t,m=>E.createElement("div",{ref:Iy(l,d.listInnerRef),"cmdk-list-sizer":""},m)))}),vft=E.forwardRef((t,r)=>{let{open:s,onOpenChange:n,overlayClassName:a,contentClassName:o,container:l,...i}=t;return E.createElement($ne,{open:s,onOpenChange:n},E.createElement(Une,{container:l},E.createElement(U3,{"cmdk-overlay":"",className:a}),E.createElement(q3,{"aria-label":t.label,"cmdk-dialog":"",className:o},E.createElement(iRe,{ref:r,...i}))))}),_ft=E.forwardRef((t,r)=>bv(s=>s.filtered.count===0)?E.createElement(qs.div,{ref:r,...t,"cmdk-empty":"",role:"presentation"}):null),bft=E.forwardRef((t,r)=>{let{progress:s,children:n,label:a="Loading...",...o}=t;return E.createElement(qs.div,{ref:r,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":s,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},hae(t,l=>E.createElement("div",{"aria-hidden":!0},l)))}),Vh=Object.assign(iRe,{List:yft,Item:pft,Input:xft,Group:fft,Separator:gft,Dialog:vft,Empty:_ft,Loading:bft});function wft(t,r){let s=t.nextElementSibling;for(;s;){if(s.matches(r))return s;s=s.nextElementSibling}}function jft(t,r){let s=t.previousElementSibling;for(;s;){if(s.matches(r))return s;s=s.previousElementSibling}}function oRe(t){let r=E.useRef(t);return jk(()=>{r.current=t}),r}var jk=typeof window>"u"?E.useEffect:E.useLayoutEffect;function tS(t){let r=E.useRef();return r.current===void 0&&(r.current=t()),r}function bv(t){let r=Dye(),s=()=>t(r.snapshot());return E.useSyncExternalStore(r.subscribe,s,s)}function lRe(t,r,s,n=[]){let a=E.useRef(),o=NP();return jk(()=>{var l;let i=(()=>{var m;for(let g of s){if(typeof g=="string")return g.trim();if(typeof g=="object"&&"current"in g)return g.current?(m=g.current.textContent)==null?void 0:m.trim():a.current}})(),d=n.map(m=>m.trim());o.value(t,i,d),(l=r.current)==null||l.setAttribute(eS,i),a.current=i}),a}var kft=()=>{let[t,r]=E.useState(),s=tS(()=>new Map);return jk(()=>{s.current.forEach(n=>n()),s.current=new Map},[t]),(n,a)=>{s.current.set(n,a),r({})}};function Nft(t){let r=t.type;return typeof r=="function"?r(t.props):"render"in r?r.render(t.props):t}function hae({asChild:t,children:r},s){return t&&E.isValidElement(r)?E.cloneElement(Nft(r),{ref:r.ref},s(r.props.children)):s(r)}var Sft={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Ry=E.forwardRef(({className:t,...r},s)=>e.jsx(Vh,{ref:s,className:qt("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...r}));Ry.displayName=Vh.displayName;const Cft=({children:t,...r})=>e.jsx(Dr,{...r,children:e.jsx(Lr,{className:"overflow-hidden p-0 shadow-lg",children:e.jsx(Ry,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:t})})}),Fy=E.forwardRef(({className:t,...r},s)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(Qn,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(Vh.Input,{ref:s,className:qt("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...r})]}));Fy.displayName=Vh.Input.displayName;const zy=E.forwardRef(({className:t,...r},s)=>e.jsx(Vh.List,{ref:s,className:qt("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...r}));zy.displayName=Vh.List.displayName;const By=E.forwardRef((t,r)=>e.jsx(Vh.Empty,{ref:r,className:"py-6 text-center text-sm",...t}));By.displayName=Vh.Empty.displayName;const $y=E.forwardRef(({className:t,...r},s)=>e.jsx(Vh.Group,{ref:s,className:qt("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...r}));$y.displayName=Vh.Group.displayName;const Mft=E.forwardRef(({className:t,...r},s)=>e.jsx(Vh.Separator,{ref:s,className:qt("-mx-1 h-px bg-border",t),...r}));Mft.displayName=Vh.Separator.displayName;const Uy=E.forwardRef(({className:t,...r},s)=>e.jsx(Vh.Item,{ref:s,className:qt("group relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-primary/80 data-[selected=true]:text-primary-foreground data-[disabled=true]:opacity-50",t),...r}));Uy.displayName=Vh.Item.displayName;const Tft={event:{label:"Events",icon:Ff,color:"bg-blue-500/10 text-blue-600"},template:{label:"Templates",icon:ed,color:"bg-purple-500/10 text-purple-600"},academy:{label:"Academy",icon:Y1,color:"bg-amber-500/10 text-amber-600"},toolbox:{label:"Toolbox",icon:wy,color:"bg-green-500/10 text-green-600"},"social-swag":{label:"Social Swag",icon:An,color:"bg-fuchsia-500/10 text-fuchsia-600"}},XNe=()=>{const[t,r]=E.useState(!1),[s,n]=E.useState(""),[a,o]=E.useState([]),[l,i]=E.useState(!1),d=Ws();E.useEffect(()=>{const v=b=>{b.key==="k"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),r(N=>!N))};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[]);const m=E.useCallback(async v=>{if(!v.trim()){o([]);return}i(!0);const b=`%${v}%`;try{const[N,j,S,A,M]=await Promise.all([Z.from("events").select("id, title, description, event_date").eq("is_published",!0).or(`title.ilike.${b},description.ilike.${b}`).limit(5),Z.from("canva_templates").select("id, name, description, publish_date").or(`name.ilike.${b},description.ilike.${b}`).limit(5),Z.from("academy_videos").select("id, title, description, publish_date").eq("is_published",!0).or(`title.ilike.${b},description.ilike.${b}`).limit(5),Z.from("resource_kits").select("id, name, description, publish_date").eq("is_published",!0).or(`name.ilike.${b},description.ilike.${b}`).limit(5),Z.from("social_swag").select("id, title, description, publish_date").eq("is_published",!0).or(`title.ilike.${b},description.ilike.${b}`).limit(5)]),I=[];N.data&&N.data.forEach(F=>{I.push({id:F.id,title:F.title,description:F.description,type:"event",date:F.event_date,path:`/event/${F.id}`})}),j.data&&j.data.forEach(F=>{I.push({id:F.id,title:F.name,description:F.description,type:"template",date:F.publish_date,path:`/templates/${F.id}`})}),S.data&&S.data.forEach(F=>{I.push({id:F.id,title:F.title,description:F.description,type:"academy",date:F.publish_date,path:`/academy/${F.id}`})}),A.data&&A.data.forEach(F=>{I.push({id:F.id,title:F.name,description:F.description,type:"toolbox",date:F.publish_date,path:`/toolbox/${F.id}`})}),M.data&&M.data.forEach(F=>{I.push({id:F.id,title:F.title,description:F.description,type:"social-swag",date:F.publish_date,path:`/social-swag/${F.id}`})}),o(I)}catch(N){console.error("Search error:",N)}finally{i(!1)}},[]);E.useEffect(()=>{const v=setTimeout(()=>{m(s)},300);return()=>clearTimeout(v)},[s,m]);const g=v=>{r(!1),n(""),d(v)},y=a.reduce((v,b)=>(v[b.type]||(v[b.type]=[]),v[b.type].push(b),v),{});return e.jsxs(e.Fragment,{children:[e.jsxs(Q,{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:()=>r(!0),children:[e.jsx(Qn,{className:"h-4 w-4 xl:mr-2"}),e.jsx("span",{className:"hidden xl:inline-flex text-muted-foreground text-sm",children:"Search..."}),e.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:[e.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),e.jsxs(Cft,{open:t,onOpenChange:r,children:[e.jsx(Fy,{placeholder:"Search events, templates, academy, toolbox, social swag...",value:s,onValueChange:n}),e.jsxs(zy,{children:[l&&e.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Searching..."}),!l&&s&&a.length===0&&e.jsxs(By,{children:['No results found for "',s,'"']}),!l&&!s&&e.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Start typing to search across all content..."}),Object.entries(y).map(([v,b])=>{const N=Tft[v],j=N.icon;return e.jsx($y,{heading:N.label,children:b.map(S=>e.jsxs(Uy,{value:`${S.type}-${S.id}-${S.title}`,onSelect:()=>g(S.path),className:"flex items-start gap-3 py-3 cursor-pointer",children:[e.jsx("div",{className:`p-2 rounded-md ${N.color}`,children:e.jsx(j,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium truncate",children:S.title}),S.description&&e.jsx("div",{className:"text-sm text-muted-foreground truncate group-data-[selected=true]:text-primary-foreground/80",children:S.description})]}),e.jsxs("div",{className:"flex flex-col items-end gap-1 shrink-0",children:[e.jsx(bt,{variant:"secondary",className:"text-xs",children:N.label}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Su(new Date(S.date),{addSuffix:!0})})]})]},`${S.type}-${S.id}`))},v)})]})]})]})},Aft=({expiresAt:t,className:r,showUpgradeButton:s=!0})=>{const[n,a]=E.useState(null),o=Ws();if(E.useEffect(()=>{const m=()=>{const y=new Date().getTime(),b=new Date(t).getTime()-y;if(b<=0){a({days:0,hours:0,minutes:0});return}const N=Math.floor(b/(1e3*60*60*24)),j=Math.floor(b%(1e3*60*60*24)/(1e3*60*60)),S=Math.floor(b%(1e3*60*60)/(1e3*60));a({days:N,hours:j,minutes:S})};m();const g=setInterval(m,6e4);return()=>clearInterval(g)},[t]),!n)return null;const l=n.days===0&&n.hours===0&&n.minutes===0,i=n.days<=1,d=n.days<=3&&!i;return l?e.jsxs("div",{className:qt("flex items-center justify-between gap-3 px-4 py-2 rounded-lg bg-destructive/10 border border-destructive/20",r),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Qu,{className:"h-4 w-4 text-destructive"}),e.jsx("span",{className:"text-sm font-medium text-destructive",children:"Your free trial has expired"})]}),s&&e.jsxs(Q,{size:"sm",onClick:()=>o("/subscription"),className:"bg-primary hover:bg-primary/90 text-xs h-7 px-3",children:[e.jsx(An,{className:"h-3 w-3 mr-1"}),"Upgrade Now"]})]}):e.jsxs("div",{className:qt("flex items-center justify-between gap-3 px-4 py-2 rounded-lg border transition-colors",i?"bg-destructive/10 border-destructive/20":d?"bg-amber-500/10 border-amber-500/20":"bg-primary/10 border-primary/20",r),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ea,{className:qt("h-4 w-4",i?"text-destructive":d?"text-amber-500":"text-primary")}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:qt("text-sm font-medium",i?"text-destructive":d?"text-amber-600":"text-primary"),children:"Free Trial:"}),e.jsxs("div",{className:"flex items-center gap-1",children:[n.days>0&&e.jsxs("span",{className:qt("text-sm font-bold",i?"text-destructive":d?"text-amber-600":"text-primary"),children:[n.days,"d"]}),e.jsxs("span",{className:qt("text-sm font-bold",i?"text-destructive":d?"text-amber-600":"text-primary"),children:[n.hours,"h"]}),e.jsxs("span",{className:qt("text-sm font-bold",i?"text-destructive":d?"text-amber-600":"text-primary"),children:[n.minutes,"m"]}),e.jsx("span",{className:qt("text-xs",i?"text-destructive/70":d?"text-amber-600/70":"text-primary/70"),children:"remaining"})]})]})]}),s&&e.jsxs(Q,{size:"sm",onClick:()=>o("/subscription"),variant:i?"destructive":d?"default":"outline",className:qt("text-xs h-7 px-3",d&&"bg-amber-500 hover:bg-amber-600 text-white"),children:[e.jsx(An,{className:"h-3 w-3 mr-1"}),"Upgrade"]})]})},Eft=()=>{const t=Ws();return e.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:e.jsxs(ze,{className:"w-full max-w-2xl shadow-2xl border-destructive/20 my-8",children:[e.jsxs(Wt,{className:"text-center pb-2",children:[e.jsx("div",{className:"mx-auto mb-4 h-16 w-16 rounded-full bg-destructive/10 flex items-center justify-center",children:e.jsx(Qu,{className:"h-8 w-8 text-destructive"})}),e.jsx(Zt,{className:"text-2xl",children:"Your Free Trial Has Ended"}),e.jsx(Ss,{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!"})]}),e.jsxs(qe,{className:"space-y-6",children:[e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[e.jsx(ze,{className:"border-2 border-primary/20 hover:border-primary/50 transition-colors cursor-pointer",onClick:()=>t("/subscription"),children:e.jsxs(qe,{className:"p-5 text-center",children:[e.jsx("div",{className:"mx-auto mb-3 h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(ws,{className:"h-6 w-6 text-primary"})}),e.jsx("h3",{className:"font-semibold text-lg mb-1",children:"Individual Agent"}),e.jsxs("p",{className:"text-2xl font-bold text-primary mb-2",children:["$39",e.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"/mo"})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Perfect for solo agents ready to level up"}),e.jsxs(Q,{className:"w-full",onClick:r=>{r.stopPropagation(),t("/subscription")},children:[e.jsx(An,{className:"h-4 w-4 mr-2"}),"Choose Individual"]})]})}),e.jsx(ze,{className:"border-2 border-amber-500/20 hover:border-amber-500/50 transition-colors cursor-pointer",onClick:()=>t("/subscription"),children:e.jsxs(qe,{className:"p-5 text-center",children:[e.jsx("div",{className:"mx-auto mb-3 h-12 w-12 rounded-full bg-amber-500/10 flex items-center justify-center",children:e.jsx(bi,{className:"h-6 w-6 text-amber-600"})}),e.jsx("h3",{className:"font-semibold text-lg mb-1",children:"Brokerage"}),e.jsxs("p",{className:"text-2xl font-bold text-amber-600 mb-2",children:["$299",e.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"/mo"})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"For teams and brokerages"}),e.jsxs(Q,{variant:"outline",className:"w-full border-amber-500 text-amber-600 hover:bg-amber-50",onClick:r=>{r.stopPropagation(),t("/subscription")},children:[e.jsx(bi,{className:"h-4 w-4 mr-2"}),"Choose Brokerage"]})]})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"With a full membership, you'll get:"}),e.jsxs("ul",{className:"text-sm space-y-1 text-muted-foreground grid sm:grid-cols-2 gap-x-4",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-primary",children:"✓"})," Unlimited access to all marketing templates"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-primary",children:"✓"})," Complete Academy training library"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-primary",children:"✓"})," AI-powered tools and resources"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-primary",children:"✓"})," Community forums and support"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-primary",children:"✓"})," Exclusive member events and workshops"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-primary",children:"✓"})," Deal pipeline & scorecard tracking"]})]})]}),e.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 space-y-3",children:[e.jsx("p",{className:"text-sm font-medium text-center",children:"Questions? Contact us:"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[e.jsxs("a",{href:"tel:1-866-527-8668",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[e.jsx(wi,{className:"h-4 w-4"}),e.jsx("span",{children:"1-866-527-8668"})]}),e.jsxs("a",{href:"mailto:support@relevelup.com",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[e.jsx(mn,{className:"h-4 w-4"}),e.jsx("span",{children:"support@relevelup.com"})]})]})]})]})]})})},Ift=({hasUnseenBrief:t,onClick:r,className:s})=>e.jsxs(Uf,{children:[e.jsx(qf,{asChild:!0,children:e.jsxs(Q,{variant:"ghost",size:"icon",onClick:r,className:qt("relative transition-colors",t&&"text-primary hover:text-primary",s),children:[e.jsx(Bf,{className:"h-5 w-5"}),t&&e.jsx("span",{className:"absolute top-1 right-1 h-2 w-2 rounded-full bg-primary animate-pulse"})]})}),e.jsx(wp,{children:e.jsx("p",{children:"The LevelUp Brief"})})]});var mae="Checkbox",[Pft]=fc(mae),[Lft,Rye]=Pft(mae);function Oft(t){const{__scopeCheckbox:r,checked:s,children:n,defaultChecked:a,disabled:o,form:l,name:i,onCheckedChange:d,required:m,value:g="on",internal_do_not_use_render:y}=t,[v,b]=oh({prop:s,defaultProp:a??!1,onChange:d,caller:mae}),[N,j]=E.useState(null),[S,A]=E.useState(null),M=E.useRef(!1),I=N?!!l||!!N.closest("form"):!0,F={checked:v,disabled:o,setChecked:b,control:N,setControl:j,name:i,form:l,value:g,hasConsumerStoppedPropagationRef:M,required:m,defaultChecked:iv(a)?!1:a,isFormControl:I,bubbleInput:S,setBubbleInput:A};return e.jsx(Lft,{scope:r,...F,children:Dft(y)?y(F):n})}var cRe="CheckboxTrigger",dRe=E.forwardRef(({__scopeCheckbox:t,onKeyDown:r,onClick:s,...n},a)=>{const{control:o,value:l,disabled:i,checked:d,required:m,setControl:g,setChecked:y,hasConsumerStoppedPropagationRef:v,isFormControl:b,bubbleInput:N}=Rye(cRe,t),j=ga(a,g),S=E.useRef(d);return E.useEffect(()=>{const A=o==null?void 0:o.form;if(A){const M=()=>y(S.current);return A.addEventListener("reset",M),()=>A.removeEventListener("reset",M)}},[o,y]),e.jsx(qs.button,{type:"button",role:"checkbox","aria-checked":iv(d)?"mixed":d,"aria-required":m,"data-state":fRe(d),"data-disabled":i?"":void 0,disabled:i,value:l,...n,ref:j,onKeyDown:bs(r,A=>{A.key==="Enter"&&A.preventDefault()}),onClick:bs(s,A=>{y(M=>iv(M)?!0:!M),N&&b&&(v.current=A.isPropagationStopped(),v.current||A.stopPropagation())})})});dRe.displayName=cRe;var Fye=E.forwardRef((t,r)=>{const{__scopeCheckbox:s,name:n,checked:a,defaultChecked:o,required:l,disabled:i,value:d,onCheckedChange:m,form:g,...y}=t;return e.jsx(Oft,{__scopeCheckbox:s,checked:a,defaultChecked:o,disabled:i,required:l,onCheckedChange:m,name:n,form:g,value:d,internal_do_not_use_render:({isFormControl:v})=>e.jsxs(e.Fragment,{children:[e.jsx(dRe,{...y,ref:r,__scopeCheckbox:s}),v&&e.jsx(pRe,{__scopeCheckbox:s})]})})});Fye.displayName=mae;var uRe="CheckboxIndicator",hRe=E.forwardRef((t,r)=>{const{__scopeCheckbox:s,forceMount:n,...a}=t,o=Rye(uRe,s);return e.jsx(zc,{present:n||iv(o.checked)||o.checked===!0,children:e.jsx(qs.span,{"data-state":fRe(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:r,style:{pointerEvents:"none",...t.style}})})});hRe.displayName=uRe;var mRe="CheckboxBubbleInput",pRe=E.forwardRef(({__scopeCheckbox:t,...r},s)=>{const{control:n,hasConsumerStoppedPropagationRef:a,checked:o,defaultChecked:l,required:i,disabled:d,name:m,value:g,form:y,bubbleInput:v,setBubbleInput:b}=Rye(mRe,t),N=ga(s,b),j=wP(o),S=dP(n);E.useEffect(()=>{const M=v;if(!M)return;const I=window.HTMLInputElement.prototype,O=Object.getOwnPropertyDescriptor(I,"checked").set,B=!a.current;if(j!==o&&O){const $=new Event("click",{bubbles:B});M.indeterminate=iv(o),O.call(M,iv(o)?!1:o),M.dispatchEvent($)}},[v,j,o,a]);const A=E.useRef(iv(o)?!1:o);return e.jsx(qs.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??A.current,required:i,disabled:d,name:m,value:g,form:y,...r,tabIndex:-1,ref:N,style:{...r.style,...S,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});pRe.displayName=mRe;function Dft(t){return typeof t=="function"}function iv(t){return t==="indeterminate"}function fRe(t){return iv(t)?"indeterminate":t?"checked":"unchecked"}const Yo=E.forwardRef(({className:t,...r},s)=>e.jsx(Fye,{ref:s,className:qt("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...r,children:e.jsx(hRe,{className:qt("flex items-center justify-center text-current"),children:e.jsx(li,{className:"h-4 w-4"})})}));Yo.displayName=Fye.displayName;var zye="Radio",[Rft,gRe]=fc(zye),[Fft,zft]=Rft(zye),xRe=E.forwardRef((t,r)=>{const{__scopeRadio:s,name:n,checked:a=!1,required:o,disabled:l,value:i="on",onCheck:d,form:m,...g}=t,[y,v]=E.useState(null),b=ga(r,S=>v(S)),N=E.useRef(!1),j=y?m||!!y.closest("form"):!0;return e.jsxs(Fft,{scope:s,checked:a,disabled:l,children:[e.jsx(qs.button,{type:"button",role:"radio","aria-checked":a,"data-state":bRe(a),"data-disabled":l?"":void 0,disabled:l,value:i,...g,ref:b,onClick:bs(t.onClick,S=>{a||d==null||d(),j&&(N.current=S.isPropagationStopped(),N.current||S.stopPropagation())})}),j&&e.jsx(_Re,{control:y,bubbles:!N.current,name:n,value:i,checked:a,required:o,disabled:l,form:m,style:{transform:"translateX(-100%)"}})]})});xRe.displayName=zye;var yRe="RadioIndicator",vRe=E.forwardRef((t,r)=>{const{__scopeRadio:s,forceMount:n,...a}=t,o=zft(yRe,s);return e.jsx(zc,{present:n||o.checked,children:e.jsx(qs.span,{"data-state":bRe(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:r})})});vRe.displayName=yRe;var Bft="RadioBubbleInput",_Re=E.forwardRef(({__scopeRadio:t,control:r,checked:s,bubbles:n=!0,...a},o)=>{const l=E.useRef(null),i=ga(l,o),d=wP(s),m=dP(r);return E.useEffect(()=>{const g=l.current;if(!g)return;const y=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(y,"checked").set;if(d!==s&&b){const N=new Event("click",{bubbles:n});b.call(g,s),g.dispatchEvent(N)}},[d,s,n]),e.jsx(qs.input,{type:"radio","aria-hidden":!0,defaultChecked:s,...a,tabIndex:-1,ref:i,style:{...a.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});_Re.displayName=Bft;function bRe(t){return t?"checked":"unchecked"}var $ft=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],pae="RadioGroup",[Uft]=fc(pae,[$3,gRe]),wRe=$3(),jRe=gRe(),[qft,Vft]=Uft(pae),kRe=E.forwardRef((t,r)=>{const{__scopeRadioGroup:s,name:n,defaultValue:a,value:o,required:l=!1,disabled:i=!1,orientation:d,dir:m,loop:g=!0,onValueChange:y,...v}=t,b=wRe(s),N=Bk(m),[j,S]=oh({prop:o,defaultProp:a??null,onChange:y,caller:pae});return e.jsx(qft,{scope:s,name:n,required:l,disabled:i,value:j,onValueChange:S,children:e.jsx(Wxe,{asChild:!0,...b,orientation:d,dir:N,loop:g,children:e.jsx(qs.div,{role:"radiogroup","aria-required":l,"aria-orientation":d,"data-disabled":i?"":void 0,dir:N,...v,ref:r})})})});kRe.displayName=pae;var NRe="RadioGroupItem",SRe=E.forwardRef((t,r)=>{const{__scopeRadioGroup:s,disabled:n,...a}=t,o=Vft(NRe,s),l=o.disabled||n,i=wRe(s),d=jRe(s),m=E.useRef(null),g=ga(r,m),y=o.value===a.value,v=E.useRef(!1);return E.useEffect(()=>{const b=j=>{$ft.includes(j.key)&&(v.current=!0)},N=()=>v.current=!1;return document.addEventListener("keydown",b),document.addEventListener("keyup",N),()=>{document.removeEventListener("keydown",b),document.removeEventListener("keyup",N)}},[]),e.jsx(Gxe,{asChild:!0,...i,focusable:!l,active:y,children:e.jsx(xRe,{disabled:l,required:o.required,checked:y,...d,...a,name:o.name,ref:g,onCheck:()=>o.onValueChange(a.value),onKeyDown:bs(b=>{b.key==="Enter"&&b.preventDefault()}),onFocus:bs(a.onFocus,()=>{var b;v.current&&((b=m.current)==null||b.click())})})})});SRe.displayName=NRe;var Hft="RadioGroupIndicator",CRe=E.forwardRef((t,r)=>{const{__scopeRadioGroup:s,...n}=t,a=jRe(s);return e.jsx(vRe,{...a,...n,ref:r})});CRe.displayName=Hft;var MRe=kRe,TRe=SRe,Wft=CRe;const Bye=E.forwardRef(({className:t,...r},s)=>e.jsx(MRe,{className:qt("grid gap-2",t),...r,ref:s}));Bye.displayName=MRe.displayName;const cre=E.forwardRef(({className:t,...r},s)=>e.jsx(TRe,{ref:s,className:qt("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...r,children:e.jsx(Wft,{className:"flex items-center justify-center",children:e.jsx(ah,{className:"h-2.5 w-2.5 fill-current text-current"})})}));cre.displayName=TRe.displayName;const Gft=({brief:t,open:r,onClose:s,onDismiss:n})=>{const{user:a}=Gr(),[o,l]=E.useState({}),[i,d]=E.useState({}),[m,g]=E.useState([]);E.useEffect(()=>{r&&a&&t.polls.length>0&&y()},[r,a,t.polls]);const y=async()=>{if(!a)return;const S=t.polls.map(M=>M.id),{data:A}=await Z.from("levelup_brief_poll_responses").select("poll_id, option_id").eq("user_id",a.id).in("poll_id",S);if(A){const M={};A.forEach(I=>{M[I.poll_id]||(M[I.poll_id]=[]),M[I.poll_id].push(I.option_id)}),d(M)}},v=(S,A)=>{l(M=>({...M,[S]:A}))},b=(S,A,M)=>{l(I=>{const F=I[S]||[];return M?{...I,[S]:[...F,A]}:{...I,[S]:F.filter(O=>O!==A)}})},N=async S=>{if(!a)return;const A=o[S];if(!A||Array.isArray(A)&&A.length===0){Se.error("Please select an option");return}g(M=>[...M,S]);try{await Z.from("levelup_brief_poll_responses").delete().eq("poll_id",S).eq("user_id",a.id);const M=Array.isArray(A)?A:[A],I=M.map(O=>({poll_id:S,option_id:O,user_id:a.id})),{error:F}=await Z.from("levelup_brief_poll_responses").insert(I);if(F)throw F;d(O=>({...O,[S]:M})),Se.success("Response submitted!")}catch(M){console.error("Error submitting poll response:",M),Se.error("Failed to submit response")}finally{g(M=>M.filter(I=>I!==S))}},j=S=>(S.includes("mediadelivery.net")||S.includes("bunny"),S);return e.jsx(Dr,{open:r,onOpenChange:S=>!S&&s(),children:e.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] p-0 overflow-hidden [&>button]:hidden",children:[e.jsxs("div",{className:"bg-gradient-to-r from-primary to-primary/80 p-4 pr-12 text-primary-foreground relative",children:[e.jsx("button",{onClick:s,className:"absolute top-3 right-3 p-1.5 rounded-full bg-white/30 hover:bg-white/50 transition-colors","aria-label":"Close",children:e.jsx(rn,{className:"h-5 w-5 text-white"})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-white/20 rounded-lg",children:e.jsx(Bf,{className:"h-6 w-6"})}),e.jsxs("div",{children:[e.jsx(bt,{variant:"secondary",className:"mb-1 bg-white/20 text-white border-0",children:"The LevelUp Brief"}),e.jsx(Br,{className:"text-xl font-bold text-white",children:t.brief.title})]})]})]}),e.jsx(Eo,{className:"max-h-[calc(90vh-240px)]",children:e.jsxs("div",{className:"p-6 space-y-6",children:[t.brief.description&&e.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:t.brief.description}}),t.brief.video_url&&e.jsx("div",{className:"relative w-full aspect-video rounded-lg overflow-hidden bg-muted",children:e.jsx("iframe",{src:j(t.brief.video_url),className:"absolute inset-0 w-full h-full",allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})}),t.brief.graphic_url&&!t.brief.video_url&&e.jsx("div",{className:"rounded-lg overflow-hidden bg-muted",children:t.brief.graphic_link_url?e.jsx("a",{href:t.brief.graphic_link_url,target:"_blank",rel:"noopener noreferrer",className:"block",children:e.jsx("img",{src:t.brief.graphic_url,alt:"Brief graphic",className:"w-full object-contain cursor-pointer hover:opacity-90 transition-opacity"})}):e.jsx("img",{src:t.brief.graphic_url,alt:"Brief graphic",className:"w-full object-contain"})}),t.links.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"font-semibold text-foreground",children:"Quick Links"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:t.links.map(S=>e.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>window.open(S.url,"_blank"),className:"gap-2",children:[e.jsx(En,{className:"h-4 w-4"}),S.title]},S.id))})]}),t.polls.map(S=>{var I,F;const A=((I=i[S.id])==null?void 0:I.length)>0,M=m.includes(S.id);return e.jsxs("div",{className:"space-y-3 p-4 bg-muted/50 rounded-lg border",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"font-semibold text-foreground",children:S.question}),A&&e.jsxs(bt,{variant:"secondary",className:"gap-1",children:[e.jsx(Li,{className:"h-3 w-3"}),"Responded"]})]}),S.poll_type==="single"?e.jsx(Bye,{value:o[S.id]||((F=i[S.id])==null?void 0:F[0])||"",onValueChange:O=>v(S.id,O),className:"space-y-2",children:S.options.map(O=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(cre,{value:O.id,id:O.id}),e.jsx(Ee,{htmlFor:O.id,className:"cursor-pointer",children:O.option_text})]},O.id))}):e.jsx("div",{className:"space-y-2",children:S.options.map(O=>{const $=(o[S.id]||i[S.id]||[]).includes(O.id);return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Yo,{id:O.id,checked:$,onCheckedChange:H=>b(S.id,O.id,H)}),e.jsx(Ee,{htmlFor:O.id,className:"cursor-pointer",children:O.option_text})]},O.id)})}),e.jsx(Q,{size:"sm",onClick:()=>N(S.id),disabled:M,children:M?"Submitting...":A?"Update Response":"Submit"})]},S.id)})]})}),e.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:[e.jsx(Q,{onClick:s,className:"w-full max-w-xs",children:"Got it!"}),e.jsx(Q,{variant:"ghost",size:"sm",onClick:n,children:"Don't show again"})]})]})})},Kft=()=>{const{user:t}=Gr(),[r,s]=E.useState(null),[n,a]=E.useState(!1),[o,l]=E.useState(!0),[i,d]=E.useState(!1),m=E.useCallback(async()=>{if(!t){l(!1);return}try{const{data:N,error:j}=await Z.from("levelup_briefs").select("*").eq("is_published",!0).lte("publish_date",new Date().toISOString()).order("publish_date",{ascending:!1}).limit(1).single();if(j||!N){l(!1);return}const{data:S}=await Z.from("levelup_brief_views").select("*").eq("brief_id",N.id).eq("user_id",t.id).maybeSingle(),[A,M]=await Promise.all([Z.from("levelup_brief_links").select("*").eq("brief_id",N.id).order("sort_order"),Z.from("levelup_brief_polls").select("*").eq("brief_id",N.id).order("sort_order")]),I=[];if(M.data)for(const H of M.data){const{data:W}=await Z.from("levelup_brief_poll_options").select("*").eq("poll_id",H.id).order("sort_order");I.push({...H,options:W||[]})}const F={brief:N,links:A.data||[],polls:I};s(F);const O=!!S,B=(S==null?void 0:S.dismissed_at)!=null,$=localStorage.getItem(`brief-dismissed-${N.id}`)==="true";if(B||$)d(!1),a(!1);else if(!O)a(!0),d(!0);else if(N.show_frequency==="every_login")a(!0),d(!0);else if(N.show_frequency==="daily"){const H=new Date(S.viewed_at);(new Date().getTime()-H.getTime())/(1e3*60*60)>=24&&(a(!0),d(!0))}else d(!1)}catch(N){console.error("Error fetching brief:",N)}finally{l(!1)}},[t]);E.useEffect(()=>{m()},[m]);const g=async()=>{if(!(!t||!r))try{const{data:N}=await Z.from("levelup_brief_views").select("id").eq("brief_id",r.brief.id).eq("user_id",t.id).maybeSingle();N?await Z.from("levelup_brief_views").update({viewed_at:new Date().toISOString()}).eq("id",N.id):await Z.from("levelup_brief_views").insert({brief_id:r.brief.id,user_id:t.id})}catch(N){console.error("Error marking brief as viewed:",N)}};return{currentBrief:r,shouldShowPopup:n,hasUnseenBrief:i,loading:o,openBrief:()=>{a(!0)},closeBrief:()=>{a(!1),g()},dismissBrief:async()=>{if(!(!t||!r)){a(!1),d(!1);try{const{data:N,error:j}=await Z.from("levelup_brief_views").select("id").eq("brief_id",r.brief.id).eq("user_id",t.id).maybeSingle();if(j&&console.error("Error checking existing brief view:",j),N){const{error:S}=await Z.from("levelup_brief_views").update({dismissed_at:new Date().toISOString()}).eq("id",N.id).eq("user_id",t.id);S&&console.error("Error updating brief dismiss:",S)}else{const{error:S}=await Z.from("levelup_brief_views").insert({brief_id:r.brief.id,user_id:t.id,dismissed_at:new Date().toISOString()});S&&console.error("Error inserting brief dismiss:",S)}localStorage.setItem(`brief-dismissed-${r.brief.id}`,"true")}catch(N){console.error("Error dismissing brief:",N),r&&localStorage.setItem(`brief-dismissed-${r.brief.id}`,"true")}}},refetch:m}};function Zft(){const[t,r]=E.useState(!1),[s,n]=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);n(y),r(!0);const v=b=>{b.preventDefault(),o(b)};return window.addEventListener("beforeinstallprompt",v),()=>{window.removeEventListener("beforeinstallprompt",v)}},[]);const l=()=>{localStorage.setItem("install-banner-dismissed","true"),r(!1)},i=async()=>{if(a){await a.prompt();const{outcome:d}=await a.userChoice;d==="accepted"&&l(),o(null)}};return t?e.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:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{className:"flex-shrink-0 p-2 bg-primary-foreground/10 rounded-full",children:e.jsx(Oi,{className:"h-5 w-5"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium text-sm",children:"Add LevelUp to your home screen"}),s?e.jsxs("p",{className:"text-xs opacity-80 flex items-center gap-1",children:["Tap ",e.jsx(FA,{className:"h-3 w-3 inline"}),' then "Add to Home Screen"']}):e.jsx("p",{className:"text-xs opacity-80",children:"Quick access anytime"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[!s&&a&&e.jsx(Q,{size:"sm",variant:"secondary",onClick:i,className:"text-xs",children:"Install"}),e.jsx("button",{onClick:l,className:"p-1.5 hover:bg-primary-foreground/10 rounded-full transition-colors","aria-label":"Dismiss",children:e.jsx(rn,{className:"h-4 w-4"})})]})]})}):null}const Yft=({children:t,onRefresh:r})=>{const[s,n]=E.useState(!1),[a,o]=E.useState(0),[l,i]=E.useState(!1),d=E.useRef(null),m=E.useRef(0),g=qr(),y=80,v=120,b=E.useCallback(M=>{const I=d.current;I&&I.scrollTop<=0&&(m.current=M.touches[0].clientY,n(!0))},[]),N=E.useCallback(M=>{if(!s||l)return;const I=d.current;if(!I||I.scrollTop>0){n(!1),o(0);return}const O=M.touches[0].clientY-m.current;if(O>0){const $=Math.min(O*.5,v);o($),$>10&&M.preventDefault()}},[s,l]),j=E.useCallback(async()=>{if(s)if(n(!1),a>=y&&!l){i(!0),o(y);try{r?await r():await g.invalidateQueries()}catch(M){console.error("Refresh failed:",M)}finally{i(!1),o(0)}}else o(0)},[s,a,l,r,g]),S=Math.min(a/y,1),A=S*180;return e.jsxs("div",{ref:d,className:"h-full overflow-auto",onTouchStart:b,onTouchMove:N,onTouchEnd:j,children:[e.jsx("div",{className:"flex justify-center items-center overflow-hidden transition-all duration-200 ease-out",style:{height:a>0?a:0,opacity:S},children:e.jsx("div",{className:`p-2 rounded-full bg-primary/10 ${l?"animate-spin":""}`,style:{transform:l?void 0:`rotate(${A}deg)`,transition:l?void 0:"transform 0.1s ease-out"},children:e.jsx(Ko,{className:"h-5 w-5 text-primary"})})}),e.jsx("div",{style:{transform:a>0?`translateY(${Math.max(0,a-60)}px)`:void 0,transition:s?void 0:"transform 0.2s ease-out"},children:t})]})},ARe=()=>{const{user:t}=Gr(),[r,s]=E.useState(!1),[n,a]=E.useState(!1),[o,l]=E.useState(0),[i,d]=E.useState(!0);E.useEffect(()=>{(async()=>{if(!t){d(!1);return}try{const{data:b}=await Z.from("membership_reviews").select("id").eq("user_id",t.id).maybeSingle();if(b){a(!0),s(!1),d(!1);return}const{data:N}=await Z.from("profiles").select("login_count").eq("id",t.id).single(),j=(N==null?void 0:N.login_count)||0;l(j);const S=sessionStorage.getItem("review-prompt-dismissed");s(j>=4&&!S)}catch(b){console.error("Error checking review eligibility:",b)}finally{d(!1)}})()},[t]);const m=E.useCallback(()=>{sessionStorage.setItem("review-prompt-dismissed","true"),s(!1)},[]),g=E.useCallback(async(v,b)=>{if(!t)return{success:!1,error:"Not authenticated"};try{const{error:N}=await Z.from("membership_reviews").insert({user_id:t.id,rating:v,review_text:b});if(N)throw N;return a(!0),s(!1),{success:!0,pointsAwarded:25}}catch(N){return console.error("Error submitting review:",N),{success:!1,error:N.message}}},[t]),y=E.useCallback(async()=>{if(t)try{await Z.from("membership_reviews").update({posted_to_google:!0}).eq("user_id",t.id)}catch(v){console.error("Error updating Google review status:",v)}},[t]);return{shouldShowPrompt:r,hasSubmittedReview:n,loginCount:o,isLoading:i,dismissPrompt:m,submitReview:g,markPostedToGoogle:y}},Xft="https://search.google.com/local/writereview?placeid=ChIJM73ERQD1QogRPxupMFObuck&source=g.page.m.ia._&laa=nmx-review-solicitation-ia2",Qft=()=>{const{shouldShowPrompt:t,isLoading:r,dismissPrompt:s,submitReview:n,markPostedToGoogle:a}=ARe(),[o,l]=E.useState(!1),[i,d]=E.useState("review"),[m,g]=E.useState(0),[y,v]=E.useState(0),[b,N]=E.useState(""),[j,S]=E.useState(!1),[A,M]=E.useState(!1);if(r||!t&&!A)return null;const I=async()=>{if(m===0){Jn({title:"Please select a rating",variant:"destructive"});return}S(!0);const B=await n(m,b);S(!1),B.success?(M(!0),Jn({title:"Thank you for your feedback!",description:"Your review helps us improve."}),d("google")):Jn({title:"Error submitting review",description:B.error,variant:"destructive"})},F=async B=>{B&&(await navigator.clipboard.writeText(b||`${m} star rating for LevelUp!`),Jn({title:"Review copied!",description:"Paste it on Google Reviews."}),await a(),window.open(Xft,"_blank")),l(!1),s()},O=()=>{l(!1),s()};return e.jsxs(e.Fragment,{children:[e.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:[e.jsx(Ln,{className:"h-3.5 w-3.5 fill-current"}),e.jsx("span",{className:"hidden sm:inline",children:"Leave a Review"})]}),e.jsx(Dr,{open:o,onOpenChange:O,children:e.jsx(Lr,{className:"sm:max-w-md",children:i==="review"?e.jsxs(e.Fragment,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{className:"text-center",children:"How are you enjoying LevelUp?"}),e.jsx(Gs,{className:"text-center",children:"Your feedback helps us improve the experience for all members."})]}),e.jsxs("div",{className:"space-y-6 py-4",children:[e.jsx("div",{className:"flex justify-center gap-1",children:[1,2,3,4,5].map(B=>e.jsx("button",{type:"button",onClick:()=>g(B),onMouseEnter:()=>v(B),onMouseLeave:()=>v(0),className:"p-1 transition-transform hover:scale-110",children:e.jsx(Ln,{className:qt("h-8 w-8 transition-colors",(y||m)>=B?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},B))}),e.jsx(Ks,{placeholder:"Tell us about your experience (optional)",value:b,onChange:B=>N(B.target.value),rows:4,className:"resize-none"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Q,{variant:"outline",onClick:O,className:"flex-1",children:"Maybe Later"}),e.jsx(Q,{onClick:I,disabled:j||m===0,className:"flex-1",children:j?"Submitting...":"Submit Review"})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{className:"text-center",children:"🎉 Thank you!"}),e.jsx(Gs,{className:"text-center",children:"Would you mind sharing your review on Google? It really helps other agents discover LevelUp!"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"We'll copy your review so you can easily paste it."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Q,{variant:"outline",onClick:()=>F(!1),className:"flex-1",children:"No Thanks"}),e.jsx(Q,{onClick:()=>F(!0),className:"flex-1",children:"Yes, Open Google"})]})]})]})})})]})};function Jft(t){const r="=".repeat((4-t.length%4)%4),s=(t+r).replace(/-/g,"+").replace(/_/g,"/"),n=window.atob(s),a=new Uint8Array(n.length);for(let o=0;o{if(!y){l(!1);return}(async()=>{try{const j="vapid_public_key";let S=localStorage.getItem(j);if(!S){const{data:I,error:F}=await Z.functions.invoke("get-vapid-public-key",{body:{}});if(F)throw F;if(S=(I==null?void 0:I.vapidPublicKey)??null,!S)throw new Error("Missing VAPID public key");localStorage.setItem(j,S)}g(S);const A=await navigator.serviceWorker.register("/push-sw.js");d(A),s(Notification.permission);const M=await A.pushManager.getSubscription();a(!!M)}catch(j){console.error("Error initializing push notifications:",j)}finally{l(!1)}})()},[y]);const v=E.useCallback(async()=>{if(!y||!i||!t)return console.error("Push notifications not supported or user not logged in"),!1;if(!m)return Se.error("Push notifications are not ready yet. Please try again in a moment."),!1;try{l(!0);const N=await i.pushManager.getSubscription();if(N){try{await N.unsubscribe()}catch(F){console.warn("Failed to unsubscribe existing push subscription:",F)}const{error:I}=await Z.from("push_subscriptions").delete().eq("user_id",t.id);I&&console.warn("Failed to cleanup push_subscriptions rows:",I)}if(Notification.permission!=="granted"){const I=await Notification.requestPermission();if(s(I),I!=="granted")return I==="denied"?Se.error("Notifications blocked. Please enable them in your browser settings (click the lock icon in the address bar)."):Se.error("Notification permission was dismissed. Please try again."),!1}const j=Jft(m);let S;try{S=await i.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:j})}catch(I){console.error("PushManager.subscribe() failed:",I);const F=(I==null?void 0:I.message)||String(I);return F.includes("permission")?Se.error("Push permission denied. Check your browser notification settings."):F.includes("key")||F.includes("VAPID")?Se.error("Push configuration error. Please contact support."):F.includes("AbortError")?Se.error("Push subscription was cancelled. Please try again."):Se.error(`Failed to subscribe: ${F}`),!1}const A=S.toJSON(),{error:M}=await Z.from("push_subscriptions").upsert({user_id:t.id,endpoint:A.endpoint,p256dh_key:A.keys.p256dh,auth_key:A.keys.auth},{onConflict:"user_id,endpoint"});if(M)throw console.error("Error saving subscription:",M),Se.error("Failed to save notification preferences. Please try again."),M;return a(!0),Se.success("Push notifications enabled!"),!0}catch(N){if(console.error("Error subscribing to push notifications:",N),!(N instanceof Error&&N.message.includes("toast"))){const j=N instanceof Error?N.message:"Unknown error";Se.error("Failed to enable push notifications: "+j)}return!1}finally{l(!1)}},[y,i,t,m]),b=E.useCallback(async()=>{if(!i||!t)return!1;try{l(!0);const N=await i.pushManager.getSubscription();return N&&await N.unsubscribe(),await Z.from("push_subscriptions").delete().eq("user_id",t.id),a(!1),Se.success("Push notifications disabled"),!0}catch(N){console.error("Error unsubscribing:",N);const j=N instanceof Error?N.message:"Unknown error";return Se.error("Failed to disable push notifications: "+j),!1}finally{l(!1)}},[i,t]);return{isSupported:y,permission:r,isSubscribed:n,isLoading:o,vapidPublicKey:m,subscribe:v,unsubscribe:b}}const QNe="push_notification_prompt_dismissed",egt=()=>{const{user:t}=Gr(),{isSupported:r,isSubscribed:s,isLoading:n,subscribe:a}=ERe(),[o,l]=E.useState(!1),[i,d]=E.useState(!1);E.useEffect(()=>{if(!t||!r||s||n||localStorage.getItem(`${QNe}_${t.id}`))return;const v=setTimeout(()=>{l(!0)},2e3);return()=>clearTimeout(v)},[t,r,s,n]);const m=async()=>{d(!0);const y=await a();d(!1),y&&l(!1)},g=()=>{t&&localStorage.setItem(`${QNe}_${t.id}`,"true"),l(!1)};return!r||s?null:e.jsx(Dr,{open:o,onOpenChange:y=>!y&&g(),children:e.jsxs(Lr,{className:"sm:max-w-md",children:[e.jsxs(Ur,{children:[e.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-primary/10",children:e.jsx(Df,{className:"h-6 w-6 text-primary"})}),e.jsx(Br,{className:"text-center",children:"Stay in the Loop!"}),e.jsx(Gs,{className:"text-center",children:"Enable push notifications to get alerted when:"})]}),e.jsxs("ul",{className:"my-4 space-y-2 text-sm text-muted-foreground",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-primary",children:"•"})," New events go live"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-primary",children:"•"})," Fresh templates are added"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-primary",children:"•"})," New toolbox resources drop"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-primary",children:"•"})," Social swag updates"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-primary",children:"•"})," New newsletters arrive"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-primary",children:"•"})," Posts in your community groups"]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(Q,{onClick:m,disabled:i,className:"w-full",children:i?"Enabling...":"Enable Notifications"}),e.jsx(Q,{variant:"ghost",onClick:g,className:"w-full",children:"Not Now"})]}),e.jsx("p",{className:"text-center text-xs text-muted-foreground",children:"You can always change this in your Profile settings."})]})})},JNe=t=>{let r;const s=new Set,n=(m,g)=>{const y=typeof m=="function"?m(r):m;if(!Object.is(y,r)){const v=r;r=g??(typeof y!="object"||y===null)?y:Object.assign({},r,y),s.forEach(b=>b(r,v))}},a=()=>r,i={setState:n,getState:a,getInitialState:()=>d,subscribe:m=>(s.add(m),()=>s.delete(m))},d=r=t(n,a,i);return i},tgt=t=>t?JNe(t):JNe,rgt=t=>t;function sgt(t,r=rgt){const s=lt.useSyncExternalStore(t.subscribe,lt.useCallback(()=>r(t.getState()),[t,r]),lt.useCallback(()=>r(t.getInitialState()),[t,r]));return lt.useDebugValue(s),s}const ngt=t=>{const r=tgt(t),s=n=>sgt(r,n);return Object.assign(s,r),s},agt=t=>ngt;function igt(t,r){let s;try{s=t()}catch{return}return{getItem:a=>{var o;const l=d=>d===null?null:JSON.parse(d,void 0),i=(o=s.getItem(a))!=null?o:null;return i instanceof Promise?i.then(l):l(i)},setItem:(a,o)=>s.setItem(a,JSON.stringify(o,void 0)),removeItem:a=>s.removeItem(a)}}const Dme=t=>r=>{try{const s=t(r);return s instanceof Promise?s:{then(n){return Dme(n)(s)},catch(n){return this}}}catch(s){return{then(n){return this},catch(n){return Dme(n)(s)}}}},ogt=(t,r)=>(s,n,a)=>{let o={storage:igt(()=>localStorage),partialize:j=>j,version:0,merge:(j,S)=>({...S,...j}),...r},l=!1;const i=new Set,d=new Set;let m=o.storage;if(!m)return t((...j)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),s(...j)},n,a);const g=()=>{const j=o.partialize({...n()});return m.setItem(o.name,{state:j,version:o.version})},y=a.setState;a.setState=(j,S)=>(y(j,S),g());const v=t((...j)=>(s(...j),g()),n,a);a.getInitialState=()=>v;let b;const N=()=>{var j,S;if(!m)return;l=!1,i.forEach(M=>{var I;return M((I=n())!=null?I:v)});const A=((S=o.onRehydrateStorage)==null?void 0:S.call(o,(j=n())!=null?j:v))||void 0;return Dme(m.getItem.bind(m))(o.name).then(M=>{if(M)if(typeof M.version=="number"&&M.version!==o.version){if(o.migrate){const I=o.migrate(M.state,M.version);return I instanceof Promise?I.then(F=>[!0,F]):[!0,I]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,M.state];return[!1,void 0]}).then(M=>{var I;const[F,O]=M;if(b=o.merge(O,(I=n())!=null?I:v),s(b,!0),F)return g()}).then(()=>{A==null||A(b,void 0),b=n(),l=!0,d.forEach(M=>M(b))}).catch(M=>{A==null||A(void 0,M)})};return a.persist={setOptions:j=>{o={...o,...j},j.storage&&(m=j.storage)},clearStorage:()=>{m==null||m.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>N(),hasHydrated:()=>l,onHydrate:j=>(i.add(j),()=>{i.delete(j)}),onFinishHydration:j=>(d.add(j),()=>{d.delete(j)})},o.skipHydration||N(),b||v},lgt=ogt,fae=agt()(lgt((t,r)=>({cartItems:[],addToCart:(s,n,a=1,o)=>{t(l=>{const i=l.cartItems.findIndex(d=>{var m;return d.product.id===s.id&&((m=d.variant)==null?void 0:m.id)===(n==null?void 0:n.id)});if(i>=0){const d=[...l.cartItems];return d[i].quantity+=a,o&&(d[i].artworkUrl=o),{cartItems:d}}return{cartItems:[...l.cartItems,{product:s,variant:n,quantity:a,artworkUrl:o}]}})},removeFromCart:(s,n)=>{t(a=>({cartItems:a.cartItems.filter(o=>{var l;return!(o.product.id===s&&((l=o.variant)==null?void 0:l.id)===n)})}))},updateQuantity:(s,n,a)=>{t(o=>({cartItems:o.cartItems.map(l=>{var i;return l.product.id===s&&((i=l.variant)==null?void 0:i.id)===n?{...l,quantity:Math.max(1,a)}:l})}))},updateArtwork:(s,n,a)=>{t(o=>({cartItems:o.cartItems.map(l=>{var i;return l.product.id===s&&((i=l.variant)==null?void 0:i.id)===n?{...l,artworkUrl:a}:l})}))},clearCart:()=>t({cartItems:[]}),getItemPrice:s=>{const n=Number(s.product.base_price),a=s.variant?Number(s.variant.price_adjustment):0;return n+a},getSubtotal:()=>{const{cartItems:s,getItemPrice:n}=r();return s.reduce((a,o)=>a+n(o)*o.quantity,0)},getShippingTotal:()=>{const{cartItems:s}=r();return s.reduce((n,a)=>n+Number(a.product.shipping_fee)*a.quantity,0)},getTotal:()=>{const{getSubtotal:s,getShippingTotal:n}=r();return s()+n()}}),{name:"marketplace-cart",partialize:t=>({cartItems:t.cartItems})})),IRe=E.createContext({onlineUsers:[],totalOnline:0}),cgt=async t=>{try{const{data:r}=await Z.storage.from("avatars").list(`${t}`);if(r&&r.length>0){const{data:s}=Z.storage.from("avatars").getPublicUrl(`${t}/${r[0].name}`);return s.publicUrl}}catch{}},dgt=({children:t})=>{const{user:r,brokerageId:s,isAdmin:n}=Gr(),[a,o]=E.useState([]),[l,i]=E.useState(null);E.useEffect(()=>{if(!r)return;const m=Z.channel("app-presence",{config:{presence:{key:r.id}}});return m.on("presence",{event:"sync"},()=>{const g=m.presenceState(),y=[];Object.entries(g).forEach(([v,b])=>{if(b&&b.length>0){const N=b[0];y.push({id:v,name:N.name||"Unknown",avatarUrl:N.avatarUrl,brokerageId:N.brokerageId,onlineSince:N.onlineSince})}}),o(y)}).on("presence",{event:"join"},()=>{}).on("presence",{event:"leave"},()=>{}).subscribe(async g=>{var y;if(g==="SUBSCRIBED"){const{data:v}=await Z.from("profiles").select("name, brokerage_id").eq("id",r.id).single(),b=await cgt(r.id);await m.track({name:(v==null?void 0:v.name)||((y=r.email)==null?void 0:y.split("@")[0])||"User",avatarUrl:b,brokerageId:v==null?void 0:v.brokerage_id,onlineSince:new Date().toISOString()})}}),i(m),()=>{m.unsubscribe()}},[r]);const d=a.filter(m=>m.id===(r==null?void 0:r.id)?!1:!!(n||s&&m.brokerageId===s||!s&&!m.brokerageId));return e.jsx(IRe.Provider,{value:{onlineUsers:d,totalOnline:a.length},children:t})},PRe=()=>E.useContext(IRe),e4e="dashboard-sidebar-collapsed",Fr=({children:t,title:r})=>{var Le,Ue,Ye;const{user:s,signOut:n,isAdmin:a,isBrokerageManager:o,brokerageId:l}=Gr(),{isAssistant:i,actingAsAgent:d}=Vxe(),{isImpersonating:m}=qxe(),y=(i&&!!d?40:0)+(m?40:0),{avatarUrl:v}=vDe(s==null?void 0:s.id),{isTrial:b,isExpired:N,expiresAt:j}=apt(s==null?void 0:s.id),{isMarketplaceEnabled:S}=bDe(),{currentBrief:A,shouldShowPopup:M,hasUnseenBrief:I,openBrief:F,closeBrief:O,dismissBrief:B}=Kft(),{unreadCount:$}=ipt(),{openCount:H}=opt(),{data:W}=Lv(),X=!!W,ae=fae(Ie=>Ie.cartItems).reduce((Ie,et)=>Ie+et.quantity,0),le=Ws(),ne=Uh(),[fe,oe]=E.useState(()=>typeof window<"u"?localStorage.getItem(e4e)==="true":!1);E.useEffect(()=>{localStorage.setItem(e4e,String(fe))},[fe]);const[de,ue]=E.useState({agentos:!0,tools:!0,marketing:!0,learning:!0,community:!0,help:!1}),xe=Ie=>{ue(et=>({...et,[Ie]:!et[Ie]}))},Te=Ie=>Ie.split(" ").map(et=>et[0]).join("").toUpperCase().slice(0,2),be=Ie=>ne.pathname===Ie,we=Ie=>Ie.some(et=>ne.pathname===et),ve=({path:Ie,icon:et,label:It,badgeCount:Pe})=>{const at=e.jsxs(Q,{variant:"ghost",size:"sm",className:qt("text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground relative",be(Ie)&&"bg-sidebar-accent text-sidebar-accent-foreground",fe?"w-10 h-10 p-0 justify-center":"w-full justify-start gap-2"),onClick:()=>le(Ie),children:[e.jsxs("div",{className:"relative",children:[e.jsx(et,{className:"h-4 w-4 shrink-0"}),fe&&Pe!=null&&Pe>0&&e.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-muted-foreground/40 border border-background"})]}),!fe&&It,!fe&&Pe!=null&&Pe>0&&e.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:Pe>9?"9+":Pe})]});return fe?e.jsxs(Uf,{delayDuration:0,children:[e.jsx(qf,{asChild:!0,children:at}),e.jsxs(wp,{side:"right",className:"flex items-center gap-2",children:[It,Pe!=null&&Pe>0&&e.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:Pe>9?"9+":Pe})]})]}):at},tt=({id:Ie,label:et,icon:It,children:Pe,activePaths:at,showBetaBadge:ce,defaultPath:$e,badgeCount:Ge})=>{if(fe){const rt=$e||at[0];return e.jsxs(Uf,{delayDuration:0,children:[e.jsx(qf,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"sm",className:qt("w-10 h-10 p-0 justify-center text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground relative",we(at)&&"text-primary"),onClick:()=>le(rt),children:e.jsxs("div",{className:"relative",children:[e.jsx(It,{className:"h-4 w-4"}),Ge!=null&&Ge>0&&e.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-muted-foreground/40 border border-background"})]})})}),e.jsxs(wp,{side:"right",className:"flex items-center gap-2",children:[et,ce&&e.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"}),Ge!=null&&Ge>0&&e.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:Ge>9?"9+":Ge})]})]})}return e.jsxs(ek,{open:de[Ie],onOpenChange:()=>xe(Ie),children:[e.jsx(tk,{asChild:!0,children:e.jsxs(Q,{variant:"ghost",size:"sm",className:qt("w-full justify-between gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",we(at)&&"text-primary"),children:[e.jsxs("span",{className:"flex items-center gap-2 font-semibold text-[15px]",children:[e.jsx(It,{className:"h-4 w-4"}),et,ce&&e.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"})]}),e.jsxs("span",{className:"flex items-center gap-1",children:[Ge!=null&&Ge>0&&e.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:Ge>9?"9+":Ge}),e.jsx(Jc,{className:qt("h-4 w-4 transition-transform duration-200",de[Ie]&&"rotate-180")})]})]})}),e.jsx(rk,{className:"pl-4 space-y-1 mt-1",children:Pe})]})},Ae=({isMobile:Ie=!1})=>{const et=Ie?!1:fe;return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:qt("p-3 border-b border-sidebar-border",et?"flex flex-col items-center gap-2":"flex items-center justify-between"),children:[et?e.jsx("img",{src:Tpt,alt:"LevelUp",className:"h-8 w-auto"}):e.jsx("img",{src:Mpt,alt:"LevelUp",className:"h-8 w-auto"}),!Ie&&e.jsxs(Uf,{delayDuration:0,children:[e.jsx(qf,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",onClick:()=>oe(!et),children:e.jsx(uc,{className:qt("h-4 w-4 transition-transform duration-300",et&&"rotate-180")})})}),e.jsx(wp,{side:"right",children:et?"Expand sidebar":"Collapse sidebar"})]})]}),e.jsx(Eo,{className:"flex-1",children:e.jsxs("nav",{className:qt("p-3 space-y-1",et&&"flex flex-col items-center"),children:[e.jsx(ve,{path:"/dashboard",icon:Vj,label:"Dashboard"}),e.jsx(ve,{path:"/events",icon:Ff,label:"Events"}),e.jsxs(tt,{id:"agentos",label:"Agent OS",icon:OS,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:[e.jsx(ve,{path:"/mission-control",icon:Ci,label:"Mission Control"}),e.jsx(ve,{path:"/mission-control/contacts",icon:ws,label:"Contacts"}),e.jsx(ve,{path:"/mission-control/plans",icon:Ff,label:"TouchPlans"}),e.jsx(ve,{path:"/mission-control/pipeline",icon:xy,label:"Deal Pipeline"}),e.jsx(ve,{path:"/mission-control/popbys",icon:uo,label:"Popbys"}),e.jsx(ve,{path:"/mission-control/video-library",icon:ya,label:"Video Library"}),e.jsx(ve,{path:"/mission-control/scorecard",icon:Nc,label:"Scorecard"}),e.jsx(ve,{path:"/mission-control/listings",icon:bi,label:"Listing Exchange"})]}),e.jsxs(tt,{id:"tools",label:"Tools",icon:im,activePaths:["/apps","/ai-toolkit","/mission-control/my-card","/mission-control/presentations","/mission-control/guest-book"],defaultPath:"/apps",children:[e.jsx(ve,{path:"/apps",icon:im,label:"Apps"}),!et&&e.jsxs(Q,{variant:"ghost",size:"sm",className:qt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",be("/mission-control/my-card")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>le("/mission-control/my-card"),children:[e.jsx(gp,{className:"h-4 w-4"}),"Digital Card",e.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"})]}),et&&e.jsx(ve,{path:"/mission-control/my-card",icon:gp,label:"Digital Card"}),!et&&e.jsxs(Q,{variant:"ghost",size:"sm",className:qt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground overflow-hidden",ne.pathname.startsWith("/mission-control/presentations")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>le("/mission-control/presentations"),children:[e.jsx($f,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:"Presentations"}),e.jsx("span",{className:"ml-auto shrink-0 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"})]}),et&&e.jsx(ve,{path:"/mission-control/presentations",icon:$f,label:"Smart Presentations"}),!et&&e.jsxs(Q,{variant:"ghost",size:"sm",className:qt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",be("/mission-control/guest-book")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>le("/mission-control/guest-book"),children:[e.jsx(W1,{className:"h-4 w-4"}),"Guest Book",e.jsx("span",{className:"ml-auto 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"})]}),et&&e.jsx(ve,{path:"/mission-control/guest-book",icon:W1,label:"Guest Book"})]}),e.jsxs(tt,{id:"marketing",label:"Marketing",icon:Bf,activePaths:["/templates","/social-swag-2","/newsletters"],defaultPath:"/templates",children:[e.jsx(ve,{path:"/templates",icon:ed,label:"Templates"}),e.jsx(ve,{path:"/social-swag-2",icon:by,label:"Social Swag"}),e.jsx(ve,{path:"/newsletters",icon:_y,label:"Newsletters"})]}),e.jsxs(tt,{id:"learning",label:"Learning",icon:W1,activePaths:["/academy","/toolbox"],defaultPath:"/academy",children:[e.jsx(ve,{path:"/academy",icon:Y1,label:"Academy"}),e.jsx(ve,{path:"/toolbox",icon:wy,label:"Toolbox"})]}),e.jsxs(tt,{id:"community",label:"Community",icon:$o,activePaths:["/community","/wishlist"],defaultPath:"/community",badgeCount:$,children:[e.jsx(ve,{path:"/community",icon:ws,label:"Community",badgeCount:$}),e.jsx(ve,{path:"/wishlist",icon:yy,label:"Wishlist",badgeCount:H}),!et&&e.jsxs(Q,{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:[e.jsx(En,{className:"h-4 w-4"}),"Facebook Group"]})]}),e.jsxs(tt,{id:"goods",label:"The Goods",icon:Lh,activePaths:["/marketplace","/reward-store"],defaultPath:"/reward-store",children:[S&&!et&&e.jsxs(Q,{variant:"ghost",size:"sm",className:qt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ne.pathname.startsWith("/marketplace")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>le("/marketplace"),children:[e.jsx(Lh,{className:"h-4 w-4"}),"Marketplace",e.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"})]}),S&&et&&e.jsx(ve,{path:"/marketplace",icon:Lh,label:"Marketplace"}),e.jsx(ve,{path:"/reward-store",icon:ho,label:"Reward Store"})]}),e.jsxs(tt,{id:"help",label:"Help & Services",icon:ey,activePaths:["/support","/additional-services"],defaultPath:"/support",children:[e.jsx(ve,{path:"/support",icon:qS,label:"Support"}),e.jsx(ve,{path:"/additional-services",icon:An,label:"Additional Services"})]}),a&&e.jsxs(e.Fragment,{children:[!et&&e.jsx("div",{className:"pt-3 pb-1",children:e.jsx("p",{className:"px-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Admin"})}),et?e.jsx("div",{className:"pt-3 border-t border-sidebar-border mt-3 space-y-1",children:e.jsx(ve,{path:"/admin",icon:ku,label:"Admin Dashboard"})}):e.jsxs(Q,{variant:"ghost",size:"sm",className:qt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ne.pathname==="/admin"&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>le("/admin"),children:[e.jsx(ku,{className:"h-4 w-4"}),"Admin Dashboard"]})]}),(l||o)&&!a&&e.jsxs(e.Fragment,{children:[!et&&e.jsx("div",{className:"pt-3 pb-1",children:e.jsx("p",{className:"px-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"My Brokerage"})}),et?e.jsxs("div",{className:"border-t border-sidebar-border mt-3 pt-3 space-y-1",children:[l&&e.jsx(ve,{path:"/my-brokerage",icon:bi,label:"My Brokerage"}),X&&!o&&e.jsx(ve,{path:"/my-team",icon:ws,label:"My Team"}),o&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{path:"/brokerage/dashboard",icon:vd,label:"Manage Brokerages"}),e.jsx(ve,{path:"/brokerage/teams",icon:ws,label:"Teams"}),e.jsx(ve,{path:"/brokerage-resources",icon:wu,label:"Brokerage Resources"})]})]}):e.jsxs(e.Fragment,{children:[l&&e.jsxs(Q,{variant:"ghost",size:"sm",className:qt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",be("/my-brokerage")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>le("/my-brokerage"),children:[e.jsx(bi,{className:"h-4 w-4"}),"My Brokerage"]}),X&&!o&&e.jsxs(Q,{variant:"ghost",size:"sm",className:qt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",be("/my-team")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>le("/my-team"),children:[e.jsx(ws,{className:"h-4 w-4"}),"My Team"]}),o&&e.jsxs(e.Fragment,{children:[e.jsxs(Q,{variant:"ghost",size:"sm",className:qt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",be("/brokerage/dashboard")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>le("/brokerage/dashboard"),children:[e.jsx(vd,{className:"h-4 w-4"}),"Manage Brokerages"]}),e.jsxs(Q,{variant:"ghost",size:"sm",className:qt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",be("/brokerage/teams")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>le("/brokerage/teams"),children:[e.jsx(ws,{className:"h-4 w-4"}),"Teams",e.jsx("span",{className:"ml-auto 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:"New"})]}),e.jsxs(Q,{variant:"ghost",size:"sm",className:qt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",be("/brokerage-resources")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>le("/brokerage-resources"),children:[e.jsx(wu,{className:"h-4 w-4"}),"Brokerage Resources"]})]})]})]})]})}),e.jsxs("div",{className:"p-3 border-t border-sidebar-border md:hidden",children:[e.jsxs(Q,{variant:"ghost",size:"sm",className:qt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",be("/profile")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>le("/profile"),children:[e.jsx(Kl,{className:"h-4 w-4"}),"Profile"]}),e.jsxs(Q,{variant:"ghost",size:"sm",className:"w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",onClick:n,children:[e.jsx(WS,{className:"h-4 w-4"}),"Sign Out"]})]})]})};return e.jsx(dgt,{children:e.jsx(L3,{children:e.jsxs("div",{className:"min-h-screen bg-background flex",children:[b&&N&&e.jsx(Eft,{}),typeof document<"u"&&Ph.createPortal(e.jsx("aside",{className:qt("hidden md:flex flex-col bg-card border-r border-border fixed left-0 z-[2147483647] isolate !pointer-events-auto transition-[width] duration-300",fe?"w-16":"w-52"),style:{top:`${y}px`,height:`calc(100vh - ${y}px)`},children:e.jsx(Ae,{})}),document.body),e.jsxs("div",{className:qt("flex-1 flex flex-col overflow-hidden transition-all duration-300",fe?"md:ml-16":"md:ml-52"),style:{height:`calc(100vh - ${y}px)`,marginTop:`${y}px`},children:[e.jsx("header",{className:"sticky top-0 z-40 bg-card border-b border-border flex-shrink-0",children:e.jsxs("div",{className:"flex items-center justify-between px-6 py-3",children:[e.jsxs(eae,{children:[e.jsx(_ye,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"icon",className:"md:hidden",children:e.jsx(kA,{className:"h-5 w-5"})})}),e.jsx(jP,{side:"left",className:"w-52 p-0 bg-card",children:e.jsx(Ae,{isMobile:!0})})]}),e.jsx("div",{className:"flex-1 md:hidden",children:e.jsx("img",{src:Apt,alt:"LevelUp",className:"h-8 w-auto"})}),e.jsx("div",{className:"hidden md:flex flex-1 justify-center",children:e.jsx(XNe,{})}),e.jsxs("div",{className:"flex items-center gap-3 ml-auto",children:[b&&!N&&j&&e.jsx(Aft,{expiresAt:j,className:"hidden lg:flex"}),e.jsx("div",{className:"md:hidden",children:e.jsx(XNe,{})}),A&&e.jsx(Ift,{hasUnseenBrief:I,onClick:F}),S&&e.jsxs(Q,{variant:"ghost",size:"icon",className:"relative",onClick:()=>le("/marketplace/cart"),children:[e.jsx(Lh,{className:"h-5 w-5"}),ae>0&&e.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:ae>99?"99+":ae})]}),e.jsx(rft,{}),e.jsx(Pme,{}),e.jsxs("span",{className:"hidden sm:block text-sm font-medium text-foreground",children:["Hello, ",((Ue=(Le=s==null?void 0:s.user_metadata)==null?void 0:Le.name)==null?void 0:Ue.split(" ")[0])||"User","!"]}),e.jsxs(mh,{children:[e.jsx(ph,{asChild:!0,children:e.jsx("button",{className:"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded-full",children:e.jsxs(ln,{className:"h-9 w-9 cursor-pointer hover:opacity-80 transition-opacity",children:[e.jsx(pa,{src:v||void 0}),e.jsx(cn,{className:"bg-primary text-primary-foreground font-medium text-sm",children:Te(((Ye=s==null?void 0:s.user_metadata)==null?void 0:Ye.name)||(s==null?void 0:s.email)||"U")})]})})}),e.jsxs(Au,{align:"end",className:"w-48",children:[e.jsxs(Ba,{onClick:()=>le("/profile"),className:"cursor-pointer",children:[e.jsx(Kl,{className:"h-4 w-4 mr-2"}),"Profile"]}),e.jsxs(Ba,{onClick:()=>le("/mission-control/integrations"),className:"cursor-pointer",children:[e.jsx(IA,{className:"h-4 w-4 mr-2"}),"Integrations"]}),e.jsx(yk,{}),e.jsxs(Ba,{onClick:n,className:"cursor-pointer text-destructive focus:text-destructive",children:[e.jsx(WS,{className:"h-4 w-4 mr-2"}),"Sign Out"]})]})]})]})]})}),e.jsx(Yft,{children:e.jsx("main",{className:"p-4 sm:p-6 lg:p-8 overflow-x-hidden",children:t})}),A&&e.jsx(Gft,{brief:A,open:M,onClose:O,onDismiss:B}),e.jsx(Zft,{}),e.jsx(Qft,{}),e.jsx(egt,{})]})]})})})},ugt=()=>{const{user:t}=Gr(),[r,s]=E.useState(!1),[n,a]=E.useState(null),[o,l]=E.useState(""),i=async y=>{var v;if(!(t!=null&&t.email)){Se.error("Please sign in to upgrade");return}s(!0),a(y);try{const{data:b,error:N}=await Z.functions.invoke("create-checkout",{body:{tier:y,email:t.email,name:((v=t.user_metadata)==null?void 0:v.full_name)||t.email,couponCode:o.trim()||void 0,skipTrial:!0}});if(N)throw N;if(b!=null&&b.url)window.open(b.url,"_blank","noopener,noreferrer"),Se.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(b){console.error("Checkout error:",b),Se.error(b.message||"Failed to start checkout. Please try again.")}finally{s(!1),a(null)}},d=["Unlimited access to all marketing templates","Complete Academy training library","AI-powered tools and resources","Community forums and support","Exclusive member events and workshops","Deal pipeline & scorecard tracking","Listing exchange access","Social media content library"],m=["Everything in Individual plan","Up to 25 agent seats","Brokerage admin dashboard","Team performance analytics","Custom branding options","Priority support","Agent onboarding tools","Brokerage-wide announcements"],g=["Everything in Brokerage plan","Unlimited agent seats","Dedicated account manager","Advanced analytics & reporting","White-label options","API access","Custom integrations","Enterprise-level support"];return e.jsx(Fr,{children:e.jsxs("div",{className:"container max-w-6xl py-8 px-4",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Upgrade Your Membership"}),e.jsx("p",{className:"text-muted-foreground text-lg",children:"Choose the plan that's right for you and unlock the full power of LevelUp"})]}),e.jsxs("div",{className:"max-w-md mx-auto mb-8",children:[e.jsx(Ee,{htmlFor:"coupon",className:"text-sm font-medium",children:"Have a discount code?"}),e.jsx(Qe,{id:"coupon",placeholder:"Enter discount code",value:o,onChange:y=>l(y.target.value),className:"mt-1"})]}),e.jsxs("div",{className:"grid md:grid-cols-3 gap-6 mb-8",children:[e.jsxs(ze,{className:"border-2 border-primary/20 hover:border-primary/50 transition-colors relative overflow-hidden",children:[e.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"}),e.jsxs(Wt,{className:"text-center pb-2",children:[e.jsx("div",{className:"mx-auto mb-3 h-14 w-14 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(ws,{className:"h-7 w-7 text-primary"})}),e.jsx(Zt,{className:"text-xl",children:"Individual Agent"}),e.jsx(Ss,{children:"Perfect for solo agents ready to level up"})]}),e.jsxs(qe,{className:"space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("span",{className:"text-4xl font-bold text-primary",children:"$39"}),e.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),e.jsx("ul",{className:"space-y-2",children:d.map((y,v)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[e.jsx(li,{className:"h-4 w-4 text-primary mt-0.5 shrink-0"}),e.jsx("span",{children:y})]},v))}),e.jsxs(Q,{className:"w-full",size:"lg",onClick:()=>i("individual_agent"),disabled:r,children:[r&&n==="individual_agent"?e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(An,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]}),e.jsxs(ze,{className:"border-2 border-amber-500/20 hover:border-amber-500/50 transition-colors",children:[e.jsxs(Wt,{className:"text-center pb-2",children:[e.jsx("div",{className:"mx-auto mb-3 h-14 w-14 rounded-full bg-amber-500/10 flex items-center justify-center",children:e.jsx(bi,{className:"h-7 w-7 text-amber-600"})}),e.jsx(Zt,{className:"text-xl",children:"Brokerage"}),e.jsx(Ss,{children:"For teams and brokerages up to 25 agents"})]}),e.jsxs(qe,{className:"space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("span",{className:"text-4xl font-bold text-amber-600",children:"$299"}),e.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),e.jsx("ul",{className:"space-y-2",children:m.map((y,v)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[e.jsx(li,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}),e.jsx("span",{children:y})]},v))}),e.jsxs(Q,{variant:"outline",className:"w-full border-amber-500 text-amber-600 hover:bg-amber-50",size:"lg",onClick:()=>i("brokerage_under_25"),disabled:r,children:[r&&n==="brokerage_under_25"?e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(bi,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]}),e.jsxs(ze,{className:"border-2 border-purple-500/20 hover:border-purple-500/50 transition-colors",children:[e.jsxs(Wt,{className:"text-center pb-2",children:[e.jsx("div",{className:"mx-auto mb-3 h-14 w-14 rounded-full bg-purple-500/10 flex items-center justify-center",children:e.jsx(bi,{className:"h-7 w-7 text-purple-600"})}),e.jsx(Zt,{className:"text-xl",children:"Brokerage 25+"}),e.jsx(Ss,{children:"For larger brokerages with 25+ agents"})]}),e.jsxs(qe,{className:"space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("span",{className:"text-4xl font-bold text-purple-600",children:"$499"}),e.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),e.jsx("ul",{className:"space-y-2",children:g.map((y,v)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[e.jsx(li,{className:"h-4 w-4 text-purple-600 mt-0.5 shrink-0"}),e.jsx("span",{children:y})]},v))}),e.jsxs(Q,{variant:"outline",className:"w-full border-purple-500 text-purple-600 hover:bg-purple-50",size:"lg",onClick:()=>i("brokerage_over_25"),disabled:r,children:[r&&n==="brokerage_over_25"?e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(bi,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]})]}),e.jsx(ze,{className:"bg-muted/50",children:e.jsxs(qe,{className:"py-6",children:[e.jsx("p",{className:"text-center font-medium mb-4",children:"Questions? We're here to help!"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[e.jsxs("a",{href:"tel:1-866-527-8668",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[e.jsx(wi,{className:"h-4 w-4"}),e.jsx("span",{children:"1-866-527-8668"})]}),e.jsxs("a",{href:"mailto:support@relevelup.com",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[e.jsx(mn,{className:"h-4 w-4"}),e.jsx("span",{children:"support@relevelup.com"})]})]})]})})]})})},hgt=()=>{const{user:t,loading:r,isBrokerageManager:s,brokerageId:n}=Gr(),a=Ws(),[o,l]=E.useState(""),[i,d]=E.useState(!1),[m,g]=E.useState(!1);E.useEffect(()=>{!r&&!t&&a("/auth")},[t,r,a]),E.useEffect(()=>{!r&&t&&n&&a("/profile?setup=true")},[t,r,n,a]);const y=async()=>{if(!o.trim()){Se.error("Please enter a brokerage name");return}const{data:v}=await Z.auth.getSession(),b=v.session;if(!t||!b){Se.error("Please sign in again to create your brokerage."),a("/auth");return}d(!0);try{console.log("[SetupBrokerage] Creating brokerage…",{hasUser:!!t,hasSession:!!b,userId:t==null?void 0:t.id});const{data:N,error:j}=await Z.functions.invoke("create-brokerage",{body:{name:o.trim()}});if(console.log("[SetupBrokerage] create-brokerage response",{data:N,error:j}),j)throw j;if(!(N!=null&&N.ok))throw new Error((N==null?void 0:N.error)||"Failed to create brokerage");d(!1),g(!0),Se.success("Brokerage created! Setting up your account..."),setTimeout(()=>{a("/profile?setup=true")},2e3)}catch(N){console.error("Error creating brokerage:",N),Se.error(N.message||"Failed to create brokerage"),d(!1)}};return r?e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):m?e.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:e.jsxs(ze,{className:"max-w-lg w-full",children:[e.jsxs(Wt,{className:"text-center",children:[e.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-4",children:e.jsx(Hr,{className:"w-10 h-10 text-primary animate-spin"})}),e.jsx(Zt,{className:"text-2xl",children:"Setting Up Your Brokerage"}),e.jsx(Ss,{className:"text-lg",children:"We're assigning you as the brokerage manager and preparing your dashboard..."})]}),e.jsxs(qe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[e.jsx(ui,{className:"w-5 h-5 text-green-500"}),e.jsx("span",{children:"Brokerage created"})]}),e.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[e.jsx(Hr,{className:"w-5 h-5 animate-spin text-primary"}),e.jsx("span",{children:"Assigning you as manager..."})]}),e.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."})]})]})}):e.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:e.jsxs(ze,{className:"max-w-lg w-full",children:[e.jsxs(Wt,{className:"text-center",children:[e.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-4",children:e.jsx(bi,{className:"w-10 h-10 text-primary"})}),e.jsx(Zt,{className:"text-2xl",children:"Set Up Your Brokerage"}),e.jsx(Ss,{className:"text-lg",children:"Create your brokerage to start managing your team"})]}),e.jsxs(qe,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"brokerage-name",children:"Brokerage Name"}),e.jsx(Qe,{id:"brokerage-name",placeholder:"Enter your brokerage name",value:o,onChange:v=>l(v.target.value),onKeyDown:v=>v.key==="Enter"&&y()}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"This is how your brokerage will appear to your agents"})]}),e.jsxs("div",{className:"p-4 rounded-lg bg-muted/50 space-y-3",children:[e.jsxs("h3",{className:"font-semibold flex items-center gap-2",children:[e.jsx(ws,{className:"w-4 h-4 text-primary"}),"What you can do as a Brokerage Manager:"]}),e.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(ui,{className:"w-4 h-4 text-green-500"}),"Invite agents to join your brokerage"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(ui,{className:"w-4 h-4 text-green-500"}),"Access exclusive brokerage resources"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(ui,{className:"w-4 h-4 text-green-500"}),"Track your team's activity and engagement"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(ui,{className:"w-4 h-4 text-green-500"}),"Share resources with your agents"]})]})]}),e.jsxs(Q,{onClick:y,className:"w-full",disabled:i||!o.trim(),children:[i?"Creating...":"Create Brokerage",e.jsx(Hi,{className:"w-4 h-4 ml-2"})]})]})]})})},t4e=()=>{const t=Ws(),[r,s]=E.useState("verifying"),[n,a]=E.useState("");E.useEffect(()=>{(async()=>{try{const{data:{session:i},error:d}=await Z.auth.getSession();if(d)throw d;if(i!=null&&i.user){const{data:m}=await Z.from("profiles").select("login_count").eq("id",i.user.id).single();if(((m==null?void 0:m.login_count)||0)>1){console.log("Account already claimed, redirecting to dashboard"),s("already_claimed");return}console.log("User logged in successfully:",i.user.email),s("success");try{await Z.functions.invoke("trial-claim-hook",{body:{userId:i.user.id}})}catch(g){console.log("Trial claim hook (non-critical):",g)}setTimeout(()=>{t("/profile?setup=true")},1500)}else setTimeout(()=>{s("already_claimed")},2e3)}catch(i){console.error("Claim error:",i),s("already_claimed")}})()},[t]);const o=()=>{window.location.href="https://dashboard.relevelup.com/auth"};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:e.jsxs(ze,{className:"w-full max-w-md",children:[e.jsxs(Wt,{className:"space-y-1 text-center",children:[e.jsxs("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10",children:[r==="verifying"&&e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),r==="success"&&e.jsx("svg",{className:"h-8 w-8 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),r==="already_claimed"&&e.jsx("svg",{className:"h-8 w-8 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.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"})}),r==="error"&&e.jsx("svg",{className:"h-8 w-8 text-destructive",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]}),e.jsxs(Zt,{className:"text-2xl",children:[r==="verifying"&&"Claiming Your Account...",r==="success"&&"Account Claimed!",r==="already_claimed"&&"Account Already Claimed",r==="error"&&"Claim Failed"]}),e.jsxs(Ss,{children:[r==="verifying"&&"Please wait while we verify your account...",r==="success"&&"Redirecting you to complete your profile...",r==="already_claimed"&&"This account has already been set up. Please log in to access your dashboard.",r==="error"&&n]})]}),(r==="already_claimed"||r==="error")&&e.jsx(qe,{children:e.jsx(Q,{onClick:o,className:"w-full",children:"Go to Login"})})]})})},mgt=()=>{const t=Ws(),[r]=Bc(),[s,n]=E.useState(r.get("code")||""),[a,o]=E.useState(""),[l,i]=E.useState(""),[d,m]=E.useState(""),[g,y]=E.useState(!1),[v,b]=E.useState(!1),[N,j]=E.useState(!1),[S,A]=E.useState(!1),[M,I]=E.useState(null),[F,O]=E.useState(null),[B,$]=E.useState(null),[H,W]=E.useState(null);E.useEffect(()=>{const le=r.get("code");le&&(n(le),X(le))},[r]);const X=async le=>{j(!0);const{data:ne,error:fe}=await Z.from("invite_codes").select("id, code, max_uses, uses_count, expires_at, is_active, brokerage_id, trial_days").eq("code",le.toUpperCase().trim()).single();if(fe||!ne){Se.error("Invalid invite code"),j(!1);return}if(!ne.is_active){Se.error("This invite code is no longer active"),j(!1);return}if(ne.max_uses&&ne.uses_count>=ne.max_uses){Se.error("This invite code has reached its maximum uses"),j(!1);return}if(ne.expires_at&&new Date(ne.expires_at){le.preventDefault(),X(s)},ae=async le=>{var ne;if(le.preventDefault(),!d.trim()){Se.error("Please enter your name");return}if(l.length<6){Se.error("Password must be at least 6 characters");return}b(!0);try{const fe=`${window.location.origin}/`,{data:oe,error:de}=await Z.auth.signUp({email:a.trim(),password:l,options:{emailRedirectTo:fe,data:{name:d.trim()}}});if(de){de.message.includes("already registered")?Se.error("This email is already registered. Please sign in instead."):Se.error(de.message);return}oe.user&&(await Z.rpc("add_default_signup_tag",{user_id:oe.user.id}),F?await Z.functions.invoke("assign-brokerage",{body:{userId:oe.user.id,brokerageId:F}}):H?await Z.functions.invoke("assign-brokerage",{body:{userId:oe.user.id,trialDays:H}}):await Z.functions.invoke("assign-brokerage",{body:{userId:oe.user.id,grandfathered:!0}}),M&&await Z.from("invite_codes").update({uses_count:((ne=(await Z.from("invite_codes").select("uses_count").eq("id",M).single()).data)==null?void 0:ne.uses_count)+1}).eq("id",M),Se.success("Account created! You can now access the dashboard."),t("/dashboard"))}catch(fe){console.error("Signup error:",fe),Se.error("An unexpected error occurred")}finally{b(!1)}};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs(ze,{className:"w-full max-w-md",children:[e.jsxs(Wt,{className:"text-center",children:[e.jsx(Zt,{className:"text-2xl font-bold text-primary",children:B?`Join ${B}`:"Join LevelUp"}),e.jsx(Ss,{children:S?B?`Create your account to join ${B}`:"Create your account to get started":"Enter your invite code to continue"})]}),e.jsx(qe,{children:S?e.jsxs("form",{onSubmit:ae,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"name",children:"Full Name"}),e.jsx(Qe,{id:"name",type:"text",placeholder:"John Doe",value:d,onChange:le=>m(le.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"email",children:"Email"}),e.jsx(Qe,{id:"email",type:"email",placeholder:"you@example.com",value:a,onChange:le=>o(le.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"password",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(Qe,{id:"password",type:g?"text":"password",placeholder:"••••••••",value:l,onChange:le=>i(le.target.value),required:!0,minLength:6}),e.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",onClick:()=>y(!g),children:g?e.jsx(zf,{className:"h-4 w-4"}):e.jsx(Gi,{className:"h-4 w-4"})})]})]}),e.jsx(Q,{type:"submit",className:"w-full",disabled:v,children:v?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating Account..."]}):"Create Account"})]}):e.jsxs("form",{onSubmit:se,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"inviteCode",children:"Invite Code"}),e.jsx(Qe,{id:"inviteCode",type:"text",placeholder:"Enter your invite code",value:s,onChange:le=>n(le.target.value),required:!0,autoFocus:!0})]}),e.jsx(Q,{type:"submit",className:"w-full",disabled:N,children:N?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"mr-2 h-4 w-4 animate-spin"}),"Verifying..."]}):"Verify Code"})]})})]})})},pgt="/assets/testimonial-avatar-1-BsCQFauB.jpg",fgt="/assets/testimonial-avatar-2-B6VPVc2t.jpg",ggt="/assets/testimonial-avatar-3-GuEFwYUE.jpg",xgt="/assets/testimonial-avatar-4-98iKMtkB.jpg",ygt="/assets/testimonial-avatar-5-ZsZfyxMX.jpg",vgt=[pgt,fgt,ggt,xgt,ygt],_gt=Pv({name:Do().trim().min(2,"Name must be at least 2 characters").max(100),email:Do().trim().email("Please enter a valid email address").max(255),phone:Do().trim().min(10,"Please enter a valid phone number").max(20).optional().or(GC("")),brokerage:Do().trim().max(200).optional().or(GC(""))}),bgt=[{icon:lp,title:"Academy Training",description:"Access a library of on-demand video training covering lead generation, marketing, technology, and more."},{icon:ed,title:"300+ Templates",description:"Professional Canva templates for social media, flyers, postcards, and marketing materials."},{icon:Mn,title:"Live Events",description:"Weekly live training sessions, workshops, and Q&A events with industry experts."},{icon:Pl,title:"Agent Community",description:"Connect with fellow agents, share wins, ask questions, and network in our private community."},{icon:fa,title:"Resource Kits",description:"Downloadable toolkits with scripts, checklists, guides, and everything you need to close more deals."},{icon:uo,title:"Social Swag",description:"Fresh social media content and designs updated regularly to help you stand out online."}],wgt=[{icon:ws,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:An,title:"Smart TouchPlans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:wi,title:"One-Tap Actions",description:"Call, text, or email contacts directly with pre-written scripts tailored to each relationship."},{icon:vm,title:"Birthday Alerts",description:"Never miss an important date—get reminders for birthdays and home anniversaries."},{icon:eo,title:"Pop-by Map",description:"See all your contacts on a map and plan efficient pop-by routes in your area."},{icon:Nc,title:"Momentum Tracking",description:"Track your touch streaks, weekly goals, and relationship health scores."},{icon:Ci,title:"Relationship Health",description:"Visual dashboard showing which contacts need attention based on last touch date."},{icon:Qg,title:"Daily Action Cards",description:"Wake up to a prioritized list of exactly who to reach out to today."}],jgt=[{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."}],kgt=()=>{const t=Ws(),[r,s]=E.useState(!1),[n,a]=E.useState({name:"",email:"",phone:"",brokerage:""}),[o,l]=E.useState({}),i=async d=>{var g,y;d.preventDefault(),l({});const m=_gt.safeParse(n);if(!m.success){const v={};m.error.errors.forEach(b=>{b.path[0]&&(v[b.path[0]]=b.message)}),l(v);return}s(!0);try{const{data:v,error:b}=await Z.functions.invoke("create-trial-signup",{body:{name:n.name.trim(),email:n.email.trim().toLowerCase(),phone:((g=n.phone)==null?void 0:g.trim())||void 0,brokerage:((y=n.brokerage)==null?void 0:y.trim())||void 0}});if(b){console.error("Trial signup error:",b),Se.error(b.message||"Something went wrong. Please try again.");return}if(v!=null&&v.error){Se.error(v.error);return}Se.success("🎉 Welcome aboard! Check your email to claim your account."),t("/trial/success")}catch(v){console.error("Trial signup error:",v),Se.error("Something went wrong. Please try again.")}finally{s(!1)}};return e.jsxs(e.Fragment,{children:[e.jsxs(qh,{children:[e.jsx("title",{children:"Start Your Free 7-Day Trial | LevelUp Dashboard"}),e.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."}),e.jsx("meta",{property:"og:title",content:"Start Your Free 7-Day Trial | LevelUp"}),e.jsx("meta",{property:"og:description",content:"Take LevelUp for a free 7-day test drive. No credit card required."}),e.jsx("meta",{property:"og:type",content:"website"})]}),e.jsxs("div",{className:"min-h-screen bg-background overflow-hidden",children:[e.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-[#4a6b6d] shadow-md",children:e.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center",children:e.jsx("img",{src:rre,alt:"LevelUp",className:"h-8 md:h-10"})}),e.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[e.jsx(Q,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var d;return(d=document.getElementById("features"))==null?void 0:d.scrollIntoView({behavior:"smooth"})},children:"Features"}),e.jsx(Q,{onClick:()=>t("/auth"),className:"bg-white text-[#4a6b6d] hover:bg-gray-100 font-medium shadow-md",children:"Sign In"})]})]})}),e.jsxs("section",{className:"relative pt-24 pb-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 opacity-10",children:e.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),e.jsx("div",{className:"container mx-auto px-4 relative",children:e.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[e.jsxs("div",{className:"space-y-8 text-center lg:text-left",children:[e.jsx("div",{className:"flex justify-center lg:justify-start",children:e.jsx("img",{alt:"LevelUp Consulting Group",className:"h-24 md:h-32 drop-shadow-lg",src:"/lovable-uploads/3a0c7ef9-9e79-411f-a9af-6f2a99e8bd7b.webp"})}),e.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:[e.jsx(An,{className:"h-4 w-4 text-yellow-400"}),e.jsx("span",{children:"7-Day Free Trial • No Credit Card Required"})]}),e.jsxs("h1",{className:"text-3xl md:text-4xl lg:text-5xl font-bold text-white leading-tight font-sans",children:["Take LevelUp for a"," ",e.jsx("span",{className:"italic",children:"Free Test Drive"})]}),e.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.",e.jsx("br",{}),e.jsx("em",{children:"The platform you need to keep it going."})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center lg:justify-start",children:[e.jsxs("div",{className:"flex items-center gap-2 text-white/80",children:[e.jsx(Li,{className:"h-5 w-5 text-green-400"}),e.jsx("span",{children:"No credit card required"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-white/80",children:[e.jsx(Li,{className:"h-5 w-5 text-green-400"}),e.jsx("span",{children:"Full access to all features"})]})]}),e.jsxs("div",{className:"flex items-center gap-4 justify-center lg:justify-start pt-4",children:[e.jsx("div",{className:"flex -space-x-3",children:vgt.map((d,m)=>e.jsx("img",{src:d,alt:`Agent ${m+1}`,className:"w-10 h-10 rounded-full border-2 border-white/20 object-cover"},m))}),e.jsxs("div",{children:[e.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(d=>e.jsx(Ln,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"},d))}),e.jsx("p",{className:"text-sm text-white/60",children:"Trusted by 3,000+ agents"})]})]})]}),e.jsx("div",{className:"lg:pl-8",children:e.jsx(ze,{className:"bg-white shadow-2xl border-0",children:e.jsxs(qe,{className:"p-8",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-[#4a6b6d] mb-4",children:e.jsx(Kg,{className:"h-8 w-8 text-white"})}),e.jsx("h2",{className:"text-2xl font-bold text-foreground font-sans",children:"Start Your Free Trial"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"Get instant access • No credit card needed"})]}),e.jsxs("form",{onSubmit:i,className:"space-y-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"name",children:"Full Name *"}),e.jsx(Qe,{id:"name",type:"text",placeholder:"John Smith",value:n.name,onChange:d=>a({...n,name:d.target.value}),required:!0}),o.name&&e.jsx("p",{className:"text-sm text-destructive",children:o.name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"email",children:"Email Address *"}),e.jsx(Qe,{id:"email",type:"email",placeholder:"john@example.com",value:n.email,onChange:d=>a({...n,email:d.target.value}),required:!0}),o.email&&e.jsx("p",{className:"text-sm text-destructive",children:o.email})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"phone",children:"Phone Number"}),e.jsx(Qe,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:n.phone,onChange:d=>a({...n,phone:d.target.value})}),o.phone&&e.jsx("p",{className:"text-sm text-destructive",children:o.phone})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"brokerage",children:"Brokerage Name"}),e.jsx(Qe,{id:"brokerage",type:"text",placeholder:"Your brokerage or team name",value:n.brokerage,onChange:d=>a({...n,brokerage:d.target.value})}),o.brokerage&&e.jsx("p",{className:"text-sm text-destructive",children:o.brokerage})]}),e.jsx(Q,{type:"submit",className:"w-full h-12 text-lg font-semibold bg-[#4a6b6d] hover:bg-[#3d5a5c]",disabled:r,children:r?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"mr-2 h-5 w-5 animate-spin"}),"Creating Your Account..."]}):e.jsxs(e.Fragment,{children:["Start My Free Trial",e.jsx(Hi,{className:"ml-2 h-5 w-5"})]})}),e.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["By signing up, you agree to our"," ",e.jsx("a",{href:"/terms-of-service",className:"text-[#4a6b6d] hover:underline",children:"Terms"})," ","and"," ",e.jsx("a",{href:"/privacy-policy",className:"text-[#4a6b6d] hover:underline",children:"Privacy Policy"})]})]})]})})})]})})]}),e.jsx("section",{className:"py-20 bg-background",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"max-w-4xl mx-auto text-center space-y-8",children:[e.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."}),e.jsxs("div",{className:"space-y-2 text-lg text-muted-foreground",children:[e.jsx("p",{children:"Agents get weekly coaching + plug-and-play marketing."}),e.jsx("p",{children:"Brokerages get higher adoption, consistency, and real engagement."})]}),e.jsx("p",{className:"text-2xl md:text-4xl text-[#4a6b6d] pt-4 font-sans font-bold",children:"LEVELUP EQUIPS BOTH TO THRIVE."})]})})}),e.jsx("section",{id:"features",className:"py-20 bg-muted/30",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[e.jsx("h2",{className:"text-3xl md:text-4xl mb-6 font-sans font-bold",children:"What's inside our members only portal?"}),e.jsx("p",{className:"text-lg text-muted-foreground",children:"Everything you need to grow your business, all in one place."})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 max-w-6xl mx-auto",children:bgt.map((d,m)=>e.jsxs(ze,{className:"group relative overflow-hidden border hover:border-[#4a6b6d]/50 transition-all duration-300 hover:shadow-lg bg-background",children:[e.jsxs(Wt,{children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#4a6b6d]/10 flex items-center justify-center mb-4",children:e.jsx(d.icon,{className:"w-7 h-7 text-[#4a6b6d]"})}),e.jsx(Zt,{className:"text-xl font-sans",children:d.title})]}),e.jsx(qe,{children:e.jsx("p",{className:"text-muted-foreground leading-relaxed",children:d.description})})]},m))})]})}),e.jsxs("section",{className:"py-20 bg-gradient-to-br from-[#4a6b6d] to-[#3d5a5c] relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 opacity-10",children:e.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),e.jsxs("div",{className:"container mx-auto px-4 relative",children:[e.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[e.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:[e.jsx(An,{className:"w-4 h-4"}),"Included with Your Trial"]}),e.jsxs("h2",{className:"text-3xl mb-6 text-white font-sans font-bold md:text-6xl",children:["Meet ",e.jsx("span",{className:"italic",children:"Agent OS"})]}),e.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."})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 max-w-6xl mx-auto",children:wgt.map((d,m)=>e.jsxs(ze,{className:"group relative overflow-hidden border-0 bg-white/10 backdrop-blur-sm hover:bg-white/20 transition-all duration-300",children:[e.jsxs(Wt,{className:"pb-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-white/20 flex items-center justify-center mb-3",children:e.jsx(d.icon,{className:"w-6 h-6 text-white"})}),e.jsx(Zt,{className:"text-lg font-semibold text-white",children:d.title})]}),e.jsx(qe,{children:e.jsx("p",{className:"text-white/70 text-sm leading-relaxed",children:d.description})})]},m))})]})]}),e.jsx("section",{className:"py-20 bg-background",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-4 font-sans",children:"Loved by Top Producers"}),e.jsx("p",{className:"text-lg text-muted-foreground",children:"See what agents are saying about LevelUp"})]}),e.jsx("div",{className:"grid md:grid-cols-3 gap-8 max-w-5xl mx-auto",children:jgt.map((d,m)=>e.jsx(ze,{className:"border hover:shadow-lg transition-shadow",children:e.jsxs(qe,{className:"p-6",children:[e.jsx("div",{className:"flex gap-1 mb-4",children:[1,2,3,4,5].map(g=>e.jsx(Ln,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"},g))}),e.jsxs("p",{className:"text-muted-foreground mb-4 italic",children:['"',d.quote,'"']}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:d.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:d.role})]})]})},m))})]})}),e.jsx("section",{className:"py-16 bg-muted/30",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"flex flex-wrap justify-center gap-8 md:gap-16",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center",children:e.jsx(Nu,{className:"h-6 w-6 text-[#4a6b6d]"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:"Secure & Private"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Bank-level encryption"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center",children:e.jsx(Qg,{className:"h-6 w-6 text-[#4a6b6d]"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:"Fast Setup"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Start in 2 minutes"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center",children:e.jsx(ws,{className:"h-6 w-6 text-[#4a6b6d]"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:"Expert Support"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Real estate pros"})]})]})]})})}),e.jsx("section",{id:"free-trial",className:"py-20 bg-background",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs(ze,{className:"bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] border-0 shadow-2xl overflow-hidden relative",children:[e.jsx("div",{className:"absolute inset-0 opacity-10",children:e.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),e.jsxs(qe,{className:"p-12 text-center relative",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-white mb-4 font-sans",children:"Ready to Level Up Your Business?"}),e.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."}),e.jsxs(Q,{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",e.jsx(Hi,{className:"ml-2 h-5 w-5"})]})]})]})})}),e.jsx("footer",{className:"bg-[#1e3a4c] py-12",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center gap-6",children:[e.jsx("img",{src:iye,alt:"LevelUp",className:"h-8"}),e.jsxs("div",{className:"flex gap-6 text-sm text-white/60",children:[e.jsx("a",{href:"/privacy-policy",className:"hover:text-white transition-colors",children:"Privacy Policy"}),e.jsx("a",{href:"/terms-of-service",className:"hover:text-white transition-colors",children:"Terms of Service"})]}),e.jsx("p",{className:"text-sm text-white/40",children:"© 2025 LevelUp Consulting Group. All rights reserved."})]})})})]})]})},Ngt=()=>{const t=Ws();return e.jsxs(e.Fragment,{children:[e.jsx(qh,{children:e.jsx("title",{children:"Welcome to LevelUp! | Check Your Email"})}),e.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[e.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-[#4a6b6d] shadow-md",children:e.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center",children:e.jsx("img",{src:rre,alt:"LevelUp",className:"h-8 md:h-10"})}),e.jsx(Q,{onClick:()=>t("/auth"),className:"bg-white text-[#4a6b6d] hover:bg-gray-100 font-medium shadow-md",children:"Sign In"})]})}),e.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:[e.jsx("div",{className:"absolute inset-0 opacity-10",children:e.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),e.jsx("div",{className:"container mx-auto px-4 relative",children:e.jsx("div",{className:"flex justify-center",children:e.jsx(ze,{className:"max-w-lg w-full bg-white shadow-2xl border-0",children:e.jsxs(qe,{className:"p-8 md:p-12 text-center",children:[e.jsxs("div",{className:"relative inline-block mb-8",children:[e.jsx("div",{className:"w-24 h-24 rounded-full bg-gradient-to-br from-[#4a6b6d] to-[#3d5a5c] flex items-center justify-center",children:e.jsx(Li,{className:"h-12 w-12 text-white"})}),e.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:e.jsx(td,{className:"h-5 w-5 text-white"})})]}),e.jsx("h1",{className:"text-3xl md:text-4xl font-bold text-foreground mb-4 font-sans",children:"You're In! 🎉"}),e.jsx("p",{className:"text-xl text-muted-foreground mb-8",children:"Your 7-day LevelUp adventure starts now!"}),e.jsxs("div",{className:"bg-[#4a6b6d]/10 rounded-xl p-6 mb-8",children:[e.jsxs("div",{className:"flex items-center justify-center gap-3 mb-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/20 flex items-center justify-center",children:e.jsx(mn,{className:"h-6 w-6 text-[#4a6b6d]"})}),e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Check Your Inbox"})]}),e.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!"})]}),e.jsxs("div",{className:"text-left space-y-3 mb-8",children:[e.jsx("p",{className:"text-sm text-muted-foreground font-medium uppercase tracking-wide",children:"What happens next:"}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d] flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("span",{className:"text-xs font-bold text-white",children:"1"})}),e.jsx("p",{className:"text-foreground",children:"Check your email for the welcome message"})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d] flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("span",{className:"text-xs font-bold text-white",children:"2"})}),e.jsx("p",{className:"text-foreground",children:'Click "Claim Your Account" to set your password'})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d] flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("span",{className:"text-xs font-bold text-white",children:"3"})}),e.jsx("p",{className:"text-foreground",children:"Start exploring all the features!"})]})]}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:["Didn't receive the email? Check your spam folder or"," ",e.jsx("button",{onClick:()=>t("/trial"),className:"text-[#4a6b6d] hover:underline font-medium",children:"try again"})]}),e.jsxs(Q,{onClick:()=>t("/auth"),className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:["Go to Sign In",e.jsx(Hi,{className:"ml-2 h-4 w-4"})]})]})})})})]}),e.jsx("footer",{className:"bg-[#1e3a4c] py-8",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center gap-4",children:[e.jsx("img",{src:iye,alt:"LevelUp",className:"h-8"}),e.jsxs("p",{className:"text-sm text-white/40",children:["© ",new Date().getFullYear()," LevelUp Consulting Group. All rights reserved."]})]})})})]})]})},Sgt=Pv({viewerName:Do().min(1,"Name is required").max(100,"Name must be less than 100 characters"),viewerEmail:Do().email("Please enter a valid email").max(255,"Email must be less than 255 characters"),viewerPhone:Do().max(20,"Phone must be less than 20 characters").optional(),message:Do().min(1,"Message is required").max(1e3,"Message must be less than 1000 characters")});function Cgt({shareToken:t,agentName:r,hasContact:s}){const[n,a]=E.useState(!1),[o,l]=E.useState(!1),[i,d]=E.useState(null),m=lae({resolver:cae(Sgt),defaultValues:{viewerName:"",viewerEmail:"",viewerPhone:"",message:""}}),g=async y=>{a(!0),d(null);try{const{data:v,error:b}=await Z.functions.invoke("video-reply-notify",{body:{shareToken:t,viewerName:y.viewerName,viewerEmail:y.viewerEmail,viewerPhone:y.viewerPhone||void 0,message:y.message}});if(b)throw new Error(b.message);if(!(v!=null&&v.success))throw new Error((v==null?void 0:v.error)||"Failed to send reply");l(!0)}catch(v){console.error("Failed to submit reply:",v),d(v.message||"Something went wrong. Please try again.")}finally{a(!1)}};return o?e.jsx(ze,{className:"border-2 border-primary/20 bg-gradient-to-br from-primary/5 to-primary/10",children:e.jsxs(qe,{className:"py-8 text-center",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/20 mb-4",children:e.jsx(Li,{className:"h-8 w-8 text-primary"})}),e.jsx("h3",{className:"text-xl font-semibold mb-2",children:"Message Sent!"}),e.jsxs("p",{className:"text-muted-foreground",children:[r?`${r} will`:"They'll"," get back to you soon."]})]})}):e.jsxs(ze,{children:[e.jsxs(Wt,{className:"pb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Pl,{className:"h-5 w-5 text-primary"}),e.jsx(Zt,{className:"text-lg",children:"Reply to this video"})]}),e.jsx(Ss,{children:s?`Have a question or want to connect? Send ${r||"them"} a message.`:`Interested? Share your info and ${r||"your agent"} will be in touch.`})]}),e.jsx(qe,{children:e.jsx(dae,{...m,children:e.jsxs("form",{onSubmit:m.handleSubmit(g),className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(zl,{control:m.control,name:"viewerName",render:({field:y})=>e.jsxs(Cl,{children:[e.jsx(Ml,{children:"Your Name *"}),e.jsx(Tl,{children:e.jsx(Qe,{placeholder:"John Smith",...y})}),e.jsx(Ju,{})]})}),e.jsx(zl,{control:m.control,name:"viewerEmail",render:({field:y})=>e.jsxs(Cl,{children:[e.jsx(Ml,{children:"Email *"}),e.jsx(Tl,{children:e.jsx(Qe,{type:"email",placeholder:"john@example.com",...y})}),e.jsx(Ju,{})]})})]}),!s&&e.jsx(zl,{control:m.control,name:"viewerPhone",render:({field:y})=>e.jsxs(Cl,{children:[e.jsx(Ml,{children:"Phone (optional)"}),e.jsx(Tl,{children:e.jsx(Qe,{type:"tel",placeholder:"(555) 123-4567",...y})}),e.jsx(Ju,{})]})}),e.jsx(zl,{control:m.control,name:"message",render:({field:y})=>e.jsxs(Cl,{children:[e.jsx(Ml,{children:"Message *"}),e.jsx(Tl,{children:e.jsx(Ks,{placeholder:s?"Thanks for the video! I had a question about...":"I'm interested in learning more about...",className:"min-h-[100px] resize-none",...y})}),e.jsx(Ju,{})]})}),i&&e.jsx("p",{className:"text-sm text-destructive",children:i}),e.jsx(Q,{type:"submit",className:"w-full gap-2",disabled:n,children:n?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"h-4 w-4 animate-spin"}),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Mi,{className:"h-4 w-4"}),"Send Message"]})})]})})})]})}const Mgt=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsxs("div",{className:"absolute inset-0 opacity-[0.08]",children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 h-[8%] bg-red-600"}),e.jsx("div",{className:"absolute top-[16%] left-0 right-0 h-[8%] bg-red-600"}),e.jsx("div",{className:"absolute top-[32%] left-0 right-0 h-[8%] bg-red-600"}),e.jsx("div",{className:"absolute top-[48%] left-0 right-0 h-[8%] bg-red-600"}),e.jsx("div",{className:"absolute top-[64%] left-0 right-0 h-[8%] bg-red-600"}),e.jsx("div",{className:"absolute top-[80%] left-0 right-0 h-[8%] bg-red-600"})]}),e.jsx("div",{className:"absolute top-0 left-0 w-[35%] h-[45%] bg-blue-900/10 rounded-br-3xl"}),e.jsx(Ln,{className:"absolute top-[5%] left-[8%] w-6 h-6 text-blue-600/30 fill-blue-600/20"}),e.jsx(Ln,{className:"absolute top-[15%] left-[20%] w-4 h-4 text-blue-600/25 fill-blue-600/15"}),e.jsx(Ln,{className:"absolute top-[8%] left-[28%] w-5 h-5 text-blue-600/30 fill-blue-600/20"}),e.jsx(Ln,{className:"absolute top-[25%] left-[12%] w-4 h-4 text-blue-600/20 fill-blue-600/10"}),e.jsx(Ln,{className:"absolute top-[20%] right-[15%] w-5 h-5 text-red-500/25 fill-red-500/15 animate-pulse"}),e.jsx(gy,{className:"absolute bottom-[20%] right-[10%] w-12 h-12 text-blue-600/15 rotate-12"})]}),Tgt=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-red-500/5 via-transparent to-blue-500/5"}),e.jsxs("div",{className:"absolute top-[10%] left-[15%] w-32 h-32",children:[e.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-red-400/20 animate-ping",style:{animationDuration:"3s"}}),e.jsx(An,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-8 h-8 text-red-400/40"})]}),e.jsxs("div",{className:"absolute top-[5%] right-[20%] w-24 h-24",children:[e.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-blue-400/20 animate-ping",style:{animationDuration:"4s",animationDelay:"1s"}}),e.jsx(Ln,{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"})]}),e.jsxs("div",{className:"absolute top-[20%] left-[50%] w-20 h-20",children:[e.jsx("div",{className:"absolute inset-0 rounded-full border border-white/10 animate-ping",style:{animationDuration:"3.5s",animationDelay:"0.5s"}}),e.jsx(An,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-5 h-5 text-amber-400/40"})]}),e.jsx(Ln,{className:"absolute bottom-[25%] left-[10%] w-6 h-6 text-blue-500/25 fill-blue-500/15 animate-pulse"}),e.jsx(Ln,{className:"absolute bottom-[15%] right-[15%] w-5 h-5 text-red-500/25 fill-red-500/15 animate-pulse",style:{animationDelay:"0.5s"}}),e.jsx(gy,{className:"absolute top-[8%] left-[5%] w-10 h-10 text-red-500/20 rotate-12"})]}),Agt=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-pink-200/20 via-rose-100/10 to-purple-200/15"}),e.jsx("div",{className:"absolute top-[5%] left-[5%] opacity-20",children:e.jsx(Tf,{className:"w-20 h-20 text-pink-400 rotate-12"})}),e.jsx("div",{className:"absolute top-[2%] right-[8%] opacity-15",children:e.jsx(Tf,{className:"w-16 h-16 text-rose-400 -rotate-12"})}),e.jsx("div",{className:"absolute bottom-[15%] left-[8%] opacity-15",children:e.jsx(Tf,{className:"w-14 h-14 text-purple-400 rotate-45"})}),e.jsx("div",{className:"absolute bottom-[20%] right-[5%] opacity-20",children:e.jsx(Tf,{className:"w-16 h-16 text-pink-300 -rotate-6"})}),e.jsx(Ci,{className:"absolute top-[15%] left-[30%] w-5 h-5 text-rose-300/40 fill-rose-300/20 animate-pulse"}),e.jsx(Ci,{className:"absolute top-[25%] right-[25%] w-4 h-4 text-pink-300/40 fill-pink-300/20 animate-pulse",style:{animationDelay:"0.3s"}}),e.jsx(Ci,{className:"absolute top-[10%] left-[60%] w-4 h-4 text-rose-400/30 fill-rose-400/15 animate-pulse",style:{animationDelay:"0.6s"}}),e.jsx("div",{className:"absolute top-[8%] left-[45%] w-8 h-8 rounded-full bg-pink-300/10 blur-sm"}),e.jsx("div",{className:"absolute bottom-[25%] right-[30%] w-6 h-6 rounded-full bg-rose-300/10 blur-sm"})]}),Egt=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-900/5 via-slate-800/3 to-indigo-900/5"}),e.jsx("div",{className:"absolute top-[5%] right-[10%] opacity-15",children:e.jsxs("div",{className:"w-12 h-24 relative",children:[e.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-10 h-3 bg-blue-600 rounded-full"}),e.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"})]})}),e.jsx(ql,{className:"absolute top-[8%] left-[12%] w-12 h-12 text-blue-600/15"}),e.jsx(Ln,{className:"absolute top-[15%] left-[22%] w-5 h-5 text-amber-500/25 fill-amber-500/15"}),e.jsx(ql,{className:"absolute bottom-[20%] right-[8%] w-14 h-14 text-indigo-500/12"}),e.jsx("div",{className:"absolute top-[3%] left-[40%] opacity-12",children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx("div",{className:"w-10 h-5 bg-slate-700 rounded-full rounded-tr-none rotate-6"}),e.jsx("div",{className:"w-10 h-5 bg-slate-700 rounded-full rounded-tl-none -rotate-6"})]})}),e.jsx(Ln,{className:"absolute bottom-[25%] left-[15%] w-6 h-6 text-blue-500/20 fill-blue-500/10 animate-pulse"}),e.jsx(Ln,{className:"absolute top-[20%] right-[22%] w-5 h-5 text-indigo-400/20 fill-indigo-400/10 animate-pulse",style:{animationDelay:"0.5s"}})]}),Igt=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-pink-100/20 via-purple-100/15 to-sky-100/20"}),e.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"}),e.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"}),e.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"}),e.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"}),e.jsx("div",{className:"absolute top-[10%] left-[10%] w-6 h-1 bg-white/30 rounded-full rotate-12"}),e.jsx("div",{className:"absolute top-[12%] right-[15%] w-5 h-1 bg-white/25 rounded-full -rotate-6"}),e.jsx(Tf,{className:"absolute top-[20%] left-[32%] w-7 h-7 text-purple-400/30"}),e.jsx(Tf,{className:"absolute top-[12%] right-[28%] w-6 h-6 text-pink-400/30"}),e.jsx(RS,{className:"absolute top-[18%] left-[52%] w-5 h-5 text-sky-400/35"})]}),Pgt=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-orange-900/12 via-purple-900/8 to-slate-900/12"}),e.jsx(Uj,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-orange-400/25"}),e.jsx(Uj,{className:"absolute top-[10%] right-[12%] w-12 h-12 text-purple-400/20 animate-pulse"}),e.jsxs("div",{className:"absolute bottom-[18%] left-[8%]",children:[e.jsx("div",{className:"w-14 h-12 rounded-full bg-orange-500/20"}),e.jsx("div",{className:"absolute -top-2 left-1/2 -translate-x-1/2 w-2 h-4 bg-green-600/25 rounded-t-full"})]}),e.jsxs("div",{className:"absolute bottom-[22%] right-[12%]",children:[e.jsx("div",{className:"w-12 h-10 rounded-full bg-orange-400/15"}),e.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"})]}),e.jsx("div",{className:"absolute top-[15%] left-[40%] opacity-20",children:e.jsx("svg",{viewBox:"0 0 24 12",className:"w-10 h-5 text-slate-800 fill-current",children:e.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"})})}),e.jsx(An,{className:"absolute top-[8%] left-[55%] w-6 h-6 text-purple-400/35 animate-pulse"}),e.jsx(An,{className:"absolute bottom-[28%] right-[25%] w-5 h-5 text-orange-400/30 animate-pulse",style:{animationDelay:"0.5s"}})]}),Lgt=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-red-900/8 via-green-900/5 to-emerald-900/8"}),e.jsx(rv,{className:"absolute bottom-[8%] left-[5%] w-20 h-20 text-green-600/18"}),e.jsx(rv,{className:"absolute bottom-[12%] right-[8%] w-16 h-16 text-emerald-600/15"}),e.jsx(rv,{className:"absolute bottom-[10%] left-[28%] w-12 h-12 text-green-500/12"}),e.jsx(T1,{className:"absolute top-[5%] left-[15%] w-10 h-10 text-sky-300/30 animate-pulse"}),e.jsx(T1,{className:"absolute top-[10%] right-[20%] w-8 h-8 text-blue-300/25 animate-pulse",style:{animationDelay:"0.3s"}}),e.jsx(T1,{className:"absolute top-[18%] left-[45%] w-6 h-6 text-sky-200/25 animate-pulse",style:{animationDelay:"0.6s"}}),e.jsx(T1,{className:"absolute top-[8%] left-[70%] w-8 h-8 text-blue-200/20 animate-pulse",style:{animationDelay:"0.9s"}}),e.jsx("div",{className:"absolute top-[12%] left-[10%] w-5 h-5 rounded-full bg-red-500/25"}),e.jsx("div",{className:"absolute top-[15%] right-[15%] w-4 h-4 rounded-full bg-amber-400/25"}),e.jsx("div",{className:"absolute top-[20%] left-[55%] w-4 h-4 rounded-full bg-green-500/20"}),e.jsx(Ln,{className:"absolute top-[3%] left-[50%] -translate-x-1/2 w-10 h-10 text-amber-400/35 fill-amber-400/25"})]}),Ogt=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-orange-900/10 via-amber-800/6 to-red-900/10"}),e.jsx("div",{className:"absolute top-[5%] left-[10%] w-10 h-8 rounded-full bg-orange-500/25 rotate-45"}),e.jsx("div",{className:"absolute top-[10%] right-[15%] w-8 h-6 rounded-full bg-red-500/20 -rotate-12"}),e.jsx("div",{className:"absolute top-[15%] left-[35%] w-7 h-5 rounded-full bg-amber-500/22 rotate-30"}),e.jsx("div",{className:"absolute bottom-[18%] left-[12%] w-10 h-7 rounded-full bg-yellow-600/18 -rotate-45"}),e.jsx("div",{className:"absolute bottom-[22%] right-[10%] w-9 h-6 rounded-full bg-orange-600/15 rotate-12"}),e.jsxs("div",{className:"absolute bottom-[12%] left-[50%] -translate-x-1/2",children:[e.jsx("div",{className:"w-16 h-14 rounded-full bg-orange-400/15"}),e.jsx("div",{className:"absolute -top-2 left-1/2 -translate-x-1/2 w-2 h-5 bg-green-600/18 rounded-t-full"})]}),e.jsx(Ci,{className:"absolute top-[8%] left-[55%] w-6 h-6 text-red-400/22 fill-red-400/12"}),e.jsx(Ci,{className:"absolute top-[20%] right-[25%] w-5 h-5 text-orange-400/22 fill-orange-400/12"})]}),Dgt=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-yellow-900/8 via-amber-900/4 to-purple-900/8"}),e.jsx(Ln,{className:"absolute top-[5%] left-[15%] w-12 h-12 text-yellow-400/35 fill-yellow-400/25 animate-pulse"}),e.jsx(Ln,{className:"absolute top-[8%] right-[12%] w-10 h-10 text-amber-400/30 fill-amber-400/20 animate-pulse",style:{animationDelay:"0.3s"}}),e.jsx(Ln,{className:"absolute top-[15%] left-[40%] w-7 h-7 text-yellow-300/25 fill-yellow-300/15 animate-pulse",style:{animationDelay:"0.6s"}}),e.jsx(Ln,{className:"absolute top-[12%] right-[35%] w-8 h-8 text-amber-300/28 fill-amber-300/18 animate-pulse",style:{animationDelay:"0.9s"}}),e.jsx("div",{className:"absolute top-[20%] left-[25%] w-4 h-4 rounded-full bg-pink-400/30"}),e.jsx("div",{className:"absolute top-[18%] right-[30%] w-3 h-3 rounded-full bg-sky-400/30"}),e.jsx("div",{className:"absolute top-[25%] left-[60%] w-2.5 h-2.5 rounded-full bg-emerald-400/30"}),e.jsx("div",{className:"absolute top-[22%] right-[42%] w-3 h-3 rounded-full bg-purple-400/30"}),e.jsx(An,{className:"absolute top-[3%] left-[50%] w-10 h-10 text-yellow-400/40"}),e.jsx(td,{className:"absolute bottom-[18%] left-[10%] w-12 h-12 text-purple-400/18 rotate-12"}),e.jsx(td,{className:"absolute bottom-[20%] right-[12%] w-10 h-10 text-amber-400/15 -rotate-12"})]}),Rgt=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-900/10 via-indigo-900/6 to-sky-900/10"}),e.jsxs("div",{className:"absolute bottom-[12%] left-1/2 -translate-x-1/2 flex items-end gap-3",children:[e.jsx("div",{className:"w-2 h-14 bg-blue-400/18 rounded-full"}),e.jsx("div",{className:"w-2 h-12 bg-blue-300/15 rounded-full"}),e.jsx("div",{className:"w-2 h-16 bg-blue-400/20 rounded-full"}),e.jsx("div",{className:"w-2.5 h-20 bg-blue-500/22 rounded-full"})," ",e.jsx("div",{className:"w-2 h-16 bg-blue-400/20 rounded-full"}),e.jsx("div",{className:"w-2 h-12 bg-blue-300/15 rounded-full"}),e.jsx("div",{className:"w-2 h-14 bg-blue-400/18 rounded-full"})]}),e.jsx("div",{className:"absolute bottom-[38%] left-[calc(50%-42px)] w-3 h-4 bg-yellow-400/30 rounded-full blur-sm"}),e.jsx("div",{className:"absolute bottom-[35%] left-[calc(50%-28px)] w-2.5 h-3 bg-yellow-300/25 rounded-full blur-sm"}),e.jsx("div",{className:"absolute bottom-[40%] left-[calc(50%-14px)] w-3 h-4 bg-amber-400/30 rounded-full blur-sm"}),e.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"}),e.jsx(Ln,{className:"absolute top-[8%] left-[50%] -translate-x-1/2 w-14 h-14 text-yellow-400/28 fill-yellow-400/18"}),e.jsx(An,{className:"absolute top-[5%] left-[20%] w-7 h-7 text-blue-400/35"}),e.jsx(An,{className:"absolute top-[10%] right-[18%] w-6 h-6 text-sky-400/30"})]}),Fgt=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-green-900/12 via-emerald-900/6 to-teal-900/10"}),e.jsx(oy,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-green-500/25"}),e.jsx(oy,{className:"absolute top-[8%] right-[12%] w-12 h-12 text-emerald-500/20"}),e.jsx(oy,{className:"absolute bottom-[18%] left-[12%] w-14 h-14 text-green-400/22"}),e.jsx(oy,{className:"absolute bottom-[22%] right-[10%] w-11 h-11 text-emerald-400/18"}),e.jsx("div",{className:"absolute top-[15%] left-[35%] w-6 h-6 rounded-full bg-yellow-500/30 border-2 border-yellow-600/25"}),e.jsx("div",{className:"absolute top-[20%] right-[28%] w-5 h-5 rounded-full bg-amber-500/25 border-2 border-amber-600/20"}),e.jsx("div",{className:"absolute bottom-[28%] left-[45%] w-5 h-5 rounded-full bg-yellow-400/25 border-2 border-yellow-500/20"}),e.jsx("div",{className:"absolute top-0 right-0 w-48 h-48 opacity-12 rounded-bl-full overflow-hidden",children:e.jsx("div",{className:"absolute inset-0 bg-gradient-to-bl from-red-400/60 via-yellow-400/60 to-green-400/60"})}),e.jsxs("div",{className:"absolute bottom-[10%] right-[5%] opacity-15",children:[e.jsx("div",{className:"w-12 h-8 bg-slate-700 rounded-b-full"}),e.jsx("div",{className:"absolute -top-1 left-1/2 -translate-x-1/2 w-10 h-3 bg-slate-600 rounded-full"}),e.jsxs("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 flex gap-0.5",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-yellow-400"}),e.jsx("div",{className:"w-2 h-2 rounded-full bg-amber-400"}),e.jsx("div",{className:"w-2 h-2 rounded-full bg-yellow-400"})]})]})]}),zgt=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-900/10 via-indigo-900/6 to-sky-900/10"}),e.jsx("div",{className:"absolute top-[8%] left-[12%] w-16 h-16 rounded-full border-4 border-blue-500/18"}),e.jsx("div",{className:"absolute top-[10%] right-[10%] w-14 h-14 rounded-full border-4 border-indigo-500/15"}),e.jsx("div",{className:"absolute bottom-[18%] left-[18%] w-12 h-12 rounded-full border-3 border-sky-500/12"}),e.jsx(Ln,{className:"absolute top-[5%] left-[42%] w-10 h-10 text-amber-400/30 fill-amber-400/20"}),e.jsx(Ln,{className:"absolute top-[15%] right-[25%] w-7 h-7 text-yellow-400/25 fill-yellow-400/15"}),e.jsx(ql,{className:"absolute bottom-[20%] right-[12%] w-12 h-12 text-blue-500/18"}),e.jsx(ql,{className:"absolute top-[18%] left-[28%] w-8 h-8 text-indigo-400/15"}),e.jsx(gy,{className:"absolute top-[8%] left-[60%] w-10 h-10 text-indigo-400/18"})]}),Bgt=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-900/6 via-rose-900/6 to-purple-900/6"}),e.jsx(vm,{className:"absolute bottom-[10%] left-[50%] -translate-x-1/2 w-20 h-20 text-amber-400/18"}),e.jsxs("div",{className:"absolute top-[5%] left-[15%]",children:[e.jsx("div",{className:"w-12 h-14 rounded-full bg-rose-400/25"}),e.jsx("div",{className:"w-0.5 h-10 bg-rose-400/18 mx-auto"})]}),e.jsxs("div",{className:"absolute top-[3%] left-[25%]",children:[e.jsx("div",{className:"w-10 h-12 rounded-full bg-sky-400/25"}),e.jsx("div",{className:"w-0.5 h-12 bg-sky-400/18 mx-auto"})]}),e.jsxs("div",{className:"absolute top-[8%] right-[18%]",children:[e.jsx("div",{className:"w-11 h-13 rounded-full bg-purple-400/25"}),e.jsx("div",{className:"w-0.5 h-9 bg-purple-400/18 mx-auto"})]}),e.jsxs("div",{className:"absolute top-[5%] right-[10%]",children:[e.jsx("div",{className:"w-10 h-12 rounded-full bg-amber-400/25"}),e.jsx("div",{className:"w-0.5 h-11 bg-amber-400/18 mx-auto"})]}),e.jsx("div",{className:"absolute top-[20%] left-[35%] w-3 h-3 bg-pink-400/35 rounded-full"}),e.jsx("div",{className:"absolute top-[18%] right-[40%] w-2.5 h-2.5 bg-emerald-400/35 rounded-full"}),e.jsx("div",{className:"absolute top-[25%] left-[55%] w-2 h-2 bg-amber-400/35 rounded-full"}),e.jsx("div",{className:"absolute top-[22%] right-[30%] w-2.5 h-2.5 bg-sky-400/35 rounded-full"}),e.jsx(td,{className:"absolute top-[8%] left-[45%] w-10 h-10 text-purple-400/22 rotate-12"}),e.jsx(uo,{className:"absolute bottom-[18%] right-[15%] w-12 h-12 text-rose-400/18"})]}),$gt=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-rose-900/12 via-pink-900/8 to-red-900/12"}),e.jsx(Ci,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-rose-400/28 fill-rose-400/18"}),e.jsx(Ci,{className:"absolute top-[8%] right-[12%] w-14 h-14 text-pink-400/25 fill-pink-400/15"}),e.jsx(Ci,{className:"absolute bottom-[15%] left-[12%] w-12 h-12 text-red-400/22 fill-red-400/12"}),e.jsx(Ci,{className:"absolute bottom-[18%] right-[10%] w-13 h-13 text-rose-300/25 fill-rose-300/15"}),e.jsx(Ci,{className:"absolute top-[15%] left-[30%] w-6 h-6 text-pink-300/35 fill-pink-300/20 animate-pulse"}),e.jsx(Ci,{className:"absolute top-[20%] right-[35%] w-5 h-5 text-rose-300/35 fill-rose-300/20 animate-pulse",style:{animationDelay:"0.3s"}}),e.jsx(Ci,{className:"absolute top-[12%] left-[55%] w-5 h-5 text-red-300/30 fill-red-300/15 animate-pulse",style:{animationDelay:"0.6s"}}),e.jsx(Ci,{className:"absolute top-[25%] right-[25%] w-4 h-4 text-pink-400/30 fill-pink-400/15 animate-pulse",style:{animationDelay:"0.9s"}}),e.jsx("div",{className:"absolute top-[18%] left-[45%] w-8 h-8 rounded-full bg-rose-300/18 blur-sm"}),e.jsx("div",{className:"absolute bottom-[25%] right-[40%] w-6 h-6 rounded-full bg-pink-300/15 blur-sm"})]}),Ugt=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-900/10 via-yellow-900/6 to-orange-900/10"}),e.jsxs("div",{className:"absolute top-[5%] right-[12%]",children:[e.jsx("div",{className:"w-24 h-24 rounded-full bg-yellow-400/25 blur-sm"}),e.jsx(tv,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-14 h-14 text-amber-400/45"})]}),e.jsx("div",{className:"absolute bottom-[12%] left-[20%] w-20 h-10 bg-slate-800/12 rounded-full blur-md"}),e.jsx(tv,{className:"absolute top-[15%] left-[18%] w-10 h-10 text-yellow-400/30"}),e.jsx(An,{className:"absolute top-[10%] left-[42%] w-7 h-7 text-amber-400/35"}),e.jsx(tv,{className:"absolute bottom-[22%] right-[25%] w-8 h-8 text-orange-400/25"}),e.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-[15%] bg-gradient-to-t from-amber-900/10 to-transparent"})]}),qgt=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-teal-900/10 via-cyan-900/6 to-emerald-900/10"}),e.jsx(Wn,{className:"absolute top-[8%] left-[10%] w-14 h-14 text-teal-500/22"}),e.jsx(Wn,{className:"absolute bottom-[15%] right-[8%] w-16 h-16 text-emerald-500/18"}),e.jsx(wm,{className:"absolute top-[12%] right-[18%] w-10 h-10 text-amber-400/25"}),e.jsx(wm,{className:"absolute bottom-[22%] left-[22%] w-8 h-8 text-yellow-400/22"}),e.jsx(Ci,{className:"absolute top-[18%] left-[40%] w-6 h-6 text-rose-400/22 fill-rose-400/12"}),e.jsx(Ci,{className:"absolute top-[22%] right-[35%] w-5 h-5 text-teal-400/20 fill-teal-400/10"}),e.jsx(An,{className:"absolute top-[5%] left-[55%] w-8 h-8 text-teal-400/30"}),e.jsx(td,{className:"absolute bottom-[20%] left-[48%] w-10 h-10 text-cyan-400/18 rotate-12"})]}),Vgt=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-emerald-900/10 via-teal-900/6 to-cyan-900/10"}),e.jsx(td,{className:"absolute top-[5%] left-[12%] w-14 h-14 text-emerald-400/25 rotate-12"}),e.jsx(td,{className:"absolute top-[8%] right-[10%] w-12 h-12 text-teal-400/22 -rotate-12"}),e.jsx(wm,{className:"absolute bottom-[18%] left-[18%] w-12 h-12 text-amber-400/25"}),e.jsx(Wn,{className:"absolute bottom-[15%] right-[12%] w-14 h-14 text-teal-500/18"}),e.jsx(An,{className:"absolute top-[15%] left-[42%] w-10 h-10 text-emerald-400/35"}),e.jsx(An,{className:"absolute top-[20%] right-[32%] w-7 h-7 text-cyan-400/30"}),e.jsx("div",{className:"absolute top-[25%] left-[55%] w-3 h-3 bg-amber-400/30 rounded-full"}),e.jsx("div",{className:"absolute top-[22%] right-[42%] w-2.5 h-2.5 bg-teal-400/30 rounded-full"}),e.jsx("div",{className:"absolute top-[28%] left-[35%] w-2 h-2 bg-emerald-400/30 rounded-full"})]}),Hgt=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-900/10 via-yellow-900/6 to-orange-900/10"}),e.jsx(wm,{className:"absolute bottom-[12%] left-[50%] -translate-x-1/2 w-24 h-24 text-amber-400/25 rotate-45"}),e.jsx(wm,{className:"absolute top-[10%] left-[12%] w-10 h-10 text-yellow-400/30"}),e.jsx(wm,{className:"absolute top-[12%] right-[15%] w-9 h-9 text-amber-300/25"}),e.jsx(Wn,{className:"absolute top-[8%] left-[42%] w-12 h-12 text-teal-500/18"}),e.jsx(td,{className:"absolute bottom-[22%] right-[18%] w-12 h-12 text-orange-400/18 rotate-12"}),e.jsx(An,{className:"absolute top-[5%] right-[35%] w-8 h-8 text-yellow-400/35"}),e.jsx(Ln,{className:"absolute top-[18%] left-[28%] w-6 h-6 text-amber-400/25 fill-amber-400/15"})]}),Wgt=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-teal-900/10 via-emerald-900/6 to-green-900/10"}),e.jsx(Wn,{className:"absolute bottom-[10%] left-[50%] -translate-x-1/2 w-20 h-20 text-teal-500/22"}),e.jsx("div",{className:"absolute bottom-[18%] left-[12%] w-12 h-10 bg-amber-400/18 rounded-sm"}),e.jsx("div",{className:"absolute bottom-[20%] left-[20%] w-10 h-8 bg-orange-400/15 rounded-sm"}),e.jsx("div",{className:"absolute bottom-[16%] right-[15%] w-11 h-9 bg-amber-300/18 rounded-sm"}),e.jsx(wm,{className:"absolute top-[10%] right-[12%] w-10 h-10 text-amber-400/28"}),e.jsx(Ci,{className:"absolute top-[8%] left-[18%] w-8 h-8 text-rose-400/25 fill-rose-400/15"}),e.jsx(An,{className:"absolute top-[12%] left-[45%] w-8 h-8 text-teal-400/30"}),e.jsx(Bj,{className:"absolute top-[15%] right-[28%] w-10 h-10 text-emerald-400/20"})]}),r4e=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute top-4 left-[10%] w-3 h-3 bg-amber-400/60 rounded-full animate-pulse"}),e.jsx("div",{className:"absolute top-12 right-[15%] w-2 h-2 bg-rose-400/60 rounded-full animate-pulse delay-100"}),e.jsx("div",{className:"absolute top-8 left-[30%] w-2.5 h-2.5 bg-sky-400/60 rounded-full animate-pulse delay-200"}),e.jsx("div",{className:"absolute top-16 right-[25%] w-2 h-2 bg-emerald-400/60 rounded-full animate-pulse delay-300"})]}),Ggt=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx(Ci,{className:"absolute top-6 left-[12%] w-4 h-4 text-rose-300/50 fill-rose-300/30 animate-pulse"}),e.jsx(Ci,{className:"absolute top-10 right-[18%] w-3 h-3 text-pink-300/50 fill-pink-300/30 animate-pulse delay-150"}),e.jsx(Ci,{className:"absolute top-4 left-[40%] w-2.5 h-2.5 text-rose-400/40 fill-rose-400/20 animate-pulse delay-300"}),e.jsx(Ci,{className:"absolute top-14 right-[35%] w-3.5 h-3.5 text-pink-300/40 fill-pink-300/20 animate-pulse delay-200"})]}),Kgt=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx(Bj,{className:"absolute top-5 left-[10%] w-4 h-4 text-blue-400/50 animate-pulse"}),e.jsx(An,{className:"absolute top-10 right-[15%] w-3 h-3 text-amber-400/50 animate-pulse delay-100"}),e.jsx(Wn,{className:"absolute top-8 left-[38%] w-3 h-3 text-teal-300/40 animate-pulse delay-200"})]}),Zgt=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx(Fj,{className:"absolute top-5 left-[12%] w-4 h-4 text-amber-500/50 animate-pulse"}),e.jsx(GS,{className:"absolute top-10 right-[15%] w-3 h-3 text-rose-400/50 animate-pulse delay-100"}),e.jsx(Fj,{className:"absolute top-8 left-[40%] w-3 h-3 text-amber-400/40 animate-pulse delay-200"})]}),kT=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx(An,{className:"absolute top-5 left-[10%] w-4 h-4 text-emerald-400/50 animate-pulse"}),e.jsx(td,{className:"absolute top-10 right-[12%] w-5 h-5 text-amber-400/50 animate-pulse delay-150"}),e.jsx(An,{className:"absolute top-8 left-[45%] w-3 h-3 text-sky-400/40 animate-pulse delay-300"})]}),s4e=()=>e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx(Wn,{className:"absolute top-6 left-[12%] w-4 h-4 text-teal-400/40 animate-pulse"}),e.jsx(An,{className:"absolute top-10 right-[15%] w-3 h-3 text-emerald-400/50 animate-pulse delay-100"}),e.jsx(Wn,{className:"absolute top-4 right-[40%] w-3 h-3 text-cyan-400/30 animate-pulse delay-200"})]}),Rme=[{id:"default",name:"Classic",description:"Clean, professional look for any occasion",icon:e.jsx(An,{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:e.jsx(Ci,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Thank You, ${t}!`:"Thank You!",subText:"Your support means the world to me",gradientClasses:"from-rose-50/70 via-pink-50/50 to-red-50/40 dark:from-rose-950/30 dark:via-pink-950/20 dark:to-red-950/20",accentColor:"rose",decorativeElement:e.jsx(Ggt,{})},{id:"thinking_of_you",name:"Thinking of You",description:"Let them know they're on your mind",icon:e.jsx(fA,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Thinking of You, ${t}`:"Thinking of You",subText:"Just wanted to reach out and say hello",gradientClasses:"from-violet-50/70 via-purple-50/50 to-indigo-50/40 dark:from-violet-950/30 dark:via-purple-950/20 dark:to-indigo-950/20",accentColor:"violet",decorativeElement:e.jsx(kT,{})},{id:"check_in",name:"Check-in",description:"Touch base with your contacts",icon:e.jsx(Fj,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Hey ${t}!`:"Hey There!",subText:"Just checking in to see how you're doing",gradientClasses:"from-amber-50/70 via-orange-50/50 to-yellow-50/40 dark:from-amber-950/30 dark:via-orange-950/20 dark:to-yellow-950/20",accentColor:"amber",decorativeElement:e.jsx(Zgt,{})},{id:"market_update",name:"Market Update",description:"Share real estate market insights",icon:e.jsx(Nc,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Market Update for ${t}`:"Market Update",subText:"The latest insights from your local market",gradientClasses:"from-blue-50/70 via-indigo-50/50 to-sky-50/40 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-sky-950/20",accentColor:"blue"},{id:"referral_thank_you",name:"Referral Thank You",description:"Thank someone for a referral",icon:e.jsx(ws,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Thank You for the Referral, ${t}!`:"Thank You for the Referral!",subText:"Your trust in me means everything",gradientClasses:"from-emerald-50/70 via-green-50/50 to-teal-50/40 dark:from-emerald-950/30 dark:via-green-950/20 dark:to-teal-950/20",accentColor:"emerald",decorativeElement:e.jsx(kT,{})},{id:"congratulations",name:"Congratulations",description:"Celebrate their achievements",icon:e.jsx(ql,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Congratulations, ${t}!`:"Congratulations!",subText:"So proud of your accomplishment",gradientClasses:"from-amber-50/70 via-yellow-50/50 to-orange-50/40 dark:from-amber-950/30 dark:via-yellow-950/20 dark:to-orange-950/20",accentColor:"amber",decorativeElement:e.jsx(r4e,{})},{id:"welcome_neighborhood",name:"Welcome to the Neighborhood",description:"Greet new neighbors",icon:e.jsx(eo,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Welcome to the Neighborhood, ${t}!`:"Welcome to the Neighborhood!",subText:"So excited to have you as our new neighbor",gradientClasses:"from-teal-50/70 via-cyan-50/50 to-sky-50/40 dark:from-teal-950/30 dark:via-cyan-950/20 dark:to-sky-950/20",accentColor:"teal",decorativeElement:e.jsx(s4e,{})},{id:"just_because",name:"Just Because",description:"No reason needed to connect",icon:e.jsx(GS,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Hey ${t}!`:"Hey There!",subText:"No reason needed – just wanted to connect",gradientClasses:"from-sky-50/70 via-blue-50/50 to-indigo-50/40 dark:from-sky-950/30 dark:via-blue-950/20 dark:to-indigo-950/20",accentColor:"sky",decorativeElement:e.jsx(kT,{})},{id:"birthday",name:"Birthday",description:"Celebrate their special day",icon:e.jsx(vm,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Birthday, ${t}!`:"Happy Birthday!",subText:"Wishing you an amazing year ahead",gradientClasses:"from-amber-50/80 via-rose-50/60 to-purple-50/40 dark:from-amber-950/30 dark:via-rose-950/20 dark:to-purple-950/20",accentColor:"amber",decorativeElement:e.jsx(Bgt,{})},{id:"valentines_day",name:"Valentine's Day",description:"Show appreciation on this special day",icon:e.jsx(Ci,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Valentine's Day, ${t}!`:"Happy Valentine's Day!",subText:"A heartfelt message from your real estate professional",gradientClasses:"from-rose-50/80 via-pink-50/60 to-red-50/40 dark:from-rose-950/30 dark:via-pink-950/20 dark:to-red-950/20",accentColor:"rose",decorativeElement:e.jsx($gt,{})},{id:"groundhog_day",name:"Groundhog Day",description:"A fun seasonal greeting",icon:e.jsx(tv,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Groundhog Day, ${t}!`:"Happy Groundhog Day!",subText:"Wishing you an early spring!",gradientClasses:"from-amber-50/70 via-yellow-50/50 to-orange-50/40 dark:from-amber-950/30 dark:via-yellow-950/20 dark:to-orange-950/20",accentColor:"amber",decorativeElement:e.jsx(Ugt,{})},{id:"new_years",name:"New Year's Day",description:"Ring in the new year",icon:e.jsx(Ln,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy New Year, ${t}!`:"Happy New Year!",subText:"Wishing you a year full of success and happiness",gradientClasses:"from-yellow-50/70 via-amber-50/50 to-orange-50/40 dark:from-yellow-950/30 dark:via-amber-950/20 dark:to-orange-950/20",accentColor:"yellow",decorativeElement:e.jsx(Dgt,{})},{id:"easter",name:"Easter",description:"Celebrate the spring season",icon:e.jsx(RS,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Easter, ${t}!`:"Happy Easter!",subText:"Wishing you a joyful celebration",gradientClasses:"from-pink-50/70 via-purple-50/50 to-sky-50/40 dark:from-pink-950/30 dark:via-purple-950/20 dark:to-sky-950/20",accentColor:"pink",decorativeElement:e.jsx(Igt,{})},{id:"mothers_day",name:"Mother's Day",description:"Celebrate the amazing moms",icon:e.jsx(Tf,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Mother's Day, ${t}!`:"Happy Mother's Day!",subText:"Celebrating the wonderful mothers in our lives",gradientClasses:"from-pink-50/70 via-rose-50/50 to-purple-50/40 dark:from-pink-950/30 dark:via-rose-950/20 dark:to-purple-950/20",accentColor:"pink",decorativeElement:e.jsx(Agt,{})},{id:"fathers_day",name:"Father's Day",description:"Celebrate the amazing dads",icon:e.jsx(ql,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Father's Day, ${t}!`:"Happy Father's Day!",subText:"Celebrating the wonderful fathers in our lives",gradientClasses:"from-blue-50/70 via-sky-50/50 to-indigo-50/40 dark:from-blue-950/30 dark:via-sky-950/20 dark:to-indigo-950/20",accentColor:"blue",decorativeElement:e.jsx(Egt,{})},{id:"memorial_day",name:"Memorial Day",description:"Honor those who served",icon:e.jsx(gy,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Memorial Day, ${t}`:"Happy Memorial Day",subText:"Honoring those who served our country",gradientClasses:"from-red-50/60 via-white to-blue-50/60 dark:from-red-950/30 dark:via-slate-950/20 dark:to-blue-950/30",accentColor:"blue",decorativeElement:e.jsx(Mgt,{})},{id:"independence_day",name:"4th of July",description:"Celebrate Independence Day",icon:e.jsx(_m,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy 4th of July, ${t}!`:"Happy 4th of July!",subText:"Celebrating freedom and independence",gradientClasses:"from-red-50/70 via-white to-blue-50/70 dark:from-red-950/30 dark:via-slate-950/10 dark:to-blue-950/30",accentColor:"red",decorativeElement:e.jsx(Tgt,{})},{id:"labor_day",name:"Labor Day",description:"Celebrate the workers",icon:e.jsx(ql,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Labor Day, ${t}!`:"Happy Labor Day!",subText:"Celebrating the hard work that builds our communities",gradientClasses:"from-blue-50/70 via-indigo-50/50 to-sky-50/40 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-sky-950/20",accentColor:"blue",decorativeElement:e.jsx(zgt,{})},{id:"halloween",name:"Halloween",description:"Spooky seasonal greetings",icon:e.jsx(Uj,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Halloween, ${t}!`:"Happy Halloween!",subText:"Have a spooktacular day!",gradientClasses:"from-orange-50/70 via-amber-50/50 to-purple-50/40 dark:from-orange-950/30 dark:via-amber-950/20 dark:to-purple-950/30",accentColor:"orange",decorativeElement:e.jsx(Pgt,{})},{id:"thanksgiving",name:"Thanksgiving",description:"Express gratitude this season",icon:e.jsx(Ci,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Thanksgiving, ${t}!`:"Happy Thanksgiving!",subText:"Grateful for you and your friendship",gradientClasses:"from-orange-50/70 via-amber-50/50 to-red-50/40 dark:from-orange-950/30 dark:via-amber-950/20 dark:to-red-950/20",accentColor:"orange",decorativeElement:e.jsx(Ogt,{})},{id:"christmas",name:"Christmas",description:"Spread holiday cheer",icon:e.jsx(rv,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Merry Christmas, ${t}!`:"Merry Christmas!",subText:"Wishing you joy and peace this holiday season",gradientClasses:"from-red-50/70 via-green-50/40 to-emerald-50/40 dark:from-red-950/30 dark:via-green-950/20 dark:to-emerald-950/20",accentColor:"red",decorativeElement:e.jsx(Lgt,{})},{id:"hanukkah",name:"Hanukkah",description:"Celebrate the Festival of Lights",icon:e.jsx(An,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Hanukkah, ${t}!`:"Happy Hanukkah!",subText:"Wishing you eight nights of light and joy",gradientClasses:"from-blue-50/70 via-indigo-50/50 to-sky-50/40 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-sky-950/20",accentColor:"blue",decorativeElement:e.jsx(Rgt,{})},{id:"st_patricks_day",name:"St. Patrick's Day",description:"Celebrate the luck of the Irish",icon:e.jsx(oy,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy St. Patrick's Day, ${t}!`:"Happy St. Patrick's Day!",subText:"Wishing you the luck of the Irish!",gradientClasses:"from-green-50/70 via-emerald-50/50 to-teal-50/40 dark:from-green-950/30 dark:via-emerald-950/20 dark:to-teal-950/20",accentColor:"green",decorativeElement:e.jsx(Fgt,{})},{id:"home_anniversary",name:"Home Anniversary",description:"Celebrate their home ownership milestone",icon:e.jsx(Wn,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Happy Home Anniversary, ${t}!`:"Happy Home Anniversary!",subText:"Celebrating another year in your beautiful home",gradientClasses:"from-teal-50/70 via-cyan-50/50 to-emerald-50/40 dark:from-teal-950/30 dark:via-cyan-950/20 dark:to-emerald-950/20",accentColor:"teal",decorativeElement:e.jsx(qgt,{})},{id:"under_contract",name:"Under Contract",description:"Celebrate this exciting milestone",icon:e.jsx(td,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Congratulations, ${t}!`:"Congratulations!",subText:"You're under contract – exciting times ahead!",gradientClasses:"from-emerald-50/70 via-teal-50/50 to-cyan-50/40 dark:from-emerald-950/30 dark:via-teal-950/20 dark:to-cyan-950/20",accentColor:"emerald",decorativeElement:e.jsx(Vgt,{})},{id:"just_listed",name:"Just Listed",description:"Announce a new listing",icon:e.jsx(Mn,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Exciting News, ${t}!`:"Just Listed!",subText:"A new property is now on the market",gradientClasses:"from-blue-50/70 via-indigo-50/50 to-violet-50/40 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-violet-950/20",accentColor:"blue",decorativeElement:e.jsx(s4e,{})},{id:"just_sold",name:"Just Sold",description:"Celebrate a successful sale",icon:e.jsx(yd,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Congratulations, ${t}!`:"Just Sold!",subText:"Another successful transaction completed",gradientClasses:"from-emerald-50/70 via-green-50/50 to-teal-50/40 dark:from-emerald-950/30 dark:via-green-950/20 dark:to-teal-950/20",accentColor:"emerald",decorativeElement:e.jsx(kT,{})},{id:"price_reduction",name:"Price Reduction",description:"Notify about a price change",icon:e.jsx(Qj,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Great News, ${t}!`:"Price Reduced!",subText:"This property just became more affordable",gradientClasses:"from-orange-50/70 via-amber-50/50 to-yellow-50/40 dark:from-orange-950/30 dark:via-amber-950/20 dark:to-yellow-950/20",accentColor:"orange"},{id:"open_house",name:"Open House",description:"Invite to an open house event",icon:e.jsx(Bj,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`You're Invited, ${t}!`:"You're Invited!",subText:"Join us for an exclusive open house",gradientClasses:"from-sky-50/70 via-blue-50/50 to-indigo-50/40 dark:from-sky-950/30 dark:via-blue-950/20 dark:to-indigo-950/20",accentColor:"sky",decorativeElement:e.jsx(Kgt,{})},{id:"closing_day",name:"Closing Day",description:"Celebrate their closing day",icon:e.jsx(wm,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Congratulations, ${t}!`:"Congratulations!",subText:"It's official – the keys are yours!",gradientClasses:"from-amber-50/70 via-yellow-50/50 to-orange-50/40 dark:from-amber-950/30 dark:via-yellow-950/20 dark:to-orange-950/20",accentColor:"amber",decorativeElement:e.jsx(Hgt,{})},{id:"move_in_day",name:"Move-in Day",description:"Welcome them to their new home",icon:e.jsx(Wn,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Welcome Home, ${t}!`:"Welcome Home!",subText:"Wishing you all the best in your new home",gradientClasses:"from-teal-50/70 via-emerald-50/50 to-green-50/40 dark:from-teal-950/30 dark:via-emerald-950/20 dark:to-green-950/20",accentColor:"teal",decorativeElement:e.jsx(Wgt,{})},{id:"offer_accepted",name:"Offer Accepted",description:"Celebrate their accepted offer",icon:e.jsx(_d,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Amazing News, ${t}!`:"Offer Accepted!",subText:"Your offer has been accepted – congratulations!",gradientClasses:"from-green-50/70 via-emerald-50/50 to-teal-50/40 dark:from-green-950/30 dark:via-emerald-950/20 dark:to-teal-950/20",accentColor:"green",decorativeElement:e.jsx(kT,{})},{id:"pre_approval",name:"Pre-Approval Congrats",description:"Congratulate on pre-approval",icon:e.jsx(ql,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Congratulations, ${t}!`:"Congratulations!",subText:"You're pre-approved and ready to find your dream home",gradientClasses:"from-violet-50/70 via-purple-50/50 to-indigo-50/40 dark:from-violet-950/30 dark:via-purple-950/20 dark:to-indigo-950/20",accentColor:"violet",decorativeElement:e.jsx(r4e,{})}],Ygt=[{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 Xgt(t){return Rme.filter(r=>r.category===t)}function iC(t){return Rme.find(r=>r.id===t)||Rme[0]}function Qgt(){const{shareToken:t}=Xl(),[r,s]=E.useState(null),[n,a]=E.useState(null),[o,l]=E.useState(null),[i,d]=E.useState(!0),[m,g]=E.useState(null),[y,v]=E.useState(!0);E.useEffect(()=>{const B=()=>{['[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(X=>{document.querySelectorAll(X).forEach(se=>{se.style.display="none"})})};B();const $=[setTimeout(B,500),setTimeout(B,1500),setTimeout(B,3e3)],H=new MutationObserver(B);return H.observe(document.body,{childList:!0,subtree:!0}),()=>{$.forEach(clearTimeout),H.disconnect()}},[]),E.useEffect(()=>{(async()=>{if(!t){g("Invalid share link"),d(!1);return}const{data:$,error:H}=await Z.from("agent_videos").select("id, title, playback_url, thumbnail_url, preview_url, duration_seconds, share_token, owner_user_id, contact_id, page_template, recipient_name").eq("share_token",t).eq("is_deleted",!1).single();if(H||!$){g("Video not found or has been removed"),d(!1);return}s($);try{await Z.rpc("log_video_view",{p_video_id:$.id,p_user_agent:navigator.userAgent,p_referrer:document.referrer||null})}catch(W){console.warn("Failed to log video view:",W)}if($.owner_user_id){const{data:W}=await Z.from("profiles").select("id, name, email, phone").eq("id",$.owner_user_id).single();if(W){a(W);try{const{data:X}=await Z.storage.from("avatars").list(`${$.owner_user_id}`);if(X&&X.length>0){const{data:se}=Z.storage.from("avatars").getPublicUrl(`${$.owner_user_id}/${X[0].name}`);l(se.publicUrl)}}catch{}}}d(!1)})()},[t]);const b=B=>{if(!B)return"0:00";const $=Math.floor(B/60),H=B%60;return`${$}:${H.toString().padStart(2,"0")}`},N=B=>B.includes("iframe.mediadelivery.net/play/")?B.replace("/play/","/embed/")+"?autoplay=true&responsive=true":B,j=B=>{if(!B)return"?";const $=B.split(" ");return $.length>=2?`${$[0][0]}${$[1][0]}`.toUpperCase():B.substring(0,2).toUpperCase()},S=iC((r==null?void 0:r.page_template)||"default"),A=(r==null?void 0:r.recipient_name)||null,M=S.headerText(A),F=`https://dashboard.relevelup.com/share/video/${t}`;if(i)return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx(Hr,{className:"h-8 w-8 animate-spin text-primary"})});if(m||!r)return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsx(ze,{className:"max-w-md w-full",children:e.jsxs(qe,{className:"py-12 text-center",children:[e.jsx(ya,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Video Not Found"}),e.jsx("p",{className:"text-muted-foreground",children:m||"This video is no longer available."})]})})});const O=S.id!=="default";return e.jsxs(e.Fragment,{children:[e.jsxs(qh,{children:[e.jsx("title",{children:M}),e.jsx("meta",{name:"description",content:S.subText}),e.jsx("meta",{property:"og:title",content:M}),e.jsx("meta",{property:"og:description",content:S.subText}),e.jsx("meta",{property:"og:type",content:"video.other"}),e.jsx("meta",{property:"og:url",content:F}),r.preview_url&&e.jsx("meta",{property:"og:image",content:r.preview_url}),!r.preview_url&&r.thumbnail_url&&e.jsx("meta",{property:"og:image",content:r.thumbnail_url}),r.playback_url&&e.jsxs(e.Fragment,{children:[e.jsx("meta",{property:"og:video",content:r.playback_url}),e.jsx("meta",{property:"og:video:type",content:"text/html"}),e.jsx("meta",{property:"og:video:width",content:"1280"}),e.jsx("meta",{property:"og:video:height",content:"720"})]}),e.jsx("meta",{name:"twitter:card",content:"player"}),e.jsx("meta",{name:"twitter:title",content:M}),e.jsx("meta",{name:"twitter:description",content:S.subText}),r.preview_url&&e.jsx("meta",{name:"twitter:image",content:r.preview_url}),r.playback_url&&e.jsxs(e.Fragment,{children:[e.jsx("meta",{name:"twitter:player",content:r.playback_url}),e.jsx("meta",{name:"twitter:player:width",content:"1280"}),e.jsx("meta",{name:"twitter:player:height",content:"720"})]})]}),e.jsxs("div",{className:qt("min-h-screen flex items-center justify-center p-4 bg-gradient-to-b relative",S.gradientClasses),children:[O&&S.decorativeElement,e.jsxs("div",{className:"max-w-2xl w-full space-y-6 relative z-10",children:[O&&e.jsxs("div",{className:"text-center py-4 animate-fade-in",children:[e.jsx("div",{className:"flex justify-center mb-3",children:e.jsx("div",{className:qt("w-14 h-14 rounded-full flex items-center justify-center shadow-sm",S.accentColor==="primary"&&"bg-primary/10 text-primary",S.accentColor==="amber"&&"bg-amber-100 text-amber-600 dark:bg-amber-900/50 dark:text-amber-400",S.accentColor==="teal"&&"bg-teal-100 text-teal-600 dark:bg-teal-900/50 dark:text-teal-400",S.accentColor==="rose"&&"bg-rose-100 text-rose-600 dark:bg-rose-900/50 dark:text-rose-400",S.accentColor==="emerald"&&"bg-emerald-100 text-emerald-600 dark:bg-emerald-900/50 dark:text-emerald-400",S.accentColor==="yellow"&&"bg-yellow-100 text-yellow-600 dark:bg-yellow-900/50 dark:text-yellow-400",S.accentColor==="pink"&&"bg-pink-100 text-pink-600 dark:bg-pink-900/50 dark:text-pink-400",S.accentColor==="blue"&&"bg-blue-100 text-blue-600 dark:bg-blue-900/50 dark:text-blue-400",S.accentColor==="red"&&"bg-red-100 text-red-600 dark:bg-red-900/50 dark:text-red-400",S.accentColor==="orange"&&"bg-orange-100 text-orange-600 dark:bg-orange-900/50 dark:text-orange-400",S.accentColor==="green"&&"bg-green-100 text-green-600 dark:bg-green-900/50 dark:text-green-400",S.accentColor==="violet"&&"bg-violet-100 text-violet-600 dark:bg-violet-900/50 dark:text-violet-400",S.accentColor==="sky"&&"bg-sky-100 text-sky-600 dark:bg-sky-900/50 dark:text-sky-400"),children:e.jsx("div",{className:"scale-150",children:S.icon})})}),e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold mb-2",children:M}),e.jsx("p",{className:"text-muted-foreground",children:S.subText})]}),n&&e.jsxs("div",{className:"flex items-center gap-4 p-4 bg-card/90 backdrop-blur-sm rounded-lg border shadow-sm",children:[e.jsxs(ln,{className:"h-14 w-14 border-2 border-primary/20",children:[e.jsx(pa,{src:o||void 0,alt:n.name||"Agent"}),e.jsx(cn,{className:"bg-primary/10 text-primary font-semibold",children:j(n.name)})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:O?"A special video from":"A personal video from"}),e.jsx("h2",{className:"text-lg font-semibold truncate",children:n.name||"Your Agent"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Your Real Estate Professional"})]}),e.jsxs("div",{className:"flex gap-2 shrink-0",children:[n.phone&&e.jsx(Q,{variant:"outline",size:"icon",asChild:!0,className:"h-10 w-10",children:e.jsx("a",{href:`tel:${n.phone}`,"aria-label":"Call agent",children:e.jsx(wi,{className:"h-4 w-4"})})}),n.email&&e.jsx(Q,{variant:"outline",size:"icon",asChild:!0,className:"h-10 w-10",children:e.jsx("a",{href:`mailto:${n.email}`,"aria-label":"Email agent",children:e.jsx(mn,{className:"h-4 w-4"})})})]})]}),e.jsx(ze,{className:"overflow-hidden shadow-lg",children:y&&r.playback_url?e.jsx("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:e.jsx("iframe",{src:N(r.playback_url),title:r.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})}):e.jsxs("div",{className:"relative aspect-video bg-muted cursor-pointer group",onClick:()=>v(!0),children:[r.preview_url||r.thumbnail_url?e.jsx("img",{src:r.preview_url||r.thumbnail_url||"",alt:r.title?`${r.title} video preview`:"Video message preview",className:"w-full h-full object-cover",onError:B=>{var H;B.currentTarget.style.display="none";const $=(H=B.currentTarget.parentElement)==null?void 0:H.querySelector(".video-fallback");$&&($.style.display="flex")}}):null,e.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:r.preview_url||r.thumbnail_url?"none":"flex"},children:e.jsx(ya,{className:"h-16 w-16 text-primary/50"})}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30 group-hover:bg-black/40 transition-colors",children:e.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:e.jsx(Gl,{className:"h-10 w-10 text-primary ml-1"})})}),r.duration_seconds&&e.jsx("div",{className:"absolute bottom-3 right-3 bg-black/70 text-white text-sm px-2 py-1 rounded",children:b(r.duration_seconds)})]})}),!O&&e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-bold",children:r.title||"Video Message"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:y?"Enjoy the video!":"Click to play the video"})]}),!y&&e.jsx("div",{className:"flex justify-center",children:e.jsxs(Q,{size:"lg",onClick:()=>v(!0),className:"gap-2",children:[e.jsx(Gl,{className:"h-5 w-5"}),"Watch Video"]})}),e.jsx(Cgt,{shareToken:t,agentName:(n==null?void 0:n.name)||null,hasContact:!!r.contact_id})]})]})]})}function Jgt(){return E.useEffect(()=>(document.body.classList.add("video-landing-page"),()=>{document.body.classList.remove("video-landing-page")}),[]),e.jsx(sst,{})}function ext(){const{token:t}=Xl();return E.useEffect(()=>{if(!t)return;const r=`https://relzejiswnotikjgvjhz.supabase.co/functions/v1/video-og-image?token=${t}`;window.location.replace(r)},[t]),e.jsx("main",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(Hr,{className:"h-5 w-5 animate-spin"}),e.jsx("span",{children:"Loading video preview…"})]})})}const txt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},rxt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},U4={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function sxt(){var ne,fe,oe,de;const{slugOrId:t}=Xl(),[r]=Bc(),{data:s,isLoading:n}=ROe(t||""),a=FOe(),o=Xct(),l=r.get("ref"),[i,d]=E.useState(""),[m,g]=E.useState(""),[y,v]=E.useState(""),[b,N]=E.useState(""),[j,S]=E.useState(!1),[A,M]=E.useState(!1),[I,F]=E.useState(null),[O,B]=E.useState(!1);E.useEffect(()=>{l&&o.mutate(l)},[l]);const $=ue=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(ue),H=async ue=>{if(ue.preventDefault(),!(!i.trim()||!y.trim()||!s)){S(!0);try{await a.mutateAsync({listingId:s.id,agentId:s.agent_id,firstName:i.trim(),lastName:m.trim(),email:y.trim(),phone:b.trim(),shareToken:l}),M(!0),Se.success("Thanks! The agent will be in touch soon.")}catch(xe){console.error("Lead submission error:",xe),Se.error(`Failed to submit: ${xe.message||"Please try again"}`)}finally{S(!1)}}},W=(s==null?void 0:s.photos)||[],X=W.find(ue=>ue.is_primary)||W[0],se=()=>{I!==null&&F(I===0?W.length-1:I-1)},ae=()=>{I!==null&&F(I===W.length-1?0:I+1)};if(n)return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("header",{className:"border-b bg-card",children:e.jsx("div",{className:"container mx-auto px-4 py-4",children:e.jsx(fr,{className:"h-8 w-32"})})}),e.jsxs("div",{className:"container mx-auto px-4 py-8",children:[e.jsx(fr,{className:"h-10 w-48 mb-6"}),e.jsx(fr,{className:"aspect-video mb-6"}),e.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"md:col-span-2 space-y-4",children:[e.jsx(fr,{className:"h-12 w-48"}),e.jsx(fr,{className:"h-6 w-full"}),e.jsx(fr,{className:"h-6 w-3/4"})]}),e.jsx(fr,{className:"h-64"})]})]})]});if(!s)return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("header",{className:"border-b bg-card",children:e.jsx("div",{className:"container mx-auto px-4 py-4",children:e.jsx(go,{to:"/public/listings",className:"flex items-center gap-2",children:e.jsx("img",{src:Kte,alt:"LevelUp",className:"h-8"})})})}),e.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[e.jsx(Wn,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Listing Not Found"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing may no longer be available."}),e.jsx(Q,{asChild:!0,children:e.jsx(go,{to:"/public/listings",children:"Browse All Listings"})})]})]});const le=s.property_address?`${s.property_address} - ${s.city}, ${s.state}`:`${s.city}, ${s.state} Home for Sale`;return e.jsxs(e.Fragment,{children:[e.jsxs(qh,{children:[e.jsxs("title",{children:[le," | LevelUp Listings"]}),e.jsx("meta",{name:"description",content:`${$(s.price)} - ${s.bedrooms||""}BD ${s.bathrooms||""}BA ${s.square_footage?s.square_footage.toLocaleString()+" sqft":""} ${U4[s.property_type]} in ${s.city}, ${s.state}. ${((ne=s.description)==null?void 0:ne.slice(0,150))||""}`}),e.jsx("link",{rel:"canonical",href:`https://listings.relevelup.com/${s.slug||s.id}`}),e.jsx("meta",{property:"og:title",content:le}),e.jsx("meta",{property:"og:description",content:`${$(s.price)} - ${s.bedrooms||""}BD ${s.bathrooms||""}BA ${U4[s.property_type]} in ${s.city}, ${s.state}. View photos, details, and contact the listing agent.`}),e.jsx("meta",{property:"og:type",content:"website"}),e.jsx("meta",{property:"og:url",content:`https://listings.relevelup.com/${s.slug||s.id}`}),X&&e.jsx("meta",{property:"og:image",content:X.photo_url}),X&&e.jsx("meta",{property:"og:image:alt",content:`${s.property_address||s.city} - ${U4[s.property_type]} for sale`}),e.jsx("meta",{property:"og:site_name",content:"LevelUp Listings"}),e.jsx("meta",{property:"og:locale",content:"en_US"}),e.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),e.jsx("meta",{name:"twitter:title",content:le}),e.jsx("meta",{name:"twitter:description",content:`${$(s.price)} - ${s.bedrooms||""}BD ${s.bathrooms||""}BA in ${s.city}, ${s.state}`}),X&&e.jsx("meta",{name:"twitter:image",content:X.photo_url}),e.jsx("meta",{name:"robots",content:"index, follow"}),e.jsx("meta",{name:"geo.region",content:`US-${s.state}`}),e.jsx("meta",{name:"geo.placename",content:s.city}),e.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"RealEstateListing",name:s.property_address||`${s.city}, ${s.state} Home`,description:s.description||`${U4[s.property_type]} for sale in ${s.city}, ${s.state}`,url:`https://listings.relevelup.com/${s.slug||s.id}`,datePosted:s.created_at,image:W.map(ue=>ue.photo_url),address:{"@type":"PostalAddress",streetAddress:s.property_address||void 0,addressLocality:s.city,addressRegion:s.state,addressCountry:"US"},geo:s.neighborhood?{"@type":"GeoCoordinates",name:s.neighborhood}:void 0,offers:{"@type":"Offer",price:s.price,priceCurrency:"USD",availability:s.status==="sold"?"https://schema.org/SoldOut":s.status==="under_contract"?"https://schema.org/LimitedAvailability":"https://schema.org/InStock"},numberOfRooms:s.bedrooms||void 0,numberOfBathroomsTotal:s.bathrooms||void 0,floorSize:s.square_footage?{"@type":"QuantitativeValue",value:s.square_footage,unitCode:"FTK"}:void 0,yearBuilt:s.year_built||void 0,broker:s.agent?{"@type":"RealEstateAgent",name:s.agent.name,email:s.agent.email,worksFor:(fe=s.agent.brokerage)!=null&&fe.name?{"@type":"RealEstateAgent",name:s.agent.brokerage.name}:void 0}:void 0})})]}),e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("header",{className:"border-b bg-card sticky top-0 z-50",children:e.jsx("div",{className:"container mx-auto px-4 py-4",children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(go,{to:"/public/listings",className:"flex items-center gap-2",children:e.jsx("img",{src:Kte,alt:"LevelUp",className:"h-8"})})})})}),e.jsxs("div",{className:"container mx-auto px-4 py-6",children:[e.jsxs(go,{to:"/public/listings",className:"inline-flex items-center text-muted-foreground hover:text-foreground mb-6",children:[e.jsx(_i,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),W.length>0&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-8",children:[e.jsx("div",{className:"md:col-span-2",children:e.jsx("div",{className:"aspect-[16/10] rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>F(0),children:e.jsx("img",{src:X==null?void 0:X.photo_url,alt:`${s.property_address||s.city+", "+s.state} - ${U4[s.property_type]} main photo`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"})})}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:W.slice(1,5).map((ue,xe)=>e.jsxs("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer relative",onClick:()=>F(xe+1),children:[e.jsx("img",{src:ue.photo_url,alt:`${s.property_address||s.city} - Photo ${xe+2} of ${W.length}`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"}),xe===3&&W.length>5&&e.jsxs("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center text-white font-semibold",children:["+",W.length-5," more"]})]},ue.id))})]}),e.jsxs("div",{className:"grid md:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"md:col-span-2 space-y-6",children:[e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center gap-2 mb-3",children:e.jsx(bt,{className:`${txt[s.status]} text-white border-0`,children:rxt[s.status]})}),e.jsx("h1",{className:"text-4xl font-bold text-primary mb-2",children:$(s.price)}),s.property_address&&e.jsx("p",{className:"text-xl font-medium",children:s.property_address}),e.jsxs("p",{className:"text-muted-foreground flex items-center gap-1",children:[e.jsx(eo,{className:"h-4 w-4"}),s.city,", ",s.state,s.neighborhood&&` • ${s.neighborhood}`]})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 py-4 border-y",children:[s.bedrooms&&e.jsxs("div",{className:"text-center",children:[e.jsx(H1,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),e.jsx("p",{className:"text-xl font-semibold",children:s.bedrooms}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Beds"})]}),s.bathrooms&&e.jsxs("div",{className:"text-center",children:[e.jsx(V1,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),e.jsx("p",{className:"text-xl font-semibold",children:s.bathrooms}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Baths"})]}),s.square_footage&&e.jsxs("div",{className:"text-center",children:[e.jsx(Yg,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),e.jsx("p",{className:"text-xl font-semibold",children:s.square_footage.toLocaleString()}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Sq Ft"})]}),s.year_built&&e.jsxs("div",{className:"text-center",children:[e.jsx(Mn,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),e.jsx("p",{className:"text-xl font-semibold",children:s.year_built}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Built"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(bt,{variant:"secondary",children:[e.jsx(bi,{className:"h-3 w-3 mr-1"}),U4[s.property_type]]}),s.lot_size&&e.jsxs(bt,{variant:"secondary",children:["Lot: ",s.lot_size]}),s.has_hoa&&e.jsx(bt,{variant:"secondary",children:"HOA"})]}),s.description&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold mb-2",children:"About This Property"}),e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:s.description})]}),s.agent_notes&&s.agent_notes_public&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Agent Notes"}),e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:s.agent_notes})]}),s.mls_link&&e.jsx(Q,{variant:"outline",asChild:!0,children:e.jsxs("a",{href:s.mls_link,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(En,{className:"h-4 w-4 mr-2"}),"View on MLS"]})})]})]}),e.jsxs("div",{className:"space-y-6",children:[s.video&&s.video.playback_url&&e.jsx(ze,{className:"overflow-hidden bg-gradient-to-br from-primary/5 to-primary/10 border-primary/20",children:e.jsxs(qe,{className:"p-0",children:[e.jsxs("div",{className:"relative aspect-video bg-muted cursor-pointer group",onClick:()=>B(!0),children:[s.video.thumbnail_url?e.jsx("img",{src:s.video.thumbnail_url,alt:"Video thumbnail",className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center bg-gradient-to-br from-primary/20 to-primary/30",children:e.jsx(ya,{className:"h-12 w-12 text-primary"})}),e.jsx("div",{className:"absolute inset-0 bg-black/30 group-hover:bg-black/40 transition-colors flex items-center justify-center",children:e.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:e.jsx(Gl,{className:"h-8 w-8 text-primary fill-primary ml-1"})})})]}),e.jsxs("div",{className:"p-4",children:[e.jsxs(Q,{onClick:()=>B(!0),className:"w-full gap-2",size:"lg",children:[e.jsx(Gl,{className:"h-4 w-4"}),"Watch Video Tour"]}),s.video.title&&e.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center truncate",children:s.video.title})]})]})}),s.agent&&e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:[e.jsx(Kl,{className:"h-5 w-5"}),"Listing Agent"]})}),e.jsxs(qe,{children:[e.jsx("p",{className:"font-semibold text-lg",children:s.agent.name}),((oe=s.agent.brokerage)==null?void 0:oe.name)&&e.jsx("p",{className:"text-sm text-muted-foreground",children:s.agent.brokerage.name})]})]}),e.jsxs(ze,{className:"border-primary",children:[e.jsx(Wt,{children:e.jsx(Zt,{className:"text-lg",children:"Interested in this property?"})}),e.jsx(qe,{children:A?e.jsxs("div",{className:"text-center py-4",children:[e.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-3",children:e.jsx(mn,{className:"h-6 w-6 text-primary"})}),e.jsx("p",{className:"font-medium",children:"Thanks for your interest!"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"The listing agent will contact you soon."})]}):e.jsxs("form",{onSubmit:H,className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"firstName",children:"First Name *"}),e.jsx(Qe,{id:"firstName",type:"text",placeholder:"John",value:i,onChange:ue=>d(ue.target.value),required:!0})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"lastName",children:"Last Name"}),e.jsx(Qe,{id:"lastName",type:"text",placeholder:"Doe",value:m,onChange:ue=>g(ue.target.value)})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"email",children:"Email *"}),e.jsx(Qe,{id:"email",type:"email",placeholder:"you@example.com",value:y,onChange:ue=>v(ue.target.value),required:!0})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"phone",children:"Phone"}),e.jsx(Qe,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:b,onChange:ue=>N(ue.target.value)})]}),e.jsx(Q,{type:"submit",className:"w-full",disabled:j,children:j?"Submitting...":"Get More Info"}),e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"The listing agent will reach out to you directly."})]})})]})]})]})]}),e.jsx(Dr,{open:I!==null,onOpenChange:()=>F(null),children:e.jsxs(Lr,{className:"max-w-5xl p-0 bg-black/95",children:[e.jsx(Ur,{className:"sr-only",children:e.jsx(Br,{children:"Photo Gallery"})}),e.jsx("button",{onClick:()=>F(null),className:"absolute right-4 top-4 z-50 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:e.jsx(rn,{className:"h-5 w-5"})}),I!==null&&W[I]&&e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:W[I].photo_url,alt:`Photo ${I+1}`,className:"w-full max-h-[80vh] object-contain"}),W.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:se,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:e.jsx(uc,{className:"h-6 w-6"})}),e.jsx("button",{onClick:ae,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:e.jsx(Wi,{className:"h-6 w-6"})}),e.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," / ",W.length]})]})]})]})}),e.jsx(Dr,{open:O,onOpenChange:B,children:e.jsxs(Lr,{className:"max-w-4xl p-0 bg-black overflow-hidden",children:[e.jsx(Ur,{className:"sr-only",children:e.jsx(Br,{children:"Video Tour"})}),e.jsx("button",{onClick:()=>B(!1),className:"absolute right-4 top-4 z-50 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:e.jsx(rn,{className:"h-5 w-5"})}),((de=s==null?void 0:s.video)==null?void 0:de.playback_url)&&e.jsx("div",{className:"aspect-video w-full",children:e.jsx("iframe",{src:s.video.playback_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})]})}),e.jsx("footer",{className:"border-t py-8 mt-16",children:e.jsxs("div",{className:"container mx-auto px-4 text-center text-sm text-muted-foreground",children:[e.jsxs("p",{children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),e.jsx("p",{className:"mt-2",children:e.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground",children:"relevelup.com"})})]})})]})]})}function nxt(){var o;const{slug:t}=Xl(),{data:r,isLoading:s,error:n}=UOe(t);if(E.useEffect(()=>(document.body.classList.add("agent-card-page"),()=>{document.body.classList.remove("agent-card-page")}),[]),E.useEffect(()=>{r!=null&&r.id&&Vi(r.id,"card_view")},[r==null?void 0:r.id]),s)return e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center",children:e.jsxs("div",{className:"w-full max-w-md mx-auto p-6 space-y-6",children:[e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx(fr,{className:"h-28 w-28 rounded-full"}),e.jsx(fr,{className:"h-6 w-48"}),e.jsx(fr,{className:"h-4 w-36"})]}),e.jsx(fr,{className:"h-12 w-full"}),e.jsx(fr,{className:"h-12 w-full"})]})});if(n||!r)return e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center p-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-bold text-slate-800 mb-2",children:"Card Not Found"}),e.jsx("p",{className:"text-slate-500",children:"This agent card doesn't exist or isn't published yet."})]})});const a=((o=r.profile)==null?void 0:o.name)||"Agent";return e.jsxs(e.Fragment,{children:[e.jsxs(qh,{children:[e.jsxs("title",{children:[a," | Real Estate Agent"]}),e.jsx("meta",{name:"description",content:r.positioning_statement||`Connect with ${a}, your trusted real estate professional.`}),e.jsx("meta",{property:"og:title",content:`${a} | Real Estate Agent`}),e.jsx("meta",{property:"og:description",content:r.positioning_statement||`Connect with ${a}`}),r.avatar_url&&e.jsx("meta",{property:"og:image",content:r.avatar_url})]}),e.jsx(lye,{card:r})]})}function NT({banners:t,autoPlayInterval:r=5e3,className:s}){const[n,a]=E.useState(0),[o,l]=E.useState(!1),i=E.useCallback(()=>{a(y=>(y+1)%t.length)},[t.length]),d=E.useCallback(()=>{a(y=>(y-1+t.length)%t.length)},[t.length]),m=E.useCallback(y=>{a(y)},[]);if(E.useEffect(()=>{if(t.length<=1||o)return;const y=setInterval(i,r);return()=>clearInterval(y)},[t.length,o,r,i]),!t||t.length===0)return null;const g=t[n];return e.jsxs("div",{className:qt("relative w-full overflow-hidden rounded-xl",s),onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[e.jsxs("div",{className:"relative aspect-[21/9] md:aspect-[3/1] w-full",children:[e.jsxs("div",{className:"absolute inset-0 transition-opacity duration-500",children:[e.jsx("img",{src:g.image_url,alt:g.title,className:"w-full h-full object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/70 via-black/20 to-transparent"})]}),e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-6 md:p-8 text-white",children:[e.jsx("h2",{className:"text-xl md:text-3xl font-bold mb-2 drop-shadow-lg",children:g.title}),g.description&&e.jsx("p",{className:"text-sm md:text-base text-white/90 mb-4 max-w-2xl drop-shadow",children:g.description}),g.link_url&&e.jsx("a",{href:g.link_url,target:"_blank",rel:"noopener noreferrer",className:"inline-block",children:e.jsx(Q,{variant:"secondary",className:"bg-white/90 hover:bg-white text-foreground font-semibold",children:g.link_text||"Learn More"})})]}),t.length>1&&e.jsxs(e.Fragment,{children:[e.jsx(Q,{variant:"ghost",size:"icon",className:qt("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:d,children:e.jsx(uc,{className:"h-6 w-6"})}),e.jsx(Q,{variant:"ghost",size:"icon",className:qt("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:e.jsx(Wi,{className:"h-6 w-6"})})]})]}),t.length>1&&e.jsx("div",{className:"absolute bottom-3 left-1/2 -translate-x-1/2 flex gap-2",children:t.map((y,v)=>e.jsx("button",{onClick:()=>m(v),className:qt("w-2 h-2 rounded-full transition-all duration-300",v===n?"bg-white w-6":"bg-white/50 hover:bg-white/70"),"aria-label":`Go to slide ${v+1}`},v))})]})}function axt(t){return"EST"}function JE(t){const s=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0,timeZone:"America/New_York"}).format(t),n=axt();return`${s} ${n}`}function oC(t){const r=new Date,s=new Date(t),n=dNe(s,-15),a=dNe(s,30);return r>a?"ended":yNe(r,{start:s,end:a})?"live":yNe(r,{start:n,end:s})?"starting_soon":"upcoming"}function $ye(t){const r=oC(t);return r==="starting_soon"||r==="live"}const n4e=$ye,ixt=({events:t,registrations:r,onNavigateToEvents:s})=>{const[n,a]=E.useState(new Date);E.useEffect(()=>{const b=setInterval(()=>{a(new Date)},3e4);return()=>clearInterval(b)},[]);const o=t.filter(b=>$ye(b.event_date));if(o.length===0)return null;const l=o[0],i=oC(l.event_date),d=r.find(b=>b.event_id===l.id),m=(d==null?void 0:d.zoom_join_url)||l.zoom_link,g=!!d,y=i==="live",v=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 e.jsxs("div",{className:`relative mb-8 overflow-hidden rounded-xl bg-gradient-to-r ${v.container} border`,children:[e.jsx("div",{className:`absolute inset-0 bg-gradient-to-r ${v.pulse} to-transparent animate-pulse`}),e.jsx("div",{className:"relative p-4 sm:p-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative flex items-center justify-center",children:[e.jsx("span",{className:`absolute inline-flex h-full w-full animate-ping rounded-full ${v.indicator} opacity-75`}),e.jsx("span",{className:`relative flex h-3 w-3 rounded-full ${v.indicator}`})]}),e.jsx("div",{className:`flex items-center gap-2 ${v.text} font-bold text-sm uppercase tracking-wider`,children:y?e.jsxs(e.Fragment,{children:[e.jsx(Yj,{className:"h-4 w-4"}),"Live Now"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ea,{className:"h-4 w-4"}),"Starting Soon"]})})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-semibold text-lg text-foreground line-clamp-1",children:l.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:y?`Started at ${JE(new Date(l.event_date))}`:`Starts at ${JE(new Date(l.event_date))}`})]}),e.jsx("div",{className:"flex items-center gap-2",children:g?e.jsxs(Q,{onClick:()=>window.open(m,"_blank"),className:`${v.button} text-white gap-2`,children:[e.jsx(En,{className:"h-4 w-4"}),y?"Join Now":"Join When Live"]}):e.jsxs(Q,{variant:"outline",onClick:s,className:`${v.outlineButton} gap-2`,children:[e.jsx(ws,{className:"h-4 w-4"}),"Register & Join"]})})]})})]})};var Uye="Progress",qye=100,[oxt]=fc(Uye),[lxt,cxt]=oxt(Uye),LRe=E.forwardRef((t,r)=>{const{__scopeProgress:s,value:n=null,max:a,getValueLabel:o=dxt,...l}=t;(a||a===0)&&!a4e(a)&&console.error(uxt(`${a}`,"Progress"));const i=a4e(a)?a:qye;n!==null&&!i4e(n,i)&&console.error(hxt(`${n}`,"Progress"));const d=i4e(n,i)?n:null,m=dre(d)?o(d,i):void 0;return e.jsx(lxt,{scope:s,value:d,max:i,children:e.jsx(qs.div,{"aria-valuemax":i,"aria-valuemin":0,"aria-valuenow":dre(d)?d:void 0,"aria-valuetext":m,role:"progressbar","data-state":RRe(d,i),"data-value":d??void 0,"data-max":i,...l,ref:r})})});LRe.displayName=Uye;var ORe="ProgressIndicator",DRe=E.forwardRef((t,r)=>{const{__scopeProgress:s,...n}=t,a=cxt(ORe,s);return e.jsx(qs.div,{"data-state":RRe(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...n,ref:r})});DRe.displayName=ORe;function dxt(t,r){return`${Math.round(t/r*100)}%`}function RRe(t,r){return t==null?"indeterminate":t===r?"complete":"loading"}function dre(t){return typeof t=="number"}function a4e(t){return dre(t)&&!isNaN(t)&&t>0}function i4e(t,r){return dre(t)&&!isNaN(t)&&t<=r&&t>=0}function uxt(t,r){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${r}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${qye}\`.`}function hxt(t,r){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${r}\`. The \`value\` prop must be: - a positive number - less than the value passed to \`max\` (or ${qye} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. Defaulting to \`null\`.`}var FRe=LRe,mxt=DRe;const hc=E.forwardRef(({className:t,value:r,...s},n)=>e.jsx(FRe,{ref:n,className:qt("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...s,children:e.jsx(mxt,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(r||0)}%)`}})}));hc.displayName=FRe.displayName;function pxt(){const{user:t,isBrokerageManager:r}=Gr(),[s,n]=E.useState([]),[a,o]=E.useState([]),[l,i]=E.useState(!1),[d,m]=E.useState(!0),g=r?"brokerage_manager":"agent";E.useEffect(()=>{if(!(t!=null&&t.id)){m(!1);return}y()},[t==null?void 0:t.id,g]);const y=async()=>{if(t!=null&&t.id)try{const{data:F,error:O}=await Z.from("onboarding_checklist_items").select("*").eq("target_role",g).eq("is_active",!0).order("sort_order");if(O)throw O;const{data:B,error:$}=await Z.from("onboarding_checklist_progress").select("item_id, completed_at").eq("user_id",t.id);if($)throw $;const{data:H,error:W}=await Z.from("onboarding_checklist_dismissed").select("id").eq("user_id",t.id).maybeSingle();if(W)throw W;n(F||[]),o(B||[]),i(!!H),F&&F.length>0&&await v(F,B||[])}catch(F){console.error("Error fetching checklist data:",F)}finally{m(!1)}},v=async(F,O)=>{var Ye,Ie;if(!(t!=null&&t.id))return;const B=O.map(et=>et.item_id),$=F.filter(et=>!B.includes(et.id));if($.length===0)return;const[H,W,X,se,ae,le,ne,fe,oe,de,ue,xe,Te,be,we]=await Promise.all([Z.from("profiles").select("brokerage_id").eq("id",t.id).maybeSingle(),Z.from("resource_shares").select("id",{count:"exact",head:!0}).eq("sender_id",t.id),Z.from("community_posts").select("id",{count:"exact",head:!0}).eq("user_id",t.id),Z.from("event_registrations").select("id",{count:"exact",head:!0}).eq("user_id",t.id),Z.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id).eq("resource_type","template"),Z.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id).eq("resource_type","academy_video"),Z.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id).eq("resource_type","toolbox"),Z.from("activity_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id),Z.from("innercircle_contacts").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),Z.from("agent_videos").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),Z.from("contact_touch_logs").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),Z.from("scorecard_transactions").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),Z.from("listings").select("id",{count:"exact",head:!0}).eq("agent_id",t.id),Z.from("innercircle_contacts").select("id").eq("owner_user_id",t.id),Z.from("deal_pipeline").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id)]),ve={},tt=(Ye=H.data)==null?void 0:Ye.brokerage_id;ve.share_resource=(W.count||0)>0,ve.post_community=(X.count||0)>0,ve.register_event=(se.count||0)>0,ve.view_template=(ae.count||0)>0,ve.watch_academy=(le.count||0)>0,ve.use_toolbox=(ne.count||0)>0,ve.launch_app=(fe.count||0)>0,ve.add_contact=(oe.count||0)>0,ve.create_video=(de.count||0)>0,ve.complete_touch=(ue.count||0)>0,ve.add_transaction=(xe.count||0)>0,ve.add_listing=(Te.count||0)>0,ve.add_deal=(we.count||0)>0;const Ae=((Ie=be.data)==null?void 0:Ie.map(et=>et.id))||[],Le=[];tt?Le.push(Z.from("profiles").select("id").eq("brokerage_id",tt).neq("id",t.id).then(et=>{var It;ve.add_agent=(((It=et.data)==null?void 0:It.length)||0)>0})):ve.add_agent=!1,Ae.length>0?(Le.push(Z.from("contact_plan_cycles").select("id",{count:"exact",head:!0}).in("contact_id",Ae).then(et=>{ve.add_plan=(et.count||0)>0})),Le.push(Z.from("contact_popby_settings").select("id",{count:"exact",head:!0}).in("contact_id",Ae).then(et=>{ve.schedule_popby=(et.count||0)>0}))):(ve.add_plan=!1,ve.schedule_popby=!1),await Promise.all(Le);const Ue=$.filter(et=>ve[et.action_type]);if(Ue.length>0){const et=Ue.map(Pe=>({user_id:t.id,item_id:Pe.id})),{error:It}=await Z.from("onboarding_checklist_progress").upsert(et,{onConflict:"user_id,item_id",ignoreDuplicates:!0});if(!It){const Pe=Ue.map(at=>({item_id:at.id,completed_at:new Date().toISOString()}));o(at=>[...at,...Pe])}}},b=async F=>{if(t!=null&&t.id)try{const{error:O}=await Z.from("onboarding_checklist_progress").insert({user_id:t.id,item_id:F});if(O)throw O;o(B=>[...B,{item_id:F,completed_at:new Date().toISOString()}])}catch(O){console.error("Error marking item complete:",O)}},N=async()=>{if(t!=null&&t.id)try{const{error:F}=await Z.from("onboarding_checklist_dismissed").insert({user_id:t.id});if(F)throw F;i(!0)}catch(F){console.error("Error dismissing checklist:",F)}},j=a.length,S=s.length,A=S>0&&j>=S,M=S>0?j/S*100:0;return{items:s,progress:a,isDismissed:l,loading:d,completedCount:j,totalCount:S,isComplete:A,progressPercentage:M,isItemComplete:F=>a.some(O=>O.item_id===F),markComplete:b,dismiss:N,refetch:y}}const fxt={add_agent:e.jsx(ws,{className:"h-4 w-4"}),share_resource:e.jsx(Oc,{className:"h-4 w-4"}),post_community:e.jsx($o,{className:"h-4 w-4"}),register_event:e.jsx(Mn,{className:"h-4 w-4"}),view_template:e.jsx(X0,{className:"h-4 w-4"}),watch_academy:e.jsx(Y1,{className:"h-4 w-4"}),use_toolbox:e.jsx(wy,{className:"h-4 w-4"}),launch_app:e.jsx(hA,{className:"h-4 w-4"}),add_deal:e.jsx(xy,{className:"h-4 w-4"}),add_listing:e.jsx(Wn,{className:"h-4 w-4"})},gxt={add_deal:"/mission-control/pipeline",add_listing:"/mission-control/listings/new",post_community:"/community",add_contact:"/mission-control/contacts"};function xxt(){const{items:t,isDismissed:r,loading:s,completedCount:n,totalCount:a,isComplete:o,progressPercentage:l,isItemComplete:i,markComplete:d,dismiss:m}=pxt(),g=Ws(),[y,v]=E.useState(!0);return s||r||a===0||o?null:e.jsxs(ze,{className:"mb-6 border-primary/20 bg-gradient-to-r from-primary/5 to-transparent",children:[e.jsxs(Wt,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:e.jsx(Kg,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx(Zt,{className:"text-lg",children:"Get Started with LevelUp"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Complete these steps to make the most of your membership"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>v(!y),className:"h-8 w-8 p-0",children:y?e.jsx(Hg,{className:"h-4 w-4"}):e.jsx(Jc,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"sm",onClick:m,className:"h-8 w-8 p-0 text-muted-foreground hover:text-foreground",children:e.jsx(rn,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"mt-4",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm mb-2",children:[e.jsx("span",{className:"text-muted-foreground",children:"Progress"}),e.jsxs("span",{className:"font-medium",children:[n," of ",a," complete"]})]}),e.jsx(hc,{value:l,className:"h-2"})]})]}),y&&e.jsx(qe,{className:"pt-0",children:e.jsx("div",{className:"space-y-3",children:t.map(b=>{const N=i(b.id);return e.jsxs("div",{className:qt("flex items-start gap-3 p-3 rounded-lg transition-colors",N?"bg-muted/50":"bg-background hover:bg-muted/30 cursor-pointer"),onClick:()=>{if(N)return;const j=gxt[b.action_type];j?g(j):d(b.id)},children:[e.jsx("div",{className:"mt-0.5",children:N?e.jsx(Li,{className:"h-5 w-5 text-primary"}):e.jsx(ah,{className:"h-5 w-5 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground",children:fxt[b.action_type]||e.jsx(ah,{className:"h-4 w-4"})}),e.jsx("span",{className:qt("font-medium",N&&"line-through text-muted-foreground"),children:b.title})]}),b.description&&e.jsx("p",{className:qt("text-sm text-muted-foreground mt-1",N&&"line-through"),children:b.description})]})]},b.id)})})})]})}const Qf=()=>Ht({queryKey:["relationship-types"],queryFn:async()=>{const{data:t,error:r}=await Z.from("relationship_types").select("*").order("sort_order");if(r)throw r;return t}}),Ip=t=>{const r=Ll(),s=1e3,n=async a=>{const o=[];let l=0;for(;;){const{data:i,error:d}=await a.range(l,l+s-1);if(d)throw d;const m=i??[];if(o.push(...m),m.length{let a=Z.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 n(a)},enabled:!!r})},yxt=t=>Ht({queryKey:["innercircle-contact",t],queryFn:async()=>{const{data:r,error:s}=await Z.from("innercircle_contacts").select(` *, tags:innercircle_contact_tags( id, contact_id, relationship_type_id, relationship_type:relationship_types(*) ) `).eq("id",t).maybeSingle();if(s)throw s;return r},enabled:!!t}),zRe=()=>{const t=Ll();return Ht({queryKey:["innercircle-contact-counts",t],queryFn:async()=>{const{data:r,error:s}=await Z.from("innercircle_contacts").select(` id, tags:innercircle_contact_tags(relationship_type_id) `);if(s)throw s;const n={};return r==null||r.forEach(a=>{var o;(o=a.tags)==null||o.forEach(l=>{n[l.relationship_type_id]=(n[l.relationship_type_id]||0)+1})}),n},enabled:!!t})},Vye=()=>{const t=qr(),r=Ll();return Jt({mutationFn:async s=>{const{tagIds:n,...a}=s,o={...a,birthday:a.birthday||null,home_anniversary:a.home_anniversary||null,owner_user_id:r},{data:l,error:i}=await Z.from("innercircle_contacts").insert(o).select().single();if(i)throw i;if(n&&n.length>0){const{error:d}=await Z.from("innercircle_contact_tags").insert(n.map(m=>({contact_id:l.id,relationship_type_id:m})));if(d)throw d}return l},onSuccess:()=>{t.invalidateQueries({queryKey:["innercircle-contacts"]}),t.invalidateQueries({queryKey:["innercircle-contact-counts"]}),Jn({title:"Contact created successfully"})},onError:s=>{Jn({title:"Error creating contact",description:s.message,variant:"destructive"})}})},BRe=()=>{const t=qr();return Jt({mutationFn:async({id:r,...s})=>{const{tagIds:n,tags:a,...o}=s,l={...o,birthday:o.birthday||null,home_anniversary:o.home_anniversary||null},{data:i,error:d}=await Z.from("innercircle_contacts").update(l).eq("id",r).select().single();if(d)throw d;if(n!==void 0&&(await Z.from("innercircle_contact_tags").delete().eq("contact_id",r),n.length>0)){const{error:m}=await Z.from("innercircle_contact_tags").insert(n.map(g=>({contact_id:r,relationship_type_id:g})));if(m)throw m}return i},onSuccess:()=>{t.invalidateQueries({queryKey:["innercircle-contacts"]}),t.invalidateQueries({queryKey:["innercircle-contact"]}),t.invalidateQueries({queryKey:["innercircle-contact-counts"]}),Jn({title:"Contact updated successfully"})},onError:r=>{Jn({title:"Error updating contact",description:r.message,variant:"destructive"})}})},Hye=()=>{const t=qr();return Jt({mutationFn:async r=>{const{error:s}=await Z.from("innercircle_contacts").delete().eq("id",r);if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["innercircle-contacts"]}),t.invalidateQueries({queryKey:["innercircle-contact-counts"]}),Jn({title:"Contact deleted successfully"})},onError:r=>{Jn({title:"Error deleting contact",description:r.message,variant:"destructive"})}})},Wye=()=>Ht({queryKey:["action-types"],queryFn:async()=>{const{data:t,error:r}=await Z.from("action_types").select("*").order("sort_order");if(r)throw r;return t}}),vxt=t=>Ht({queryKey:["action-scripts",t],queryFn:async()=>{let r=Z.from("action_scripts").select("*, action_type:action_types(*)");const{data:s,error:n}=await r;if(n)throw n;return s}}),_xt=()=>Ht({queryKey:["touchpoint-plans"],queryFn:async()=>{const{data:t,error:r}=await Z.from("touchpoint_plans").select(` *, items:touchpoint_plan_items( *, action_type:action_types(*), default_script:action_scripts(*) ) `).order("name");if(r)throw r;return t}}),bxt=()=>{const t=qr(),r=Ll();return Jt({mutationFn:async({name:s,description:n})=>{const{data:a,error:o}=await Z.from("touchpoint_plans").insert({name:s,description:n,owner_user_id:r,active:!0,is_template:!1}).select().single();if(o)throw o;return a},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),Jn({title:"Plan created successfully"})},onError:s=>{Jn({title:"Error creating plan",description:s.message,variant:"destructive"})}})},wxt=()=>{const t=qr(),r=Ll();return Jt({mutationFn:async({sourcePlanId:s,newName:n})=>{const{data:a,error:o}=await Z.from("touchpoint_plans").select(` *, items:touchpoint_plan_items(*) `).eq("id",s).single();if(o)throw o;if(!a)throw new Error("Source plan not found");const{data:l,error:i}=await Z.from("touchpoint_plans").insert({name:n,description:a.description,owner_user_id:r,active:!0,is_template:!1}).select().single();if(i)throw i;if(a.items&&a.items.length>0){const d=a.items.map(g=>({plan_id:l.id,month_number:g.month_number,action_type_id:g.action_type_id,default_script_id:g.default_script_id,notes:g.notes})),{error:m}=await Z.from("touchpoint_plan_items").insert(d);if(m)throw m}return l},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),Jn({title:"Plan duplicated successfully",description:"You can now edit your copy of this plan."})},onError:s=>{Jn({title:"Error duplicating plan",description:s.message,variant:"destructive"})}})},jxt=()=>{const t=qr();return Jt({mutationFn:async({id:r,name:s,description:n})=>{const{data:a,error:o}=await Z.from("touchpoint_plans").update({name:s,description:n}).eq("id",r).select().single();if(o)throw o;return a},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),Jn({title:"Plan updated successfully"})}})},kxt=()=>{const t=qr();return Jt({mutationFn:async r=>{const{error:s}=await Z.from("touchpoint_plans").delete().eq("id",r);if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),Jn({title:"Plan deleted successfully"})}})},Nxt=()=>{const t=qr();return Jt({mutationFn:async({planId:r,items:s})=>{if(await Z.from("touchpoint_plan_items").delete().eq("plan_id",r),s.length>0){const{error:n}=await Z.from("touchpoint_plan_items").insert(s.map(a=>({plan_id:r,month_number:a.month_number,action_type_id:a.action_type_id,default_script_id:a.default_script_id||null,notes:a.notes})));if(n)throw n}},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),Jn({title:"Plan schedule updated"})}})},Sxt=()=>{const t=qr();return Jt({mutationFn:async({actionTypeId:r,title:s,scriptBody:n,emailSubject:a,tone:o})=>{const{data:{user:l}}=await Z.auth.getUser(),{data:i,error:d}=await Z.from("action_scripts").insert({action_type_id:r,title:s,script_body:n,email_subject:a||null,tone:o||null,active:!0,user_id:l==null?void 0:l.id}).select().single();if(d)throw d;return i},onSuccess:()=>{t.invalidateQueries({queryKey:["action-scripts"]}),Jn({title:"Script created successfully"})},onError:r=>{Jn({title:"Error creating script",description:r.message,variant:"destructive"})}})},Cxt=()=>{const t=Ll();return Ht({queryKey:["user-plan-enrollments",t],queryFn:async()=>{const{data:r,error:s}=await Z.from("user_plan_enrollments").select(` *, plan:touchpoint_plans(*), relationship_type:relationship_types(*) `);if(s)throw s;return r},enabled:!!t})},Mxt=()=>{const t=qr(),r=Ll();return Jt({mutationFn:async({planId:s,relationshipTypeId:n,active:a})=>{const{data:o}=await Z.from("user_plan_enrollments").select("id").eq("plan_id",s).eq("relationship_type_id",n).maybeSingle();if(o){const{error:l}=await Z.from("user_plan_enrollments").update({active:a}).eq("id",o.id);if(l)throw l}else if(a){const{error:l}=await Z.from("user_plan_enrollments").insert({owner_user_id:r,plan_id:s,relationship_type_id:n,active:!0,start_date:new Date().toISOString().split("T")[0]});if(l)throw l}},onSuccess:()=>{t.invalidateQueries({queryKey:["user-plan-enrollments"]}),Jn({title:"Plan enrollment updated"})}})},gae=(t=7)=>{const r=Ll();return Ht({queryKey:["contact-touch-logs",r,t],queryFn:async()=>{const s=new Date;s.setDate(s.getDate()-t);const{data:n,error:a}=await Z.from("contact_touch_logs").select(` *, contact:innercircle_contacts(*), action_type:action_types(*) `).gte("completed_at",s.toISOString()).order("completed_at",{ascending:!1});if(a)throw a;return n},enabled:!!r})},$Re=()=>{const t=Ll();return Ht({queryKey:["contacts-last-touch",t],queryFn:async()=>{const{data:r,error:s}=await Z.from("contact_touch_logs").select("contact_id, completed_at").order("completed_at",{ascending:!1});if(s)throw s;const n={};return r==null||r.forEach(a=>{n[a.contact_id]||(n[a.contact_id]=a.completed_at)}),n},enabled:!!t})},Txt=(t=90)=>{const{data:r}=Ip(),{data:s}=$Re();if(!r||!s)return{contacts:[],count:0};const n=new Date;n.setDate(n.getDate()-t);const a=r.filter(o=>{const l=s[o.id];return l?new Date(l){const t=qr(),r=Ll();return Jt({mutationFn:async({contactId:s,actionTypeId:n,scriptUsedId:a,notes:o})=>{const{data:l,error:i}=await Z.from("contact_touch_logs").insert({owner_user_id:r,contact_id:s,action_type_id:n,script_used_id:a,notes:o,completed_at:new Date().toISOString()}).select().single();if(i)throw i;return l},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-touch-logs"]}),t.invalidateQueries({queryKey:["contacts-last-touch"]}),t.invalidateQueries({queryKey:["today-actions"]}),Jn({title:"Action completed!"})}})},qRe="agentos_weekly_touch_goal",o4e=20,ure=()=>{if(typeof window>"u")return o4e;const t=localStorage.getItem(qRe);if(t){const r=parseInt(t,10);if(!isNaN(r)&&r>0)return r}return o4e},VRe=t=>{localStorage.setItem(qRe,t.toString())},HRe=()=>{const{data:t}=gae(7),r=new Date;r.setHours(0,0,0,0);const s=new Date(r);s.setDate(r.getDate()-r.getDay());const n=(t==null?void 0:t.filter(l=>new Date(l.completed_at)>=s).length)||0;let a=0;if(t&&t.length>0){const l=new Set(t.map(d=>new Date(d.completed_at).toDateString()));let i=new Date(r);for(;l.has(i.toDateString());)a++,i.setDate(i.getDate()-1)}const o=ure();return{actionsThisWeek:n,weeklyGoal:o,streak:a,progress:Math.min(n/o*100,100)}},Axt=()=>{const t=Ll();return Ht({queryKey:["contact-plan-cycles",t],queryFn:async()=>{const{data:r,error:s}=await Z.from("contact_plan_cycles").select(` *, contact:innercircle_contacts(*), plan:touchpoint_plans( *, items:touchpoint_plan_items( *, action_type:action_types(*), default_script:action_scripts(*) ) ) `);if(s)throw s;return r},enabled:!!t})},Ext=()=>{const t=qr();return Ll(),Jt({mutationFn:async()=>{const{data:r}=await Z.from("user_plan_enrollments").select("*").eq("active",!0);if(!r||r.length===0)return;const{data:s}=await Z.from("innercircle_contacts").select(` id, tags:innercircle_contact_tags(relationship_type_id) `);if(!s)return;const{data:n}=await Z.from("contact_plan_cycles").select("contact_id, plan_id"),a=new Set((n==null?void 0:n.map(l=>`${l.contact_id}-${l.plan_id}`))||[]),o=[];for(const l of s)for(const i of l.tags||[]){const d=r.find(m=>m.relationship_type_id===i.relationship_type_id);d&&!a.has(`${l.id}-${d.plan_id}`)&&o.push({contact_id:l.id,plan_id:d.plan_id,relationship_type_id:i.relationship_type_id})}if(o.length>0){const{error:l}=await Z.from("contact_plan_cycles").insert(o);if(l)throw l}return o.length},onSuccess:r=>{t.invalidateQueries({queryKey:["contact-plan-cycles"]}),r&&r>0&&Jn({title:`${r} contact(s) enrolled in plans`})}})},WRe=()=>{const t=Ll(),{data:r}=Axt(),{data:s}=gae(30);return Ht({queryKey:["today-actions",t,r==null?void 0:r.length,s==null?void 0:s.length],queryFn:async()=>{var N;if(!r||r.length===0)return[];const{data:n}=await Z.from("contact_snoozes").select("contact_id").gte("snoozed_until",new Date().toISOString()),a=new Set((n==null?void 0:n.map(j=>j.contact_id))||[]),o=new Date,l=[],i=new Date(o.getFullYear(),o.getMonth(),1),d=new Set((s==null?void 0:s.filter(j=>new Date(j.completed_at)>=i).map(j=>`${j.contact_id}-${j.action_type_id}`))||[]);for(const j of r){if(!((N=j.plan)!=null&&N.items)||j.plan.items.length===0||!j.contact||a.has(j.contact_id))continue;const S=new Date(j.cycle_start_date),M=Math.floor((o.getTime()-S.getTime())/(30.44*24*60*60*1e3))%12+1,I=j.plan.items.find(F=>F.month_number===M);if(I&&I.action_type){const F=`${j.contact_id}-${I.action_type_id}`;if(!d.has(F)){const{data:O}=await Z.from("relationship_types").select("name").eq("id",j.relationship_type_id).single();l.push({contact:j.contact,actionType:I.action_type,script:I.default_script||void 0,planName:j.plan.name,relationshipTypeName:(O==null?void 0:O.name)||"",monthNumber:M})}}}const m=5,g=o.getDate(),y=l.sort((j,S)=>j.contact.first_name.localeCompare(S.contact.first_name)),v=(g-1)%Math.max(1,y.length);return[...y.slice(v),...y.slice(0,v)].slice(0,m)},enabled:!!t&&!!r})};function Ixt(){const t=Ws(),{data:r,isLoading:s}=WRe(),{data:n}=Ip(),a=HRe(),[o,l]=E.useState(ure()),[i,d]=E.useState(""),[m,g]=E.useState(!1);E.useEffect(()=>{l(ure())},[]);const y=()=>{const B=parseInt(i,10);if(isNaN(B)||B<1){Jn({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}l(B),VRe(B),g(!1),Jn({title:"Goal updated",description:`Weekly touch goal set to ${B}`})},v=()=>{d(o.toString()),g(!0)},b=Em(new Date),N=sc(b,7),j=B=>{if(!B)return null;const $=B.split(/[-/T]/);if($.length<3)return null;const H=parseInt($[1],10)-1,W=parseInt($[2],10);return isNaN(H)||isNaN(W)?null:new Date(b.getFullYear(),H,W)},S=(n==null?void 0:n.map(B=>{const $=j(B.birthday),H=j(B.home_anniversary),W=[];return $&&$>=b&&$<=N&&W.push({contact:B,type:"birthday",date:$,isToday:Vl($,b)}),H&&H>=b&&H<=N&&W.push({contact:B,type:"anniversary",date:H,isToday:Vl(H,b)}),W}).flat().sort((B,$)=>B.date.getTime()-$.date.getTime()).slice(0,3))||[],A=(n==null?void 0:n.filter(B=>{const $=j(B.birthday),H=j(B.home_anniversary);return $&&Vl($,b)||H&&Vl(H,b)}).length)||0,M=(r==null?void 0:r.length)||0,I=A+M,F=(a==null?void 0:a.actionsThisWeek)||0,O=(a==null?void 0:a.streak)||0;return s?e.jsx(ze,{className:"bg-gradient-to-br from-primary/5 via-primary/10 to-primary/5 border-primary/20",children:e.jsx(qe,{className:"p-4",children:e.jsxs("div",{className:"animate-pulse flex items-center gap-4",children:[e.jsx("div",{className:"h-12 w-12 bg-primary/20 rounded-lg"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("div",{className:"h-4 bg-primary/20 rounded w-1/3"}),e.jsx("div",{className:"h-3 bg-primary/10 rounded w-1/2"})]})]})})}):e.jsxs(ze,{className:"bg-gradient-to-br from-primary/5 via-primary/10 to-primary/5 border-primary/20",children:[e.jsxs(Wt,{className:"pb-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:[e.jsx(ws,{className:"h-5 w-5 text-primary"}),"Agent OS"]}),e.jsx("div",{className:"flex items-center gap-2",children:O>0&&e.jsxs(bt,{variant:"secondary",className:"gap-1 bg-orange-500/10 text-orange-600 border-orange-200",children:[e.jsx(_m,{className:"h-3 w-3"}),O," day streak"]})})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[I>0?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-primary font-medium",children:[I," tasks"]})," for today"]}):"No tasks for today",F>0&&e.jsxs("span",{className:"ml-2",children:["• ",e.jsx("span",{className:"text-emerald-600 font-medium",children:F})," touches this week"]})]})]}),e.jsxs(qe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(Q,{size:"sm",variant:"outline",className:"gap-1.5",onClick:B=>{B.stopPropagation(),t("/mission-control/contacts?new=true")},children:[e.jsx($d,{className:"h-3.5 w-3.5"}),"Add Contact"]}),e.jsxs(Q,{size:"sm",variant:"outline",className:"gap-1.5",onClick:B=>{B.stopPropagation(),t("/mission-control")},children:[e.jsx(wi,{className:"h-3.5 w-3.5"}),"Log Touch"]}),e.jsxs(Q,{size:"sm",variant:"outline",className:"gap-1.5 border-emerald-200 text-emerald-700 hover:bg-emerald-50 hover:text-emerald-800",onClick:B=>{B.stopPropagation(),t("/mission-control/video/record")},children:[e.jsx(ya,{className:"h-3.5 w-3.5"}),"Quick Video"]}),e.jsxs(Q,{size:"sm",variant:"outline",className:"gap-1.5",onClick:B=>{B.stopPropagation(),t("/mission-control/popbys")},children:[e.jsx(eo,{className:"h-3.5 w-3.5"}),"Pop-by Map"]}),e.jsxs(Q,{size:"sm",variant:"outline",className:"gap-1.5 border-purple-200 text-purple-700 hover:bg-purple-50 hover:text-purple-800",onClick:B=>{B.stopPropagation(),t("/mission-control/pipeline")},children:[e.jsx(xy,{className:"h-3.5 w-3.5"}),"Pipeline"]})]}),e.jsxs("div",{className:"pt-3 border-t border-border/50",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(bp,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"text-sm font-medium",children:"Weekly Goal"}),e.jsxs(Dr,{open:m,onOpenChange:g,children:[e.jsx(xo,{asChild:!0,children:e.jsx("button",{onClick:v,className:"p-0.5 rounded hover:bg-muted transition-colors","aria-label":"Edit weekly goal",children:e.jsx(vd,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-primary"})})}),e.jsxs(Lr,{className:"sm:max-w-[360px]",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Set Weekly Goal"}),e.jsx(Gs,{children:"How many touches do you want to complete each week?"})]}),e.jsxs("div",{className:"space-y-4 pt-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"weekly-goal",children:"Weekly touch goal"}),e.jsx(Qe,{id:"weekly-goal",type:"number",min:"1",value:i,onChange:B=>d(B.target.value),placeholder:"20",onKeyDown:B=>{B.key==="Enter"&&y()}})]}),e.jsx(Q,{onClick:y,className:"w-full",children:"Save Goal"})]})]})]})]}),e.jsxs("span",{className:"text-sm",children:[e.jsx("span",{className:"font-medium text-primary",children:F}),e.jsxs("span",{className:"text-muted-foreground",children:[" / ",o," touches"]})]})]}),e.jsx(hc,{value:Math.min(F/o*100,100),className:"h-2 bg-muted [&>div]:bg-primary"}),F>=o&&e.jsxs("p",{className:"text-xs text-emerald-600 mt-1.5 flex items-center gap-1",children:[e.jsx("span",{children:"🎉"})," Goal achieved! Keep the momentum going."]}),F0&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1.5",children:[o-F," more to hit your weekly goal"]})]}),S.length>0&&e.jsxs("div",{className:"pt-3 border-t border-border/50",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(vm,{className:"h-4 w-4 text-pink-500"}),e.jsx("span",{className:"text-sm font-medium",children:"Upcoming Milestones"})]}),e.jsx("div",{className:"space-y-2",children:S.map((B,$)=>e.jsxs("div",{className:`flex items-center justify-between p-2 rounded-lg cursor-pointer transition-colors ${B.isToday?"bg-pink-500/10 hover:bg-pink-500/15":"bg-muted/50 hover:bg-muted"}`,onClick:H=>{H.stopPropagation(),t(`/mission-control/contacts/${B.contact.id}`)},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[B.type==="birthday"?e.jsx(vm,{className:"h-3.5 w-3.5 text-pink-500"}):e.jsx(Wn,{className:"h-3.5 w-3.5 text-blue-500"}),e.jsxs("span",{className:"text-sm",children:[B.contact.first_name," ",B.contact.last_name]}),B.isToday&&e.jsx(bt,{variant:"secondary",className:"text-[10px] px-1.5 py-0 bg-pink-500/20 text-pink-600",children:"Today!"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{children:B.isToday?B.type==="birthday"?"🎂":"🏠":Xr(B.date,"EEE, MMM d")}),e.jsx(Wi,{className:"h-3 w-3"})]})]},`${B.contact.id}-${B.type}-${$}`))})]}),e.jsxs(Q,{variant:"ghost",size:"sm",className:"w-full gap-1 text-muted-foreground hover:text-primary",onClick:()=>t("/mission-control"),children:["Open Agent OS",e.jsx(Hi,{className:"h-4 w-4"})]})]})]})}const GRe=()=>Ht({queryKey:["listing-exchange-enabled"],queryFn:async()=>{const{data:t,error:r}=await Z.from("feature_flags").select("enabled").eq("key","listing_exchange_enabled").maybeSingle();if(r)throw r;return(t==null?void 0:t.enabled)??!1}}),KRe=t=>{const{user:r,brokerageId:s}=Gr();return Ht({queryKey:["listings",t,s],queryFn:async()=>{let n=Z.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)) `).eq("is_approved",!0).eq("is_public",!0);t!=null&&t.status&&(n=n.eq("status",t.status)),t!=null&&t.propertyType&&(n=n.eq("property_type",t.propertyType)),t!=null&&t.city&&(n=n.ilike("city",`%${t.city}%`)),t!=null&&t.minPrice&&(n=n.gte("price",t.minPrice)),t!=null&&t.maxPrice&&(n=n.lte("price",t.maxPrice)),t!=null&&t.openToReferrals&&(n=n.eq("open_to_referrals",!0));const{data:a,error:o}=await n;if(o)throw o;let l=a||[];if(s){const{data:i}=await Z.from("profiles").select("id").eq("brokerage_id",s);if(i&&i.length>0){const d=i.map(y=>y.id);let m=Z.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",d);t!=null&&t.status&&(m=m.eq("status",t.status)),t!=null&&t.propertyType&&(m=m.eq("property_type",t.propertyType)),t!=null&&t.city&&(m=m.ilike("city",`%${t.city}%`)),t!=null&&t.minPrice&&(m=m.gte("price",t.minPrice)),t!=null&&t.maxPrice&&(m=m.lte("price",t.maxPrice)),t!=null&&t.openToReferrals&&(m=m.eq("open_to_referrals",!0));const{data:g}=await m;if(g){const y=new Set(l.map(b=>b.id)),v=g.filter(b=>!y.has(b.id));l=[...l,...v]}}}switch(t==null?void 0:t.sortBy){case"updated":l.sort((i,d)=>new Date(d.updated_at).getTime()-new Date(i.updated_at).getTime());break;case"price_asc":l.sort((i,d)=>i.price-d.price);break;case"price_desc":l.sort((i,d)=>d.price-i.price);break;default:l.sort((i,d)=>new Date(d.created_at).getTime()-new Date(i.created_at).getTime())}return l}})},ZRe=()=>{const{user:t}=Gr();return Ht({queryKey:["my-listings",t==null?void 0:t.id],queryFn:async()=>{if(!t)return[];const{data:r,error:s}=await Z.from("listings").select(` *, photos:listing_photos(*) `).eq("agent_id",t.id).order("created_at",{ascending:!1});if(s)throw s;return r},enabled:!!t})},YRe=t=>{const{user:r}=Gr();return Ht({queryKey:["listing",t],queryFn:async()=>{const{data:s,error:n}=await Z.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)), video:agent_videos!listings_video_id_fkey(id, playback_url, thumbnail_url, title, duration_seconds) `).eq("id",t).single();if(n)throw n;return r&&await Z.from("listing_views").insert({listing_id:t,viewer_id:r.id}),s},enabled:!!t})},Pxt=()=>{const t=qr(),{user:r}=Gr();return Jt({mutationFn:async s=>{if(!r)throw new Error("Not authenticated");const{data:n,error:a}=await Z.from("listings").insert({...s,agent_id:r.id}).select().single();if(a)throw a;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["listings"]}),t.invalidateQueries({queryKey:["my-listings"]})}})},Lxt=()=>{const t=qr();return Jt({mutationFn:async({agentId:r,...s})=>{const{data:n,error:a}=await Z.from("listings").insert({...s,agent_id:r}).select().single();if(a)throw a;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["listings"]}),t.invalidateQueries({queryKey:["my-listings"]}),t.invalidateQueries({queryKey:["brokerage-listings"]})}})},Oxt=()=>{const t=qr();return Jt({mutationFn:async({id:r,...s})=>{const{data:n,error:a}=await Z.from("listings").update(s).eq("id",r).select().single();if(a)throw a;return n},onSuccess:r=>{t.invalidateQueries({queryKey:["listings"]}),t.invalidateQueries({queryKey:["my-listings"]}),t.invalidateQueries({queryKey:["listing",r.id]})}})},XRe=()=>{const t=qr();return Jt({mutationFn:async r=>{const{error:s}=await Z.from("listings").delete().eq("id",r);if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["listings"]}),t.invalidateQueries({queryKey:["my-listings"]})}})},Dxt=()=>{const t=qr();return Jt({mutationFn:async({listingId:r,photoUrl:s,isPrimary:n=!1})=>{const{data:a,error:o}=await Z.from("listing_photos").insert({listing_id:r,photo_url:s,is_primary:n}).select().single();if(o)throw o;return a},onSuccess:r=>{t.invalidateQueries({queryKey:["listing",r.listing_id]}),t.invalidateQueries({queryKey:["my-listings"]})}})},Rxt=()=>{const t=qr();return Jt({mutationFn:async({photoId:r,listingId:s})=>{const{error:n}=await Z.from("listing_photos").delete().eq("id",r);if(n)throw n;return s},onSuccess:r=>{t.invalidateQueries({queryKey:["listing",r]}),t.invalidateQueries({queryKey:["my-listings"]})}})},Fxt=()=>{const{user:t}=Gr();return Ht({queryKey:["saved-listings",t==null?void 0:t.id],queryFn:async()=>{if(!t)return[];const{data:r,error:s}=await Z.from("listing_saves").select(` *, listing:listings( *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id) ) `).eq("agent_id",t.id);if(s)throw s;return r},enabled:!!t})},QRe=()=>{const t=qr(),{user:r}=Gr();return Jt({mutationFn:async s=>{if(!r)throw new Error("Not authenticated");const{data:n}=await Z.from("listing_saves").select("id").eq("listing_id",s).eq("agent_id",r.id).maybeSingle();return n?(await Z.from("listing_saves").delete().eq("id",n.id),{saved:!1}):(await Z.from("listing_saves").insert({listing_id:s,agent_id:r.id}),{saved:!0})},onSuccess:()=>{t.invalidateQueries({queryKey:["saved-listings"]}),t.invalidateQueries({queryKey:["listings"]})}})},JRe=t=>{const{user:r}=Gr();return Ht({queryKey:["listing-saved",t,r==null?void 0:r.id],queryFn:async()=>{if(!r)return!1;const{data:s}=await Z.from("listing_saves").select("id").eq("listing_id",t).eq("agent_id",r.id).maybeSingle();return!!s},enabled:!!r&&!!t})},zxt=()=>{const t=qr(),{user:r}=Gr();return Jt({mutationFn:async s=>{if(!r)throw new Error("Not authenticated");const{data:n}=await Z.from("listing_follows").select("id").eq("listing_id",s).eq("agent_id",r.id).maybeSingle();return n?(await Z.from("listing_follows").delete().eq("id",n.id),{following:!1}):(await Z.from("listing_follows").insert({listing_id:s,agent_id:r.id}),{following:!0})},onSuccess:()=>{t.invalidateQueries({queryKey:["listing-following"]})}})},Bxt=t=>{const{user:r}=Gr();return Ht({queryKey:["listing-following",t,r==null?void 0:r.id],queryFn:async()=>{if(!r)return!1;const{data:s}=await Z.from("listing_follows").select("id").eq("listing_id",t).eq("agent_id",r.id).maybeSingle();return!!s},enabled:!!r&&!!t})},$xt=()=>{const{user:t}=Gr();return Jt({mutationFn:async({listingId:r,shareType:s})=>{if(!t)throw new Error("Not authenticated");const{error:n}=await Z.from("listing_shares").insert({listing_id:r,sharing_agent_id:t.id,share_type:s});if(n)throw n}})},Uxt=()=>{const{user:t}=Gr();return Ht({queryKey:["my-referrals",t==null?void 0:t.id],queryFn:async()=>{if(!t)return{sent:[],received:[]};const[r,s]=await Promise.all([Z.from("listing_referrals").select(` *, listing:listings(*,photos:listing_photos(*)) `).eq("sender_agent_id",t.id).order("created_at",{ascending:!1}),Z.from("listing_referrals").select(` *, sender:profiles!listing_referrals_sender_agent_id_fkey(id, name, email), listing:listings(*,photos:listing_photos(*)) `).eq("listing_agent_id",t.id).order("created_at",{ascending:!1})]);return{sent:r.data||[],received:s.data||[]}},enabled:!!t})},qxt=()=>{const t=qr(),{user:r}=Gr();return Jt({mutationFn:async({listingId:s,listingAgentId:n,buyerName:a,buyerType:o,notes:l})=>{if(!r)throw new Error("Not authenticated");const{data:i,error:d}=await Z.from("listing_referrals").insert({listing_id:s,sender_agent_id:r.id,listing_agent_id:n,buyer_name:a,buyer_type:o,notes:l}).select().single();if(d)throw d;return i},onSuccess:()=>{t.invalidateQueries({queryKey:["my-referrals"]})}})},Vxt=()=>Ht({queryKey:["listing-leaderboard"],queryFn:async()=>{const{data:t}=await Z.from("listing_shares").select("sharing_agent_id, profiles!listing_shares_agent_id_fkey(name)").order("created_at",{ascending:!1}),r=new Map;t==null||t.forEach(l=>{var m;const i=l.sharing_agent_id;if(!i)return;const d=r.get(i);d?d.count++:r.set(i,{name:((m=l.profiles)==null?void 0:m.name)||"Unknown",count:1})});const s=Array.from(r.entries()).map(([l,i])=>({agentId:l,...i})).sort((l,i)=>i.count-l.count).slice(0,10),{data:n}=await Z.from("listings").select("agent_id, agent:profiles!listings_agent_id_fkey(name)").eq("is_approved",!0),a=new Map;n==null||n.forEach(l=>{var d;const i=a.get(l.agent_id);i?i.count++:a.set(l.agent_id,{name:((d=l.agent)==null?void 0:d.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:s,topListers:o}}}),Hxt=()=>{const{user:t,brokerageId:r}=Gr();return Ht({queryKey:["brokerage-listings",r],queryFn:async()=>{if(!t||!r)return[];const{data:s}=await Z.from("profiles").select("id").eq("brokerage_id",r);if(!s||s.length===0)return[];const n=s.map(l=>l.id),{data:a,error:o}=await Z.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)) `).in("agent_id",n).eq("is_approved",!0).order("created_at",{ascending:!1});if(o)throw o;return a},enabled:!!t&&!!r})},eFe=({className:t,variant:r="default"})=>e.jsx(bt,{variant:"outline",className:qt("text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0 h-4",r==="default"?"border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10":"border-muted-foreground/30 text-muted-foreground",t),children:"Beta"}),Wxt={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"},Gxt={coming_soon:"Coming Soon",active:"Active",under_contract:"Under Contract",sold:"Sold",withdrawn:"Withdrawn"};function Kxt(t){return t>=1e6?`$${(t/1e6).toFixed(1)}M`:`$${(t/1e3).toFixed(0)}K`}function Zxt(){const t=Ws(),{data:r,isLoading:s}=GRe(),{data:n,isLoading:a}=KRe({status:void 0,propertyType:void 0,sortBy:"newest"}),o=(n==null?void 0:n.filter(g=>g.is_approved&&g.is_public))||[],l=o.filter(g=>g.is_featured),i=o.filter(g=>!g.is_featured),d=[...l,...i].slice(0,6),m=s||a;return!m&&!r?null:m?e.jsx(ze,{className:"bg-gradient-to-br from-emerald-500/5 via-emerald-500/10 to-emerald-500/5 border-emerald-500/20",children:e.jsx(qe,{className:"p-4",children:e.jsxs("div",{className:"animate-pulse flex items-center gap-4",children:[e.jsx("div",{className:"h-12 w-12 bg-emerald-500/20 rounded-lg"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("div",{className:"h-4 bg-emerald-500/20 rounded w-1/3"}),e.jsx("div",{className:"h-3 bg-emerald-500/10 rounded w-1/2"})]})]})})}):e.jsxs("section",{className:"mb-10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Listing Exchange"}),e.jsx(eFe,{})]}),e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>t("/mission-control/listings"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",e.jsx(Hi,{className:"h-4 w-4"})]})]}),d.length===0?e.jsx(ze,{className:"bg-muted/30 border-dashed",children:e.jsx(qe,{className:"flex items-center justify-center py-8",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Wn,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No listings available yet"}),e.jsx(Q,{variant:"link",size:"sm",onClick:()=>t("/mission-control/listings/new"),className:"mt-2",children:"Add the first listing"})]})})}):e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:d.map(g=>{var v,b;const y=((v=g.photos)==null?void 0:v.find(N=>N.is_primary))||((b=g.photos)==null?void 0:b[0]);return e.jsxs("div",{onClick:()=>t(`/mission-control/listings/${g.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:[e.jsxs("div",{className:"aspect-[4/3] bg-muted/50 overflow-hidden relative",children:[y!=null&&y.photo_url?e.jsx("img",{src:y.photo_url,alt:`${g.city}, ${g.state}`,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(Wn,{className:"h-8 w-8 text-muted-foreground/50"})}),g.is_featured&&e.jsx("div",{className:"absolute top-1.5 left-1.5",children:e.jsxs(bt,{className:"gap-1 bg-amber-500 text-white border-0 text-[10px] px-1.5 py-0.5",children:[e.jsx(Ln,{className:"h-2.5 w-2.5 fill-current"}),"Featured"]})}),e.jsx("div",{className:"absolute top-1.5 right-1.5",children:e.jsx(bt,{className:`text-[10px] px-1.5 py-0.5 ${Wxt[g.status]}`,children:Gxt[g.status]})})]}),e.jsxs("div",{className:"p-2",children:[e.jsx("p",{className:"font-bold text-sm text-foreground",children:Kxt(g.price)}),e.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[g.city,", ",g.state]}),(g.bedrooms||g.bathrooms)&&e.jsxs("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:[g.bedrooms&&`${g.bedrooms} bed`,g.bedrooms&&g.bathrooms&&" · ",g.bathrooms&&`${g.bathrooms} bath`]})]})]},g.id)})})]})}function tFe(t=10,r){return Ht({queryKey:["event-leaderboard",t,r],queryFn:async()=>{const{data:s}=await Z.from("user_roles").select("user_id").eq("role","admin"),n=new Set((s==null?void 0:s.map(v=>v.user_id))||[]);let a=null;if(r){const{data:v}=await Z.from("profiles").select("id").eq("brokerage_id",r);a=new Set((v==null?void 0:v.map(b=>b.id))||[])}const{data:o,error:l}=await Z.from("agent_attendance_stats").select("user_id, total_points, total_events_attended, current_streak").order("total_points",{ascending:!1}).limit(t+n.size+50);if(l)throw l;if(!o||o.length===0)return[];let i=o.filter(v=>!n.has(v.user_id));a&&(i=i.filter(v=>a.has(v.user_id)));const d=i.slice(0,t),m=d.map(v=>v.user_id),{data:g}=await Z.from("profiles").select("id, name").in("id",m),y=new Map((g==null?void 0:g.map(v=>[v.id,{name:v.name}]))||[]);return d.map(v=>({user_id:v.user_id,total_points:v.total_points,total_events_attended:v.total_events_attended,current_streak:v.current_streak,profile:y.get(v.user_id)||null}))}})}function rFe(t){return Ht({queryKey:["user-attendance-stats",t],queryFn:async()=>{if(!t)return null;const{data:r,error:s}=await Z.from("agent_attendance_stats").select("*").eq("user_id",t).single();if(s&&s.code!=="PGRST116")throw s;return r},enabled:!!t})}function sFe(t){return Ht({queryKey:["user-badges",t],queryFn:async()=>{if(!t)return[];const{data:r,error:s}=await Z.from("agent_badges").select("*").eq("user_id",t).order("earned_at",{ascending:!1});if(s)throw s;return r},enabled:!!t})}function nFe(t,r){return Ht({queryKey:["user-rank",t,r],queryFn:async()=>{if(!t)return null;const{data:s}=await Z.from("agent_attendance_stats").select("total_points").eq("user_id",t).single();if(!s)return null;const{data:n}=await Z.from("user_roles").select("user_id").eq("role","admin"),a=new Set((n==null?void 0:n.map(d=>d.user_id))||[]),{data:o,error:l}=await Z.from("agent_attendance_stats").select("user_id, total_points").gt("total_points",s.total_points);if(l)throw l;let i=(o==null?void 0:o.filter(d=>!a.has(d.user_id)))||[];if(r){const{data:d}=await Z.from("profiles").select("id").eq("brokerage_id",r),m=new Set((d==null?void 0:d.map(g=>g.id))||[]);i=i.filter(g=>m.has(g.user_id))}return i.length+1},enabled:!!t})}function Yxt(){const{user:t,brokerageId:r,isAdmin:s}=Gr();Ws();const n=!!r,[a,o]=E.useState("brokerage"),l=()=>{if(s)return null;if(n)return a==="global"?null:r},{data:i,isLoading:d}=tFe(5,l()),{data:m}=rFe(t==null?void 0:t.id),{data:g}=nFe(t==null?void 0:t.id,l()),{data:y}=sFe(t==null?void 0:t.id),v=s||n,b=()=>s?"Agent Leaderboard":n?a==="global"?"All LevelUp":"My Brokerage":"My Points";if(d)return e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsxs(Zt,{className:"text-base flex items-center gap-2",children:[e.jsx(ho,{className:"h-4 w-4 text-yellow-500"}),b()]})}),e.jsx(qe,{children:e.jsx("div",{className:"space-y-2",children:[...Array(v?5:3)].map((j,S)=>e.jsx(fr,{className:"h-10 w-full"},S))})})]});const N=j=>j===0?e.jsx(ho,{className:"h-4 w-4 text-yellow-500 mx-auto"}):j===1?e.jsx("span",{className:"text-sm font-medium text-gray-400",children:"2"}):j===2?e.jsx("span",{className:"text-sm font-medium text-amber-600",children:"3"}):e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:j+1});if(v){const j=(i==null?void 0:i.slice(0,5))||[];return e.jsxs(ze,{children:[e.jsxs(Wt,{className:"pb-2",children:[e.jsxs(Zt,{className:"text-base flex items-center gap-2",children:[e.jsx(ho,{className:"h-4 w-4 text-yellow-500"}),b()]}),!s&&n&&e.jsxs("div",{className:"flex gap-1 mt-2",children:[e.jsx(Q,{variant:a==="brokerage"?"default":"outline",size:"sm",className:"text-xs h-7 flex-1",onClick:()=>o("brokerage"),children:"My Brokerage"}),e.jsx(Q,{variant:a==="global"?"default":"outline",size:"sm",className:"text-xs h-7 flex-1",onClick:()=>o("global"),children:"All LevelUp"})]})]}),e.jsxs(qe,{children:[!s&&m&&e.jsx("div",{className:"mb-3 p-2 rounded-lg bg-primary/5 border border-primary/10",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Your Rank:"}),e.jsxs("span",{className:"font-bold text-primary",children:["#",g||"-"]})]}),e.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[e.jsxs("span",{children:[e.jsx("strong",{className:"text-primary",children:m.total_points})," pts"]}),e.jsxs("span",{children:[e.jsx("strong",{children:m.total_events_attended})," events"]})]})]})}),e.jsxs("div",{className:"space-y-2",children:[j.map((S,A)=>{var M,I,F;return e.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg ${S.user_id===(t==null?void 0:t.id)?"bg-primary/10 border border-primary/20":A===0?"bg-yellow-500/10":""}`,children:[e.jsx("div",{className:"w-5 text-center",children:N(A)}),e.jsx(ln,{className:"h-6 w-6",children:e.jsx(cn,{className:"text-xs",children:((I=(M=S.profile)==null?void 0:M.name)==null?void 0:I.charAt(0))||"?"})}),e.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:((F=S.profile)==null?void 0:F.name)||"Unknown"}),e.jsx("span",{className:"text-sm font-bold text-primary",children:S.total_points})]},S.user_id)}),j.length===0&&e.jsx("div",{className:"text-center text-muted-foreground py-2 text-sm",children:"No data yet"})]}),e.jsxs(go,{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:[e.jsx(uo,{className:"h-4 w-4"}),"Spend Points in Reward Store",e.jsx(Wi,{className:"h-4 w-4"})]})]})]})}return e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsxs(Zt,{className:"text-base flex items-center gap-2",children:[e.jsx(ho,{className:"h-4 w-4 text-yellow-500"}),"My Points"]})}),e.jsx(qe,{children:m?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"p-3 rounded-lg bg-primary/5 border border-primary/10 text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-primary",children:m.total_points}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Total Points"})]}),e.jsxs("div",{className:"p-3 rounded-lg bg-muted/50 text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:m.total_events_attended}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Events Attended"})]})]}),e.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-orange-500/10 border border-orange-500/20",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_m,{className:"h-4 w-4 text-orange-500"}),e.jsx("span",{className:"text-sm font-medium",children:"Current Streak"})]}),e.jsxs("span",{className:"font-bold text-orange-500",children:[m.current_streak," 🔥"]})]}),y&&y.length>0&&e.jsxs("div",{className:"pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[e.jsx(ql,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Badges"})]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[y.slice(0,4).map(j=>e.jsx("span",{className:"text-xs px-2 py-1 rounded-full bg-yellow-500/10 text-yellow-600 border border-yellow-500/20",children:j.badge_name},j.id)),y.length>4&&e.jsxs("span",{className:"text-xs text-muted-foreground px-2 py-1",children:["+",y.length-4," more"]})]})]}),e.jsxs(go,{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:[e.jsx(uo,{className:"h-4 w-4"}),"Spend Points in Reward Store",e.jsx(Wi,{className:"h-4 w-4"})]})]}):e.jsxs("div",{className:"text-center text-muted-foreground py-4 text-sm",children:[e.jsx(Ln,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground/50"}),e.jsx("p",{children:"Attend events to earn points!"}),e.jsxs(go,{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:[e.jsx(uo,{className:"h-4 w-4"}),"Visit Reward Store",e.jsx(Wi,{className:"h-4 w-4"})]})]})})]})}const xae=()=>Ht({queryKey:["lead-sources"],queryFn:async()=>{const{data:t,error:r}=await Z.from("lead_sources").select("*").eq("is_active",!0).order("sort_order");if(r)throw r;return t}}),Xxt=()=>{const t=qr(),{user:r}=Gr();return Jt({mutationFn:async s=>{const{data:n,error:a}=await Z.from("lead_sources").insert({name:s,owner_user_id:r==null?void 0:r.id,sort_order:100}).select().single();if(a)throw a;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["lead-sources"]}),Se.success("Lead source added")},onError:s=>{Se.error("Failed to add lead source"),console.error(s)}})},Gye=(t,r)=>{const{user:s,isAdmin:n}=Gr(),a=n&&r?r:s==null?void 0:s.id;return Ht({queryKey:["scorecard-transactions",t,a],queryFn:async()=>{let o=Z.from("scorecard_transactions").select(` *, lead_source:lead_sources(id, name), client_type:relationship_types(id, name), contact:innercircle_contacts(id, first_name, last_name) `).eq("owner_user_id",a).order("close_date",{ascending:!1});t&&(o=o.gte("close_date",`${t}-01-01`).lte("close_date",`${t}-12-31`));const{data:l,error:i}=await o;if(i)throw i;return l},enabled:!!a})},aFe=t=>{const{user:r,isAdmin:s}=Gr(),n=s&&t?t:r==null?void 0:r.id;return Ht({queryKey:["scorecard-transactions-all",n],queryFn:async()=>{const{data:a,error:o}=await Z.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",n).order("close_date",{ascending:!1});if(o)throw o;return a},enabled:!!n})},yae=()=>{const t=qr(),{user:r}=Gr();return Jt({mutationFn:async s=>{const{data:n,error:a}=await Z.from("scorecard_transactions").insert({...s,owner_user_id:r.id}).select().single();if(a)throw a;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["scorecard-transactions"]}),t.invalidateQueries({queryKey:["scorecard-transactions-all"]}),Se.success("Transaction added")},onError:s=>{Se.error("Failed to add transaction"),console.error(s)}})},Qxt=()=>{const t=qr();return Jt({mutationFn:async({id:r,...s})=>{const{data:n,error:a}=await Z.from("scorecard_transactions").update(s).eq("id",r).select().single();if(a)throw a;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["scorecard-transactions"]}),t.invalidateQueries({queryKey:["scorecard-transactions-all"]}),Se.success("Transaction updated")},onError:r=>{Se.error("Failed to update transaction"),console.error(r)}})},Jxt=()=>{const t=qr();return Jt({mutationFn:async r=>{const{error:s}=await Z.from("scorecard_transactions").delete().eq("id",r);if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["scorecard-transactions"]}),t.invalidateQueries({queryKey:["scorecard-transactions-all"]}),Se.success("Transaction deleted")},onError:r=>{Se.error("Failed to delete transaction"),console.error(r)}})},iFe=(t,r)=>{const{user:s,isAdmin:n}=Gr(),a=n&&r?r:s==null?void 0:s.id;return Ht({queryKey:["scorecard-goals",t,a],queryFn:async()=>{const{data:o,error:l}=await Z.from("scorecard_goals").select("*").eq("owner_user_id",a).eq("year",t).maybeSingle();if(l)throw l;return o},enabled:!!a})},eyt=()=>{const t=qr(),{user:r}=Gr();return Jt({mutationFn:async s=>{const{data:n,error:a}=await Z.from("scorecard_goals").upsert({...s,owner_user_id:r.id},{onConflict:"owner_user_id,year"}).select().single();if(a)throw a;return n},onSuccess:(s,n)=>{t.invalidateQueries({queryKey:["scorecard-goals",n.year]}),Se.success("Goals saved")},onError:s=>{Se.error("Failed to save goals"),console.error(s)}})},vae=()=>{const{user:t}=Gr();return Ht({queryKey:["scorecard-settings",t==null?void 0:t.id],queryFn:async()=>{const{data:r,error:s}=await Z.from("scorecard_settings").select("*").eq("user_id",t.id).maybeSingle();if(s)throw s;return r},enabled:!!(t!=null&&t.id)})},tyt=()=>{const t=qr(),{user:r}=Gr();return Jt({mutationFn:async s=>{const{data:n,error:a}=await Z.from("scorecard_settings").upsert({...s,user_id:r.id},{onConflict:"user_id"}).select().single();if(a)throw a;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["scorecard-settings"]}),Se.success("Settings saved")},onError:s=>{Se.error("Failed to save settings"),console.error(s)}})},oFe=(t,r)=>{const{data:s,isLoading:n}=Gye(t,r),{data:a,isLoading:o}=aFe(r),{data:l}=vae(),i=(l==null?void 0:l.show_commission)??!0,d=m=>{if(!m||m.length===0)return{totalTransactions:0,buyerCount:0,sellerCount:0,totalVolume:0,averagePrice:0,totalCommission:0,topLeadSource:null,transactionsByMonth:[],leadSourceBreakdown:[]};const g=m.filter(F=>F.transaction_type==="buyer").length,y=m.filter(F=>F.transaction_type==="seller").length,v=m.reduce((F,O)=>F+Number(O.sale_price),0),b=m.reduce((F,O)=>F+(Number(O.commission_amount)||0),0),N={};m.forEach(F=>{var B;const O=((B=F.lead_source)==null?void 0:B.name)||"Unknown";N[O]=(N[O]||0)+1});const j=Object.entries(N).map(([F,O])=>({name:F,count:O})).sort((F,O)=>O.count-F.count),S=j[0]||null,A={};m.forEach(F=>{const O=new Date(F.close_date).toLocaleString("default",{month:"short"});A[O]=(A[O]||0)+1});const I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"].map(F=>({month:F,count:A[F]||0}));return{totalTransactions:m.length,buyerCount:g,sellerCount:y,totalVolume:v,averagePrice:m.length>0?v/m.length:0,totalCommission:i?b:0,topLeadSource:S,transactionsByMonth:I,leadSourceBreakdown:j}};return{yearStats:d(s),lifetimeStats:d(a),isLoading:n||o,showCommission:i}},ryt=()=>{const{isAdmin:t}=Gr();return Ht({queryKey:["agents-with-transactions"],queryFn:async()=>{const{data:r,error:s}=await Z.from("scorecard_transactions").select("owner_user_id").order("owner_user_id");if(s)throw s;const n=[...new Set(r.map(l=>l.owner_user_id))],{data:a,error:o}=await Z.from("profiles").select("id, name, email").in("id",n);if(o)throw o;return a},enabled:t})},r1={recency:40,touchpoints:30,transactions:20},l4e={warm:70,cooling:40};function syt(t){return t===null?0:t<=14?r1.recency:t<=30?r1.recency*.85:t<=60?r1.recency*.65:t<=90?r1.recency*.4:t<=180?r1.recency*.2:r1.recency*.05}function nyt(t){const r=Math.min(t/12,1);return Math.round(r1.touchpoints*r)}function ayt(t){return t?r1.transactions:0}function iyt(){return 0}function oyt(t){return t>=l4e.warm?"warm":t>=l4e.cooling?"cooling":"at-risk"}function Kye(){const{data:t,isLoading:r}=Ip(),{data:s}=$Re(),{data:n}=gae(365),{data:a}=aFe(),o=E.useMemo(()=>{if(!t)return[];const i=new Date,d=Qht(i),m={};n==null||n.forEach(y=>{new Date(y.completed_at)>=d&&(m[y.contact_id]=(m[y.contact_id]||0)+1)});const g=new Set((a==null?void 0:a.filter(y=>y.contact_id).map(y=>y.contact_id))||[]);return t.map(y=>{const v=(s==null?void 0:s[y.id])||null,b=v?Dy(i,new Date(v)):null,N=m[y.id]||0,j=g.has(y.id),S=syt(b),A=nyt(N),M=ayt(j),I=iyt(),F=Math.round(S+A+M+I),O={score:F,status:oyt(F),breakdown:{recency:Math.round(S),touchpoints:Math.round(A),transactions:Math.round(M),referrals:Math.round(I)},lastTouchDate:v,daysSinceTouch:b,touchCountLast12Months:N,hasTransaction:j};return{...y,relationshipScore:O}})},[t,s,n,a]),l=E.useMemo(()=>{const i=o.filter(v=>v.relationshipScore.status==="warm").length,d=o.filter(v=>v.relationshipScore.status==="cooling").length,m=o.filter(v=>v.relationshipScore.status==="at-risk").length,g=o.length,y=g>0?Math.round(o.reduce((v,b)=>v+b.relationshipScore.score,0)/g):0;return{warm:i,cooling:d,atRisk:m,total:g,averageScore:y}},[o]);return{contactsWithScores:o,stats:l,isLoading:r}}function lFe(){const t=Ws(),{stats:r,contactsWithScores:s,isLoading:n}=Kye();if(n)return e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(fr,{className:"h-5 w-40"})}),e.jsxs(qe,{className:"space-y-4",children:[e.jsx(fr,{className:"h-20 w-full"}),e.jsx(fr,{className:"h-16 w-full"})]})]});if(r.total===0)return e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:[e.jsx(ws,{className:"h-5 w-5"}),"Relationship Health"]})}),e.jsxs(qe,{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Add contacts to see your relationship health scores."}),e.jsx(Q,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>t("/mission-control/contacts?new=true"),children:"Add Your First Contact"})]})]});const a=Math.round(r.warm/r.total*100),o=Math.round(r.cooling/r.total*100),l=Math.round(r.atRisk/r.total*100),i=s.filter(d=>d.relationshipScore.status==="at-risk").sort((d,m)=>d.relationshipScore.score-m.relationshipScore.score).slice(0,3);return e.jsxs(ze,{children:[e.jsxs(Wt,{className:"pb-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:[e.jsx(ou,{className:"h-5 w-5 text-emerald-500"}),"Relationship Health"]}),e.jsx("span",{className:"text-2xl font-bold",children:r.averageScore})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Average score across ",r.total," contacts"]})]}),e.jsxs(qe,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-emerald-500"}),e.jsx("span",{children:"Warm"})]}),e.jsxs("span",{className:"font-medium",children:[r.warm," (",a,"%)"]})]}),e.jsx(hc,{value:a,className:"h-2 bg-muted [&>div]:bg-emerald-500"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-amber-500"}),e.jsx("span",{children:"Cooling Off"})]}),e.jsxs("span",{className:"font-medium",children:[r.cooling," (",o,"%)"]})]}),e.jsx(hc,{value:o,className:"h-2 bg-muted [&>div]:bg-amber-500"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-red-500"}),e.jsx("span",{children:"At Risk"})]}),e.jsxs("span",{className:"font-medium",children:[r.atRisk," (",l,"%)"]})]}),e.jsx(hc,{value:l,className:"h-2 bg-muted [&>div]:bg-red-500"})]})]}),i.length>0&&e.jsxs("div",{className:"pt-3 border-t",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Qj,{className:"h-4 w-4 text-red-500"}),e.jsx("span",{className:"text-sm font-medium",children:"Needs Attention"})]}),e.jsx("div",{className:"space-y-2",children:i.map(d=>e.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-red-500/5 hover:bg-red-500/10 cursor-pointer transition-colors",onClick:()=>t(`/mission-control/contacts/${d.id}`),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"}),e.jsxs("span",{className:"text-sm",children:[d.first_name," ",d.last_name]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{children:d.relationshipScore.daysSinceTouch===null?"Never":`${d.relationshipScore.daysSinceTouch}d`}),e.jsx(Wi,{className:"h-3 w-3"})]})]},d.id))})]}),e.jsxs(Q,{variant:"outline",size:"sm",className:"w-full",onClick:()=>t("/mission-control/contacts?filter=at-risk"),children:["View All At-Risk Contacts",e.jsx(Wi,{className:"h-4 w-4 ml-1"})]})]})]})}const lyt=()=>{var oe;const{user:t,isAdmin:r}=Gr(),s=Ws(),[n,a]=E.useState([]),[o,l]=E.useState([]),[i,d]=E.useState([]),[m,g]=E.useState([]),[y,v]=E.useState([]),[b,N]=E.useState([]),[j,S]=E.useState(new Set),[A,M]=E.useState([]),[I,F]=E.useState([]),[O,B]=E.useState([]),[$,H]=E.useState(null),[W,X]=E.useState(!0);E.useEffect(()=>{se()},[t]);const se=async()=>{var de,ue,xe,Te,be;try{const[we,ve,tt,Ae,Le,Ue,Ye,Ie,et,It,Pe]=await Promise.all([Z.from("user_tags").select("tag").eq("user_id",t==null?void 0:t.id),Z.from("app_tiles").select("*").order("name"),Z.from("user_favorites").select("app_id").eq("user_id",t==null?void 0:t.id),Z.from("events").select("*").order("event_date",{ascending:!0}),Z.from("event_registrations").select("event_id, zoom_join_url").eq("user_id",t==null?void 0:t.id),Z.from("canva_templates").select("id, name, preview_image_url, publish_date").order("publish_date",{ascending:!1}).limit(4),Z.from("resource_kits").select("id, name, description, featured_image_url, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),Z.from("academy_videos").select("id, title, description, thumbnail_url, duration, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),Z.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),Z.from("dashboard_banners").select("id, title, description, image_url, link_url, link_text, placement, section_after").eq("is_active",!0).order("sort_order"),Z.from("profiles").select("name").eq("id",t==null?void 0:t.id).single()]);(de=Pe.data)!=null&&de.name&&H(Pe.data.name);const at=((ue=we.data)==null?void 0:ue.map(it=>it.tag))||[],ce=new Set(((xe=tt.data)==null?void 0:xe.map(it=>it.app_id))||[]);S(ce);const Ge=(((Te=ve.data)==null?void 0:Te.filter(it=>!it.required_tags||it.required_tags.length===0?!0:it.required_tags.some(Me=>at.includes(Me))))||[]).sort((it,Me)=>it.name==="LevelUp Members Portal"?-1:Me.name==="LevelUp Members Portal"?1:0);a(Ge.slice(0,6));const rt=((be=Ae.data)==null?void 0:be.filter(it=>oC(it.event_date)!=="ended"))||[];l(rt.slice(0,4)),M(Le.data||[]),d(Ue.data||[]),g(Ye.data||[]),v(Ie.data||[]),N(et.data||[]);const je=It.data||[];F(je.filter(it=>it.placement==="top")),B(je.filter(it=>it.placement==="between"))}catch(we){console.error("Error loading dashboard:",we),Se.error("Failed to load dashboard data")}finally{X(!1)}},ae=async de=>{var xe;const ue=window.open("about:blank","_blank");try{await Z.from("activity_logs").insert({user_id:t==null?void 0:t.id,app_id:de.app_id,app_name:de.name,user_agent:navigator.userAgent});const{data:Te,error:be}=await Z.functions.invoke("sso-launch",{body:{app_id:de.app_id}});if(be)throw be;Te!=null&&Te.redirect_url?ue&&!ue.closed?(ue.location.href=Te.redirect_url,(xe=ue.focus)==null||xe.call(ue)):window.location.assign(Te.redirect_url):(ue==null||ue.close(),Se.error("Launch link unavailable"))}catch(Te){ue==null||ue.close(),console.error("Error launching app:",Te),Se.error("Failed to launch app")}},le=de=>A==null?void 0:A.some(ue=>ue.event_id===de),ne=de=>{const ue=A==null?void 0:A.find(xe=>xe.event_id===de);return ue==null?void 0:ue.zoom_join_url};if(W)return e.jsx(Fr,{title:"Dashboard",children:e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Loading your dashboard..."})]})})});const fe=de=>O.filter(ue=>ue.section_after===de);return e.jsxs(Fr,{title:"Dashboard",children:[e.jsx(ixt,{events:o,registrations:A,onNavigateToEvents:()=>s("/events")}),I.length>0&&e.jsx("div",{className:"mb-8",children:e.jsx(NT,{banners:I})}),e.jsx(xxt,{}),e.jsxs("div",{className:"mb-6",children:[e.jsxs("h2",{className:"text-2xl font-bold text-foreground",children:["Welcome back, ",($||((oe=t==null?void 0:t.user_metadata)==null?void 0:oe.name)||"there").split(" ")[0],"!"]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Are you ready to LevelUp today?"})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4 mb-8",children:[e.jsx(Ixt,{}),e.jsx(lFe,{}),e.jsx(Yxt,{})]}),e.jsxs("section",{className:"mb-10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Upcoming Events"}),e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>s("/events"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",e.jsx(Hi,{className:"h-4 w-4"})]})]}),o.length===0?e.jsx(ze,{className:"bg-muted/30 border-dashed",children:e.jsx(qe,{className:"flex items-center justify-center py-8",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Mn,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No upcoming events"})]})})}):e.jsx("div",{className:"bg-card rounded-xl border border-border overflow-hidden divide-y divide-border max-w-full",children:o.map(de=>{const ue=le(de.id),xe=ne(de.id)||de.zoom_link;return e.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 ${n4e(de.event_date)?"bg-red-500/5 border-l-2 border-l-red-500":""}`,onClick:()=>s("/events"),children:[n4e(de.event_date)?e.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:[e.jsx("span",{className:"absolute inline-flex h-3 w-3 top-1 right-1 animate-ping rounded-full bg-red-500 opacity-75"}),e.jsx(Yj,{className:"h-5 w-5 text-red-500"}),e.jsx("span",{className:"text-[10px] font-bold text-red-500 uppercase mt-0.5",children:"Live"})]}):e.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:[e.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(de.event_date))}),e.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(de.event_date))})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h4",{className:"font-medium text-sm sm:text-base text-foreground group-hover:text-primary transition-colors line-clamp-2 sm:truncate",children:de.title}),e.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(de.event_date))," at ",JE(new Date(de.event_date))]})]}),e.jsx("div",{className:"hidden sm:flex flex-shrink-0",children:ue?e.jsxs(Q,{size:"sm",variant:"default",className:"gap-1",onClick:Te=>{Te.stopPropagation(),window.open(xe,"_blank")},children:[e.jsx(En,{className:"h-3.5 w-3.5"}),"Join"]}):e.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground group-hover:text-primary transition-colors",children:[e.jsx("span",{className:"text-sm",children:"Register"}),e.jsx(Wi,{className:"h-4 w-4"})]})})]},de.id)})})]}),fe("events").length>0&&e.jsx("div",{className:"mb-10",children:e.jsx(NT,{banners:fe("events")})}),e.jsxs("section",{className:"mb-10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Academy Videos"}),e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>s("/academy"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",e.jsx(Hi,{className:"h-4 w-4"})]})]}),y.length===0?e.jsx(ze,{className:"bg-muted/30 border-dashed",children:e.jsx(qe,{className:"flex items-center justify-center py-8",children:e.jsxs("div",{className:"text-center",children:[e.jsx(lp,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No academy videos available"})]})})}):e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:y.map(de=>e.jsxs("div",{onClick:()=>s(`/academy/${de.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:[e.jsxs("div",{className:"aspect-[3/2] bg-muted/50 overflow-hidden relative",children:[de.thumbnail_url?e.jsx("img",{src:de.thumbnail_url,alt:de.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(lp,{className:"h-8 w-8 text-muted-foreground/50"})}),de.duration&&e.jsx("span",{className:"absolute bottom-2 right-2 bg-black/70 text-white text-xs px-1.5 py-0.5 rounded",children:de.duration})]}),e.jsx("div",{className:"p-3",children:e.jsx("h4",{className:"font-medium text-sm text-foreground line-clamp-2 group-hover:text-primary transition-colors",children:de.title})})]},de.id))})]}),fe("academy").length>0&&e.jsx("div",{className:"mb-10",children:e.jsx(NT,{banners:fe("academy")})}),e.jsxs("section",{className:"mb-10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Resource Kits"}),e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>s("/toolbox"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",e.jsx(Hi,{className:"h-4 w-4"})]})]}),m.length===0?e.jsx(ze,{className:"bg-muted/30 border-dashed",children:e.jsx(qe,{className:"flex items-center justify-center py-8",children:e.jsxs("div",{className:"text-center",children:[e.jsx(bm,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No resource kits available"})]})})}):e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:m.map(de=>e.jsxs("div",{onClick:()=>s(`/toolbox/${de.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:[e.jsx("div",{className:"aspect-[3/2] bg-muted/50 overflow-hidden",children:de.featured_image_url?e.jsx("img",{src:de.featured_image_url,alt:de.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(bm,{className:"h-8 w-8 text-muted-foreground/50"})})}),e.jsx("div",{className:"p-3",children:e.jsx("h4",{className:"font-medium text-sm text-foreground truncate group-hover:text-primary transition-colors",children:de.name})})]},de.id))})]}),fe("toolbox").length>0&&e.jsx("div",{className:"mb-10",children:e.jsx(NT,{banners:fe("toolbox")})}),e.jsxs("section",{className:"mb-10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"New Templates"}),e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>s("/templates"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",e.jsx(Hi,{className:"h-4 w-4"})]})]}),i.length===0?e.jsx(ze,{className:"bg-muted/30 border-dashed",children:e.jsx(qe,{className:"flex items-center justify-center py-8",children:e.jsxs("div",{className:"text-center",children:[e.jsx(G1,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No templates available"})]})})}):e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:i.map(de=>e.jsxs("div",{onClick:()=>s("/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:[e.jsx("div",{className:"aspect-[3/2] bg-muted/50 overflow-hidden",children:de.preview_image_url?e.jsx("img",{src:de.preview_image_url,alt:de.name,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(G1,{className:"h-8 w-8 text-muted-foreground/50"})})}),e.jsx("div",{className:"p-3",children:e.jsx("h4",{className:"font-medium text-sm text-foreground truncate group-hover:text-primary transition-colors",children:de.name})})]},de.id))})]}),fe("templates").length>0&&e.jsx("div",{className:"mb-10",children:e.jsx(NT,{banners:fe("templates")})}),e.jsx("div",{className:"mb-10",children:e.jsx(Zxt,{})}),e.jsxs("section",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Your Apps"}),e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>s("/apps"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",e.jsx(Hi,{className:"h-4 w-4"})]})]}),n.length===0?e.jsx(ze,{className:"bg-muted/30 border-dashed",children:e.jsx(qe,{className:"flex items-center justify-center py-12",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Rf,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No apps available"})]})})}):e.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:n.map(de=>{const ue=j.has(de.id);return e.jsxs("div",{onClick:()=>ae(de),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:[e.jsx("div",{className:"flex-shrink-0 w-14 h-14 rounded-xl bg-primary/10 flex items-center justify-center text-3xl",children:de.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-semibold text-foreground group-hover:text-primary transition-colors truncate",children:de.name}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:de.description})]}),ue&&e.jsx(Rf,{className:"h-5 w-5 text-primary fill-current flex-shrink-0"})]},de.id)})})]}),e.jsxs("section",{className:"mt-10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Additional Services"}),e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>s("/additional-services"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",e.jsx(Hi,{className:"h-4 w-4"})]})]}),b.length===0?e.jsx(ze,{className:"bg-muted/30 border-dashed",children:e.jsx(qe,{className:"flex items-center justify-center py-8",children:e.jsxs("div",{className:"text-center",children:[e.jsx(An,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No additional services available"})]})})}):e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:b.map(de=>e.jsxs("div",{onClick:()=>window.open(de.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:[e.jsx("div",{className:"aspect-[4/3] bg-muted/50 overflow-hidden",children:de.preview_image_url?e.jsx("img",{src:de.preview_image_url,alt:de.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(An,{className:"h-8 w-8 text-muted-foreground/50"})})}),e.jsxs("div",{className:"p-3",children:[e.jsx("h4",{className:"font-medium text-sm text-foreground truncate group-hover:text-primary transition-colors",children:de.name}),de.description&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:de.description})]})]},de.id))})]})]})};var _ae="Switch",[cyt]=fc(_ae),[dyt,uyt]=cyt(_ae),cFe=E.forwardRef((t,r)=>{const{__scopeSwitch:s,name:n,checked:a,defaultChecked:o,required:l,disabled:i,value:d="on",onCheckedChange:m,form:g,...y}=t,[v,b]=E.useState(null),N=ga(r,I=>b(I)),j=E.useRef(!1),S=v?g||!!v.closest("form"):!0,[A,M]=oh({prop:a,defaultProp:o??!1,onChange:m,caller:_ae});return e.jsxs(dyt,{scope:s,checked:A,disabled:i,children:[e.jsx(qs.button,{type:"button",role:"switch","aria-checked":A,"aria-required":l,"data-state":mFe(A),"data-disabled":i?"":void 0,disabled:i,value:d,...y,ref:N,onClick:bs(t.onClick,I=>{M(F=>!F),S&&(j.current=I.isPropagationStopped(),j.current||I.stopPropagation())})}),S&&e.jsx(hFe,{control:v,bubbles:!j.current,name:n,value:d,checked:A,required:l,disabled:i,form:g,style:{transform:"translateX(-100%)"}})]})});cFe.displayName=_ae;var dFe="SwitchThumb",uFe=E.forwardRef((t,r)=>{const{__scopeSwitch:s,...n}=t,a=uyt(dFe,s);return e.jsx(qs.span,{"data-state":mFe(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:r})});uFe.displayName=dFe;var hyt="SwitchBubbleInput",hFe=E.forwardRef(({__scopeSwitch:t,control:r,checked:s,bubbles:n=!0,...a},o)=>{const l=E.useRef(null),i=ga(l,o),d=wP(s),m=dP(r);return E.useEffect(()=>{const g=l.current;if(!g)return;const y=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(y,"checked").set;if(d!==s&&b){const N=new Event("click",{bubbles:n});b.call(g,s),g.dispatchEvent(N)}},[d,s,n]),e.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:s,...a,tabIndex:-1,ref:i,style:{...a.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});hFe.displayName=hyt;function mFe(t){return t?"checked":"unchecked"}var pFe=cFe,myt=uFe;const xn=E.forwardRef(({className:t,...r},s)=>e.jsx(pFe,{className:qt("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",t),...r,ref:s,children:e.jsx(myt,{className:qt("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")})}));xn.displayName=pFe.displayName;var fFe="AlertDialog",[pyt]=fc(fFe,[L8e]),Ky=L8e(),gFe=t=>{const{__scopeAlertDialog:r,...s}=t,n=Ky(r);return e.jsx($ne,{...n,...s,modal:!0})};gFe.displayName=fFe;var fyt="AlertDialogTrigger",xFe=E.forwardRef((t,r)=>{const{__scopeAlertDialog:s,...n}=t,a=Ky(s);return e.jsx(aye,{...a,...n,ref:r})});xFe.displayName=fyt;var gyt="AlertDialogPortal",yFe=t=>{const{__scopeAlertDialog:r,...s}=t,n=Ky(r);return e.jsx(Une,{...n,...s})};yFe.displayName=gyt;var xyt="AlertDialogOverlay",vFe=E.forwardRef((t,r)=>{const{__scopeAlertDialog:s,...n}=t,a=Ky(s);return e.jsx(U3,{...a,...n,ref:r})});vFe.displayName=xyt;var lC="AlertDialogContent",[yyt,vyt]=pyt(lC),_yt=xIe("AlertDialogContent"),_Fe=E.forwardRef((t,r)=>{const{__scopeAlertDialog:s,children:n,...a}=t,o=Ky(s),l=E.useRef(null),i=ga(r,l),d=E.useRef(null);return e.jsx(cct,{contentName:lC,titleName:bFe,docsSlug:"alert-dialog",children:e.jsx(yyt,{scope:s,cancelRef:d,children:e.jsxs(q3,{role:"alertdialog",...o,...a,ref:i,onOpenAutoFocus:bs(a.onOpenAutoFocus,m=>{var g;m.preventDefault(),(g=d.current)==null||g.focus({preventScroll:!0})}),onPointerDownOutside:m=>m.preventDefault(),onInteractOutside:m=>m.preventDefault(),children:[e.jsx(_yt,{children:n}),e.jsx(wyt,{contentRef:l})]})})})});_Fe.displayName=lC;var bFe="AlertDialogTitle",wFe=E.forwardRef((t,r)=>{const{__scopeAlertDialog:s,...n}=t,a=Ky(s);return e.jsx(_P,{...a,...n,ref:r})});wFe.displayName=bFe;var jFe="AlertDialogDescription",kFe=E.forwardRef((t,r)=>{const{__scopeAlertDialog:s,...n}=t,a=Ky(s);return e.jsx(bP,{...a,...n,ref:r})});kFe.displayName=jFe;var byt="AlertDialogAction",NFe=E.forwardRef((t,r)=>{const{__scopeAlertDialog:s,...n}=t,a=Ky(s);return e.jsx(qne,{...a,...n,ref:r})});NFe.displayName=byt;var SFe="AlertDialogCancel",CFe=E.forwardRef((t,r)=>{const{__scopeAlertDialog:s,...n}=t,{cancelRef:a}=vyt(SFe,s),o=Ky(s),l=ga(r,a);return e.jsx(qne,{...o,...n,ref:l})});CFe.displayName=SFe;var wyt=({contentRef:t})=>{const r=`\`${lC}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${lC}\` by passing a \`${jFe}\` 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 \`${lC}\`. 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 n;document.getElementById((n=t.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(r)},[r,t]),null},jyt=gFe,kyt=xFe,Nyt=yFe,MFe=vFe,TFe=_Fe,AFe=NFe,EFe=CFe,IFe=wFe,PFe=kFe;const Xc=jyt,xm=kyt,Syt=Nyt,LFe=E.forwardRef(({className:t,...r},s)=>e.jsx(MFe,{className:qt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r,ref:s}));LFe.displayName=MFe.displayName;const Tc=E.forwardRef(({className:t,...r},s)=>e.jsxs(Syt,{children:[e.jsx(LFe,{}),e.jsx(TFe,{ref:s,className:qt("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...r})]}));Tc.displayName=TFe.displayName;const Ac=({className:t,...r})=>e.jsx("div",{className:qt("flex flex-col space-y-2 text-center sm:text-left",t),...r});Ac.displayName="AlertDialogHeader";const Ec=({className:t,...r})=>e.jsx("div",{className:qt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r});Ec.displayName="AlertDialogFooter";const Ic=E.forwardRef(({className:t,...r},s)=>e.jsx(IFe,{ref:s,className:qt("text-lg font-semibold",t),...r}));Ic.displayName=IFe.displayName;const Pc=E.forwardRef(({className:t,...r},s)=>e.jsx(PFe,{ref:s,className:qt("text-sm text-muted-foreground",t),...r}));Pc.displayName=PFe.displayName;const dc=E.forwardRef(({className:t,...r},s)=>e.jsx(AFe,{ref:s,className:qt(GE(),t),...r}));dc.displayName=AFe.displayName;const Lc=E.forwardRef(({className:t,...r},s)=>e.jsx(EFe,{ref:s,className:qt(GE({variant:"outline"}),"mt-2 sm:mt-0",t),...r}));Lc.displayName=EFe.displayName;const Cyt=[{key:"contacts",label:"Contacts",icon:wi,description:"View, add, and edit contacts"},{key:"pipeline",label:"Deal Pipeline",icon:Vj,description:"View, add, and move deals"},{key:"videos",label:"Videos",icon:ya,description:"View and upload videos"},{key:"listings",label:"Listings",icon:Wn,description:"View, create, and edit listings"},{key:"scorecard",label:"Scorecard",icon:xA,description:"View and add transactions"},{key:"popbys",label:"Pop-bys",icon:eo,description:"View and log pop-bys"}];function Myt(){var O;const{user:t}=Gr(),[r,s]=E.useState([]),[n,a]=E.useState(!0),[o,l]=E.useState(!1),[i,d]=E.useState(!1),[m,g]=E.useState(null),[y,v]=E.useState({email:"",name:"",password:""}),[b,N]=E.useState(!1),[j,S]=E.useState(null);E.useEffect(()=>{t&&A()},[t]);const A=async()=>{if(t){a(!0);try{const{data:B,error:$}=await Z.from("agent_assistant_assignments").select("id, assistant_id, permissions, created_at").eq("agent_id",t.id);if($)throw $;if(B&&B.length>0){const H=B.map(se=>se.assistant_id),{data:W}=await Z.from("profiles").select("id, name, email").in("id",H),X=B.map(se=>{const ae=W==null?void 0:W.find(le=>le.id===se.assistant_id);return{...se,permissions:se.permissions,assistant_profile:ae?{name:ae.name||"",email:ae.email||""}:void 0}});s(X)}else s([])}catch(B){console.error("Error loading assistants:",B)}finally{a(!1)}}},M=async()=>{if(!t||!y.email.trim()||!y.name.trim()||!y.password.trim()){Se.error("Please fill in all fields");return}if(y.password.length<6){Se.error("Password must be at least 6 characters");return}if(r.length>=1){Se.error("You can only have 1 assistant");return}N(!0);try{const{data:{session:B}}=await Z.auth.getSession();if(!B)throw new Error("Not authenticated");const $=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${B.access_token}`},body:JSON.stringify({email:y.email.trim(),password:y.password,name:y.name.trim(),purpose:"assistant"})}),H=await $.json();if(!$.ok)throw new Error(H.error||"Failed to create assistant account");const W=H.userId||H.id;if(!W)throw new Error("No user ID returned");const X=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${B.access_token}`},body:JSON.stringify({userId:W,role:"assistant",action:"add",agentId:t.id})}),se=await X.json();if(!X.ok)throw new Error(se.error||"Failed to assign assistant role");const{error:ae}=await Z.from("agent_assistant_assignments").insert({agent_id:t.id,assistant_id:W,permissions:{contacts:!0,pipeline:!0,videos:!1,listings:!1,scorecard:!1,popbys:!1}});if(ae)throw ae;Se.success(`Assistant account created for ${y.name.trim()}`),l(!1),v({email:"",name:"",password:""}),A()}catch(B){console.error("Error adding assistant:",B),Se.error(B.message||"Failed to add assistant")}finally{N(!1)}},I=async()=>{if(!(!m||!t))try{const{data:{session:B}}=await Z.auth.getSession();if(!B)throw new Error("Not authenticated");const{error:$}=await Z.from("agent_assistant_assignments").delete().eq("id",m.id);if($)throw $;const{data:H}=await Z.from("agent_assistant_assignments").select("id").eq("assistant_id",m.assistant_id);(!H||H.length===0)&&await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${B.access_token}`},body:JSON.stringify({userId:m.assistant_id,role:"assistant",action:"remove"})}),Se.success("Assistant removed"),d(!1),g(null),A()}catch(B){console.error("Error removing assistant:",B),Se.error(B.message||"Failed to remove assistant")}},F=async(B,$,H)=>{S(B);try{const W=r.find(ae=>ae.id===B);if(!W)return;const X={...W.permissions,[$]:H},{error:se}=await Z.from("agent_assistant_assignments").update({permissions:X}).eq("id",B);if(se)throw se;s(ae=>ae.map(le=>le.id===B?{...le,permissions:X}:le))}catch(W){console.error("Error updating permissions:",W),Se.error("Failed to update permissions")}finally{S(null)}};return n?e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(ws,{className:"h-5 w-5"}),"My Assistant"]})}),e.jsx(qe,{children:e.jsx("div",{className:"flex items-center justify-center py-4",children:e.jsx(Hr,{className:"h-6 w-6 animate-spin text-muted-foreground"})})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(ws,{className:"h-5 w-5"}),"My Assistant"]}),e.jsx(Ss,{children:"Add an assistant to help manage your Agent OS"})]}),r.length===0&&e.jsxs(Q,{size:"sm",onClick:()=>l(!0),children:[e.jsx(gs,{className:"h-4 w-4 mr-1"}),"Add Assistant"]})]})}),e.jsx(qe,{children:r.length===0?e.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."}):e.jsx("div",{className:"space-y-4",children:r.map(B=>{var $,H,W,X;return e.jsxs("div",{className:"border rounded-lg p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ln,{className:"h-10 w-10",children:e.jsx(cn,{children:((H=($=B.assistant_profile)==null?void 0:$.name)==null?void 0:H.split(" ").map(se=>se[0]).join("").toUpperCase())||"A"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:((W=B.assistant_profile)==null?void 0:W.name)||"Unknown"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:((X=B.assistant_profile)==null?void 0:X.email)||""})]}),e.jsxs(bt,{variant:"secondary",className:"ml-2",children:[e.jsx(Nu,{className:"h-3 w-3 mr-1"}),"Assistant"]})]}),e.jsx(Q,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>{g(B),d(!0)},children:e.jsx(Rs,{className:"h-4 w-4"})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-3",children:"Permissions"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Cyt.map(se=>{const ae=se.icon;return e.jsxs("div",{className:"flex items-center justify-between p-2 rounded-md border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:se.label}),e.jsx("p",{className:"text-xs text-muted-foreground",children:se.description})]})]}),e.jsx(xn,{checked:B.permissions[se.key]||!1,onCheckedChange:le=>F(B.id,se.key,le),disabled:j===B.id})]},se.key)})})]})]},B.id)})})})]}),e.jsx(Dr,{open:o,onOpenChange:l,children:e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Add Assistant"}),e.jsx(Gs,{children:"Create an account for your assistant. They'll be able to manage the features you enable below."})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"assistant-name",children:"Name"}),e.jsx(Qe,{id:"assistant-name",value:y.name,onChange:B=>v({...y,name:B.target.value}),placeholder:"Assistant's full name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"assistant-email",children:"Email"}),e.jsx(Qe,{id:"assistant-email",type:"email",value:y.email,onChange:B=>v({...y,email:B.target.value}),placeholder:"assistant@email.com"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"assistant-password",children:"Temporary Password"}),e.jsx(Qe,{id:"assistant-password",type:"password",value:y.password,onChange:B=>v({...y,password:B.target.value}),placeholder:"Min 6 characters"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Your assistant can change this after their first login."})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsxs(Q,{onClick:M,disabled:b,children:[b&&e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),"Create Assistant"]})]})]})}),e.jsx(Xc,{open:i,onOpenChange:d,children:e.jsxs(Tc,{children:[e.jsxs(Ac,{children:[e.jsx(Ic,{children:"Remove Assistant?"}),e.jsxs(Pc,{children:["This will remove ",(O=m==null?void 0:m.assistant_profile)==null?void 0:O.name,"'s access to your Agent OS. Their account will remain active but they won't be able to manage your data."]})]}),e.jsxs(Ec,{children:[e.jsx(Lc,{children:"Cancel"}),e.jsx(dc,{onClick:I,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]})})]})}function tu(t){this.content=t}tu.prototype={constructor:tu,find:function(t){for(var r=0;r>1}};tu.from=function(t){if(t instanceof tu)return t;var r=[];if(t)for(var s in t)r.push(s,t[s]);return new tu(r)};function OFe(t,r,s){for(let n=0;;n++){if(n==t.childCount||n==r.childCount)return t.childCount==r.childCount?null:s;let a=t.child(n),o=r.child(n);if(a==o){s+=a.nodeSize;continue}if(!a.sameMarkup(o))return s;if(a.isText&&a.text!=o.text){for(let l=0;a.text[l]==o.text[l];l++)s++;return s}if(a.content.size||o.content.size){let l=OFe(a.content,o.content,s+1);if(l!=null)return l}s+=a.nodeSize}}function DFe(t,r,s,n){for(let a=t.childCount,o=r.childCount;;){if(a==0||o==0)return a==o?null:{a:s,b:n};let l=t.child(--a),i=r.child(--o),d=l.nodeSize;if(l==i){s-=d,n-=d;continue}if(!l.sameMarkup(i))return{a:s,b:n};if(l.isText&&l.text!=i.text){let m=0,g=Math.min(l.text.length,i.text.length);for(;mr&&n(d,a+i,o||null,l)!==!1&&d.content.size){let g=i+1;d.nodesBetween(Math.max(0,r-g),Math.min(d.content.size,s-g),n,a+g)}i=m}}descendants(r){this.nodesBetween(0,this.size,r)}textBetween(r,s,n,a){let o="",l=!0;return this.nodesBetween(r,s,(i,d)=>{let m=i.isText?i.text.slice(Math.max(r,d)-d,s-d):i.isLeaf?a?typeof a=="function"?a(i):a:i.type.spec.leafText?i.type.spec.leafText(i):"":"";i.isBlock&&(i.isLeaf&&m||i.isTextblock)&&n&&(l?l=!1:o+=n),o+=m},0),o}append(r){if(!r.size)return this;if(!this.size)return r;let s=this.lastChild,n=r.firstChild,a=this.content.slice(),o=0;for(s.isText&&s.sameMarkup(n)&&(a[a.length-1]=s.withText(s.text+n.text),o=1);or)for(let o=0,l=0;lr&&((ls)&&(i.isText?i=i.cut(Math.max(0,r-l),Math.min(i.text.length,s-l)):i=i.cut(Math.max(0,r-l-1),Math.min(i.content.size,s-l-1))),n.push(i),a+=i.nodeSize),l=d}return new _s(n,a)}cutByIndex(r,s){return r==s?_s.empty:r==0&&s==this.content.length?this:new _s(this.content.slice(r,s))}replaceChild(r,s){let n=this.content[r];if(n==s)return this;let a=this.content.slice(),o=this.size+s.nodeSize-n.nodeSize;return a[r]=s,new _s(a,o)}addToStart(r){return new _s([r].concat(this.content),this.size+r.nodeSize)}addToEnd(r){return new _s(this.content.concat(r),this.size+r.nodeSize)}eq(r){if(this.content.length!=r.content.length)return!1;for(let s=0;sthis.size||r<0)throw new RangeError(`Position ${r} outside of fragment (${this})`);for(let s=0,n=0;;s++){let a=this.child(s),o=n+a.nodeSize;if(o>=r)return o==r?w8(s+1,o):w8(s,n);n=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(r=>r.toJSON()):null}static fromJSON(r,s){if(!s)return _s.empty;if(!Array.isArray(s))throw new RangeError("Invalid input for Fragment.fromJSON");return new _s(s.map(r.nodeFromJSON))}static fromArray(r){if(!r.length)return _s.empty;let s,n=0;for(let a=0;athis.type.rank&&(s||(s=r.slice(0,a)),s.push(this),n=!0),s&&s.push(o)}}return s||(s=r.slice()),n||s.push(this),s}removeFromSet(r){for(let s=0;sn.type.rank-a.type.rank),s}};Zo.none=[];class mre extends Error{}class sn{constructor(r,s,n){this.content=r,this.openStart=s,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(r,s){let n=FFe(this.content,r+this.openStart,s);return n&&new sn(n,this.openStart,this.openEnd)}removeBetween(r,s){return new sn(RFe(this.content,r+this.openStart,s+this.openStart),this.openStart,this.openEnd)}eq(r){return this.content.eq(r.content)&&this.openStart==r.openStart&&this.openEnd==r.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let r={content:this.content.toJSON()};return this.openStart>0&&(r.openStart=this.openStart),this.openEnd>0&&(r.openEnd=this.openEnd),r}static fromJSON(r,s){if(!s)return sn.empty;let n=s.openStart||0,a=s.openEnd||0;if(typeof n!="number"||typeof a!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new sn(_s.fromJSON(r,s.content),n,a)}static maxOpen(r,s=!0){let n=0,a=0;for(let o=r.firstChild;o&&!o.isLeaf&&(s||!o.type.spec.isolating);o=o.firstChild)n++;for(let o=r.lastChild;o&&!o.isLeaf&&(s||!o.type.spec.isolating);o=o.lastChild)a++;return new sn(r,n,a)}}sn.empty=new sn(_s.empty,0,0);function RFe(t,r,s){let{index:n,offset:a}=t.findIndex(r),o=t.maybeChild(n),{index:l,offset:i}=t.findIndex(s);if(a==r||o.isText){if(i!=s&&!t.child(l).isText)throw new RangeError("Removing non-flat range");return t.cut(0,r).append(t.cut(s))}if(n!=l)throw new RangeError("Removing non-flat range");return t.replaceChild(n,o.copy(RFe(o.content,r-a-1,s-a-1)))}function FFe(t,r,s,n){let{index:a,offset:o}=t.findIndex(r),l=t.maybeChild(a);if(o==r||l.isText)return n&&!n.canReplace(a,a,s)?null:t.cut(0,r).append(s).append(t.cut(r));let i=FFe(l.content,r-o-1,s,l);return i&&t.replaceChild(a,l.copy(i))}function Tyt(t,r,s){if(s.openStart>t.depth)throw new mre("Inserted content deeper than insertion position");if(t.depth-s.openStart!=r.depth-s.openEnd)throw new mre("Inconsistent open depths");return zFe(t,r,s,0)}function zFe(t,r,s,n){let a=t.index(n),o=t.node(n);if(a==r.index(n)&&n=0&&t.isText&&t.sameMarkup(r[s])?r[s]=t.withText(r[s].text+t.text):r.push(t)}function tE(t,r,s,n){let a=(r||t).node(s),o=0,l=r?r.index(s):a.childCount;t&&(o=t.index(s),t.depth>s?o++:t.textOffset&&(sk(t.nodeAfter,n),o++));for(let i=o;ia&&zme(t,r,a+1),l=n.depth>a&&zme(s,n,a+1),i=[];return tE(null,t,a,i),o&&l&&r.index(a)==s.index(a)?(BFe(o,l),sk(nk(o,$Fe(t,r,s,n,a+1)),i)):(o&&sk(nk(o,pre(t,r,a+1)),i),tE(r,s,a,i),l&&sk(nk(l,pre(s,n,a+1)),i)),tE(n,null,a,i),new _s(i)}function pre(t,r,s){let n=[];if(tE(null,t,s,n),t.depth>s){let a=zme(t,r,s+1);sk(nk(a,pre(t,r,s+1)),n)}return tE(r,null,s,n),new _s(n)}function Ayt(t,r){let s=r.depth-t.openStart,a=r.node(s).copy(t.content);for(let o=s-1;o>=0;o--)a=r.node(o).copy(_s.from(a));return{start:a.resolveNoCache(t.openStart+s),end:a.resolveNoCache(a.content.size-t.openEnd-s)}}class eI{constructor(r,s,n){this.pos=r,this.path=s,this.parentOffset=n,this.depth=s.length/3-1}resolveDepth(r){return r==null?this.depth:r<0?this.depth+r:r}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(r){return this.path[this.resolveDepth(r)*3]}index(r){return this.path[this.resolveDepth(r)*3+1]}indexAfter(r){return r=this.resolveDepth(r),this.index(r)+(r==this.depth&&!this.textOffset?0:1)}start(r){return r=this.resolveDepth(r),r==0?0:this.path[r*3-1]+1}end(r){return r=this.resolveDepth(r),this.start(r)+this.node(r).content.size}before(r){if(r=this.resolveDepth(r),!r)throw new RangeError("There is no position before the top-level node");return r==this.depth+1?this.pos:this.path[r*3-1]}after(r){if(r=this.resolveDepth(r),!r)throw new RangeError("There is no position after the top-level node");return r==this.depth+1?this.pos:this.path[r*3-1]+this.path[r*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let r=this.parent,s=this.index(this.depth);if(s==r.childCount)return null;let n=this.pos-this.path[this.path.length-1],a=r.child(s);return n?r.child(s).cut(n):a}get nodeBefore(){let r=this.index(this.depth),s=this.pos-this.path[this.path.length-1];return s?this.parent.child(r).cut(0,s):r==0?null:this.parent.child(r-1)}posAtIndex(r,s){s=this.resolveDepth(s);let n=this.path[s*3],a=s==0?0:this.path[s*3-1]+1;for(let o=0;o0;s--)if(this.start(s)<=r&&this.end(s)>=r)return s;return 0}blockRange(r=this,s){if(r.pos=0;n--)if(r.pos<=this.end(n)&&(!s||s(this.node(n))))return new fre(this,r,n);return null}sameParent(r){return this.pos-this.parentOffset==r.pos-r.parentOffset}max(r){return r.pos>this.pos?r:this}min(r){return r.pos=0&&s<=r.content.size))throw new RangeError("Position "+s+" out of range");let n=[],a=0,o=s;for(let l=r;;){let{index:i,offset:d}=l.content.findIndex(o),m=o-d;if(n.push(l,i,a+d),!m||(l=l.child(i),l.isText))break;o=m-1,a+=d+1}return new eI(s,n,o)}static resolveCached(r,s){let n=c4e.get(r);if(n)for(let o=0;or&&this.nodesBetween(r,s,o=>(n.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 r=this.type.name;return this.content.size&&(r+="("+this.content.toStringInner()+")"),UFe(this.marks,r)}contentMatchAt(r){let s=this.type.contentMatch.matchFragment(this.content,0,r);if(!s)throw new Error("Called contentMatchAt on a node with invalid content");return s}canReplace(r,s,n=_s.empty,a=0,o=n.childCount){let l=this.contentMatchAt(r).matchFragment(n,a,o),i=l&&l.matchFragment(this.content,s);if(!i||!i.validEnd)return!1;for(let d=a;ds.type.name)}`);this.content.forEach(s=>s.check())}toJSON(){let r={type:this.type.name};for(let s in this.attrs){r.attrs=this.attrs;break}return this.content.size&&(r.content=this.content.toJSON()),this.marks.length&&(r.marks=this.marks.map(s=>s.toJSON())),r}static fromJSON(r,s){if(!s)throw new RangeError("Invalid input for Node.fromJSON");let n;if(s.marks){if(!Array.isArray(s.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=s.marks.map(r.markFromJSON)}if(s.type=="text"){if(typeof s.text!="string")throw new RangeError("Invalid text node in JSON");return r.text(s.text,n)}let a=_s.fromJSON(r,s.content),o=r.nodeType(s.type).create(s.attrs,a,n);return o.type.checkAttrs(o.attrs),o}};ov.prototype.text=void 0;class gre extends ov{constructor(r,s,n,a){if(super(r,s,null,a),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):UFe(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(r,s){return this.text.slice(r,s)}get nodeSize(){return this.text.length}mark(r){return r==this.marks?this:new gre(this.type,this.attrs,this.text,r)}withText(r){return r==this.text?this:new gre(this.type,this.attrs,r,this.marks)}cut(r=0,s=this.text.length){return r==0&&s==this.text.length?this:this.withText(this.text.slice(r,s))}eq(r){return this.sameMarkup(r)&&this.text==r.text}toJSON(){let r=super.toJSON();return r.text=this.text,r}}function UFe(t,r){for(let s=t.length-1;s>=0;s--)r=t[s].type.name+"("+r+")";return r}class kk{constructor(r){this.validEnd=r,this.next=[],this.wrapCache=[]}static parse(r,s){let n=new Lyt(r,s);if(n.next==null)return kk.empty;let a=qFe(n);n.next&&n.err("Unexpected trailing text");let o=$yt(Byt(a));return Uyt(o,n),o}matchType(r){for(let s=0;sm.createAndFill()));for(let m=0;m=this.next.length)throw new RangeError(`There's no ${r}th edge in this content match`);return this.next[r]}toString(){let r=[];function s(n){r.push(n);for(let a=0;a{let o=a+(n.validEnd?"*":" ")+" ";for(let l=0;l"+r.indexOf(n.next[l].next);return o}).join(` `)}}kk.empty=new kk(!0);class Lyt{constructor(r,s){this.string=r,this.nodeTypes=s,this.inline=null,this.pos=0,this.tokens=r.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(r){return this.next==r&&(this.pos++||!0)}err(r){throw new SyntaxError(r+" (in content expression '"+this.string+"')")}}function qFe(t){let r=[];do r.push(Oyt(t));while(t.eat("|"));return r.length==1?r[0]:{type:"choice",exprs:r}}function Oyt(t){let r=[];do r.push(Dyt(t));while(t.next&&t.next!=")"&&t.next!="|");return r.length==1?r[0]:{type:"seq",exprs:r}}function Dyt(t){let r=zyt(t);for(;;)if(t.eat("+"))r={type:"plus",expr:r};else if(t.eat("*"))r={type:"star",expr:r};else if(t.eat("?"))r={type:"opt",expr:r};else if(t.eat("{"))r=Ryt(t,r);else break;return r}function d4e(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let r=Number(t.next);return t.pos++,r}function Ryt(t,r){let s=d4e(t),n=s;return t.eat(",")&&(t.next!="}"?n=d4e(t):n=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:s,max:n,expr:r}}function Fyt(t,r){let s=t.nodeTypes,n=s[r];if(n)return[n];let a=[];for(let o in s){let l=s[o];l.isInGroup(r)&&a.push(l)}return a.length==0&&t.err("No node type or group '"+r+"' found"),a}function zyt(t){if(t.eat("(")){let r=qFe(t);return t.eat(")")||t.err("Missing closing paren"),r}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let r=Fyt(t,t.next).map(s=>(t.inline==null?t.inline=s.isInline:t.inline!=s.isInline&&t.err("Mixing inline and block content"),{type:"name",value:s}));return t.pos++,r.length==1?r[0]:{type:"choice",exprs:r}}}function Byt(t){let r=[[]];return a(o(t,0),s()),r;function s(){return r.push([])-1}function n(l,i,d){let m={term:d,to:i};return r[l].push(m),m}function a(l,i){l.forEach(d=>d.to=i)}function o(l,i){if(l.type=="choice")return l.exprs.reduce((d,m)=>d.concat(o(m,i)),[]);if(l.type=="seq")for(let d=0;;d++){let m=o(l.exprs[d],i);if(d==l.exprs.length-1)return m;a(m,i=s())}else if(l.type=="star"){let d=s();return n(i,d),a(o(l.expr,d),d),[n(d)]}else if(l.type=="plus"){let d=s();return a(o(l.expr,i),d),a(o(l.expr,d),d),[n(d)]}else{if(l.type=="opt")return[n(i)].concat(o(l.expr,i));if(l.type=="range"){let d=i;for(let m=0;m{t[l].forEach(({term:i,to:d})=>{if(!i)return;let m;for(let g=0;g{m||a.push([i,m=[]]),m.indexOf(g)==-1&&m.push(g)})})});let o=r[n.join(",")]=new kk(n.indexOf(t.length-1)>-1);for(let l=0;l-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let r in this.attrs)if(this.attrs[r].isRequired)return!0;return!1}compatibleContent(r){return this==r||this.contentMatch.compatible(r.contentMatch)}computeAttrs(r){return!r&&this.defaultAttrs?this.defaultAttrs:WFe(this.attrs,r)}create(r=null,s,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ov(this,this.computeAttrs(r),_s.from(s),Zo.setFrom(n))}createChecked(r=null,s,n){return s=_s.from(s),this.checkContent(s),new ov(this,this.computeAttrs(r),s,Zo.setFrom(n))}createAndFill(r=null,s,n){if(r=this.computeAttrs(r),s=_s.from(s),s.size){let l=this.contentMatch.fillBefore(s);if(!l)return null;s=l.append(s)}let a=this.contentMatch.matchFragment(s),o=a&&a.fillBefore(_s.empty,!0);return o?new ov(this,r,s.append(o),Zo.setFrom(n)):null}validContent(r){let s=this.contentMatch.matchFragment(r);if(!s||!s.validEnd)return!1;for(let n=0;n-1}allowsMarks(r){if(this.markSet==null)return!0;for(let s=0;sn[o]=new ZFe(o,s,l));let a=s.spec.topNode||"doc";if(!n[a])throw new RangeError("Schema is missing its top node type ('"+a+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let o in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function qyt(t,r,s){let n=s.split("|");return a=>{let o=a===null?"null":typeof a;if(n.indexOf(o)<0)throw new RangeError(`Expected value of type ${n} for attribute ${r} on type ${t}, got ${o}`)}}class Vyt{constructor(r,s,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?qyt(r,s,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class bae{constructor(r,s,n,a){this.name=r,this.rank=s,this.schema=n,this.spec=a,this.attrs=KFe(r,a.attrs),this.excluded=null;let o=HFe(this.attrs);this.instance=o?new Zo(this,o):null}create(r=null){return!r&&this.instance?this.instance:new Zo(this,WFe(this.attrs,r))}static compile(r,s){let n=Object.create(null),a=0;return r.forEach((o,l)=>n[o]=new bae(o,a++,s,l)),n}removeFromSet(r){for(var s=0;s-1}}class YFe{constructor(r){this.linebreakReplacement=null,this.cached=Object.create(null);let s=this.spec={};for(let a in r)s[a]=r[a];s.nodes=tu.from(r.nodes),s.marks=tu.from(r.marks||{}),this.nodes=h4e.compile(this.spec.nodes,this),this.marks=bae.compile(this.spec.marks,this);let n=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=n[l]||(n[l]=kk.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?m4e(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==""?[]:m4e(this,l.split(" "))}this.nodeFromJSON=a=>ov.fromJSON(this,a),this.markFromJSON=a=>Zo.fromJSON(this,a),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(r,s=null,n,a){if(typeof r=="string")r=this.nodeType(r);else if(r instanceof h4e){if(r.schema!=this)throw new RangeError("Node type from different schema used ("+r.name+")")}else throw new RangeError("Invalid node type: "+r);return r.createChecked(s,n,a)}text(r,s){let n=this.nodes.text;return new gre(n,n.defaultAttrs,r,Zo.setFrom(s))}mark(r,s){return typeof r=="string"&&(r=this.marks[r]),r.create(s)}nodeType(r){let s=this.nodes[r];if(!s)throw new RangeError("Unknown node type: "+r);return s}}function m4e(t,r){let s=[];for(let n=0;n-1)&&s.push(l=d)}if(!l)throw new SyntaxError("Unknown mark type: '"+r[n]+"'")}return s}function Hyt(t){return t.tag!=null}function Wyt(t){return t.style!=null}let rE=class $me{constructor(r,s){this.schema=r,this.rules=s,this.tags=[],this.styles=[];let n=this.matchedStyles=[];s.forEach(a=>{if(Hyt(a))this.tags.push(a);else if(Wyt(a)){let o=/[^=]*/.exec(a.style)[0];n.indexOf(o)<0&&n.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=r.nodes[a.node];return o.contentMatch.matchType(o)})}parse(r,s={}){let n=new f4e(this,s,!1);return n.addAll(r,Zo.none,s.from,s.to),n.finish()}parseSlice(r,s={}){let n=new f4e(this,s,!0);return n.addAll(r,Zo.none,s.from,s.to),sn.maxOpen(n.finish())}matchTag(r,s,n){for(let a=n?this.tags.indexOf(n)+1:0;ar.length&&(i.charCodeAt(r.length)!=61||i.slice(r.length+1)!=s))){if(l.getAttrs){let d=l.getAttrs(s);if(d===!1)continue;l.attrs=d||void 0}return l}}}static schemaRules(r){let s=[];function n(a){let o=a.priority==null?50:a.priority,l=0;for(;l{n(l=g4e(l)),l.mark||l.ignore||l.clearMark||(l.mark=a)})}for(let a in r.nodes){let o=r.nodes[a].spec.parseDOM;o&&o.forEach(l=>{n(l=g4e(l)),l.node||l.ignore||l.mark||(l.node=a)})}return s}static fromSchema(r){return r.cached.domParser||(r.cached.domParser=new $me(r,$me.schemaRules(r)))}};const XFe={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},Gyt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},QFe={ol:!0,ul:!0},tI=1,Ume=2,sE=4;function p4e(t,r,s){return r!=null?(r?tI:0)|(r==="full"?Ume:0):t&&t.whitespace=="pre"?tI|Ume:s&~sE}class j8{constructor(r,s,n,a,o,l){this.type=r,this.attrs=s,this.marks=n,this.solid=a,this.options=l,this.content=[],this.activeMarks=Zo.none,this.match=o||(l&sE?null:r.contentMatch)}findWrapping(r){if(!this.match){if(!this.type)return[];let s=this.type.contentMatch.fillBefore(_s.from(r));if(s)this.match=this.type.contentMatch.matchFragment(s);else{let n=this.type.contentMatch,a;return(a=n.findWrapping(r.type))?(this.match=n,a):null}}return this.match.findWrapping(r.type)}finish(r){if(!(this.options&tI)){let n=this.content[this.content.length-1],a;if(n&&n.isText&&(a=/[ \t\r\n\u000c]+$/.exec(n.text))){let o=n;n.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 s=_s.from(this.content);return!r&&this.match&&(s=s.append(this.match.fillBefore(_s.empty,!0))),this.type?this.type.create(this.attrs,s,this.marks):s}inlineContext(r){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:r.parentNode&&!XFe.hasOwnProperty(r.parentNode.nodeName.toLowerCase())}}class f4e{constructor(r,s,n){this.parser=r,this.options=s,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let a=s.topNode,o,l=p4e(null,s.preserveWhitespace,0)|(n?sE:0);a?o=new j8(a.type,a.attrs,Zo.none,!0,s.topMatch||a.type.contentMatch,l):n?o=new j8(null,null,Zo.none,!0,null,l):o=new j8(r.schema.topNodeType,null,Zo.none,!0,null,l),this.nodes=[o],this.find=s.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(r,s){r.nodeType==3?this.addTextNode(r,s):r.nodeType==1&&this.addElement(r,s)}addTextNode(r,s){let n=r.nodeValue,a=this.top,o=a.options&Ume?"full":this.localPreserveWS||(a.options&tI)>0,{schema:l}=this.parser;if(o==="full"||a.inlineContext(r)||/[^ \t\r\n\u000c]/.test(n)){if(o)if(o==="full")n=n.replace(/\r\n?/g,` `);else if(l.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(l.linebreakReplacement.create())){let i=n.split(/\r?\n|\r/);for(let d=0;d!d.clearMark(m)):s=s.concat(this.parser.schema.marks[d.mark].create(d.attrs)),d.consuming===!1)i=d;else break}}return s}addElementByRule(r,s,n,a){let o,l;if(s.node)if(l=this.parser.schema.nodes[s.node],l.isLeaf)this.insertNode(l.create(s.attrs),n,r.nodeName=="BR")||this.leafFallback(r,n);else{let d=this.enter(l,s.attrs||null,n,s.preserveWhitespace);d&&(o=!0,n=d)}else{let d=this.parser.schema.marks[s.mark];n=n.concat(d.create(s.attrs))}let i=this.top;if(l&&l.isLeaf)this.findInside(r);else if(a)this.addElement(r,n,a);else if(s.getContent)this.findInside(r),s.getContent(r,this.parser.schema).forEach(d=>this.insertNode(d,n,!1));else{let d=r;typeof s.contentElement=="string"?d=r.querySelector(s.contentElement):typeof s.contentElement=="function"?d=s.contentElement(r):s.contentElement&&(d=s.contentElement),this.findAround(r,d,!0),this.addAll(d,n),this.findAround(r,d,!1)}o&&this.sync(i)&&this.open--}addAll(r,s,n,a){let o=n||0;for(let l=n?r.childNodes[n]:r.firstChild,i=a==null?null:r.childNodes[a];l!=i;l=l.nextSibling,++o)this.findAtPoint(r,o),this.addDOM(l,s);this.findAtPoint(r,o)}findPlace(r,s,n){let a,o;for(let l=this.open,i=0;l>=0;l--){let d=this.nodes[l],m=d.findWrapping(r);if(m&&(!a||a.length>m.length+i)&&(a=m,o=d,!m.length))break;if(d.solid){if(n)break;i+=2}}if(!a)return null;this.sync(o);for(let l=0;l(l.type?l.type.allowsMarkType(m.type):x4e(m.type,r))?(d=m.addToSet(d),!1):!0),this.nodes.push(new j8(r,s,d,a,null,i)),this.open++,n}closeExtra(r=!1){let s=this.nodes.length-1;if(s>this.open){for(;s>this.open;s--)this.nodes[s-1].content.push(this.nodes[s].finish(r));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(r){for(let s=this.open;s>=0;s--){if(this.nodes[s]==r)return this.open=s,!0;this.localPreserveWS&&(this.nodes[s].options|=tI)}return!1}get currentPos(){this.closeExtra();let r=0;for(let s=this.open;s>=0;s--){let n=this.nodes[s].content;for(let a=n.length-1;a>=0;a--)r+=n[a].nodeSize;s&&r++}return r}findAtPoint(r,s){if(this.find)for(let n=0;n-1)return r.split(/\s*\|\s*/).some(this.matchesContext,this);let s=r.split("/"),n=this.options.context,a=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),o=-(n?n.depth+1:0)+(a?0:1),l=(i,d)=>{for(;i>=0;i--){let m=s[i];if(m==""){if(i==s.length-1||i==0)continue;for(;d>=o;d--)if(l(i-1,d))return!0;return!1}else{let g=d>0||d==0&&a?this.nodes[d].type:n&&d>=o?n.node(d-o).type:null;if(!g||g.name!=m&&!g.isInGroup(m))return!1;d--}}return!0};return l(s.length-1,this.open)}textblockFromContext(){let r=this.options.context;if(r)for(let s=r.depth;s>=0;s--){let n=r.node(s).contentMatchAt(r.indexAfter(s)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let s in this.parser.schema.nodes){let n=this.parser.schema.nodes[s];if(n.isTextblock&&n.defaultAttrs)return n}}}function Kyt(t){for(let r=t.firstChild,s=null;r;r=r.nextSibling){let n=r.nodeType==1?r.nodeName.toLowerCase():null;n&&QFe.hasOwnProperty(n)&&s?(s.appendChild(r),r=s):n=="li"?s=r:n&&(s=null)}}function Zyt(t,r){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,r)}function g4e(t){let r={};for(let s in t)r[s]=t[s];return r}function x4e(t,r){let s=r.schema.nodes;for(let n in s){let a=s[n];if(!a.allowsMarkType(t))continue;let o=[],l=i=>{o.push(i);for(let d=0;d{if(o.length||l.marks.length){let i=0,d=0;for(;i=0;a--){let o=this.serializeMark(r.marks[a],r.isInline,s);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(r,s,n={}){let a=this.marks[r.type.name];return a&&Yee(sde(n),a(r,s),null,r.attrs)}static renderSpec(r,s,n=null,a){return Yee(r,s,n,a)}static fromSchema(r){return r.cached.domSerializer||(r.cached.domSerializer=new qk(this.nodesFromSchema(r),this.marksFromSchema(r)))}static nodesFromSchema(r){let s=y4e(r.nodes);return s.text||(s.text=n=>n.text),s}static marksFromSchema(r){return y4e(r.marks)}}function y4e(t){let r={};for(let s in t){let n=t[s].spec.toDOM;n&&(r[s]=n)}return r}function sde(t){return t.document||window.document}const v4e=new WeakMap;function Yyt(t){let r=v4e.get(t);return r===void 0&&v4e.set(t,r=Xyt(t)),r}function Xyt(t){let r=null;function s(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")r||(r=[]),r.push(n);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&&(s=a.slice(0,l),a=a.slice(l+1));let i,d=s?t.createElementNS(s,a):t.createElement(a),m=r[1],g=1;if(m&&typeof m=="object"&&m.nodeType==null&&!Array.isArray(m)){g=2;for(let y in m)if(m[y]!=null){let v=y.indexOf(" ");v>0?d.setAttributeNS(y.slice(0,v),y.slice(v+1),m[y]):y=="style"&&d.style?d.style.cssText=m[y]:d.setAttribute(y,m[y])}}for(let y=g;yg)throw new RangeError("Content hole must be the only child of its parent node");return{dom:d,contentDOM:d}}else{let{dom:b,contentDOM:N}=Yee(t,v,s,n);if(d.appendChild(b),N){if(i)throw new RangeError("Multiple content holes");i=N}}}return{dom:d,contentDOM:i}}const JFe=65535,eze=Math.pow(2,16);function Qyt(t,r){return t+r*eze}function _4e(t){return t&JFe}function Jyt(t){return(t-(t&JFe))/eze}const tze=1,rze=2,Xee=4,sze=8;class qme{constructor(r,s,n){this.pos=r,this.delInfo=s,this.recover=n}get deleted(){return(this.delInfo&sze)>0}get deletedBefore(){return(this.delInfo&(tze|Xee))>0}get deletedAfter(){return(this.delInfo&(rze|Xee))>0}get deletedAcross(){return(this.delInfo&Xee)>0}}class mm{constructor(r,s=!1){if(this.ranges=r,this.inverted=s,!r.length&&mm.empty)return mm.empty}recover(r){let s=0,n=_4e(r);if(!this.inverted)for(let a=0;ar)break;let m=this.ranges[i+o],g=this.ranges[i+l],y=d+m;if(r<=y){let v=m?r==d?-1:r==y?1:s:s,b=d+a+(v<0?0:g);if(n)return b;let N=r==(s<0?d:y)?null:Qyt(i/3,r-d),j=r==d?rze:r==y?tze:Xee;return(s<0?r!=d:r!=y)&&(j|=sze),new qme(b,j,N)}a+=g-m}return n?r+a:new qme(r+a,0,null)}touches(r,s){let n=0,a=_4e(s),o=this.inverted?2:1,l=this.inverted?1:2;for(let i=0;ir)break;let m=this.ranges[i+o],g=d+m;if(r<=g&&i==a*3)return!0;n+=this.ranges[i+l]-m}return!1}forEach(r){let s=this.inverted?2:1,n=this.inverted?1:2;for(let a=0,o=0;a=0;s--){let a=r.getMirror(s);this.appendMap(r._maps[s].invert(),a!=null&&a>s?n-a-1:void 0)}}invert(){let r=new rI;return r.appendMappingInverted(this),r}map(r,s=1){if(this.mirror)return this._map(r,s,!0);for(let n=this.from;no&&d!l.isAtom||!i.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),a),s.openStart,s.openEnd);return Qc.fromReplace(r,this.from,this.to,o)}invert(){return new zg(this.from,this.to,this.mark)}map(r){let s=r.mapResult(this.from,1),n=r.mapResult(this.to,-1);return s.deleted&&n.deleted||s.pos>=n.pos?null:new I1(s.pos,n.pos,this.mark)}merge(r){return r instanceof I1&&r.mark.eq(this.mark)&&this.from<=r.to&&this.to>=r.from?new I1(Math.min(this.from,r.from),Math.max(this.to,r.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(r,s){if(typeof s.from!="number"||typeof s.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new I1(s.from,s.to,r.markFromJSON(s.mark))}}Eu.jsonID("addMark",I1);class zg extends Eu{constructor(r,s,n){super(),this.from=r,this.to=s,this.mark=n}apply(r){let s=r.slice(this.from,this.to),n=new sn(Zye(s.content,a=>a.mark(this.mark.removeFromSet(a.marks)),r),s.openStart,s.openEnd);return Qc.fromReplace(r,this.from,this.to,n)}invert(){return new I1(this.from,this.to,this.mark)}map(r){let s=r.mapResult(this.from,1),n=r.mapResult(this.to,-1);return s.deleted&&n.deleted||s.pos>=n.pos?null:new zg(s.pos,n.pos,this.mark)}merge(r){return r instanceof zg&&r.mark.eq(this.mark)&&this.from<=r.to&&this.to>=r.from?new zg(Math.min(this.from,r.from),Math.max(this.to,r.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(r,s){if(typeof s.from!="number"||typeof s.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new zg(s.from,s.to,r.markFromJSON(s.mark))}}Eu.jsonID("removeMark",zg);class P1 extends Eu{constructor(r,s){super(),this.pos=r,this.mark=s}apply(r){let s=r.nodeAt(this.pos);if(!s)return Qc.fail("No node at mark step's position");let n=s.type.create(s.attrs,null,this.mark.addToSet(s.marks));return Qc.fromReplace(r,this.pos,this.pos+1,new sn(_s.from(n),0,s.isLeaf?0:1))}invert(r){let s=r.nodeAt(this.pos);if(s){let n=this.mark.addToSet(s.marks);if(n.length==s.marks.length){for(let a=0;an.pos?null:new Ud(s.pos,n.pos,a,o,this.slice,this.insert,this.structure)}toJSON(){let r={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(r.slice=this.slice.toJSON()),this.structure&&(r.structure=!0),r}static fromJSON(r,s){if(typeof s.from!="number"||typeof s.to!="number"||typeof s.gapFrom!="number"||typeof s.gapTo!="number"||typeof s.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ud(s.from,s.to,s.gapFrom,s.gapTo,sn.fromJSON(r,s.slice),s.insert,!!s.structure)}}Eu.jsonID("replaceAround",Ud);function Vme(t,r,s){let n=t.resolve(r),a=s-r,o=n.depth;for(;a>0&&o>0&&n.indexAfter(o)==n.node(o).childCount;)o--,a--;if(a>0){let l=n.node(o).maybeChild(n.indexAfter(o));for(;a>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,a--}}return!1}function e0t(t,r,s,n){let a=[],o=[],l,i;t.doc.nodesBetween(r,s,(d,m,g)=>{if(!d.isInline)return;let y=d.marks;if(!n.isInSet(y)&&g.type.allowsMarkType(n.type)){let v=Math.max(m,r),b=Math.min(m+d.nodeSize,s),N=n.addToSet(y);for(let j=0;jt.step(d)),o.forEach(d=>t.step(d))}function t0t(t,r,s,n){let a=[],o=0;t.doc.nodesBetween(r,s,(l,i)=>{if(!l.isInline)return;o++;let d=null;if(n instanceof bae){let m=l.marks,g;for(;g=n.isInSet(m);)(d||(d=[])).push(g),m=g.removeFromSet(m)}else n?n.isInSet(l.marks)&&(d=[n]):d=l.marks;if(d&&d.length){let m=Math.min(i+l.nodeSize,s);for(let g=0;gt.step(new zg(l.from,l.to,l.style)))}function Yye(t,r,s,n=s.contentMatch,a=!0){let o=t.doc.nodeAt(r),l=[],i=r+1;for(let d=0;d=0;d--)t.step(l[d])}function r0t(t,r,s){return(r==0||t.canReplace(r,t.childCount))&&(s==t.childCount||t.canReplace(0,s))}function H3(t){let s=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let n=t.depth,a=0,o=0;;--n){let l=t.$from.node(n),i=t.$from.index(n)+a,d=t.$to.indexAfter(n)-o;if(ns;N--)j||n.index(N)>0?(j=!0,g=_s.from(n.node(N).copy(g)),y++):d--;let v=_s.empty,b=0;for(let N=o,j=!1;N>s;N--)j||a.after(N+1)=0;l--){if(n.size){let i=s[l].type.contentMatch.matchFragment(n);if(!i||!i.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=_s.from(s[l].type.create(s[l].attrs,n))}let a=r.start,o=r.end;t.step(new Ud(a,o,a,o,new sn(n,0,0),s.length,!0))}function o0t(t,r,s,n,a){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(r,s,(l,i)=>{let d=typeof a=="function"?a(l):a;if(l.isTextblock&&!l.hasMarkup(n,d)&&l0t(t.doc,t.mapping.slice(o).map(i),n)){let m=null;if(n.schema.linebreakReplacement){let b=n.whitespace=="pre",N=!!n.contentMatch.matchType(n.schema.linebreakReplacement);b&&!N?m=!1:!b&&N&&(m=!0)}m===!1&&aze(t,l,i,o),Yye(t,t.mapping.slice(o).map(i,1),n,void 0,m===null);let g=t.mapping.slice(o),y=g.map(i,1),v=g.map(i+l.nodeSize,1);return t.step(new Ud(y,v,y+1,v-1,new sn(_s.from(n.create(d,null,l.marks)),0,0),1,!0)),m===!0&&nze(t,l,i,o),!1}})}function nze(t,r,s,n){r.forEach((a,o)=>{if(a.isText){let l,i=/\r?\n|\r/g;for(;l=i.exec(a.text);){let d=t.mapping.slice(n).map(s+1+o+l.index);t.replaceWith(d,d+1,r.type.schema.linebreakReplacement.create())}}})}function aze(t,r,s,n){r.forEach((a,o)=>{if(a.type==a.type.schema.linebreakReplacement){let l=t.mapping.slice(n).map(s+1+o);t.replaceWith(l,l+1,r.type.schema.text(` `))}})}function l0t(t,r,s){let n=t.resolve(r),a=n.index();return n.parent.canReplaceWith(a,a+1,s)}function c0t(t,r,s,n,a){let o=t.doc.nodeAt(r);if(!o)throw new RangeError("No node at given position");s||(s=o.type);let l=s.create(n,null,a||o.marks);if(o.isLeaf)return t.replaceWith(r,r+o.nodeSize,l);if(!s.validContent(o.content))throw new RangeError("Invalid content for node type "+s.name);t.step(new Ud(r,r+o.nodeSize,r+1,r+o.nodeSize-1,new sn(_s.from(l),0,0),1,!0))}function jy(t,r,s=1,n){let a=t.resolve(r),o=a.depth-s,l=n&&n[n.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 m=a.depth-1,g=s-2;m>o;m--,g--){let y=a.node(m),v=a.index(m);if(y.type.spec.isolating)return!1;let b=y.content.cutByIndex(v,y.childCount),N=n&&n[g+1];N&&(b=b.replaceChild(0,N.type.create(N.attrs)));let j=n&&n[g]||y;if(!y.canReplace(v+1,y.childCount)||!j.type.validContent(b))return!1}let i=a.indexAfter(o),d=n&&n[0];return a.node(o).canReplaceWith(i,i,d?d.type:a.node(o+1).type)}function d0t(t,r,s=1,n){let a=t.doc.resolve(r),o=_s.empty,l=_s.empty;for(let i=a.depth,d=a.depth-s,m=s-1;i>d;i--,m--){o=_s.from(a.node(i).copy(o));let g=n&&n[m];l=_s.from(g?g.type.create(g.attrs,l):a.node(i).copy(l))}t.step(new Rd(r,r,new sn(o.append(l),s,s),!0))}function Ov(t,r){let s=t.resolve(r),n=s.index();return ize(s.nodeBefore,s.nodeAfter)&&s.parent.canReplace(n,n+1)}function u0t(t,r){r.content.size||t.type.compatibleContent(r.type);let s=t.contentMatchAt(t.childCount),{linebreakReplacement:n}=t.type.schema;for(let a=0;a0?(o=n.node(a+1),i++,l=n.node(a).maybeChild(i)):(o=n.node(a).maybeChild(i-1),l=n.node(a+1)),o&&!o.isTextblock&&ize(o,l)&&n.node(a).canReplace(i,i+1))return r;if(a==0)break;r=s<0?n.before(a):n.after(a)}}function h0t(t,r,s){let n=null,{linebreakReplacement:a}=t.doc.type.schema,o=t.doc.resolve(r-s),l=o.node().type;if(a&&l.inlineContent){let g=l.whitespace=="pre",y=!!l.contentMatch.matchType(a);g&&!y?n=!1:!g&&y&&(n=!0)}let i=t.steps.length;if(n===!1){let g=t.doc.resolve(r+s);aze(t,g.node(),g.before(),i)}l.inlineContent&&Yye(t,r+s-1,l,o.node().contentMatchAt(o.index()),n==null);let d=t.mapping.slice(i),m=d.map(r-s);if(t.step(new Rd(m,d.map(r+s,-1),sn.empty,!0)),n===!0){let g=t.doc.resolve(m);nze(t,g.node(),g.before(),t.steps.length)}return t}function m0t(t,r,s){let n=t.resolve(r);if(n.parent.canReplaceWith(n.index(),n.index(),s))return r;if(n.parentOffset==0)for(let a=n.depth-1;a>=0;a--){let o=n.index(a);if(n.node(a).canReplaceWith(o,o,s))return n.before(a+1);if(o>0)return null}if(n.parentOffset==n.parent.content.size)for(let a=n.depth-1;a>=0;a--){let o=n.indexAfter(a);if(n.node(a).canReplaceWith(o,o,s))return n.after(a+1);if(o=0;l--){let i=l==n.depth?0:n.pos<=(n.start(l+1)+n.end(l+1))/2?-1:1,d=n.index(l)+(i>0?1:0),m=n.node(l),g=!1;if(o==1)g=m.canReplace(d,d,a);else{let y=m.contentMatchAt(d).findWrapping(a.firstChild.type);g=y&&m.canReplaceWith(d,d,y[0])}if(g)return i==0?n.pos:i<0?n.before(l+1):n.after(l+1)}return null}function jae(t,r,s=r,n=sn.empty){if(r==s&&!n.size)return null;let a=t.resolve(r),o=t.resolve(s);return lze(a,o,n)?new Rd(r,s,n):new p0t(a,o,n).fit()}function lze(t,r,s){return!s.openStart&&!s.openEnd&&t.start()==r.start()&&t.parent.canReplace(t.index(),r.index(),s.content)}class p0t{constructor(r,s,n){this.$from=r,this.$to=s,this.unplaced=n,this.frontier=[],this.placed=_s.empty;for(let a=0;a<=r.depth;a++){let o=r.node(a);this.frontier.push({type:o.type,match:o.contentMatchAt(r.indexAfter(a))})}for(let a=r.depth;a>0;a--)this.placed=_s.from(r.node(a).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let m=this.findFittable();m?this.placeNodes(m):this.openMore()||this.dropNode()}let r=this.mustMoveInline(),s=this.placed.size-this.depth-this.$from.depth,n=this.$from,a=this.close(r<0?this.$to:n.doc.resolve(r));if(!a)return null;let o=this.placed,l=n.depth,i=a.depth;for(;l&&i&&o.childCount==1;)o=o.firstChild.content,l--,i--;let d=new sn(o,l,i);return r>-1?new Ud(n.pos,r,this.$to.pos,this.$to.end(),d,s):d.size||n.pos!=this.$to.pos?new Rd(n.pos,a.pos,d):null}findFittable(){let r=this.unplaced.openStart;for(let s=this.unplaced.content,n=0,a=this.unplaced.openEnd;n1&&(a=0),o.type.spec.isolating&&a<=n){r=n;break}s=o.content}for(let s=1;s<=2;s++)for(let n=s==1?r:this.unplaced.openStart;n>=0;n--){let a,o=null;n?(o=ade(this.unplaced.content,n-1).firstChild,a=o.content):a=this.unplaced.content;let l=a.firstChild;for(let i=this.depth;i>=0;i--){let{type:d,match:m}=this.frontier[i],g,y=null;if(s==1&&(l?m.matchType(l.type)||(y=m.fillBefore(_s.from(l),!1)):o&&d.compatibleContent(o.type)))return{sliceDepth:n,frontierDepth:i,parent:o,inject:y};if(s==2&&l&&(g=m.findWrapping(l.type)))return{sliceDepth:n,frontierDepth:i,parent:o,wrap:g};if(o&&m.matchType(o.type))break}}}openMore(){let{content:r,openStart:s,openEnd:n}=this.unplaced,a=ade(r,s);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new sn(r,s+1,Math.max(n,a.size+s>=r.size-n?s+1:0)),!0)}dropNode(){let{content:r,openStart:s,openEnd:n}=this.unplaced,a=ade(r,s);if(a.childCount<=1&&s>0){let o=r.size-s<=s+a.size;this.unplaced=new sn(YT(r,s-1,1),s-1,o?s-1:n)}else this.unplaced=new sn(YT(r,s,1),s,n)}placeNodes({sliceDepth:r,frontierDepth:s,parent:n,inject:a,wrap:o}){for(;this.depth>s;)this.closeFrontierNode();if(o)for(let j=0;j1||d==0||j.content.size)&&(y=S,g.push(cze(j.mark(v.allowedMarks(j.marks)),m==1?d:0,m==i.childCount?b:-1)))}let N=m==i.childCount;N||(b=-1),this.placed=XT(this.placed,s,_s.from(g)),this.frontier[s].match=y,N&&b<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let j=0,S=i;j1&&a==this.$to.end(--n);)++a;return a}findCloseLevel(r){e:for(let s=Math.min(this.depth,r.depth);s>=0;s--){let{match:n,type:a}=this.frontier[s],o=s=0;i--){let{match:d,type:m}=this.frontier[i],g=ide(r,i,m,d,!0);if(!g||g.childCount)continue e}return{depth:s,fit:l,move:o?r.doc.resolve(r.after(s+1)):r}}}}close(r){let s=this.findCloseLevel(r);if(!s)return null;for(;this.depth>s.depth;)this.closeFrontierNode();s.fit.childCount&&(this.placed=XT(this.placed,s.depth,s.fit)),r=s.move;for(let n=s.depth+1;n<=r.depth;n++){let a=r.node(n),o=a.type.contentMatch.fillBefore(a.content,!0,r.index(n));this.openFrontierNode(a.type,a.attrs,o)}return r}openFrontierNode(r,s=null,n){let a=this.frontier[this.depth];a.match=a.match.matchType(r),this.placed=XT(this.placed,this.depth,_s.from(r.create(s,n))),this.frontier.push({type:r,match:r.contentMatch})}closeFrontierNode(){let s=this.frontier.pop().match.fillBefore(_s.empty,!0);s.childCount&&(this.placed=XT(this.placed,this.frontier.length,s))}}function YT(t,r,s){return r==0?t.cutByIndex(s,t.childCount):t.replaceChild(0,t.firstChild.copy(YT(t.firstChild.content,r-1,s)))}function XT(t,r,s){return r==0?t.append(s):t.replaceChild(t.childCount-1,t.lastChild.copy(XT(t.lastChild.content,r-1,s)))}function ade(t,r){for(let s=0;s1&&(n=n.replaceChild(0,cze(n.firstChild,r-1,n.childCount==1?s-1:0))),r>0&&(n=t.type.contentMatch.fillBefore(n).append(n),s<=0&&(n=n.append(t.type.contentMatch.matchFragment(n).fillBefore(_s.empty,!0)))),t.copy(n)}function ide(t,r,s,n,a){let o=t.node(r),l=a?t.indexAfter(r):t.index(r);if(l==o.childCount&&!s.compatibleContent(o.type))return null;let i=n.fillBefore(o.content,!0,l);return i&&!f0t(s,o.content,l)?i:null}function f0t(t,r,s){for(let n=s;n0;v--,b--){let N=a.node(v).type.spec;if(N.defining||N.definingAsContext||N.isolating)break;l.indexOf(v)>-1?i=v:a.before(v)==b&&l.splice(1,0,-v)}let d=l.indexOf(i),m=[],g=n.openStart;for(let v=n.content,b=0;;b++){let N=v.firstChild;if(m.push(N),b==n.openStart)break;v=N.content}for(let v=g-1;v>=0;v--){let b=m[v],N=g0t(b.type);if(N&&!b.sameMarkup(a.node(Math.abs(i)-1)))g=v;else if(N||!b.type.isTextblock)break}for(let v=n.openStart;v>=0;v--){let b=(v+g+1)%(n.openStart+1),N=m[b];if(N)for(let j=0;j=0&&(t.replace(r,s,n),!(t.steps.length>y));v--){let b=l[v];b<0||(r=a.before(b),s=o.after(b))}}function dze(t,r,s,n,a){if(rn){let o=a.contentMatchAt(0),l=o.fillBefore(t).append(t);t=l.append(o.matchFragment(l).fillBefore(_s.empty,!0))}return t}function y0t(t,r,s,n){if(!n.isInline&&r==s&&t.doc.resolve(r).parent.content.size){let a=m0t(t.doc,r,n.type);a!=null&&(r=s=a)}t.replaceRange(r,s,new sn(_s.from(n),0,0))}function v0t(t,r,s){let n=t.doc.resolve(r),a=t.doc.resolve(s),o=uze(n,a);for(let l=0;l0&&(d||n.node(i-1).canReplace(n.index(i-1),a.indexAfter(i-1))))return t.delete(n.before(i),a.after(i))}for(let l=1;l<=n.depth&&l<=a.depth;l++)if(r-n.start(l)==n.depth-l&&s>n.end(l)&&a.end(l)-s!=a.depth-l&&n.start(l-1)==a.start(l-1)&&n.node(l-1).canReplace(n.index(l-1),a.index(l-1)))return t.delete(n.before(l),s);t.delete(r,s)}function uze(t,r){let s=[],n=Math.min(t.depth,r.depth);for(let a=n;a>=0;a--){let o=t.start(a);if(or.pos+(r.depth-a)||t.node(a).type.spec.isolating||r.node(a).type.spec.isolating)break;(o==r.start(a)||a==t.depth&&a==r.depth&&t.parent.inlineContent&&r.parent.inlineContent&&a&&r.start(a-1)==o-1)&&s.push(a)}return s}class cC extends Eu{constructor(r,s,n){super(),this.pos=r,this.attr=s,this.value=n}apply(r){let s=r.nodeAt(this.pos);if(!s)return Qc.fail("No node at attribute step's position");let n=Object.create(null);for(let o in s.attrs)n[o]=s.attrs[o];n[this.attr]=this.value;let a=s.type.create(n,null,s.marks);return Qc.fromReplace(r,this.pos,this.pos+1,new sn(_s.from(a),0,s.isLeaf?0:1))}getMap(){return mm.empty}invert(r){return new cC(this.pos,this.attr,r.nodeAt(this.pos).attrs[this.attr])}map(r){let s=r.mapResult(this.pos,1);return s.deletedAfter?null:new cC(s.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(r,s){if(typeof s.pos!="number"||typeof s.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new cC(s.pos,s.attr,s.value)}}Eu.jsonID("attr",cC);class sI extends Eu{constructor(r,s){super(),this.attr=r,this.value=s}apply(r){let s=Object.create(null);for(let a in r.attrs)s[a]=r.attrs[a];s[this.attr]=this.value;let n=r.type.create(s,r.content,r.marks);return Qc.ok(n)}getMap(){return mm.empty}invert(r){return new sI(this.attr,r.attrs[this.attr])}map(r){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(r,s){if(typeof s.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new sI(s.attr,s.value)}}Eu.jsonID("docAttr",sI);let ZC=class extends Error{};ZC=function t(r){let s=Error.call(this,r);return s.__proto__=t.prototype,s};ZC.prototype=Object.create(Error.prototype);ZC.prototype.constructor=ZC;ZC.prototype.name="TransformError";class Qye{constructor(r){this.doc=r,this.steps=[],this.docs=[],this.mapping=new rI}get before(){return this.docs.length?this.docs[0]:this.doc}step(r){let s=this.maybeStep(r);if(s.failed)throw new ZC(s.failed);return this}maybeStep(r){let s=r.apply(this.doc);return s.failed||this.addStep(r,s.doc),s}get docChanged(){return this.steps.length>0}addStep(r,s){this.docs.push(this.doc),this.steps.push(r),this.mapping.appendMap(r.getMap()),this.doc=s}replace(r,s=r,n=sn.empty){let a=jae(this.doc,r,s,n);return a&&this.step(a),this}replaceWith(r,s,n){return this.replace(r,s,new sn(_s.from(n),0,0))}delete(r,s){return this.replace(r,s,sn.empty)}insert(r,s){return this.replaceWith(r,r,s)}replaceRange(r,s,n){return x0t(this,r,s,n),this}replaceRangeWith(r,s,n){return y0t(this,r,s,n),this}deleteRange(r,s){return v0t(this,r,s),this}lift(r,s){return s0t(this,r,s),this}join(r,s=1){return h0t(this,r,s),this}wrap(r,s){return i0t(this,r,s),this}setBlockType(r,s=r,n,a=null){return o0t(this,r,s,n,a),this}setNodeMarkup(r,s,n=null,a){return c0t(this,r,s,n,a),this}setNodeAttribute(r,s,n){return this.step(new cC(r,s,n)),this}setDocAttribute(r,s){return this.step(new sI(r,s)),this}addNodeMark(r,s){return this.step(new P1(r,s)),this}removeNodeMark(r,s){let n=this.doc.nodeAt(r);if(!n)throw new RangeError("No node at position "+r);if(s instanceof Zo)s.isInSet(n.marks)&&this.step(new Nk(r,s));else{let a=n.marks,o,l=[];for(;o=s.isInSet(a);)l.push(new Nk(r,o)),a=o.removeFromSet(a);for(let i=l.length-1;i>=0;i--)this.step(l[i])}return this}split(r,s=1,n){return d0t(this,r,s,n),this}addMark(r,s,n){return e0t(this,r,s,n),this}removeMark(r,s,n){return t0t(this,r,s,n),this}clearIncompatible(r,s,n){return Yye(this,r,s,n),this}}const ode=Object.create(null);class $a{constructor(r,s,n){this.$anchor=r,this.$head=s,this.ranges=n||[new hze(r.min(s),r.max(s))]}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 r=this.ranges;for(let s=0;s=0;o--){let l=s<0?rS(r.node(0),r.node(o),r.before(o+1),r.index(o),s,n):rS(r.node(0),r.node(o),r.after(o+1),r.index(o)+1,s,n);if(l)return l}return null}static near(r,s=1){return this.findFrom(r,s)||this.findFrom(r,-s)||new Cm(r.node(0))}static atStart(r){return rS(r,r,0,0,1)||new Cm(r)}static atEnd(r){return rS(r,r,r.content.size,r.childCount,-1)||new Cm(r)}static fromJSON(r,s){if(!s||!s.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=ode[s.type];if(!n)throw new RangeError(`No selection type ${s.type} defined`);return n.fromJSON(r,s)}static jsonID(r,s){if(r in ode)throw new RangeError("Duplicate use of selection JSON ID "+r);return ode[r]=s,s.prototype.jsonID=r,s}getBookmark(){return Na.between(this.$anchor,this.$head).getBookmark()}}$a.prototype.visible=!0;class hze{constructor(r,s){this.$from=r,this.$to=s}}let w4e=!1;function j4e(t){!w4e&&!t.parent.inlineContent&&(w4e=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Na extends $a{constructor(r,s=r){j4e(r),j4e(s),super(r,s)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(r,s){let n=r.resolve(s.map(this.head));if(!n.parent.inlineContent)return $a.near(n);let a=r.resolve(s.map(this.anchor));return new Na(a.parent.inlineContent?a:n,n)}replace(r,s=sn.empty){if(super.replace(r,s),s==sn.empty){let n=this.$from.marksAcross(this.$to);n&&r.ensureMarks(n)}}eq(r){return r instanceof Na&&r.anchor==this.anchor&&r.head==this.head}getBookmark(){return new kae(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(r,s){if(typeof s.anchor!="number"||typeof s.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Na(r.resolve(s.anchor),r.resolve(s.head))}static create(r,s,n=s){let a=r.resolve(s);return new this(a,n==s?a:r.resolve(n))}static between(r,s,n){let a=r.pos-s.pos;if((!n||a)&&(n=a>=0?1:-1),!s.parent.inlineContent){let o=$a.findFrom(s,n,!0)||$a.findFrom(s,-n,!0);if(o)s=o.$head;else return $a.near(s,n)}return r.parent.inlineContent||(a==0?r=s:(r=($a.findFrom(r,-n,!0)||$a.findFrom(r,n,!0)).$anchor,r.pos0?0:1);a>0?l=0;l+=a){let i=r.child(l);if(i.isAtom){if(!o&&va.isSelectable(i))return va.create(t,s-(a<0?i.nodeSize:0))}else{let d=rS(t,i,s+a,a<0?i.childCount:0,a,o);if(d)return d}s+=i.nodeSize*a}return null}function k4e(t,r,s){let n=t.steps.length-1;if(n{l==null&&(l=g)}),t.setSelection($a.near(t.doc.resolve(l),s))}const N4e=1,k8=2,S4e=4;class b0t extends Qye{constructor(r){super(r.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=r.selection,this.storedMarks=r.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(r){return this.storedMarks=r,this.updated|=k8,this}ensureMarks(r){return Zo.sameSet(this.storedMarks||this.selection.$from.marks(),r)||this.setStoredMarks(r),this}addStoredMark(r){return this.ensureMarks(r.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(r){return this.ensureMarks(r.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&k8)>0}addStep(r,s){super.addStep(r,s),this.updated=this.updated&~k8,this.storedMarks=null}setTime(r){return this.time=r,this}replaceSelection(r){return this.selection.replace(this,r),this}replaceSelectionWith(r,s=!0){let n=this.selection;return s&&(r=r.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Zo.none))),n.replaceWith(this,r),this}deleteSelection(){return this.selection.replace(this),this}insertText(r,s,n){let a=this.doc.type.schema;if(s==null)return r?this.replaceSelectionWith(a.text(r),!0):this.deleteSelection();{if(n==null&&(n=s),!r)return this.deleteRange(s,n);let o=this.storedMarks;if(!o){let l=this.doc.resolve(s);o=n==s?l.marks():l.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(s,n,a.text(r,o)),!this.selection.empty&&this.selection.to==s+r.length&&this.setSelection($a.near(this.selection.$to)),this}}setMeta(r,s){return this.meta[typeof r=="string"?r:r.key]=s,this}getMeta(r){return this.meta[typeof r=="string"?r:r.key]}get isGeneric(){for(let r in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=S4e,this}get scrolledIntoView(){return(this.updated&S4e)>0}}function C4e(t,r){return!r||!t?t:t.bind(r)}class QT{constructor(r,s,n){this.name=r,this.init=C4e(s.init,n),this.apply=C4e(s.apply,n)}}const w0t=[new QT("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new QT("selection",{init(t,r){return t.selection||$a.atStart(r.doc)},apply(t){return t.selection}}),new QT("storedMarks",{init(t){return t.storedMarks||null},apply(t,r,s,n){return n.selection.$cursor?t.storedMarks:null}}),new QT("scrollToSelection",{init(){return 0},apply(t,r){return t.scrolledIntoView?r+1:r}})];class lde{constructor(r,s){this.schema=r,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=w0t.slice(),s&&s.forEach(n=>{if(this.pluginsByKey[n.key])throw new RangeError("Adding different instances of a keyed plugin ("+n.key+")");this.plugins.push(n),this.pluginsByKey[n.key]=n,n.spec.state&&this.fields.push(new QT(n.key,n.spec.state,n))})}}class xS{constructor(r){this.config=r}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(r){return this.applyTransaction(r).state}filterTransaction(r,s=-1){for(let n=0;nn.toJSON())),r&&typeof r=="object")for(let n in r){if(n=="doc"||n=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let a=r[n],o=a.spec.state;o&&o.toJSON&&(s[n]=o.toJSON.call(a,this[a.key]))}return s}static fromJSON(r,s,n){if(!s)throw new RangeError("Invalid input for EditorState.fromJSON");if(!r.schema)throw new RangeError("Required config field 'schema' missing");let a=new lde(r.schema,r.plugins),o=new xS(a);return a.fields.forEach(l=>{if(l.name=="doc")o.doc=ov.fromJSON(r.schema,s.doc);else if(l.name=="selection")o.selection=$a.fromJSON(o.doc,s.selection);else if(l.name=="storedMarks")s.storedMarks&&(o.storedMarks=s.storedMarks.map(r.schema.markFromJSON));else{if(n)for(let i in n){let d=n[i],m=d.spec.state;if(d.key==l.name&&m&&m.fromJSON&&Object.prototype.hasOwnProperty.call(s,i)){o[l.name]=m.fromJSON.call(d,r,s[i],o);return}}o[l.name]=l.init(r,o)}}),o}}function mze(t,r,s){for(let n in t){let a=t[n];a instanceof Function?a=a.bind(r):n=="handleDOMEvents"&&(a=mze(a,r,{})),s[n]=a}return s}class wd{constructor(r){this.spec=r,this.props={},r.props&&mze(r.props,this,this.props),this.key=r.key?r.key.key:pze("plugin")}getState(r){return r[this.key]}}const cde=Object.create(null);function pze(t){return t in cde?t+"$"+ ++cde[t]:(cde[t]=0,t+"$")}class Iu{constructor(r="key"){this.key=pze(r)}get(r){return r.config.pluginsByKey[this.key]}getState(r){return r[this.key]}}const su=function(t){for(var r=0;;r++)if(t=t.previousSibling,!t)return r},YC=function(t){let r=t.assignedSlot||t.parentNode;return r&&r.nodeType==11?r.host:r};let Hme=null;const Xx=function(t,r,s){let n=Hme||(Hme=document.createRange());return n.setEnd(t,s??t.nodeValue.length),n.setStart(t,r||0),n},j0t=function(){Hme=null},Sk=function(t,r,s,n){return s&&(M4e(t,r,s,n,-1)||M4e(t,r,s,n,1))},k0t=/^(img|br|input|textarea|hr)$/i;function M4e(t,r,s,n,a){for(var o;;){if(t==s&&r==n)return!0;if(r==(a<0?0:dp(t))){let l=t.parentNode;if(!l||l.nodeType!=1||SP(t)||k0t.test(t.nodeName)||t.contentEditable=="false")return!1;r=su(t)+(a<0?0:1),t=l}else if(t.nodeType==1){let l=t.childNodes[r+(a<0?-1:0)];if(l.nodeType==1&&l.contentEditable=="false")if(!((o=l.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)r+=a;else return!1;else t=l,r=a<0?dp(t):0}else return!1}}function dp(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function N0t(t,r){for(;;){if(t.nodeType==3&&r)return t;if(t.nodeType==1&&r>0){if(t.contentEditable=="false")return null;t=t.childNodes[r-1],r=dp(t)}else if(t.parentNode&&!SP(t))r=su(t),t=t.parentNode;else return null}}function S0t(t,r){for(;;){if(t.nodeType==3&&r2),np=XC||(ax?/Mac/.test(ax.platform):!1),xze=ax?/Win/.test(ax.platform):!1,ly=/Android \d/.test(Dv),CP=!!T4e&&"webkitFontSmoothing"in T4e.documentElement.style,A0t=CP?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function E0t(t){let r=t.defaultView&&t.defaultView.visualViewport;return r?{left:0,right:r.width,top:0,bottom:r.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function $x(t,r){return typeof t=="number"?t:t[r]}function I0t(t){let r=t.getBoundingClientRect(),s=r.width/t.offsetWidth||1,n=r.height/t.offsetHeight||1;return{left:r.left,right:r.left+t.clientWidth*s,top:r.top,bottom:r.top+t.clientHeight*n}}function A4e(t,r,s){let n=t.someProp("scrollThreshold")||0,a=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let l=s||t.dom;l;){if(l.nodeType!=1){l=YC(l);continue}let i=l,d=i==o.body,m=d?E0t(o):I0t(i),g=0,y=0;if(r.topm.bottom-$x(n,"bottom")&&(y=r.bottom-r.top>m.bottom-m.top?r.top+$x(a,"top")-m.top:r.bottom-m.bottom+$x(a,"bottom")),r.leftm.right-$x(n,"right")&&(g=r.right-m.right+$x(a,"right")),g||y)if(d)o.defaultView.scrollBy(g,y);else{let b=i.scrollLeft,N=i.scrollTop;y&&(i.scrollTop+=y),g&&(i.scrollLeft+=g);let j=i.scrollLeft-b,S=i.scrollTop-N;r={left:r.left-j,top:r.top-S,right:r.right-j,bottom:r.bottom-S}}let v=d?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(v))break;l=v=="absolute"?l.offsetParent:YC(l)}}function P0t(t){let r=t.dom.getBoundingClientRect(),s=Math.max(0,r.top),n,a;for(let o=(r.left+r.right)/2,l=s+1;l=s-20){n=i,a=d.top;break}}return{refDOM:n,refTop:a,stack:yze(t.dom)}}function yze(t){let r=[],s=t.ownerDocument;for(let n=t;n&&(r.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),t!=s);n=YC(n));return r}function L0t({refDOM:t,refTop:r,stack:s}){let n=t?t.getBoundingClientRect().top:0;vze(s,n==0?0:n-r)}function vze(t,r){for(let s=0;s=i){l=Math.max(N.bottom,l),i=Math.min(N.top,i);let j=N.left>r.left?N.left-r.left:N.right=(N.left+N.right)/2?1:0));continue}}else N.top>r.top&&!d&&N.left<=r.left&&N.right>=r.left&&(d=g,m={left:Math.max(N.left,Math.min(N.right,r.left)),top:N.top});!s&&(r.left>=N.right&&r.top>=N.top||r.left>=N.left&&r.top>=N.bottom)&&(o=y+1)}}return!s&&d&&(s=d,a=m,n=0),s&&s.nodeType==3?D0t(s,a):!s||n&&s.nodeType==1?{node:t,offset:o}:_ze(s,a)}function D0t(t,r){let s=t.nodeValue.length,n=document.createRange(),a;for(let o=0;o=(l.left+l.right)/2?1:0)};break}}return n.detach(),a||{node:t,offset:0}}function e0e(t,r){return t.left>=r.left-1&&t.left<=r.right+1&&t.top>=r.top-1&&t.top<=r.bottom+1}function R0t(t,r){let s=t.parentNode;return s&&/^li$/i.test(s.nodeName)&&r.left(l.left+l.right)/2?1:-1}return t.docView.posFromDOM(n,a,o)}function z0t(t,r,s,n){let a=-1;for(let o=r,l=!1;o!=t.dom;){let i=t.docView.nearestDesc(o,!0),d;if(!i)return null;if(i.dom.nodeType==1&&(i.node.isBlock&&i.parent||!i.contentDOM)&&((d=i.dom.getBoundingClientRect()).width||d.height)&&(i.node.isBlock&&i.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(i.dom.nodeName)&&(!l&&d.left>n.left||d.top>n.top?a=i.posBefore:(!l&&d.right-1?a:t.docView.posFromDOM(r,s,-1)}function bze(t,r,s){let n=t.childNodes.length;if(n&&s.topr.top&&a++}let m;CP&&a&&n.nodeType==1&&(m=n.childNodes[a-1]).nodeType==1&&m.contentEditable=="false"&&m.getBoundingClientRect().top>=r.top&&a--,n==t.dom&&a==n.childNodes.length-1&&n.lastChild.nodeType==1&&r.top>n.lastChild.getBoundingClientRect().bottom?i=t.state.doc.content.size:(a==0||n.nodeType!=1||n.childNodes[a-1].nodeName!="BR")&&(i=z0t(t,n,a,r))}i==null&&(i=F0t(t,l,r));let d=t.docView.nearestDesc(l,!0);return{pos:i,inside:d?d.posAtStart-d.border:-1}}function E4e(t){return t.top=0&&a==n.nodeValue.length?(d--,g=1):s<0?d--:m++,ST(G0(Xx(n,d,m),g),g<0)}if(!t.state.doc.resolve(r-(o||0)).parent.inlineContent){if(o==null&&a&&(s<0||a==dp(n))){let d=n.childNodes[a-1];if(d.nodeType==1)return dde(d.getBoundingClientRect(),!1)}if(o==null&&a=0)}if(o==null&&a&&(s<0||a==dp(n))){let d=n.childNodes[a-1],m=d.nodeType==3?Xx(d,dp(d)-(l?0:1)):d.nodeType==1&&(d.nodeName!="BR"||!d.nextSibling)?d:null;if(m)return ST(G0(m,1),!1)}if(o==null&&a=0)}function ST(t,r){if(t.width==0)return t;let s=r?t.left:t.right;return{top:t.top,bottom:t.bottom,left:s,right:s}}function dde(t,r){if(t.height==0)return t;let s=r?t.top:t.bottom;return{top:s,bottom:s,left:t.left,right:t.right}}function jze(t,r,s){let n=t.state,a=t.root.activeElement;n!=r&&t.updateState(r),a!=t.dom&&t.focus();try{return s()}finally{n!=r&&t.updateState(n),a!=t.dom&&a&&a.focus()}}function U0t(t,r,s){let n=r.selection,a=s=="up"?n.$from:n.$to;return jze(t,r,()=>{let{node:o}=t.docView.domFromPos(a.pos,s=="up"?-1:1);for(;;){let i=t.docView.nearestDesc(o,!0);if(!i)break;if(i.node.isBlock){o=i.contentDOM||i.dom;break}o=i.dom.parentNode}let l=wze(t,a.pos,1);for(let i=o.firstChild;i;i=i.nextSibling){let d;if(i.nodeType==1)d=i.getClientRects();else if(i.nodeType==3)d=Xx(i,0,i.nodeValue.length).getClientRects();else continue;for(let m=0;mg.top+1&&(s=="up"?l.top-g.top>(g.bottom-l.top)*2:g.bottom-l.bottom>(l.bottom-g.top)*2))return!1}}return!0})}const q0t=/[\u0590-\u08ac]/;function V0t(t,r,s){let{$head:n}=r.selection;if(!n.parent.isTextblock)return!1;let a=n.parentOffset,o=!a,l=a==n.parent.content.size,i=t.domSelection();return i?!q0t.test(n.parent.textContent)||!i.modify?s=="left"||s=="backward"?o:l:jze(t,r,()=>{let{focusNode:d,focusOffset:m,anchorNode:g,anchorOffset:y}=t.domSelectionRange(),v=i.caretBidiLevel;i.modify("move",s,"character");let b=n.depth?t.docView.domAfterPos(n.before()):t.dom,{focusNode:N,focusOffset:j}=t.domSelectionRange(),S=N&&!b.contains(N.nodeType==1?N:N.parentNode)||d==N&&m==j;try{i.collapse(g,y),d&&(d!=g||m!=y)&&i.extend&&i.extend(d,m)}catch{}return v!=null&&(i.caretBidiLevel=v),S}):n.pos==n.start()||n.pos==n.end()}let I4e=null,P4e=null,L4e=!1;function H0t(t,r,s){return I4e==r&&P4e==s?L4e:(I4e=r,P4e=s,L4e=s=="up"||s=="down"?U0t(t,r,s):V0t(t,r,s))}const Np=0,O4e=1,pj=2,ix=3;class MP{constructor(r,s,n,a){this.parent=r,this.children=s,this.dom=n,this.contentDOM=a,this.dirty=Np,n.pmViewDesc=this}matchesWidget(r){return!1}matchesMark(r){return!1}matchesNode(r,s,n){return!1}matchesHack(r){return!1}parseRule(){return null}stopEvent(r){return!1}get size(){let r=0;for(let s=0;ssu(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=r.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(s==0)for(let o=r;;o=o.parentNode){if(o==this.dom){a=!1;break}if(o.previousSibling)break}if(a==null&&s==r.childNodes.length)for(let o=r;;o=o.parentNode){if(o==this.dom){a=!0;break}if(o.nextSibling)break}}return a??n>0?this.posAtEnd:this.posAtStart}nearestDesc(r,s=!1){for(let n=!0,a=r;a;a=a.parentNode){let o=this.getDesc(a),l;if(o&&(!s||o.node))if(n&&(l=o.nodeDOM)&&!(l.nodeType==1?l.contains(r.nodeType==1?r:r.parentNode):l==r))n=!1;else return o}}getDesc(r){let s=r.pmViewDesc;for(let n=s;n;n=n.parent)if(n==this)return s}posFromDOM(r,s,n){for(let a=r;a;a=a.parentNode){let o=this.getDesc(a);if(o)return o.localPosFromDOM(r,s,n)}return-1}descAt(r){for(let s=0,n=0;sr||l instanceof Nze){a=r-o;break}o=i}if(a)return this.children[n].domFromPos(a-this.children[n].border,s);for(let o;n&&!(o=this.children[n-1]).size&&o instanceof kze&&o.side>=0;n--);if(s<=0){let o,l=!0;for(;o=n?this.children[n-1]:null,!(!o||o.dom.parentNode==this.contentDOM);n--,l=!1);return o&&s&&l&&!o.border&&!o.domAtom?o.domFromPos(o.size,s):{node:this.contentDOM,offset:o?su(o.dom)+1:0}}else{let o,l=!0;for(;o=n=g&&s<=m-d.border&&d.node&&d.contentDOM&&this.contentDOM.contains(d.contentDOM))return d.parseRange(r,s,g);r=l;for(let y=i;y>0;y--){let v=this.children[y-1];if(v.size&&v.dom.parentNode==this.contentDOM&&!v.emptyChildAt(1)){a=su(v.dom)+1;break}r-=v.size}a==-1&&(a=0)}if(a>-1&&(m>s||i==this.children.length-1)){s=m;for(let g=i+1;gN&&ls){let N=i;i=d,d=N}let b=document.createRange();b.setEnd(d.node,d.offset),b.setStart(i.node,i.offset),m.removeAllRanges(),m.addRange(b)}}ignoreMutation(r){return!this.contentDOM&&r.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(r,s){for(let n=0,a=0;a=n:rn){let i=n+o.border,d=l-o.border;if(r>=i&&s<=d){this.dirty=r==n||s==l?pj:O4e,r==i&&s==d&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=ix:o.markDirty(r-i,s-i);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?pj:ix}n=l}this.dirty=pj}markParentsDirty(){let r=1;for(let s=this.parent;s;s=s.parent,r++){let n=r==1?pj:O4e;s.dirty{if(!o)return a;if(o.parent)return o.parent.posBeforeChild(o)})),!s.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(r,[],l,null),this.widget=s,this.widget=s,o=this}matchesWidget(r){return this.dirty==Np&&r.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(r){let s=this.widget.spec.stopEvent;return s?s(r):!1}ignoreMutation(r){return r.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 W0t extends MP{constructor(r,s,n,a){super(r,[],s,null),this.textDOM=n,this.text=a}get size(){return this.text.length}localPosFromDOM(r,s){return r!=this.textDOM?this.posAtStart+(s?this.size:0):this.posAtStart+s}domFromPos(r){return{node:this.textDOM,offset:r}}ignoreMutation(r){return r.type==="characterData"&&r.target.nodeValue==r.oldValue}}class Ck extends MP{constructor(r,s,n,a,o){super(r,[],n,a),this.mark=s,this.spec=o}static create(r,s,n,a){let o=a.nodeViews[s.type.name],l=o&&o(s,a,n);return(!l||!l.dom)&&(l=qk.renderSpec(document,s.type.spec.toDOM(s,n),null,s.attrs)),new Ck(r,s,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&ix||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(r){return this.dirty!=ix&&this.mark.eq(r)}markDirty(r,s){if(super.markDirty(r,s),this.dirty!=Np){let n=this.parent;for(;!n.node;)n=n.parent;n.dirty0&&(o=Yme(o,0,r,n));for(let i=0;i{if(!d)return l;if(d.parent)return d.parent.posBeforeChild(d)},n,a),g=m&&m.dom,y=m&&m.contentDOM;if(s.isText){if(!g)g=document.createTextNode(s.text);else if(g.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else g||({dom:g,contentDOM:y}=qk.renderSpec(document,s.type.spec.toDOM(s),null,s.attrs));!y&&!s.isText&&g.nodeName!="BR"&&(g.hasAttribute("contenteditable")||(g.contentEditable="false"),s.type.spec.draggable&&(g.draggable=!0));let v=g;return g=Mze(g,n,s),m?d=new G0t(r,s,n,a,g,y||null,v,m,o,l+1):s.isText?new Sae(r,s,n,a,g,v,o):new cv(r,s,n,a,g,y||null,v,o,l+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let r={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(r.preserveWhitespace="full"),!this.contentDOM)r.getContent=()=>this.node.content;else if(!this.contentLost)r.contentElement=this.contentDOM;else{for(let s=this.children.length-1;s>=0;s--){let n=this.children[s];if(this.dom.contains(n.dom.parentNode)){r.contentElement=n.dom.parentNode;break}}r.contentElement||(r.getContent=()=>_s.empty)}return r}matchesNode(r,s,n){return this.dirty==Np&&r.eq(this.node)&&xre(s,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(r,s){let n=this.node.inlineContent,a=s,o=r.composing?this.localCompositionInfo(r,s):null,l=o&&o.pos>-1?o:null,i=o&&o.pos<0,d=new Z0t(this,l&&l.node,r);Q0t(this.node,this.innerDeco,(m,g,y)=>{m.spec.marks?d.syncToMarks(m.spec.marks,n,r):m.type.side>=0&&!y&&d.syncToMarks(g==this.node.childCount?Zo.none:this.node.child(g).marks,n,r),d.placeWidget(m,r,a)},(m,g,y,v)=>{d.syncToMarks(m.marks,n,r);let b;d.findNodeMatch(m,g,y,v)||i&&r.state.selection.from>a&&r.state.selection.to-1&&d.updateNodeAt(m,g,y,b,r)||d.updateNextNode(m,g,y,r,v,a)||d.addNode(m,g,y,r,a),a+=m.nodeSize}),d.syncToMarks([],n,r),this.node.isTextblock&&d.addTextblockHacks(),d.destroyRest(),(d.changed||this.dirty==pj)&&(l&&this.protectLocalComposition(r,l),Sze(this.contentDOM,this.children,r),XC&&J0t(this.dom))}localCompositionInfo(r,s){let{from:n,to:a}=r.state.selection;if(!(r.state.selection instanceof Na)||ns+this.node.content.size)return null;let o=r.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let l=o.nodeValue,i=e1t(this.node.content,l,n-s,a-s);return i<0?null:{node:o,pos:i,text:l}}else return{node:o,pos:-1,text:""}}protectLocalComposition(r,{node:s,pos:n,text:a}){if(this.getDesc(s))return;let o=s;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 W0t(this,o,s,a);r.input.compositionNodes.push(l),this.children=Yme(this.children,n,n+a.length,r,l)}update(r,s,n,a){return this.dirty==ix||!r.sameMarkup(this.node)?!1:(this.updateInner(r,s,n,a),!0)}updateInner(r,s,n,a){this.updateOuterDeco(s),this.node=r,this.innerDeco=n,this.contentDOM&&this.updateChildren(a,this.posAtStart),this.dirty=Np}updateOuterDeco(r){if(xre(r,this.outerDeco))return;let s=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=Cze(this.dom,this.nodeDOM,Zme(this.outerDeco,this.node,s),Zme(r,this.node,s)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=r}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 D4e(t,r,s,n,a){Mze(n,r,t);let o=new cv(void 0,t,r,s,n,n,n,a,0);return o.contentDOM&&o.updateChildren(a,0),o}class Sae extends cv{constructor(r,s,n,a,o,l,i){super(r,s,n,a,o,null,l,i,0)}parseRule(){let r=this.nodeDOM.parentNode;for(;r&&r!=this.dom&&!r.pmIsDeco;)r=r.parentNode;return{skip:r||!0}}update(r,s,n,a){return this.dirty==ix||this.dirty!=Np&&!this.inParent()||!r.sameMarkup(this.node)?!1:(this.updateOuterDeco(s),(this.dirty!=Np||r.text!=this.node.text)&&r.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=r.text,a.trackWrites==this.nodeDOM&&(a.trackWrites=null)),this.node=r,this.dirty=Np,!0)}inParent(){let r=this.parent.contentDOM;for(let s=this.nodeDOM;s;s=s.parentNode)if(s==r)return!0;return!1}domFromPos(r){return{node:this.nodeDOM,offset:r}}localPosFromDOM(r,s,n){return r==this.nodeDOM?this.posAtStart+Math.min(s,this.node.text.length):super.localPosFromDOM(r,s,n)}ignoreMutation(r){return r.type!="characterData"&&r.type!="selection"}slice(r,s,n){let a=this.node.cut(r,s),o=document.createTextNode(a.text);return new Sae(this.parent,a,this.outerDeco,this.innerDeco,o,o,n)}markDirty(r,s){super.markDirty(r,s),this.dom!=this.nodeDOM&&(r==0||s==this.nodeDOM.nodeValue.length)&&(this.dirty=ix)}get domAtom(){return!1}isText(r){return this.node.text==r}}class Nze extends MP{parseRule(){return{ignore:!0}}matchesHack(r){return this.dirty==Np&&this.dom.nodeName==r}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class G0t extends cv{constructor(r,s,n,a,o,l,i,d,m,g){super(r,s,n,a,o,l,i,m,g),this.spec=d}update(r,s,n,a){if(this.dirty==ix)return!1;if(this.spec.update&&(this.node.type==r.type||this.spec.multiType)){let o=this.spec.update(r,s,n);return o&&this.updateInner(r,s,n,a),o}else return!this.contentDOM&&!r.isLeaf?!1:super.update(r,s,n,a)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(r,s,n,a){this.spec.setSelection?this.spec.setSelection(r,s,n.root):super.setSelection(r,s,n,a)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(r){return this.spec.stopEvent?this.spec.stopEvent(r):!1}ignoreMutation(r){return this.spec.ignoreMutation?this.spec.ignoreMutation(r):super.ignoreMutation(r)}}function Sze(t,r,s){let n=t.firstChild,a=!1;for(let o=0;o>1,l=Math.min(o,r.length);for(;a-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let d=Ck.create(this.top,r[o],s,n);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,o++}}findNodeMatch(r,s,n,a){let o=-1,l;if(a>=this.preMatch.index&&(l=this.preMatch.matches[a-this.preMatch.index]).parent==this.top&&l.matchesNode(r,s,n))o=this.top.children.indexOf(l,this.index);else for(let i=this.index,d=Math.min(this.top.children.length,i+5);i0;){let i;for(;;)if(n){let m=s.children[n-1];if(m instanceof Ck)s=m,n=m.children.length;else{i=m,n--;break}}else{if(s==r)break e;n=s.parent.children.indexOf(s),s=s.parent}let d=i.node;if(d){if(d!=t.child(a-1))break;--a,o.set(i,a),l.push(i)}}return{index:a,matched:o,matches:l.reverse()}}function X0t(t,r){return t.type.side-r.type.side}function Q0t(t,r,s,n){let a=r.locals(t),o=0;if(a.length==0){for(let m=0;mo;)i.push(a[l++]);let N=o+v.nodeSize;if(v.isText){let S=N;l!S.inline):i.slice();n(v,j,r.forChild(o,v),b),o=N}}function J0t(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let r=t.style.cssText;t.style.cssText=r+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=r}}function e1t(t,r,s,n){for(let a=0,o=0;a=s){if(o>=n&&d.slice(n-r.length-i,n-i)==r)return n-r.length;let m=i=0&&m+r.length+i>=s)return i+m;if(s==n&&d.length>=n+r.length-i&&d.slice(n-i,n-i+r.length)==r)return n}}return-1}function Yme(t,r,s,n,a){let o=[];for(let l=0,i=0;l=s||g<=r?o.push(d):(ms&&o.push(d.slice(s-m,d.size,n)))}return o}function t0e(t,r=null){let s=t.domSelectionRange(),n=t.state.doc;if(!s.focusNode)return null;let a=t.docView.nearestDesc(s.focusNode),o=a&&a.size==0,l=t.docView.posFromDOM(s.focusNode,s.focusOffset,1);if(l<0)return null;let i=n.resolve(l),d,m;if(Nae(s)){for(d=l;a&&!a.node;)a=a.parent;let y=a.node;if(a&&y.isAtom&&va.isSelectable(y)&&a.parent&&!(y.isInline&&C0t(s.focusNode,s.focusOffset,a.dom))){let v=a.posBefore;m=new va(l==v?i:n.resolve(v))}}else{if(s instanceof t.dom.ownerDocument.defaultView.Selection&&s.rangeCount>1){let y=l,v=l;for(let b=0;b{(s.anchorNode!=n||s.anchorOffset!=a)&&(r.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Tze(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function r1t(t){let r=t.domSelection();if(!r)return;let s=t.cursorWrapper.dom,n=s.nodeName=="IMG";n?r.collapse(s.parentNode,su(s)+1):r.collapse(s,0),!n&&!t.state.selection.visible&&Bh&&lv<=11&&(s.disabled=!0,s.disabled=!1)}function Aze(t,r){if(r instanceof va){let s=t.docView.descAt(r.from);s!=t.lastSelectedViewDesc&&($4e(t),s&&s.selectNode(),t.lastSelectedViewDesc=s)}else $4e(t)}function $4e(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function r0e(t,r,s,n){return t.someProp("createSelectionBetween",a=>a(t,r,s))||Na.between(r,s,n)}function U4e(t){return t.editable&&!t.hasFocus()?!1:Eze(t)}function Eze(t){let r=t.domSelectionRange();if(!r.anchorNode)return!1;try{return t.dom.contains(r.anchorNode.nodeType==3?r.anchorNode.parentNode:r.anchorNode)&&(t.editable||t.dom.contains(r.focusNode.nodeType==3?r.focusNode.parentNode:r.focusNode))}catch{return!1}}function s1t(t){let r=t.docView.domFromPos(t.state.selection.anchor,0),s=t.domSelectionRange();return Sk(r.node,r.offset,s.anchorNode,s.anchorOffset)}function Xme(t,r){let{$anchor:s,$head:n}=t.selection,a=r>0?s.max(n):s.min(n),o=a.parent.inlineContent?a.depth?t.doc.resolve(r>0?a.after():a.before()):null:a;return o&&$a.findFrom(o,r)}function s1(t,r){return t.dispatch(t.state.tr.setSelection(r).scrollIntoView()),!0}function q4e(t,r,s){let n=t.state.selection;if(n instanceof Na)if(s.indexOf("s")>-1){let{$head:a}=n,o=a.textOffset?null:r<0?a.nodeBefore:a.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let l=t.state.doc.resolve(a.pos+o.nodeSize*(r<0?-1:1));return s1(t,new Na(n.$anchor,l))}else if(n.empty){if(t.endOfTextblock(r>0?"forward":"backward")){let a=Xme(t.state,r);return a&&a instanceof va?s1(t,a):!1}else if(!(np&&s.indexOf("m")>-1)){let a=n.$head,o=a.textOffset?null:r<0?a.nodeBefore:a.nodeAfter,l;if(!o||o.isText)return!1;let i=r<0?a.pos-o.nodeSize:a.pos;return o.isAtom||(l=t.docView.descAt(i))&&!l.contentDOM?va.isSelectable(o)?s1(t,new va(r<0?t.state.doc.resolve(a.pos-o.nodeSize):a)):CP?s1(t,new Na(t.state.doc.resolve(r<0?i:i+o.nodeSize))):!1:!1}}else return!1;else{if(n instanceof va&&n.node.isInline)return s1(t,new Na(r>0?n.$to:n.$from));{let a=Xme(t.state,r);return a?s1(t,a):!1}}}function yre(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function aE(t,r){let s=t.pmViewDesc;return s&&s.size==0&&(r<0||t.nextSibling||t.nodeName!="BR")}function V4(t,r){return r<0?n1t(t):a1t(t)}function n1t(t){let r=t.domSelectionRange(),s=r.focusNode,n=r.focusOffset;if(!s)return;let a,o,l=!1;for(kp&&s.nodeType==1&&n0){if(s.nodeType!=1)break;{let i=s.childNodes[n-1];if(aE(i,-1))a=s,o=--n;else if(i.nodeType==3)s=i,n=s.nodeValue.length;else break}}else{if(Ize(s))break;{let i=s.previousSibling;for(;i&&aE(i,-1);)a=s.parentNode,o=su(i),i=i.previousSibling;if(i)s=i,n=yre(s);else{if(s=s.parentNode,s==t.dom)break;n=0}}}l?Qme(t,s,n):a&&Qme(t,a,o)}function a1t(t){let r=t.domSelectionRange(),s=r.focusNode,n=r.focusOffset;if(!s)return;let a=yre(s),o,l;for(;;)if(n{t.state==a&&ky(t)},50)}function V4e(t,r){let s=t.state.doc.resolve(r);if(!(zd||xze)&&s.parent.inlineContent){let a=t.coordsAtPos(r);if(r>s.start()){let o=t.coordsAtPos(r-1),l=(o.top+o.bottom)/2;if(l>a.top&&l1)return o.lefta.top&&l1)return o.left>a.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function H4e(t,r,s){let n=t.state.selection;if(n instanceof Na&&!n.empty||s.indexOf("s")>-1||np&&s.indexOf("m")>-1)return!1;let{$from:a,$to:o}=n;if(!a.parent.inlineContent||t.endOfTextblock(r<0?"up":"down")){let l=Xme(t.state,r);if(l&&l instanceof va)return s1(t,l)}if(!a.parent.inlineContent){let l=r<0?a:o,i=n instanceof Cm?$a.near(l,r):$a.findFrom(l,r);return i?s1(t,i):!1}return!1}function W4e(t,r){if(!(t.state.selection instanceof Na))return!0;let{$head:s,$anchor:n,empty:a}=t.state.selection;if(!s.sameParent(n))return!0;if(!a)return!1;if(t.endOfTextblock(r>0?"forward":"backward"))return!0;let o=!s.textOffset&&(r<0?s.nodeBefore:s.nodeAfter);if(o&&!o.isText){let l=t.state.tr;return r<0?l.delete(s.pos-o.nodeSize,s.pos):l.delete(s.pos,s.pos+o.nodeSize),t.dispatch(l),!0}return!1}function G4e(t,r,s){t.domObserver.stop(),r.contentEditable=s,t.domObserver.start()}function l1t(t){if(!Mu||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:r,focusOffset:s}=t.domSelectionRange();if(r&&r.nodeType==1&&s==0&&r.firstChild&&r.firstChild.contentEditable=="false"){let n=r.firstChild;G4e(t,n,"true"),setTimeout(()=>G4e(t,n,"false"),20)}return!1}function c1t(t){let r="";return t.ctrlKey&&(r+="c"),t.metaKey&&(r+="m"),t.altKey&&(r+="a"),t.shiftKey&&(r+="s"),r}function d1t(t,r){let s=r.keyCode,n=c1t(r);if(s==8||np&&s==72&&n=="c")return W4e(t,-1)||V4(t,-1);if(s==46&&!r.shiftKey||np&&s==68&&n=="c")return W4e(t,1)||V4(t,1);if(s==13||s==27)return!0;if(s==37||np&&s==66&&n=="c"){let a=s==37?V4e(t,t.state.selection.from)=="ltr"?-1:1:-1;return q4e(t,a,n)||V4(t,a)}else if(s==39||np&&s==70&&n=="c"){let a=s==39?V4e(t,t.state.selection.from)=="ltr"?1:-1:1;return q4e(t,a,n)||V4(t,a)}else{if(s==38||np&&s==80&&n=="c")return H4e(t,-1,n)||V4(t,-1);if(s==40||np&&s==78&&n=="c")return l1t(t)||H4e(t,1,n)||V4(t,1);if(n==(np?"m":"c")&&(s==66||s==73||s==89||s==90))return!0}return!1}function s0e(t,r){t.someProp("transformCopied",b=>{r=b(r,t)});let s=[],{content:n,openStart:a,openEnd:o}=r;for(;a>1&&o>1&&n.childCount==1&&n.firstChild.childCount==1;){a--,o--;let b=n.firstChild;s.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),n=b.content}let l=t.someProp("clipboardSerializer")||qk.fromSchema(t.state.schema),i=Fze(),d=i.createElement("div");d.appendChild(l.serializeFragment(n,{document:i}));let m=d.firstChild,g,y=0;for(;m&&m.nodeType==1&&(g=Rze[m.nodeName.toLowerCase()]);){for(let b=g.length-1;b>=0;b--){let N=i.createElement(g[b]);for(;d.firstChild;)N.appendChild(d.firstChild);d.appendChild(N),y++}m=d.firstChild}m&&m.nodeType==1&&m.setAttribute("data-pm-slice",`${a} ${o}${y?` -${y}`:""} ${JSON.stringify(s)}`);let v=t.someProp("clipboardTextSerializer",b=>b(r,t))||r.content.textBetween(0,r.content.size,` `);return{dom:d,text:v,slice:r}}function Pze(t,r,s,n,a){let o=a.parent.type.spec.code,l,i;if(!s&&!r)return null;let d=!!r&&(n||o||!s);if(d){if(t.someProp("transformPastedText",v=>{r=v(r,o||n,t)}),o)return i=new sn(_s.from(t.state.schema.text(r.replace(/\r\n?/g,` `))),0,0),t.someProp("transformPasted",v=>{i=v(i,t,!0)}),i;let y=t.someProp("clipboardTextParser",v=>v(r,a,n,t));if(y)i=y;else{let v=a.marks(),{schema:b}=t.state,N=qk.fromSchema(b);l=document.createElement("div"),r.split(/(?:\r\n?|\n)+/).forEach(j=>{let S=l.appendChild(document.createElement("p"));j&&S.appendChild(N.serializeNode(b.text(j,v)))})}}else t.someProp("transformPastedHTML",y=>{s=y(s,t)}),l=p1t(s),CP&&f1t(l);let m=l&&l.querySelector("[data-pm-slice]"),g=m&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(m.getAttribute("data-pm-slice")||"");if(g&&g[3])for(let y=+g[3];y>0;y--){let v=l.firstChild;for(;v&&v.nodeType!=1;)v=v.nextSibling;if(!v)break;l=v}if(i||(i=(t.someProp("clipboardParser")||t.someProp("domParser")||rE.fromSchema(t.state.schema)).parseSlice(l,{preserveWhitespace:!!(d||g),context:a,ruleFromNode(v){return v.nodeName=="BR"&&!v.nextSibling&&v.parentNode&&!u1t.test(v.parentNode.nodeName)?{ignore:!0}:null}})),g)i=g1t(K4e(i,+g[1],+g[2]),g[4]);else if(i=sn.maxOpen(h1t(i.content,a),!0),i.openStart||i.openEnd){let y=0,v=0;for(let b=i.content.firstChild;y{i=y(i,t,d)}),i}const u1t=/^(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 h1t(t,r){if(t.childCount<2)return t;for(let s=r.depth;s>=0;s--){let a=r.node(s).contentMatchAt(r.index(s)),o,l=[];if(t.forEach(i=>{if(!l)return;let d=a.findWrapping(i.type),m;if(!d)return l=null;if(m=l.length&&o.length&&Oze(d,o,i,l[l.length-1],0))l[l.length-1]=m;else{l.length&&(l[l.length-1]=Dze(l[l.length-1],o.length));let g=Lze(i,d);l.push(g),a=a.matchType(g.type),o=d}}),l)return _s.from(l)}return t}function Lze(t,r,s=0){for(let n=r.length-1;n>=s;n--)t=r[n].create(null,_s.from(t));return t}function Oze(t,r,s,n,a){if(a1&&(o=0),a=s&&(i=r<0?l.contentMatchAt(0).fillBefore(i,o<=a).append(i):i.append(l.contentMatchAt(l.childCount).fillBefore(_s.empty,!0))),t.replaceChild(r<0?0:t.childCount-1,l.copy(i))}function K4e(t,r,s){return rs})),hde.createHTML(t)):t}function p1t(t){let r=/^(\s*]*>)*/.exec(t);r&&(t=t.slice(r[0].length));let s=Fze().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(t),a;if((a=n&&Rze[n[1].toLowerCase()])&&(t=a.map(o=>"<"+o+">").join("")+t+a.map(o=>"").reverse().join("")),s.innerHTML=m1t(t),a)for(let o=0;o=0;i-=2){let d=s.nodes[n[i]];if(!d||d.hasRequiredAttrs())break;a=_s.from(d.create(n[i+1],a)),o++,l++}return new sn(a,o,l)}const lh={},ch={},x1t={touchstart:!0,touchmove:!0};class y1t{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 v1t(t){for(let r in lh){let s=lh[r];t.dom.addEventListener(r,t.input.eventHandlers[r]=n=>{b1t(t,n)&&!n0e(t,n)&&(t.editable||!(n.type in ch))&&s(t,n)},x1t[r]?{passive:!0}:void 0)}Mu&&t.dom.addEventListener("input",()=>null),epe(t)}function L1(t,r){t.input.lastSelectionOrigin=r,t.input.lastSelectionTime=Date.now()}function _1t(t){t.domObserver.stop();for(let r in t.input.eventHandlers)t.dom.removeEventListener(r,t.input.eventHandlers[r]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function epe(t){t.someProp("handleDOMEvents",r=>{for(let s in r)t.input.eventHandlers[s]||t.dom.addEventListener(s,t.input.eventHandlers[s]=n=>n0e(t,n))})}function n0e(t,r){return t.someProp("handleDOMEvents",s=>{let n=s[r.type];return n?n(t,r)||r.defaultPrevented:!1})}function b1t(t,r){if(!r.bubbles)return!0;if(r.defaultPrevented)return!1;for(let s=r.target;s!=t.dom;s=s.parentNode)if(!s||s.nodeType==11||s.pmViewDesc&&s.pmViewDesc.stopEvent(r))return!1;return!0}function w1t(t,r){!n0e(t,r)&&lh[r.type]&&(t.editable||!(r.type in ch))&&lh[r.type](t,r)}ch.keydown=(t,r)=>{let s=r;if(t.input.shiftKey=s.keyCode==16||s.shiftKey,!Bze(t,s)&&(t.input.lastKeyCode=s.keyCode,t.input.lastKeyCodeTime=Date.now(),!(ly&&zd&&s.keyCode==13)))if(s.keyCode!=229&&t.domObserver.forceFlush(),XC&&s.keyCode==13&&!s.ctrlKey&&!s.altKey&&!s.metaKey){let n=Date.now();t.input.lastIOSEnter=n,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==n&&(t.someProp("handleKeyDown",a=>a(t,aj(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",n=>n(t,s))||d1t(t,s)?s.preventDefault():L1(t,"key")};ch.keyup=(t,r)=>{r.keyCode==16&&(t.input.shiftKey=!1)};ch.keypress=(t,r)=>{let s=r;if(Bze(t,s)||!s.charCode||s.ctrlKey&&!s.altKey||np&&s.metaKey)return;if(t.someProp("handleKeyPress",a=>a(t,s))){s.preventDefault();return}let n=t.state.selection;if(!(n instanceof Na)||!n.$from.sameParent(n.$to)){let a=String.fromCharCode(s.charCode),o=()=>t.state.tr.insertText(a).scrollIntoView();!/[\r\n]/.test(a)&&!t.someProp("handleTextInput",l=>l(t,n.$from.pos,n.$to.pos,a,o))&&t.dispatch(o()),s.preventDefault()}};function Cae(t){return{left:t.clientX,top:t.clientY}}function j1t(t,r){let s=r.x-t.clientX,n=r.y-t.clientY;return s*s+n*n<100}function a0e(t,r,s,n,a){if(n==-1)return!1;let o=t.state.doc.resolve(n);for(let l=o.depth+1;l>0;l--)if(t.someProp(r,i=>l>o.depth?i(t,s,o.nodeAfter,o.before(l),a,!0):i(t,s,o.node(l),o.before(l),a,!1)))return!0;return!1}function dC(t,r,s){if(t.focused||t.focus(),t.state.selection.eq(r))return;let n=t.state.tr.setSelection(r);n.setMeta("pointer",!0),t.dispatch(n)}function k1t(t,r){if(r==-1)return!1;let s=t.state.doc.resolve(r),n=s.nodeAfter;return n&&n.isAtom&&va.isSelectable(n)?(dC(t,new va(s)),!0):!1}function N1t(t,r){if(r==-1)return!1;let s=t.state.selection,n,a;s instanceof va&&(n=s.node);let o=t.state.doc.resolve(r);for(let l=o.depth+1;l>0;l--){let i=l>o.depth?o.nodeAfter:o.node(l);if(va.isSelectable(i)){n&&s.$from.depth>0&&l>=s.$from.depth&&o.before(s.$from.depth+1)==s.$from.pos?a=o.before(s.$from.depth):a=o.before(l);break}}return a!=null?(dC(t,va.create(t.state.doc,a)),!0):!1}function S1t(t,r,s,n,a){return a0e(t,"handleClickOn",r,s,n)||t.someProp("handleClick",o=>o(t,r,n))||(a?N1t(t,s):k1t(t,s))}function C1t(t,r,s,n){return a0e(t,"handleDoubleClickOn",r,s,n)||t.someProp("handleDoubleClick",a=>a(t,r,n))}function M1t(t,r,s,n){return a0e(t,"handleTripleClickOn",r,s,n)||t.someProp("handleTripleClick",a=>a(t,r,n))||T1t(t,s,n)}function T1t(t,r,s){if(s.button!=0)return!1;let n=t.state.doc;if(r==-1)return n.inlineContent?(dC(t,Na.create(n,0,n.content.size)),!0):!1;let a=n.resolve(r);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)dC(t,Na.create(n,i+1,i+1+l.content.size));else if(va.isSelectable(l))dC(t,va.create(n,i));else continue;return!0}}function i0e(t){return vre(t)}const zze=np?"metaKey":"ctrlKey";lh.mousedown=(t,r)=>{let s=r;t.input.shiftKey=s.shiftKey;let n=i0e(t),a=Date.now(),o="singleClick";a-t.input.lastClick.time<500&&j1t(s,t.input.lastClick)&&!s[zze]&&t.input.lastClick.button==s.button&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:a,x:s.clientX,y:s.clientY,type:o,button:s.button};let l=t.posAtCoords(Cae(s));l&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new A1t(t,l,s,!!n)):(o=="doubleClick"?C1t:M1t)(t,l.pos,l.inside,s)?s.preventDefault():L1(t,"pointer"))};class A1t{constructor(r,s,n,a){this.view=r,this.pos=s,this.event=n,this.flushed=a,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=r.state.doc,this.selectNode=!!n[zze],this.allowDefault=n.shiftKey;let o,l;if(s.inside>-1)o=r.state.doc.nodeAt(s.inside),l=s.inside;else{let g=r.state.doc.resolve(s.pos);o=g.parent,l=g.depth?g.before():0}const i=a?null:n.target,d=i?r.docView.nearestDesc(i,!0):null;this.target=d&&d.nodeDOM.nodeType==1?d.nodeDOM:null;let{selection:m}=r.state;(n.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||m instanceof va&&m.from<=l&&m.to>l)&&(this.mightDrag={node:o,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&kp&&!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()),r.root.addEventListener("mouseup",this.up=this.up.bind(this)),r.root.addEventListener("mousemove",this.move=this.move.bind(this)),L1(r,"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(()=>ky(this.view)),this.view.input.mouseDown=null}up(r){if(this.done(),!this.view.dom.contains(r.target))return;let s=this.pos;this.view.state.doc!=this.startDoc&&(s=this.view.posAtCoords(Cae(r))),this.updateAllowDefault(r),this.allowDefault||!s?L1(this.view,"pointer"):S1t(this.view,s.pos,s.inside,r,this.selectNode)?r.preventDefault():r.button==0&&(this.flushed||Mu&&this.mightDrag&&!this.mightDrag.node.isAtom||zd&&!this.view.state.selection.visible&&Math.min(Math.abs(s.pos-this.view.state.selection.from),Math.abs(s.pos-this.view.state.selection.to))<=2)?(dC(this.view,$a.near(this.view.state.doc.resolve(s.pos))),r.preventDefault()):L1(this.view,"pointer")}move(r){this.updateAllowDefault(r),L1(this.view,"pointer"),r.buttons==0&&this.done()}updateAllowDefault(r){!this.allowDefault&&(Math.abs(this.event.x-r.clientX)>4||Math.abs(this.event.y-r.clientY)>4)&&(this.allowDefault=!0)}}lh.touchstart=t=>{t.input.lastTouch=Date.now(),i0e(t),L1(t,"pointer")};lh.touchmove=t=>{t.input.lastTouch=Date.now(),L1(t,"pointer")};lh.contextmenu=t=>i0e(t);function Bze(t,r){return t.composing?!0:Mu&&Math.abs(r.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const E1t=ly?5e3:-1;ch.compositionstart=ch.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:r}=t,s=r.selection.$to;if(r.selection instanceof Na&&(r.storedMarks||!s.textOffset&&s.parentOffset&&s.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)||zd&&xze&&I1t(t)))t.markCursor=t.state.storedMarks||s.marks(),vre(t,!0),t.markCursor=null;else if(vre(t,!r.selection.empty),kp&&r.selection.empty&&s.parentOffset&&!s.textOffset&&s.nodeBefore.marks.length){let n=t.domSelectionRange();for(let a=n.focusNode,o=n.focusOffset;a&&a.nodeType==1&&o!=0;){let l=o<0?a.lastChild:a.childNodes[o-1];if(!l)break;if(l.nodeType==3){let i=t.domSelection();i&&i.collapse(l,l.nodeValue.length);break}else a=l,o=-1}}t.input.composing=!0}$ze(t,E1t)};function I1t(t){let{focusNode:r,focusOffset:s}=t.domSelectionRange();if(!r||r.nodeType!=1||s>=r.childNodes.length)return!1;let n=r.childNodes[s];return n.nodeType==1&&n.contentEditable=="false"}ch.compositionend=(t,r)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=r.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,$ze(t,20))};function $ze(t,r){clearTimeout(t.input.composingTimeout),r>-1&&(t.input.composingTimeout=setTimeout(()=>vre(t),r))}function Uze(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=L1t());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function P1t(t){let r=t.domSelectionRange();if(!r.focusNode)return null;let s=N0t(r.focusNode,r.focusOffset),n=S0t(r.focusNode,r.focusOffset);if(s&&n&&s!=n){let a=n.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(s==o||n==o)return o;if(!a||!a.isText(n.nodeValue))return n;if(t.input.compositionNode==n){let l=s.pmViewDesc;if(!(!l||!l.isText(s.nodeValue)))return n}}return s||n}function L1t(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function vre(t,r=!1){if(!(ly&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Uze(t),r||t.docView&&t.docView.dirty){let s=t0e(t),n=t.state.selection;return s&&!s.eq(n)?t.dispatch(t.state.tr.setSelection(s)):(t.markCursor||r)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function O1t(t,r){if(!t.dom.parentNode)return;let s=t.dom.parentNode.appendChild(document.createElement("div"));s.appendChild(r),s.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),a=document.createRange();a.selectNodeContents(r),t.dom.blur(),n.removeAllRanges(),n.addRange(a),setTimeout(()=>{s.parentNode&&s.parentNode.removeChild(s),t.focus()},50)}const nI=Bh&&lv<15||XC&&A0t<604;lh.copy=ch.cut=(t,r)=>{let s=r,n=t.state.selection,a=s.type=="cut";if(n.empty)return;let o=nI?null:s.clipboardData,l=n.content(),{dom:i,text:d}=s0e(t,l);o?(s.preventDefault(),o.clearData(),o.setData("text/html",i.innerHTML),o.setData("text/plain",d)):O1t(t,i),a&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function D1t(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function R1t(t,r){if(!t.dom.parentNode)return;let s=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,n=t.dom.parentNode.appendChild(document.createElement(s?"textarea":"div"));s||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let a=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),n.parentNode&&n.parentNode.removeChild(n),s?aI(t,n.value,null,a,r):aI(t,n.textContent,n.innerHTML,a,r)},50)}function aI(t,r,s,n,a){let o=Pze(t,r,s,n,t.state.selection.$from);if(t.someProp("handlePaste",d=>d(t,a,o||sn.empty)))return!0;if(!o)return!1;let l=D1t(o),i=l?t.state.tr.replaceSelectionWith(l,n):t.state.tr.replaceSelection(o);return t.dispatch(i.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function qze(t){let r=t.getData("text/plain")||t.getData("Text");if(r)return r;let s=t.getData("text/uri-list");return s?s.replace(/\r?\n/g," "):""}ch.paste=(t,r)=>{let s=r;if(t.composing&&!ly)return;let n=nI?null:s.clipboardData,a=t.input.shiftKey&&t.input.lastKeyCode!=45;n&&aI(t,qze(n),n.getData("text/html"),a,s)?s.preventDefault():R1t(t,s)};class Vze{constructor(r,s,n){this.slice=r,this.move=s,this.node=n}}const F1t=np?"altKey":"ctrlKey";function Hze(t,r){let s=t.someProp("dragCopies",n=>!n(r));return s??!r[F1t]}lh.dragstart=(t,r)=>{let s=r,n=t.input.mouseDown;if(n&&n.done(),!s.dataTransfer)return;let a=t.state.selection,o=a.empty?null:t.posAtCoords(Cae(s)),l;if(!(o&&o.pos>=a.from&&o.pos<=(a instanceof va?a.to-1:a.to))){if(n&&n.mightDrag)l=va.create(t.state.doc,n.mightDrag.pos);else if(s.target&&s.target.nodeType==1){let y=t.docView.nearestDesc(s.target,!0);y&&y.node.type.spec.draggable&&y!=t.docView&&(l=va.create(t.state.doc,y.posBefore))}}let i=(l||t.state.selection).content(),{dom:d,text:m,slice:g}=s0e(t,i);(!s.dataTransfer.files.length||!zd||gze>120)&&s.dataTransfer.clearData(),s.dataTransfer.setData(nI?"Text":"text/html",d.innerHTML),s.dataTransfer.effectAllowed="copyMove",nI||s.dataTransfer.setData("text/plain",m),t.dragging=new Vze(g,Hze(t,s),l)};lh.dragend=t=>{let r=t.dragging;window.setTimeout(()=>{t.dragging==r&&(t.dragging=null)},50)};ch.dragover=ch.dragenter=(t,r)=>r.preventDefault();ch.drop=(t,r)=>{try{z1t(t,r,t.dragging)}finally{t.dragging=null}};function z1t(t,r,s){if(!r.dataTransfer)return;let n=t.posAtCoords(Cae(r));if(!n)return;let a=t.state.doc.resolve(n.pos),o=s&&s.slice;o?t.someProp("transformPasted",b=>{o=b(o,t,!1)}):o=Pze(t,qze(r.dataTransfer),nI?null:r.dataTransfer.getData("text/html"),!1,a);let l=!!(s&&Hze(t,r));if(t.someProp("handleDrop",b=>b(t,r,o||sn.empty,l))){r.preventDefault();return}if(!o)return;r.preventDefault();let i=o?oze(t.state.doc,a.pos,o):a.pos;i==null&&(i=a.pos);let d=t.state.tr;if(l){let{node:b}=s;b?b.replace(d):d.deleteSelection()}let m=d.mapping.map(i),g=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,y=d.doc;if(g?d.replaceRangeWith(m,m,o.content.firstChild):d.replaceRange(m,m,o),d.doc.eq(y))return;let v=d.doc.resolve(m);if(g&&va.isSelectable(o.content.firstChild)&&v.nodeAfter&&v.nodeAfter.sameMarkup(o.content.firstChild))d.setSelection(new va(v));else{let b=d.mapping.map(i);d.mapping.maps[d.mapping.maps.length-1].forEach((N,j,S,A)=>b=A),d.setSelection(r0e(t,v,d.doc.resolve(b)))}t.focus(),t.dispatch(d.setMeta("uiEvent","drop"))}lh.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&ky(t)},20))};lh.blur=(t,r)=>{let s=r;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),s.relatedTarget&&t.dom.contains(s.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};lh.beforeinput=(t,r)=>{if(zd&&ly&&r.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:n}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=n||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",o=>o(t,aj(8,"Backspace")))))return;let{$cursor:a}=t.state.selection;a&&a.pos>0&&t.dispatch(t.state.tr.delete(a.pos-1,a.pos).scrollIntoView())},50)}};for(let t in ch)lh[t]=ch[t];function iI(t,r){if(t==r)return!0;for(let s in t)if(t[s]!==r[s])return!1;for(let s in r)if(!(s in t))return!1;return!0}class _re{constructor(r,s){this.toDOM=r,this.spec=s||ak,this.side=this.spec.side||0}map(r,s,n,a){let{pos:o,deleted:l}=r.mapResult(s.from+a,this.side<0?-1:1);return l?null:new eh(o-n,o-n,this)}valid(){return!0}eq(r){return this==r||r instanceof _re&&(this.spec.key&&this.spec.key==r.spec.key||this.toDOM==r.toDOM&&iI(this.spec,r.spec))}destroy(r){this.spec.destroy&&this.spec.destroy(r)}}class dv{constructor(r,s){this.attrs=r,this.spec=s||ak}map(r,s,n,a){let o=r.map(s.from+a,this.spec.inclusiveStart?-1:1)-n,l=r.map(s.to+a,this.spec.inclusiveEnd?1:-1)-n;return o>=l?null:new eh(o,l,this)}valid(r,s){return s.from=r&&(!o||o(i.spec))&&n.push(i.copy(i.from+a,i.to+a))}for(let l=0;lr){let i=this.children[l]+1;this.children[l+2].findInner(r-i,s-i,n,a+i,o)}}map(r,s,n){return this==xu||r.maps.length==0?this:this.mapInner(r,s,0,0,n||ak)}mapInner(r,s,n,a,o){let l;for(let i=0;i{let m=d+n,g;if(g=Gze(s,i,m)){for(a||(a=this.children.slice());oi&&y.to=r){this.children[i]==r&&(n=this.children[i+2]);break}let o=r+1,l=o+s.content.size;for(let i=0;io&&d.type instanceof dv){let m=Math.max(o,d.from)-o,g=Math.min(l,d.to)-o;ma.map(r,s,ak));return m1.from(n)}forChild(r,s){if(s.isLeaf)return ac.empty;let n=[];for(let a=0;as instanceof ac)?r:r.reduce((s,n)=>s.concat(n instanceof ac?n:n.members),[]))}}forEachSet(r){for(let s=0;s{let S=j-N-(b-v);for(let A=0;AM+g-y)continue;let I=i[A]+g-y;b>=I?i[A+1]=v<=I?-2:-1:v>=g&&S&&(i[A]+=S,i[A+1]+=S)}y+=S}),g=s.maps[m].map(g,-1)}let d=!1;for(let m=0;m=n.content.size){d=!0;continue}let v=s.map(t[m+1]+o,-1),b=v-a,{index:N,offset:j}=n.content.findIndex(y),S=n.maybeChild(N);if(S&&j==y&&j+S.nodeSize==b){let A=i[m+2].mapInner(s,S,g+1,t[m]+o+1,l);A!=xu?(i[m]=y,i[m+1]=b,i[m+2]=A):(i[m+1]=-2,d=!0)}else d=!0}if(d){let m=$1t(i,t,r,s,a,o,l),g=bre(m,n,0,l);r=g.local;for(let y=0;ys&&l.to{let m=Gze(t,i,d+s);if(m){o=!0;let g=bre(m,i,s+d+1,n);g!=xu&&a.push(d,d+i.nodeSize,g)}});let l=Wze(o?Kze(t):t,-s).sort(ik);for(let i=0;i0;)r++;t.splice(r,0,s)}function mde(t){let r=[];return t.someProp("decorations",s=>{let n=s(t.state);n&&n!=xu&&r.push(n)}),t.cursorWrapper&&r.push(ac.create(t.state.doc,[t.cursorWrapper.deco])),m1.from(r)}const U1t={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},q1t=Bh&&lv<=11;class V1t{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(r){this.anchorNode=r.anchorNode,this.anchorOffset=r.anchorOffset,this.focusNode=r.focusNode,this.focusOffset=r.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(r){return r.anchorNode==this.anchorNode&&r.anchorOffset==this.anchorOffset&&r.focusNode==this.focusNode&&r.focusOffset==this.focusOffset}}class H1t{constructor(r,s){this.view=r,this.handleDOMChange=s,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new V1t,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(n=>{for(let a=0;aa.type=="childList"&&a.removedNodes.length||a.type=="characterData"&&a.oldValue.length>a.target.nodeValue.length)?this.flushSoon():this.flush()}),q1t&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.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,U1t)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let r=this.observer.takeRecords();if(r.length){for(let s=0;sthis.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(U4e(this.view)){if(this.suppressingSelectionUpdates)return ky(this.view);if(Bh&&lv<=11&&!this.view.state.selection.empty){let r=this.view.domSelectionRange();if(r.focusNode&&Sk(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(r){if(!r.focusNode)return!0;let s=new Set,n;for(let o=r.focusNode;o;o=YC(o))s.add(o);for(let o=r.anchorNode;o;o=YC(o))if(s.has(o)){n=o;break}let a=n&&this.view.docView.nearestDesc(n);if(a&&a.ignoreMutation({type:"selection",target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let r of this.observer.takeRecords())this.queue.push(r);return this.queue}flush(){let{view:r}=this;if(!r.docView||this.flushingSoon>-1)return;let s=this.pendingRecords();s.length&&(this.queue=[]);let n=r.domSelectionRange(),a=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&U4e(r)&&!this.ignoreSelectionChange(n),o=-1,l=-1,i=!1,d=[];if(r.editable)for(let g=0;gy.nodeName=="BR");if(g.length==2){let[y,v]=g;y.parentNode&&y.parentNode.parentNode==v.parentNode?v.remove():y.remove()}else{let{focusNode:y}=this.currentSelection;for(let v of g){let b=v.parentNode;b&&b.nodeName=="LI"&&(!y||K1t(r,y)!=b)&&v.remove()}}}else if((zd||Mu)&&d.some(g=>g.nodeName=="BR")&&(r.input.lastKeyCode==8||r.input.lastKeyCode==46)){for(let g of d)if(g.nodeName=="BR"&&g.parentNode){let y=g.nextSibling;y&&y.nodeType==1&&y.contentEditable=="false"&&g.parentNode.removeChild(g)}}let m=null;o<0&&a&&r.input.lastFocus>Date.now()-200&&Math.max(r.input.lastTouch,r.input.lastClick.time)-1||a)&&(o>-1&&(r.docView.markDirty(o,l),W1t(r)),this.handleDOMChange(o,l,i,d),r.docView&&r.docView.dirty?r.updateState(r.state):this.currentSelection.eq(n)||ky(r),this.currentSelection.set(n))}registerMutation(r,s){if(s.indexOf(r.target)>-1)return null;let n=this.view.docView.nearestDesc(r.target);if(r.type=="attributes"&&(n==this.view.docView||r.attributeName=="contenteditable"||r.attributeName=="style"&&!r.oldValue&&!r.target.getAttribute("style"))||!n||n.ignoreMutation(r))return null;if(r.type=="childList"){for(let g=0;ga;S--){let A=n.childNodes[S-1],M=A.pmViewDesc;if(A.nodeName=="BR"&&!M){o=S;break}if(!M||M.size)break}let y=t.state.doc,v=t.someProp("domParser")||rE.fromSchema(t.state.schema),b=y.resolve(l),N=null,j=v.parse(n,{topNode:b.parent,topMatch:b.parent.contentMatchAt(b.index()),topOpen:!0,from:a,to:o,preserveWhitespace:b.parent.type.whitespace=="pre"?"full":!0,findPositions:m,ruleFromNode:Y1t,context:b});if(m&&m[0].pos!=null){let S=m[0].pos,A=m[1]&&m[1].pos;A==null&&(A=S),N={anchor:S+l,head:A+l}}return{doc:j,sel:N,from:l,to:i}}function Y1t(t){let r=t.pmViewDesc;if(r)return r.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Mu&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let s=document.createElement("div");return s.appendChild(document.createElement("li")),{skip:s}}else if(t.parentNode.lastChild==t||Mu&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const X1t=/^(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 Q1t(t,r,s,n,a){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,r<0){let $=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,H=t0e(t,$);if(H&&!t.state.selection.eq(H)){if(zd&&ly&&t.input.lastKeyCode===13&&Date.now()-100X(t,aj(13,"Enter"))))return;let W=t.state.tr.setSelection(H);$=="pointer"?W.setMeta("pointer",!0):$=="key"&&W.scrollIntoView(),o&&W.setMeta("composition",o),t.dispatch(W)}return}let l=t.state.doc.resolve(r),i=l.sharedDepth(s);r=l.before(i+1),s=t.state.doc.resolve(s).after(i+1);let d=t.state.selection,m=Z1t(t,r,s),g=t.state.doc,y=g.slice(m.from,m.to),v,b;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||ly)&&a.some($=>$.nodeType==1&&!X1t.test($.nodeName))&&(!N||N.endA>=N.endB)&&t.someProp("handleKeyDown",$=>$(t,aj(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!N)if(n&&d instanceof Na&&!d.empty&&d.$head.sameParent(d.$anchor)&&!t.composing&&!(m.sel&&m.sel.anchor!=m.sel.head))N={start:d.from,endA:d.to,endB:d.to};else{if(m.sel){let $=eSe(t,t.state.doc,m.sel);if($&&!$.eq(t.state.selection)){let H=t.state.tr.setSelection($);o&&H.setMeta("composition",o),t.dispatch(H)}}return}t.state.selection.fromt.state.selection.from&&N.start<=t.state.selection.from+2&&t.state.selection.from>=m.from?N.start=t.state.selection.from:N.endA=t.state.selection.to-2&&t.state.selection.to<=m.to&&(N.endB+=t.state.selection.to-N.endA,N.endA=t.state.selection.to)),Bh&&lv<=11&&N.endB==N.start+1&&N.endA==N.start&&N.start>m.from&&m.doc.textBetween(N.start-m.from-1,N.start-m.from+1)=="  "&&(N.start--,N.endA--,N.endB--);let j=m.doc.resolveNoCache(N.start-m.from),S=m.doc.resolveNoCache(N.endB-m.from),A=g.resolve(N.start),M=j.sameParent(S)&&j.parent.inlineContent&&A.end()>=N.endA;if((XC&&t.input.lastIOSEnter>Date.now()-225&&(!M||a.some($=>$.nodeName=="DIV"||$.nodeName=="P"))||!M&&j.pos$(t,aj(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>N.start&&evt(g,N.start,N.endA,j,S)&&t.someProp("handleKeyDown",$=>$(t,aj(8,"Backspace")))){ly&&zd&&t.domObserver.suppressSelectionUpdates();return}zd&&N.endB==N.start&&(t.input.lastChromeDelete=Date.now()),ly&&!M&&j.start()!=S.start()&&S.parentOffset==0&&j.depth==S.depth&&m.sel&&m.sel.anchor==m.sel.head&&m.sel.head==N.endA&&(N.endB-=2,S=m.doc.resolveNoCache(N.endB-m.from),setTimeout(()=>{t.someProp("handleKeyDown",function($){return $(t,aj(13,"Enter"))})},20));let I=N.start,F=N.endA,O=$=>{let H=$||t.state.tr.replace(I,F,m.doc.slice(N.start-m.from,N.endB-m.from));if(m.sel){let W=eSe(t,H.doc,m.sel);W&&!(zd&&t.composing&&W.empty&&(N.start!=N.endB||t.input.lastChromeDeleteky(t),20));let $=O(t.state.tr.delete(I,F)),H=g.resolve(N.start).marksAcross(g.resolve(N.endA));H&&$.ensureMarks(H),t.dispatch($)}else if(N.endA==N.endB&&(B=J1t(j.parent.content.cut(j.parentOffset,S.parentOffset),A.parent.content.cut(A.parentOffset,N.endA-A.start())))){let $=O(t.state.tr);B.type=="add"?$.addMark(I,F,B.mark):$.removeMark(I,F,B.mark),t.dispatch($)}else if(j.parent.child(j.index()).isText&&j.index()==S.index()-(S.textOffset?0:1)){let $=j.parent.textBetween(j.parentOffset,S.parentOffset),H=()=>O(t.state.tr.insertText($,I,F));t.someProp("handleTextInput",W=>W(t,I,F,$,H))||t.dispatch(H())}else t.dispatch(O());else t.dispatch(O())}function eSe(t,r,s){return Math.max(s.anchor,s.head)>r.content.size?null:r0e(t,r.resolve(s.anchor),r.resolve(s.head))}function J1t(t,r){let s=t.firstChild.marks,n=r.firstChild.marks,a=s,o=n,l,i,d;for(let g=0;gg.mark(i.addToSet(g.marks));else if(a.length==0&&o.length==1)i=o[0],l="remove",d=g=>g.mark(i.removeFromSet(g.marks));else return null;let m=[];for(let g=0;gs||pde(l,!0,!1)0&&(r||t.indexAfter(n)==t.node(n).childCount);)n--,a++,r=!1;if(s){let o=t.node(n).maybeChild(t.indexAfter(n));for(;o&&!o.isLeaf;)o=o.firstChild,a++}return a}function tvt(t,r,s,n,a){let o=t.findDiffStart(r,s);if(o==null)return null;let{a:l,b:i}=t.findDiffEnd(r,s+t.size,s+r.size);if(a=="end"){let d=Math.max(0,o-Math.min(l,i));n-=l+d-o}if(l=l?o-n:0;o-=d,o&&o=i?o-n:0;o-=d,o&&o=56320&&r<=57343&&s>=55296&&s<=56319}class Zze{constructor(r,s){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 y1t,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=s,this.state=s.state,this.directPlugins=s.plugins||[],this.directPlugins.forEach(iSe),this.dispatch=this.dispatch.bind(this),this.dom=r&&r.mount||document.createElement("div"),r&&(r.appendChild?r.appendChild(this.dom):typeof r=="function"?r(this.dom):r.mount&&(this.mounted=!0)),this.editable=nSe(this),sSe(this),this.nodeViews=aSe(this),this.docView=D4e(this.state.doc,rSe(this),mde(this),this.dom,this),this.domObserver=new H1t(this,(n,a,o,l)=>Q1t(this,n,a,o,l)),this.domObserver.start(),v1t(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let r=this._props;this._props={};for(let s in r)this._props[s]=r[s];this._props.state=this.state}return this._props}update(r){r.handleDOMEvents!=this._props.handleDOMEvents&&epe(this);let s=this._props;this._props=r,r.plugins&&(r.plugins.forEach(iSe),this.directPlugins=r.plugins),this.updateStateInner(r.state,s)}setProps(r){let s={};for(let n in this._props)s[n]=this._props[n];s.state=this.state;for(let n in r)s[n]=r[n];this.update(s)}updateState(r){this.updateStateInner(r,this._props)}updateStateInner(r,s){var n;let a=this.state,o=!1,l=!1;r.storedMarks&&this.composing&&(Uze(this),l=!0),this.state=r;let i=a.plugins!=r.plugins||this._props.plugins!=s.plugins;if(i||this._props.plugins!=s.plugins||this._props.nodeViews!=s.nodeViews){let b=aSe(this);svt(b,this.nodeViews)&&(this.nodeViews=b,o=!0)}(i||s.handleDOMEvents!=this._props.handleDOMEvents)&&epe(this),this.editable=nSe(this),sSe(this);let d=mde(this),m=rSe(this),g=a.plugins!=r.plugins&&!a.doc.eq(r.doc)?"reset":r.scrollToSelection>a.scrollToSelection?"to selection":"preserve",y=o||!this.docView.matchesNode(r.doc,m,d);(y||!r.selection.eq(a.selection))&&(l=!0);let v=g=="preserve"&&l&&this.dom.style.overflowAnchor==null&&P0t(this);if(l){this.domObserver.stop();let b=y&&(Bh||zd)&&!this.composing&&!a.selection.empty&&!r.selection.empty&&rvt(a.selection,r.selection);if(y){let N=zd?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=P1t(this)),(o||!this.docView.update(r.doc,m,d,this))&&(this.docView.updateOuterDeco(m),this.docView.destroy(),this.docView=D4e(r.doc,m,d,this.dom,this)),N&&!this.trackWrites&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&s1t(this))?ky(this,b):(Aze(this,r.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(a),!((n=this.dragging)===null||n===void 0)&&n.node&&!a.doc.eq(r.doc)&&this.updateDraggedNode(this.dragging,a),g=="reset"?this.dom.scrollTop=0:g=="to selection"?this.scrollToSelection():v&&L0t(v)}scrollToSelection(){let r=this.domSelectionRange().focusNode;if(!(!r||!this.dom.contains(r.nodeType==1?r:r.parentNode))){if(!this.someProp("handleScrollToSelection",s=>s(this)))if(this.state.selection instanceof va){let s=this.docView.domAfterPos(this.state.selection.from);s.nodeType==1&&A4e(this,s.getBoundingClientRect(),r)}else A4e(this,this.coordsAtPos(this.state.selection.head,1),r)}}destroyPluginViews(){let r;for(;r=this.pluginViews.pop();)r.destroy&&r.destroy()}updatePluginViews(r){if(!r||r.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let s=0;s0&&this.state.doc.nodeAt(o))==n.node&&(a=o)}this.dragging=new Vze(r.slice,r.move,a<0?void 0:va.create(this.state.doc,a))}someProp(r,s){let n=this._props&&this._props[r],a;if(n!=null&&(a=s?s(n):n))return a;for(let l=0;ls.ownerDocument.getSelection()),this._root=s}return r||document}updateRoot(){this._root=null}posAtCoords(r){return B0t(this,r)}coordsAtPos(r,s=1){return wze(this,r,s)}domAtPos(r,s=0){return this.docView.domFromPos(r,s)}nodeDOM(r){let s=this.docView.descAt(r);return s?s.nodeDOM:null}posAtDOM(r,s,n=-1){let a=this.docView.posFromDOM(r,s,n);if(a==null)throw new RangeError("DOM position not inside the editor");return a}endOfTextblock(r,s){return H0t(this,s||this.state,r)}pasteHTML(r,s){return aI(this,"",r,!1,s||new ClipboardEvent("paste"))}pasteText(r,s){return aI(this,r,null,!0,s||new ClipboardEvent("paste"))}serializeForClipboard(r){return s0e(this,r)}destroy(){this.docView&&(_1t(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],mde(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,j0t())}get isDestroyed(){return this.docView==null}dispatchEvent(r){return w1t(this,r)}domSelectionRange(){let r=this.domSelection();return r?Mu&&this.root.nodeType===11&&M0t(this.dom.ownerDocument)==this.dom&&G1t(this,r)||r:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Zze.prototype.dispatch=function(t){let r=this._props.dispatchTransaction;r?r.call(this,t):this.updateState(this.state.apply(t))};function rSe(t){let r=Object.create(null);return r.class="ProseMirror",r.contenteditable=String(t.editable),t.someProp("attributes",s=>{if(typeof s=="function"&&(s=s(t.state)),s)for(let n in s)n=="class"?r.class+=" "+s[n]:n=="style"?r.style=(r.style?r.style+";":"")+s[n]:!r[n]&&n!="contenteditable"&&n!="nodeName"&&(r[n]=String(s[n]))}),r.translate||(r.translate="no"),[eh.node(0,t.state.doc.content.size,r)]}function sSe(t){if(t.markCursor){let r=document.createElement("img");r.className="ProseMirror-separator",r.setAttribute("mark-placeholder","true"),r.setAttribute("alt",""),t.cursorWrapper={dom:r,deco:eh.widget(t.state.selection.from,r,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function nSe(t){return!t.someProp("editable",r=>r(t.state)===!1)}function rvt(t,r){let s=Math.min(t.$anchor.sharedDepth(t.head),r.$anchor.sharedDepth(r.head));return t.$anchor.start(s)!=r.$anchor.start(s)}function aSe(t){let r=Object.create(null);function s(n){for(let a in n)Object.prototype.hasOwnProperty.call(r,a)||(r[a]=n[a])}return t.someProp("nodeViews",s),t.someProp("markViews",s),r}function svt(t,r){let s=0,n=0;for(let a in t){if(t[a]!=r[a])return!0;s++}for(let a in r)n++;return s!=n}function iSe(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var wv={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:"'"},wre={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},nvt=typeof navigator<"u"&&/Mac/.test(navigator.platform),avt=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var nu=0;nu<10;nu++)wv[48+nu]=wv[96+nu]=String(nu);for(var nu=1;nu<=24;nu++)wv[nu+111]="F"+nu;for(var nu=65;nu<=90;nu++)wv[nu]=String.fromCharCode(nu+32),wre[nu]=String.fromCharCode(nu);for(var fde in wv)wre.hasOwnProperty(fde)||(wre[fde]=wv[fde]);function ivt(t){var r=nvt&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||avt&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",s=!r&&t.key||(t.shiftKey?wre:wv)[t.keyCode]||t.key||"Unidentified";return s=="Esc"&&(s="Escape"),s=="Del"&&(s="Delete"),s=="Left"&&(s="ArrowLeft"),s=="Up"&&(s="ArrowUp"),s=="Right"&&(s="ArrowRight"),s=="Down"&&(s="ArrowDown"),s}const ovt=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),lvt=typeof navigator<"u"&&/Win/.test(navigator.platform);function cvt(t){let r=t.split(/-(?!$)/),s=r[r.length-1];s=="Space"&&(s=" ");let n,a,o,l;for(let i=0;it.selection.empty?!1:(r&&r(t.tr.deleteSelection().scrollIntoView()),!0);function Yze(t,r){let{$cursor:s}=t.selection;return!s||(r?!r.endOfTextblock("backward",t):s.parentOffset>0)?null:s}const Xze=(t,r,s)=>{let n=Yze(t,s);if(!n)return!1;let a=u0e(n);if(!a){let l=n.blockRange(),i=l&&H3(l);return i==null?!1:(r&&r(t.tr.lift(l,i).scrollIntoView()),!0)}let o=a.nodeBefore;if(i7e(t,a,r,-1))return!0;if(n.parent.content.size==0&&(QC(o,"end")||va.isSelectable(o)))for(let l=n.depth;;l--){let i=jae(t.doc,n.before(l),n.after(l),sn.empty);if(i&&i.slice.size1)break}return o.isAtom&&a.depth==n.depth-1?(r&&r(t.tr.delete(a.pos-o.nodeSize,a.pos).scrollIntoView()),!0):!1},hvt=(t,r,s)=>{let n=Yze(t,s);if(!n)return!1;let a=u0e(n);return a?Qze(t,a,r):!1},mvt=(t,r,s)=>{let n=e7e(t,s);if(!n)return!1;let a=h0e(n);return a?Qze(t,a,r):!1};function Qze(t,r,s){let n=r.nodeBefore,a=n,o=r.pos-1;for(;!a.isTextblock;o--){if(a.type.spec.isolating)return!1;let g=a.lastChild;if(!g)return!1;a=g}let l=r.nodeAfter,i=l,d=r.pos+1;for(;!i.isTextblock;d++){if(i.type.spec.isolating)return!1;let g=i.firstChild;if(!g)return!1;i=g}let m=jae(t.doc,o,d,sn.empty);if(!m||m.from!=o||m instanceof Rd&&m.slice.size>=d-o)return!1;if(s){let g=t.tr.step(m);g.setSelection(Na.create(g.doc,o)),s(g.scrollIntoView())}return!0}function QC(t,r,s=!1){for(let n=t;n;n=r=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(s&&n.childCount!=1)return!1}return!1}const Jze=(t,r,s)=>{let{$head:n,empty:a}=t.selection,o=n;if(!a)return!1;if(n.parent.isTextblock){if(s?!s.endOfTextblock("backward",t):n.parentOffset>0)return!1;o=u0e(n)}let l=o&&o.nodeBefore;return!l||!va.isSelectable(l)?!1:(r&&r(t.tr.setSelection(va.create(t.doc,o.pos-l.nodeSize)).scrollIntoView()),!0)};function u0e(t){if(!t.parent.type.spec.isolating)for(let r=t.depth-1;r>=0;r--){if(t.index(r)>0)return t.doc.resolve(t.before(r+1));if(t.node(r).type.spec.isolating)break}return null}function e7e(t,r){let{$cursor:s}=t.selection;return!s||(r?!r.endOfTextblock("forward",t):s.parentOffset{let n=e7e(t,s);if(!n)return!1;let a=h0e(n);if(!a)return!1;let o=a.nodeAfter;if(i7e(t,a,r,1))return!0;if(n.parent.content.size==0&&(QC(o,"start")||va.isSelectable(o))){let l=jae(t.doc,n.before(),n.after(),sn.empty);if(l&&l.slice.size{let{$head:n,empty:a}=t.selection,o=n;if(!a)return!1;if(n.parent.isTextblock){if(s?!s.endOfTextblock("forward",t):n.parentOffset=0;r--){let s=t.node(r);if(t.index(r)+1{let s=t.selection,n=s instanceof va,a;if(n){if(s.node.isTextblock||!Ov(t.doc,s.from))return!1;a=s.from}else if(a=wae(t.doc,s.from,-1),a==null)return!1;if(r){let o=t.tr.join(a);n&&o.setSelection(va.create(o.doc,a-t.doc.resolve(a).nodeBefore.nodeSize)),r(o.scrollIntoView())}return!0},fvt=(t,r)=>{let s=t.selection,n;if(s instanceof va){if(s.node.isTextblock||!Ov(t.doc,s.to))return!1;n=s.to}else if(n=wae(t.doc,s.to,1),n==null)return!1;return r&&r(t.tr.join(n).scrollIntoView()),!0},gvt=(t,r)=>{let{$from:s,$to:n}=t.selection,a=s.blockRange(n),o=a&&H3(a);return o==null?!1:(r&&r(t.tr.lift(a,o).scrollIntoView()),!0)},s7e=(t,r)=>{let{$head:s,$anchor:n}=t.selection;return!s.parent.type.spec.code||!s.sameParent(n)?!1:(r&&r(t.tr.insertText(` `).scrollIntoView()),!0)};function m0e(t){for(let r=0;r{let{$head:s,$anchor:n}=t.selection;if(!s.parent.type.spec.code||!s.sameParent(n))return!1;let a=s.node(-1),o=s.indexAfter(-1),l=m0e(a.contentMatchAt(o));if(!l||!a.canReplaceWith(o,o,l))return!1;if(r){let i=s.after(),d=t.tr.replaceWith(i,i,l.createAndFill());d.setSelection($a.near(d.doc.resolve(i),1)),r(d.scrollIntoView())}return!0},n7e=(t,r)=>{let s=t.selection,{$from:n,$to:a}=s;if(s instanceof Cm||n.parent.inlineContent||a.parent.inlineContent)return!1;let o=m0e(a.parent.contentMatchAt(a.indexAfter()));if(!o||!o.isTextblock)return!1;if(r){let l=(!n.parentOffset&&a.index(){let{$cursor:s}=t.selection;if(!s||s.parent.content.size)return!1;if(s.depth>1&&s.after()!=s.end(-1)){let o=s.before();if(jy(t.doc,o))return r&&r(t.tr.split(o).scrollIntoView()),!0}let n=s.blockRange(),a=n&&H3(n);return a==null?!1:(r&&r(t.tr.lift(n,a).scrollIntoView()),!0)};function yvt(t){return(r,s)=>{let{$from:n,$to:a}=r.selection;if(r.selection instanceof va&&r.selection.node.isBlock)return!n.parentOffset||!jy(r.doc,n.pos)?!1:(s&&s(r.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let o=[],l,i,d=!1,m=!1;for(let b=n.depth;;b--)if(n.node(b).isBlock){d=n.end(b)==n.pos+(n.depth-b),m=n.start(b)==n.pos-(n.depth-b),i=m0e(n.node(b-1).contentMatchAt(n.indexAfter(b-1))),o.unshift(d&&i?{type:i}:null),l=b;break}else{if(b==1)return!1;o.unshift(null)}let g=r.tr;(r.selection instanceof Na||r.selection instanceof Cm)&&g.deleteSelection();let y=g.mapping.map(n.pos),v=jy(g.doc,y,o.length,o);if(v||(o[0]=i?{type:i}:null,v=jy(g.doc,y,o.length,o)),!v)return!1;if(g.split(y,o.length,o),!d&&m&&n.node(l).type!=i){let b=g.mapping.map(n.before(l)),N=g.doc.resolve(b);i&&n.node(l-1).canReplaceWith(N.index(),N.index()+1,i)&&g.setNodeMarkup(g.mapping.map(n.before(l)),i)}return s&&s(g.scrollIntoView()),!0}}const vvt=yvt(),_vt=(t,r)=>{let{$from:s,to:n}=t.selection,a,o=s.sharedDepth(n);return o==0?!1:(a=s.before(o),r&&r(t.tr.setSelection(va.create(t.doc,a))),!0)};function bvt(t,r,s){let n=r.nodeBefore,a=r.nodeAfter,o=r.index();return!n||!a||!n.type.compatibleContent(a.type)?!1:!n.content.size&&r.parent.canReplace(o-1,o)?(s&&s(t.tr.delete(r.pos-n.nodeSize,r.pos).scrollIntoView()),!0):!r.parent.canReplace(o,o+1)||!(a.isTextblock||Ov(t.doc,r.pos))?!1:(s&&s(t.tr.join(r.pos).scrollIntoView()),!0)}function i7e(t,r,s,n){let a=r.nodeBefore,o=r.nodeAfter,l,i,d=a.type.spec.isolating||o.type.spec.isolating;if(!d&&bvt(t,r,s))return!0;let m=!d&&r.parent.canReplace(r.index(),r.index()+1);if(m&&(l=(i=a.contentMatchAt(a.childCount)).findWrapping(o.type))&&i.matchType(l[0]||o.type).validEnd){if(s){let b=r.pos+o.nodeSize,N=_s.empty;for(let A=l.length-1;A>=0;A--)N=_s.from(l[A].create(null,N));N=_s.from(a.copy(N));let j=t.tr.step(new Ud(r.pos-1,b,r.pos,b,new sn(N,1,0),l.length,!0)),S=j.doc.resolve(b+2*l.length);S.nodeAfter&&S.nodeAfter.type==a.type&&Ov(j.doc,S.pos)&&j.join(S.pos),s(j.scrollIntoView())}return!0}let g=o.type.spec.isolating||n>0&&d?null:$a.findFrom(r,1),y=g&&g.$from.blockRange(g.$to),v=y&&H3(y);if(v!=null&&v>=r.depth)return s&&s(t.tr.lift(y,v).scrollIntoView()),!0;if(m&&QC(o,"start",!0)&&QC(a,"end")){let b=a,N=[];for(;N.push(b),!b.isTextblock;)b=b.lastChild;let j=o,S=1;for(;!j.isTextblock;j=j.firstChild)S++;if(b.canReplace(b.childCount,b.childCount,j.content)){if(s){let A=_s.empty;for(let I=N.length-1;I>=0;I--)A=_s.from(N[I].copy(A));let M=t.tr.step(new Ud(r.pos-N.length,r.pos+o.nodeSize,r.pos+S,r.pos+o.nodeSize-S,new sn(A,N.length,0),0,!0));s(M.scrollIntoView())}return!0}}return!1}function o7e(t){return function(r,s){let n=r.selection,a=t<0?n.$from:n.$to,o=a.depth;for(;a.node(o).isInline;){if(!o)return!1;o--}return a.node(o).isTextblock?(s&&s(r.tr.setSelection(Na.create(r.doc,t<0?a.start(o):a.end(o)))),!0):!1}}const wvt=o7e(-1),jvt=o7e(1);function kvt(t,r=null){return function(s,n){let{$from:a,$to:o}=s.selection,l=a.blockRange(o),i=l&&Xye(l,t,r);return i?(n&&n(s.tr.wrap(l,i).scrollIntoView()),!0):!1}}function oSe(t,r=null){return function(s,n){let a=!1;for(let o=0;o{if(a)return!1;if(!(!d.isTextblock||d.hasMarkup(t,r)))if(d.type==t)a=!0;else{let g=s.doc.resolve(m),y=g.index();a=g.parent.canReplaceWith(y,y+1,t)}})}if(!a)return!1;if(n){let o=s.tr;for(let l=0;l=2&&r.$from.node(r.depth-1).type.compatibleContent(s)&&r.startIndex==0){if(r.$from.index(r.depth-1)==0)return!1;let d=l.resolve(r.start-2);o=new fre(d,d,r.depth),r.endIndex=0;g--)o=_s.from(s[g].type.create(s[g].attrs,o));t.step(new Ud(r.start-(n?2:0),r.end,r.start,r.end,new sn(o,0,0),s.length,!0));let l=0;for(let g=0;gl.childCount>0&&l.firstChild.type==t);return o?s?n.node(o.depth-1).type==t?Tvt(r,s,t,o):Avt(r,s,o):!0:!1}}function Tvt(t,r,s,n){let a=t.tr,o=n.end,l=n.$to.end(n.depth);oj;N--)b-=a.child(N).nodeSize,n.delete(b-1,b+1);let o=n.doc.resolve(s.start),l=o.nodeAfter;if(n.mapping.map(s.end)!=s.start+o.nodeAfter.nodeSize)return!1;let i=s.startIndex==0,d=s.endIndex==a.childCount,m=o.node(-1),g=o.index(-1);if(!m.canReplace(g+(i?0:1),g+1,l.content.append(d?_s.empty:_s.from(a))))return!1;let y=o.pos,v=y+l.nodeSize;return n.step(new Ud(y-(i?1:0),v+(d?1:0),y+1,v-1,new sn((i?_s.empty:_s.from(a.copy(_s.empty))).append(d?_s.empty:_s.from(a.copy(_s.empty))),i?0:1,d?0:1),i?0:1)),r(n.scrollIntoView()),!0}function Evt(t){return function(r,s){let{$from:n,$to:a}=r.selection,o=n.blockRange(a,m=>m.childCount>0&&m.firstChild.type==t);if(!o)return!1;let l=o.startIndex;if(l==0)return!1;let i=o.parent,d=i.child(l-1);if(d.type!=t)return!1;if(s){let m=d.lastChild&&d.lastChild.type==i.type,g=_s.from(m?t.create():null),y=new sn(_s.from(t.create(null,_s.from(i.type.create(null,g)))),m?3:1,0),v=o.start,b=o.end;s(r.tr.step(new Ud(v-(m?3:1),b,v,b,y,1,!0)).scrollIntoView())}return!0}}function Mae(t){const{state:r,transaction:s}=t;let{selection:n}=s,{doc:a}=s,{storedMarks:o}=s;return{...r,apply:r.apply.bind(r),applyTransaction:r.applyTransaction.bind(r),plugins:r.plugins,schema:r.schema,reconfigure:r.reconfigure.bind(r),toJSON:r.toJSON.bind(r),get storedMarks(){return o},get selection(){return n},get doc(){return a},get tr(){return n=s.selection,a=s.doc,o=s.storedMarks,s}}}class Tae{constructor(r){this.editor=r.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=r.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:r,editor:s,state:n}=this,{view:a}=s,{tr:o}=n,l=this.buildProps(o);return Object.fromEntries(Object.entries(r).map(([i,d])=>[i,(...g)=>{const y=d(...g)(l);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(o),y}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(r,s=!0){const{rawCommands:n,editor:a,state:o}=this,{view:l}=a,i=[],d=!!r,m=r||o.tr,g=()=>(!d&&s&&!m.getMeta("preventDispatch")&&!this.hasCustomState&&l.dispatch(m),i.every(v=>v===!0)),y={...Object.fromEntries(Object.entries(n).map(([v,b])=>[v,(...j)=>{const S=this.buildProps(m,s),A=b(...j)(S);return i.push(A),y}])),run:g};return y}createCan(r){const{rawCommands:s,state:n}=this,a=!1,o=r||n.tr,l=this.buildProps(o,a);return{...Object.fromEntries(Object.entries(s).map(([d,m])=>[d,(...g)=>m(...g)({...l,dispatch:void 0})])),chain:()=>this.createChain(o,a)}}buildProps(r,s=!0){const{rawCommands:n,editor:a,state:o}=this,{view:l}=a,i={tr:r,editor:a,view:l,state:Mae({state:o,transaction:r}),dispatch:s?()=>{}:void 0,chain:()=>this.createChain(r,s),can:()=>this.createCan(r),get commands(){return Object.fromEntries(Object.entries(n).map(([d,m])=>[d,(...g)=>m(...g)(i)]))}};return i}}let Ivt=class{constructor(){this.callbacks={}}on(r,s){return this.callbacks[r]||(this.callbacks[r]=[]),this.callbacks[r].push(s),this}emit(r,...s){const n=this.callbacks[r];return n&&n.forEach(a=>a.apply(this,s)),this}off(r,s){const n=this.callbacks[r];return n&&(s?this.callbacks[r]=n.filter(a=>a!==s):delete this.callbacks[r]),this}once(r,s){const n=(...a)=>{this.off(r,n),s.apply(this,a)};return this.on(r,n)}removeAllListeners(){this.callbacks={}}};function Bn(t,r,s){return t.config[r]===void 0&&t.parent?Bn(t.parent,r,s):typeof t.config[r]=="function"?t.config[r].bind({...s,parent:t.parent?Bn(t.parent,r,s):null}):t.config[r]}function Aae(t){const r=t.filter(a=>a.type==="extension"),s=t.filter(a=>a.type==="node"),n=t.filter(a=>a.type==="mark");return{baseExtensions:r,nodeExtensions:s,markExtensions:n}}function l7e(t){const r=[],{nodeExtensions:s,markExtensions:n}=Aae(t),a=[...s,...n],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(l=>{const i={name:l.name,options:l.options,storage:l.storage,extensions:a},d=Bn(l,"addGlobalAttributes",i);if(!d)return;d().forEach(g=>{g.types.forEach(y=>{Object.entries(g.attributes).forEach(([v,b])=>{r.push({type:y,name:v,attribute:{...o,...b}})})})})}),a.forEach(l=>{const i={name:l.name,options:l.options,storage:l.storage},d=Bn(l,"addAttributes",i);if(!d)return;const m=d();Object.entries(m).forEach(([g,y])=>{const v={...o,...y};typeof(v==null?void 0:v.default)=="function"&&(v.default=v.default()),v!=null&&v.isRequired&&(v==null?void 0:v.default)===void 0&&delete v.default,r.push({type:l.name,name:g,attribute:v})})}),r}function Vd(t,r){if(typeof t=="string"){if(!r.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return r.nodes[t]}return t}function Yl(...t){return t.filter(r=>!!r).reduce((r,s)=>{const n={...r};return Object.entries(s).forEach(([a,o])=>{if(!n[a]){n[a]=o;return}if(a==="class"){const i=o?String(o).split(" "):[],d=n[a]?n[a].split(" "):[],m=i.filter(g=>!d.includes(g));n[a]=[...d,...m].join(" ")}else if(a==="style"){const i=o?o.split(";").map(g=>g.trim()).filter(Boolean):[],d=n[a]?n[a].split(";").map(g=>g.trim()).filter(Boolean):[],m=new Map;d.forEach(g=>{const[y,v]=g.split(":").map(b=>b.trim());m.set(y,v)}),i.forEach(g=>{const[y,v]=g.split(":").map(b=>b.trim());m.set(y,v)}),n[a]=Array.from(m.entries()).map(([g,y])=>`${g}: ${y}`).join("; ")}else n[a]=o}),n},{})}function tpe(t,r){return r.filter(s=>s.type===t.type.name).filter(s=>s.attribute.rendered).map(s=>s.attribute.renderHTML?s.attribute.renderHTML(t.attrs)||{}:{[s.name]:t.attrs[s.name]}).reduce((s,n)=>Yl(s,n),{})}function c7e(t){return typeof t=="function"}function Si(t,r=void 0,...s){return c7e(t)?r?t.bind(r)(...s):t(...s):t}function Pvt(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Lvt(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function lSe(t,r){return"style"in t?t:{...t,getAttrs:s=>{const n=t.getAttrs?t.getAttrs(s):t.attrs;if(n===!1)return!1;const a=r.reduce((o,l)=>{const i=l.attribute.parseHTML?l.attribute.parseHTML(s):Lvt(s.getAttribute(l.name));return i==null?o:{...o,[l.name]:i}},{});return{...n,...a}}}}function cSe(t){return Object.fromEntries(Object.entries(t).filter(([r,s])=>r==="attrs"&&Pvt(s)?!1:s!=null))}function Ovt(t,r){var s;const n=l7e(t),{nodeExtensions:a,markExtensions:o}=Aae(t),l=(s=a.find(m=>Bn(m,"topNode")))===null||s===void 0?void 0:s.name,i=Object.fromEntries(a.map(m=>{const g=n.filter(A=>A.type===m.name),y={name:m.name,options:m.options,storage:m.storage,editor:r},v=t.reduce((A,M)=>{const I=Bn(M,"extendNodeSchema",y);return{...A,...I?I(m):{}}},{}),b=cSe({...v,content:Si(Bn(m,"content",y)),marks:Si(Bn(m,"marks",y)),group:Si(Bn(m,"group",y)),inline:Si(Bn(m,"inline",y)),atom:Si(Bn(m,"atom",y)),selectable:Si(Bn(m,"selectable",y)),draggable:Si(Bn(m,"draggable",y)),code:Si(Bn(m,"code",y)),whitespace:Si(Bn(m,"whitespace",y)),linebreakReplacement:Si(Bn(m,"linebreakReplacement",y)),defining:Si(Bn(m,"defining",y)),isolating:Si(Bn(m,"isolating",y)),attrs:Object.fromEntries(g.map(A=>{var M;return[A.name,{default:(M=A==null?void 0:A.attribute)===null||M===void 0?void 0:M.default}]}))}),N=Si(Bn(m,"parseHTML",y));N&&(b.parseDOM=N.map(A=>lSe(A,g)));const j=Bn(m,"renderHTML",y);j&&(b.toDOM=A=>j({node:A,HTMLAttributes:tpe(A,g)}));const S=Bn(m,"renderText",y);return S&&(b.toText=S),[m.name,b]})),d=Object.fromEntries(o.map(m=>{const g=n.filter(S=>S.type===m.name),y={name:m.name,options:m.options,storage:m.storage,editor:r},v=t.reduce((S,A)=>{const M=Bn(A,"extendMarkSchema",y);return{...S,...M?M(m):{}}},{}),b=cSe({...v,inclusive:Si(Bn(m,"inclusive",y)),excludes:Si(Bn(m,"excludes",y)),group:Si(Bn(m,"group",y)),spanning:Si(Bn(m,"spanning",y)),code:Si(Bn(m,"code",y)),attrs:Object.fromEntries(g.map(S=>{var A;return[S.name,{default:(A=S==null?void 0:S.attribute)===null||A===void 0?void 0:A.default}]}))}),N=Si(Bn(m,"parseHTML",y));N&&(b.parseDOM=N.map(S=>lSe(S,g)));const j=Bn(m,"renderHTML",y);return j&&(b.toDOM=S=>j({mark:S,HTMLAttributes:tpe(S,g)})),[m.name,b]}));return new YFe({topNode:l,nodes:i,marks:d})}function xde(t,r){return r.nodes[t]||r.marks[t]||null}function dSe(t,r){return Array.isArray(r)?r.some(s=>(typeof s=="string"?s:s.name)===t.name):r}function f0e(t,r){const s=qk.fromSchema(r).serializeFragment(t),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(s),a.innerHTML}const Dvt=(t,r=500)=>{let s="";const n=t.parentOffset;return t.parent.nodesBetween(Math.max(0,n-r),n,(a,o,l,i)=>{var d,m;const g=((m=(d=a.type.spec).toText)===null||m===void 0?void 0:m.call(d,{node:a,pos:o,parent:l,index:i}))||a.textContent||"%leaf%";s+=a.isAtom&&!a.isText?g:g.slice(0,Math.max(0,n-o))}),s};function g0e(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class Eae{constructor(r){this.find=r.find,this.handler=r.handler}}const Rvt=(t,r)=>{if(g0e(r))return r.exec(t);const s=r(t);if(!s)return null;const n=[s.text];return n.index=s.index,n.input=t,n.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),n.push(s.replaceWith)),n};function N8(t){var r;const{editor:s,from:n,to:a,text:o,rules:l,plugin:i}=t,{view:d}=s;if(d.composing)return!1;const m=d.state.doc.resolve(n);if(m.parent.type.spec.code||!((r=m.nodeBefore||m.nodeAfter)===null||r===void 0)&&r.marks.find(v=>v.type.spec.code))return!1;let g=!1;const y=Dvt(m)+o;return l.forEach(v=>{if(g)return;const b=Rvt(y,v.find);if(!b)return;const N=d.state.tr,j=Mae({state:d.state,transaction:N}),S={from:n-(b[0].length-o.length),to:a},{commands:A,chain:M,can:I}=new Tae({editor:s,state:j});v.handler({state:j,range:S,match:b,commands:A,chain:M,can:I})===null||!N.steps.length||(N.setMeta(i,{transform:N,from:n,to:a,text:o}),d.dispatch(N),g=!0)}),g}function Fvt(t){const{editor:r,rules:s}=t,n=new wd({state:{init(){return null},apply(a,o,l){const i=a.getMeta(n);if(i)return i;const d=a.getMeta("applyInputRules");return!!d&&setTimeout(()=>{let{text:g}=d;typeof g=="string"?g=g:g=f0e(_s.from(g),l.schema);const{from:y}=d,v=y+g.length;N8({editor:r,from:y,to:v,text:g,rules:s,plugin:n})}),a.selectionSet||a.docChanged?null:o}},props:{handleTextInput(a,o,l,i){return N8({editor:r,from:o,to:l,text:i,rules:s,plugin:n})},handleDOMEvents:{compositionend:a=>(setTimeout(()=>{const{$cursor:o}=a.state.selection;o&&N8({editor:r,from:o.pos,to:o.pos,text:"",rules:s,plugin:n})}),!1)},handleKeyDown(a,o){if(o.key!=="Enter")return!1;const{$cursor:l}=a.state.selection;return l?N8({editor:r,from:l.pos,to:l.pos,text:` `,rules:s,plugin:n}):!1}},isInputRules:!0});return n}function zvt(t){return Object.prototype.toString.call(t).slice(8,-1)}function S8(t){return zvt(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Iae(t,r){const s={...t};return S8(t)&&S8(r)&&Object.keys(r).forEach(n=>{S8(r[n])&&S8(t[n])?s[n]=Iae(t[n],r[n]):s[n]=r[n]}),s}class ox{constructor(r={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...r},this.name=this.config.name,r.defaultOptions&&Object.keys(r.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=Si(Bn(this,"addOptions",{name:this.name}))),this.storage=Si(Bn(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(r={}){return new ox(r)}configure(r={}){const s=this.extend({...this.config,addOptions:()=>Iae(this.options,r)});return s.name=this.name,s.parent=this.parent,s}extend(r={}){const s=new ox(r);return s.parent=this,this.child=s,s.name=r.name?r.name:s.parent.name,r.defaultOptions&&Object.keys(r.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${s.name}".`),s.options=Si(Bn(s,"addOptions",{name:s.name})),s.storage=Si(Bn(s,"addStorage",{name:s.name,options:s.options})),s}static handleExit({editor:r,mark:s}){const{tr:n}=r.state,a=r.state.selection.$from;if(a.pos===a.end()){const l=a.marks();if(!!!l.find(m=>(m==null?void 0:m.type.name)===s.name))return!1;const d=l.find(m=>(m==null?void 0:m.type.name)===s.name);return d&&n.removeStoredMark(d),n.insertText(" ",a.pos),r.view.dispatch(n),!0}return!1}}function Bvt(t){return typeof t=="number"}class $vt{constructor(r){this.find=r.find,this.handler=r.handler}}const Uvt=(t,r,s)=>{if(g0e(r))return[...t.matchAll(r)];const n=r(t,s);return n?n.map(a=>{const o=[a.text];return o.index=a.index,o.input=t,o.data=a.data,a.replaceWith&&(a.text.includes(a.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(a.replaceWith)),o}):[]};function qvt(t){const{editor:r,state:s,from:n,to:a,rule:o,pasteEvent:l,dropEvent:i}=t,{commands:d,chain:m,can:g}=new Tae({editor:r,state:s}),y=[];return s.doc.nodesBetween(n,a,(b,N)=>{if(!b.isTextblock||b.type.spec.code)return;const j=Math.max(n,N),S=Math.min(a,N+b.content.size),A=b.textBetween(j-N,S-N,void 0,"");Uvt(A,o.find,l).forEach(I=>{if(I.index===void 0)return;const F=j+I.index+1,O=F+I[0].length,B={from:s.tr.mapping.map(F),to:s.tr.mapping.map(O)},$=o.handler({state:s,range:B,match:I,commands:d,chain:m,can:g,pasteEvent:l,dropEvent:i});y.push($)})}),y.every(b=>b!==null)}let C8=null;const Vvt=t=>{var r;const s=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(r=s.clipboardData)===null||r===void 0||r.setData("text/html",t),s};function Hvt(t){const{editor:r,rules:s}=t;let n=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 d=({state:g,from:y,to:v,rule:b,pasteEvt:N})=>{const j=g.tr,S=Mae({state:g,transaction:j});if(!(!qvt({editor:r,state:S,from:Math.max(y-1,0),to:v.b-1,rule:b,pasteEvent:N,dropEvent:i})||!j.steps.length)){try{i=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{i=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,j}};return s.map(g=>new wd({view(y){const v=N=>{var j;n=!((j=y.dom.parentElement)===null||j===void 0)&&j.contains(N.target)?y.dom.parentElement:null,n&&(C8=r)},b=()=>{C8&&(C8=null)};return window.addEventListener("dragstart",v),window.addEventListener("dragend",b),{destroy(){window.removeEventListener("dragstart",v),window.removeEventListener("dragend",b)}}},props:{handleDOMEvents:{drop:(y,v)=>{if(o=n===y.dom.parentElement,i=v,!o){const b=C8;b!=null&&b.isEditable&&setTimeout(()=>{const N=b.state.selection;N&&b.commands.deleteRange({from:N.from,to:N.to})},10)}return!1},paste:(y,v)=>{var b;const N=(b=v.clipboardData)===null||b===void 0?void 0:b.getData("text/html");return l=v,a=!!(N!=null&&N.includes("data-pm-slice")),!1}}},appendTransaction:(y,v,b)=>{const N=y[0],j=N.getMeta("uiEvent")==="paste"&&!a,S=N.getMeta("uiEvent")==="drop"&&!o,A=N.getMeta("applyPasteRules"),M=!!A;if(!j&&!S&&!M)return;if(M){let{text:O}=A;typeof O=="string"?O=O:O=f0e(_s.from(O),b.schema);const{from:B}=A,$=B+O.length,H=Vvt(O);return d({rule:g,state:b,from:B,to:{b:$},pasteEvt:H})}const I=v.doc.content.findDiffStart(b.doc.content),F=v.doc.content.findDiffEnd(b.doc.content);if(!(!Bvt(I)||!F||I===F.b))return d({rule:g,state:b,from:I,to:F,pasteEvt:l})}}))}function Wvt(t){const r=t.filter((s,n)=>t.indexOf(s)!==n);return Array.from(new Set(r))}class yS{constructor(r,s){this.splittableMarks=[],this.editor=s,this.extensions=yS.resolve(r),this.schema=Ovt(this.extensions,s),this.setupExtensions()}static resolve(r){const s=yS.sort(yS.flatten(r)),n=Wvt(s.map(a=>a.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(a=>`'${a}'`).join(", ")}]. This can lead to issues.`),s}static flatten(r){return r.map(s=>{const n={name:s.name,options:s.options,storage:s.storage},a=Bn(s,"addExtensions",n);return a?[s,...this.flatten(a())]:s}).flat(10)}static sort(r){return r.sort((n,a)=>{const o=Bn(n,"priority")||100,l=Bn(a,"priority")||100;return o>l?-1:o{const n={name:s.name,options:s.options,storage:s.storage,editor:this.editor,type:xde(s.name,this.schema)},a=Bn(s,"addCommands",n);return a?{...r,...a()}:r},{})}get plugins(){const{editor:r}=this,s=yS.sort([...this.extensions].reverse()),n=[],a=[],o=s.map(l=>{const i={name:l.name,options:l.options,storage:l.storage,editor:r,type:xde(l.name,this.schema)},d=[],m=Bn(l,"addKeyboardShortcuts",i);let g={};if(l.type==="mark"&&Bn(l,"exitable",i)&&(g.ArrowRight=()=>ox.handleExit({editor:r,mark:l})),m){const j=Object.fromEntries(Object.entries(m()).map(([S,A])=>[S,()=>A({editor:r})]));g={...g,...j}}const y=uvt(g);d.push(y);const v=Bn(l,"addInputRules",i);dSe(l,r.options.enableInputRules)&&v&&n.push(...v());const b=Bn(l,"addPasteRules",i);dSe(l,r.options.enablePasteRules)&&b&&a.push(...b());const N=Bn(l,"addProseMirrorPlugins",i);if(N){const j=N();d.push(...j)}return d}).flat();return[Fvt({editor:r,rules:n}),...Hvt({editor:r,rules:a}),...o]}get attributes(){return l7e(this.extensions)}get nodeViews(){const{editor:r}=this,{nodeExtensions:s}=Aae(this.extensions);return Object.fromEntries(s.filter(n=>!!Bn(n,"addNodeView")).map(n=>{const a=this.attributes.filter(d=>d.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:r,type:Vd(n.name,this.schema)},l=Bn(n,"addNodeView",o);if(!l)return[];const i=(d,m,g,y,v)=>{const b=tpe(d,a);return l()({node:d,view:m,getPos:g,decorations:y,innerDecorations:v,editor:r,extension:n,HTMLAttributes:b})};return[n.name,i]}))}setupExtensions(){this.extensions.forEach(r=>{var s;this.editor.extensionStorage[r.name]=r.storage;const n={name:r.name,options:r.options,storage:r.storage,editor:this.editor,type:xde(r.name,this.schema)};r.type==="mark"&&(!((s=Si(Bn(r,"keepOnSplit",n)))!==null&&s!==void 0)||s)&&this.splittableMarks.push(r.name);const a=Bn(r,"onBeforeCreate",n),o=Bn(r,"onCreate",n),l=Bn(r,"onUpdate",n),i=Bn(r,"onSelectionUpdate",n),d=Bn(r,"onTransaction",n),m=Bn(r,"onFocus",n),g=Bn(r,"onBlur",n),y=Bn(r,"onDestroy",n);a&&this.editor.on("beforeCreate",a),o&&this.editor.on("create",o),l&&this.editor.on("update",l),i&&this.editor.on("selectionUpdate",i),d&&this.editor.on("transaction",d),m&&this.editor.on("focus",m),g&&this.editor.on("blur",g),y&&this.editor.on("destroy",y)})}}class cu{constructor(r={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...r},this.name=this.config.name,r.defaultOptions&&Object.keys(r.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=Si(Bn(this,"addOptions",{name:this.name}))),this.storage=Si(Bn(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(r={}){return new cu(r)}configure(r={}){const s=this.extend({...this.config,addOptions:()=>Iae(this.options,r)});return s.name=this.name,s.parent=this.parent,s}extend(r={}){const s=new cu({...this.config,...r});return s.parent=this,this.child=s,s.name=r.name?r.name:s.parent.name,r.defaultOptions&&Object.keys(r.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${s.name}".`),s.options=Si(Bn(s,"addOptions",{name:s.name})),s.storage=Si(Bn(s,"addStorage",{name:s.name,options:s.options})),s}}function d7e(t,r,s){const{from:n,to:a}=r,{blockSeparator:o=` `,textSerializers:l={}}=s||{};let i="";return t.nodesBetween(n,a,(d,m,g,y)=>{var v;d.isBlock&&m>n&&(i+=o);const b=l==null?void 0:l[d.type.name];if(b)return g&&(i+=b({node:d,pos:m,parent:g,index:y,range:r})),!1;d.isText&&(i+=(v=d==null?void 0:d.text)===null||v===void 0?void 0:v.slice(Math.max(n,m)-m,a-m))}),i}function u7e(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,r])=>r.spec.toText).map(([r,s])=>[r,s.spec.toText]))}const Gvt=cu.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new wd({key:new Iu("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:r,schema:s}=t,{doc:n,selection:a}=r,{ranges:o}=a,l=Math.min(...o.map(g=>g.$from.pos)),i=Math.max(...o.map(g=>g.$to.pos)),d=u7e(s);return d7e(n,{from:l,to:i},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:d})}}})]}}),Kvt=()=>({editor:t,view:r})=>(requestAnimationFrame(()=>{var s;t.isDestroyed||(r.dom.blur(),(s=window==null?void 0:window.getSelection())===null||s===void 0||s.removeAllRanges())}),!0),Zvt=(t=!1)=>({commands:r})=>r.setContent("",t),Yvt=()=>({state:t,tr:r,dispatch:s})=>{const{selection:n}=r,{ranges:a}=n;return s&&a.forEach(({$from:o,$to:l})=>{t.doc.nodesBetween(o.pos,l.pos,(i,d)=>{if(i.type.isText)return;const{doc:m,mapping:g}=r,y=m.resolve(g.map(d)),v=m.resolve(g.map(d+i.nodeSize)),b=y.blockRange(v);if(!b)return;const N=H3(b);if(i.type.isTextblock){const{defaultType:j}=y.parent.contentMatchAt(y.index());r.setNodeMarkup(b.start,j)}(N||N===0)&&r.lift(b,N)})}),!0},Xvt=t=>r=>t(r),Qvt=()=>({state:t,dispatch:r})=>n7e(t,r),Jvt=(t,r)=>({editor:s,tr:n})=>{const{state:a}=s,o=a.doc.slice(t.from,t.to);n.deleteRange(t.from,t.to);const l=n.mapping.map(r);return n.insert(l,o.content),n.setSelection(new Na(n.doc.resolve(Math.max(l-1,0)))),!0},e_t=()=>({tr:t,dispatch:r})=>{const{selection:s}=t,n=s.$anchor.node();if(n.content.size>0)return!1;const a=t.selection.$anchor;for(let o=a.depth;o>0;o-=1)if(a.node(o).type===n.type){if(r){const i=a.before(o),d=a.after(o);t.delete(i,d).scrollIntoView()}return!0}return!1},t_t=t=>({tr:r,state:s,dispatch:n})=>{const a=Vd(t,s.schema),o=r.selection.$anchor;for(let l=o.depth;l>0;l-=1)if(o.node(l).type===a){if(n){const d=o.before(l),m=o.after(l);r.delete(d,m).scrollIntoView()}return!0}return!1},r_t=t=>({tr:r,dispatch:s})=>{const{from:n,to:a}=t;return s&&r.delete(n,a),!0},s_t=()=>({state:t,dispatch:r})=>d0e(t,r),n_t=()=>({commands:t})=>t.keyboardShortcut("Enter"),a_t=()=>({state:t,dispatch:r})=>xvt(t,r);function jre(t,r,s={strict:!0}){const n=Object.keys(r);return n.length?n.every(a=>s.strict?r[a]===t[a]:g0e(r[a])?r[a].test(t[a]):r[a]===t[a]):!0}function h7e(t,r,s={}){return t.find(n=>n.type===r&&jre(Object.fromEntries(Object.keys(s).map(a=>[a,n.attrs[a]])),s))}function uSe(t,r,s={}){return!!h7e(t,r,s)}function x0e(t,r,s){var n;if(!t||!r)return;let a=t.parent.childAfter(t.parentOffset);if((!a.node||!a.node.marks.some(g=>g.type===r))&&(a=t.parent.childBefore(t.parentOffset)),!a.node||!a.node.marks.some(g=>g.type===r)||(s=s||((n=a.node.marks[0])===null||n===void 0?void 0:n.attrs),!h7e([...a.node.marks],r,s)))return;let l=a.index,i=t.start()+a.offset,d=l+1,m=i+a.node.nodeSize;for(;l>0&&uSe([...t.parent.child(l-1).marks],r,s);)l-=1,i-=t.parent.child(l).nodeSize;for(;d({tr:s,state:n,dispatch:a})=>{const o=Rv(t,n.schema),{doc:l,selection:i}=s,{$from:d,from:m,to:g}=i;if(a){const y=x0e(d,o,r);if(y&&y.from<=m&&y.to>=g){const v=Na.create(l,y.from,y.to);s.setSelection(v)}}return!0},o_t=t=>r=>{const s=typeof t=="function"?t(r):t;for(let n=0;n({editor:s,view:n,tr:a,dispatch:o})=>{r={scrollIntoView:!0,...r};const l=()=>{(y0e()||l_t())&&n.dom.focus(),requestAnimationFrame(()=>{s.isDestroyed||(n.focus(),r!=null&&r.scrollIntoView&&s.commands.scrollIntoView())})};if(n.hasFocus()&&t===null||t===!1)return!0;if(o&&t===null&&!m7e(s.state.selection))return l(),!0;const i=p7e(a.doc,t)||s.state.selection,d=s.state.selection.eq(i);return o&&(d||a.setSelection(i),d&&a.storedMarks&&a.setStoredMarks(a.storedMarks),l()),!0},d_t=(t,r)=>s=>t.every((n,a)=>r(n,{...s,index:a})),u_t=(t,r)=>({tr:s,commands:n})=>n.insertContentAt({from:s.selection.from,to:s.selection.to},t,r),f7e=t=>{const r=t.childNodes;for(let s=r.length-1;s>=0;s-=1){const n=r[s];n.nodeType===3&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?t.removeChild(n):n.nodeType===1&&f7e(n)}return t};function M8(t){const r=`${t}`,s=new window.DOMParser().parseFromString(r,"text/html").body;return f7e(s)}function oI(t,r,s){if(t instanceof ov||t instanceof _s)return t;s={slice:!0,parseOptions:{},...s};const n=typeof t=="object"&&t!==null,a=typeof t=="string";if(n)try{if(Array.isArray(t)&&t.length>0)return _s.fromArray(t.map(i=>r.nodeFromJSON(i)));const l=r.nodeFromJSON(t);return s.errorOnInvalidContent&&l.check(),l}catch(o){if(s.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),oI("",r,s)}if(a){if(s.errorOnInvalidContent){let l=!1,i="";const d=new YFe({topNode:r.spec.topNode,marks:r.spec.marks,nodes:r.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:m=>(l=!0,i=typeof m=="string"?m:m.outerHTML,null)}]}})});if(s.slice?rE.fromSchema(d).parseSlice(M8(t),s.parseOptions):rE.fromSchema(d).parse(M8(t),s.parseOptions),s.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${i}`)})}const o=rE.fromSchema(r);return s.slice?o.parseSlice(M8(t),s.parseOptions).content:o.parse(M8(t),s.parseOptions)}return oI("",r,s)}function h_t(t,r,s){const n=t.steps.length-1;if(n{l===0&&(l=g)}),t.setSelection($a.near(t.doc.resolve(l),s))}const m_t=t=>!("type"in t),p_t=(t,r,s)=>({tr:n,dispatch:a,editor:o})=>{var l;if(a){s={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...s};let i;const d=S=>{o.emit("contentError",{editor:o,error:S,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},m={preserveWhitespace:"full",...s.parseOptions};if(!s.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{oI(r,o.schema,{parseOptions:m,errorOnInvalidContent:!0})}catch(S){d(S)}try{i=oI(r,o.schema,{parseOptions:m,errorOnInvalidContent:(l=s.errorOnInvalidContent)!==null&&l!==void 0?l:o.options.enableContentCheck})}catch(S){return d(S),!1}let{from:g,to:y}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},v=!0,b=!0;if((m_t(i)?i:[i]).forEach(S=>{S.check(),v=v?S.isText&&S.marks.length===0:!1,b=b?S.isBlock:!1}),g===y&&b){const{parent:S}=n.doc.resolve(g);S.isTextblock&&!S.type.spec.code&&!S.childCount&&(g-=1,y+=1)}let j;if(v){if(Array.isArray(r))j=r.map(S=>S.text||"").join("");else if(r instanceof _s){let S="";r.forEach(A=>{A.text&&(S+=A.text)}),j=S}else typeof r=="object"&&r&&r.text?j=r.text:j=r;n.insertText(j,g,y)}else j=i,n.replaceWith(g,y,j);s.updateSelection&&h_t(n,n.steps.length-1,-1),s.applyInputRules&&n.setMeta("applyInputRules",{from:g,text:j}),s.applyPasteRules&&n.setMeta("applyPasteRules",{from:g,text:j})}return!0},f_t=()=>({state:t,dispatch:r})=>pvt(t,r),g_t=()=>({state:t,dispatch:r})=>fvt(t,r),x_t=()=>({state:t,dispatch:r})=>Xze(t,r),y_t=()=>({state:t,dispatch:r})=>t7e(t,r),v_t=()=>({state:t,dispatch:r,tr:s})=>{try{const n=wae(t.doc,t.selection.$from.pos,-1);return n==null?!1:(s.join(n,2),r&&r(s),!0)}catch{return!1}},__t=()=>({state:t,dispatch:r,tr:s})=>{try{const n=wae(t.doc,t.selection.$from.pos,1);return n==null?!1:(s.join(n,2),r&&r(s),!0)}catch{return!1}},b_t=()=>({state:t,dispatch:r})=>hvt(t,r),w_t=()=>({state:t,dispatch:r})=>mvt(t,r);function g7e(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function j_t(t){const r=t.split(/-(?!$)/);let s=r[r.length-1];s==="Space"&&(s=" ");let n,a,o,l;for(let i=0;i({editor:r,view:s,tr:n,dispatch:a})=>{const o=j_t(t).split(/-(?!$)/),l=o.find(m=>!["Alt","Ctrl","Meta","Shift"].includes(m)),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}),d=r.captureTransaction(()=>{s.someProp("handleKeyDown",m=>m(s,i))});return d==null||d.steps.forEach(m=>{const g=m.map(n.mapping);g&&a&&n.maybeStep(g)}),!0};function lI(t,r,s={}){const{from:n,to:a,empty:o}=t.selection,l=r?Vd(r,t.schema):null,i=[];t.doc.nodesBetween(n,a,(y,v)=>{if(y.isText)return;const b=Math.max(n,v),N=Math.min(a,v+y.nodeSize);i.push({node:y,from:b,to:N})});const d=a-n,m=i.filter(y=>l?l.name===y.node.type.name:!0).filter(y=>jre(y.node.attrs,s,{strict:!1}));return o?!!m.length:m.reduce((y,v)=>y+v.to-v.from,0)>=d}const N_t=(t,r={})=>({state:s,dispatch:n})=>{const a=Vd(t,s.schema);return lI(s,a,r)?gvt(s,n):!1},S_t=()=>({state:t,dispatch:r})=>a7e(t,r),C_t=t=>({state:r,dispatch:s})=>{const n=Vd(t,r.schema);return Mvt(n)(r,s)},M_t=()=>({state:t,dispatch:r})=>s7e(t,r);function Pae(t,r){return r.nodes[t]?"node":r.marks[t]?"mark":null}function hSe(t,r){const s=typeof r=="string"?[r]:r;return Object.keys(t).reduce((n,a)=>(s.includes(a)||(n[a]=t[a]),n),{})}const T_t=(t,r)=>({tr:s,state:n,dispatch:a})=>{let o=null,l=null;const i=Pae(typeof t=="string"?t:t.name,n.schema);return i?(i==="node"&&(o=Vd(t,n.schema)),i==="mark"&&(l=Rv(t,n.schema)),a&&s.selection.ranges.forEach(d=>{n.doc.nodesBetween(d.$from.pos,d.$to.pos,(m,g)=>{o&&o===m.type&&s.setNodeMarkup(g,void 0,hSe(m.attrs,r)),l&&m.marks.length&&m.marks.forEach(y=>{l===y.type&&s.addMark(g,g+m.nodeSize,l.create(hSe(y.attrs,r)))})})}),!0):!1},A_t=()=>({tr:t,dispatch:r})=>(r&&t.scrollIntoView(),!0),E_t=()=>({tr:t,dispatch:r})=>{if(r){const s=new Cm(t.doc);t.setSelection(s)}return!0},I_t=()=>({state:t,dispatch:r})=>Jze(t,r),P_t=()=>({state:t,dispatch:r})=>r7e(t,r),L_t=()=>({state:t,dispatch:r})=>_vt(t,r),O_t=()=>({state:t,dispatch:r})=>jvt(t,r),D_t=()=>({state:t,dispatch:r})=>wvt(t,r);function rpe(t,r,s={},n={}){return oI(t,r,{slice:!1,parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent})}const R_t=(t,r=!1,s={},n={})=>({editor:a,tr:o,dispatch:l,commands:i})=>{var d,m;const{doc:g}=o;if(s.preserveWhitespace!=="full"){const y=rpe(t,a.schema,s,{errorOnInvalidContent:(d=n.errorOnInvalidContent)!==null&&d!==void 0?d:a.options.enableContentCheck});return l&&o.replaceWith(0,g.content.size,y).setMeta("preventUpdate",!r),!0}return l&&o.setMeta("preventUpdate",!r),i.insertContentAt({from:0,to:g.content.size},t,{parseOptions:s,errorOnInvalidContent:(m=n.errorOnInvalidContent)!==null&&m!==void 0?m:a.options.enableContentCheck})};function x7e(t,r){const s=Rv(r,t.schema),{from:n,to:a,empty:o}=t.selection,l=[];o?(t.storedMarks&&l.push(...t.storedMarks),l.push(...t.selection.$head.marks())):t.doc.nodesBetween(n,a,d=>{l.push(...d.marks)});const i=l.find(d=>d.type.name===s.name);return i?{...i.attrs}:{}}function F_t(t,r){const s=new Qye(t);return r.forEach(n=>{n.steps.forEach(a=>{s.step(a)})}),s}function z_t(t){for(let r=0;r{s(a)&&n.push({node:a,pos:o})}),n}function y7e(t,r){for(let s=t.depth;s>0;s-=1){const n=t.node(s);if(r(n))return{pos:s>0?t.before(s):0,start:t.start(s),depth:s,node:n}}}function v0e(t){return r=>y7e(r.$from,t)}function $_t(t,r){const s={from:0,to:t.content.size};return d7e(t,s,r)}function U_t(t,r){const s=Vd(r,t.schema),{from:n,to:a}=t.selection,o=[];t.doc.nodesBetween(n,a,i=>{o.push(i)});const l=o.reverse().find(i=>i.type.name===s.name);return l?{...l.attrs}:{}}function v7e(t,r){const s=Pae(typeof r=="string"?r:r.name,t.schema);return s==="node"?U_t(t,r):s==="mark"?x7e(t,r):{}}function q_t(t,r=JSON.stringify){const s={};return t.filter(n=>{const a=r(n);return Object.prototype.hasOwnProperty.call(s,a)?!1:s[a]=!0})}function V_t(t){const r=q_t(t);return r.length===1?r:r.filter((s,n)=>!r.filter((o,l)=>l!==n).some(o=>s.oldRange.from>=o.oldRange.from&&s.oldRange.to<=o.oldRange.to&&s.newRange.from>=o.newRange.from&&s.newRange.to<=o.newRange.to))}function H_t(t){const{mapping:r,steps:s}=t,n=[];return r.maps.forEach((a,o)=>{const l=[];if(a.ranges.length)a.forEach((i,d)=>{l.push({from:i,to:d})});else{const{from:i,to:d}=s[o];if(i===void 0||d===void 0)return;l.push({from:i,to:d})}l.forEach(({from:i,to:d})=>{const m=r.slice(o).map(i,-1),g=r.slice(o).map(d),y=r.invert().map(m,-1),v=r.invert().map(g);n.push({oldRange:{from:y,to:v},newRange:{from:m,to:g}})})}),V_t(n)}function _0e(t,r,s){const n=[];return t===r?s.resolve(t).marks().forEach(a=>{const o=s.resolve(t),l=x0e(o,a.type);l&&n.push({mark:a,...l})}):s.nodesBetween(t,r,(a,o)=>{!a||(a==null?void 0:a.nodeSize)===void 0||n.push(...a.marks.map(l=>({from:o,to:o+a.nodeSize,mark:l})))}),n}function Qee(t,r,s){return Object.fromEntries(Object.entries(s).filter(([n])=>{const a=t.find(o=>o.type===r&&o.name===n);return a?a.attribute.keepOnSplit:!1}))}function spe(t,r,s={}){const{empty:n,ranges:a}=t.selection,o=r?Rv(r,t.schema):null;if(n)return!!(t.storedMarks||t.selection.$from.marks()).filter(y=>o?o.name===y.type.name:!0).find(y=>jre(y.attrs,s,{strict:!1}));let l=0;const i=[];if(a.forEach(({$from:y,$to:v})=>{const b=y.pos,N=v.pos;t.doc.nodesBetween(b,N,(j,S)=>{if(!j.isText&&!j.marks.length)return;const A=Math.max(b,S),M=Math.min(N,S+j.nodeSize),I=M-A;l+=I,i.push(...j.marks.map(F=>({mark:F,from:A,to:M})))})}),l===0)return!1;const d=i.filter(y=>o?o.name===y.mark.type.name:!0).filter(y=>jre(y.mark.attrs,s,{strict:!1})).reduce((y,v)=>y+v.to-v.from,0),m=i.filter(y=>o?y.mark.type!==o&&y.mark.type.excludes(o):!0).reduce((y,v)=>y+v.to-v.from,0);return(d>0?d+m:d)>=l}function W_t(t,r,s={}){if(!r)return lI(t,null,s)||spe(t,null,s);const n=Pae(r,t.schema);return n==="node"?lI(t,r,s):n==="mark"?spe(t,r,s):!1}function mSe(t,r){const{nodeExtensions:s}=Aae(r),n=s.find(l=>l.name===t);if(!n)return!1;const a={name:n.name,options:n.options,storage:n.storage},o=Si(Bn(n,"group",a));return typeof o!="string"?!1:o.split(" ").includes("list")}function b0e(t,{checkChildren:r=!0,ignoreWhitespace:s=!1}={}){var n;if(s){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((n=t.text)!==null&&n!==void 0?n:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(r){let a=!0;return t.content.forEach(o=>{a!==!1&&(b0e(o,{ignoreWhitespace:s,checkChildren:r})||(a=!1))}),a}return!1}function G_t(t){return t instanceof va}function K_t(t,r,s){var n;const{selection:a}=r;let o=null;if(m7e(a)&&(o=a.$cursor),o){const i=(n=t.storedMarks)!==null&&n!==void 0?n:o.marks();return!!s.isInSet(i)||!i.some(d=>d.type.excludes(s))}const{ranges:l}=a;return l.some(({$from:i,$to:d})=>{let m=i.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(s):!1;return t.doc.nodesBetween(i.pos,d.pos,(g,y,v)=>{if(m)return!1;if(g.isInline){const b=!v||v.type.allowsMarkType(s),N=!!s.isInSet(g.marks)||!g.marks.some(j=>j.type.excludes(s));m=b&&N}return!m}),m})}const Z_t=(t,r={})=>({tr:s,state:n,dispatch:a})=>{const{selection:o}=s,{empty:l,ranges:i}=o,d=Rv(t,n.schema);if(a)if(l){const m=x7e(n,d);s.addStoredMark(d.create({...m,...r}))}else i.forEach(m=>{const g=m.$from.pos,y=m.$to.pos;n.doc.nodesBetween(g,y,(v,b)=>{const N=Math.max(b,g),j=Math.min(b+v.nodeSize,y);v.marks.find(A=>A.type===d)?v.marks.forEach(A=>{d===A.type&&s.addMark(N,j,d.create({...A.attrs,...r}))}):s.addMark(N,j,d.create(r))})});return K_t(n,s,d)},Y_t=(t,r)=>({tr:s})=>(s.setMeta(t,r),!0),X_t=(t,r={})=>({state:s,dispatch:n,chain:a})=>{const o=Vd(t,s.schema);let l;return s.selection.$anchor.sameParent(s.selection.$head)&&(l=s.selection.$anchor.parent.attrs),o.isTextblock?a().command(({commands:i})=>oSe(o,{...l,...r})(s)?!0:i.clearNodes()).command(({state:i})=>oSe(o,{...l,...r})(i,n)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Q_t=t=>({tr:r,dispatch:s})=>{if(s){const{doc:n}=r,a=gj(t,0,n.content.size),o=va.create(n,a);r.setSelection(o)}return!0},J_t=t=>({tr:r,dispatch:s})=>{if(s){const{doc:n}=r,{from:a,to:o}=typeof t=="number"?{from:t,to:t}:t,l=Na.atStart(n).from,i=Na.atEnd(n).to,d=gj(a,l,i),m=gj(o,l,i),g=Na.create(n,d,m);r.setSelection(g)}return!0},ebt=t=>({state:r,dispatch:s})=>{const n=Vd(t,r.schema);return Evt(n)(r,s)};function pSe(t,r){const s=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(s){const n=s.filter(a=>r==null?void 0:r.includes(a.type.name));t.tr.ensureMarks(n)}}const tbt=({keepMarks:t=!0}={})=>({tr:r,state:s,dispatch:n,editor:a})=>{const{selection:o,doc:l}=r,{$from:i,$to:d}=o,m=a.extensionManager.attributes,g=Qee(m,i.node().type.name,i.node().attrs);if(o instanceof va&&o.node.isBlock)return!i.parentOffset||!jy(l,i.pos)?!1:(n&&(t&&pSe(s,a.extensionManager.splittableMarks),r.split(i.pos).scrollIntoView()),!0);if(!i.parent.isBlock)return!1;const y=d.parentOffset===d.parent.content.size,v=i.depth===0?void 0:z_t(i.node(-1).contentMatchAt(i.indexAfter(-1)));let b=y&&v?[{type:v,attrs:g}]:void 0,N=jy(r.doc,r.mapping.map(i.pos),1,b);if(!b&&!N&&jy(r.doc,r.mapping.map(i.pos),1,v?[{type:v}]:void 0)&&(N=!0,b=v?[{type:v,attrs:g}]:void 0),n){if(N&&(o instanceof Na&&r.deleteSelection(),r.split(r.mapping.map(i.pos),1,b),v&&!y&&!i.parentOffset&&i.parent.type!==v)){const j=r.mapping.map(i.before()),S=r.doc.resolve(j);i.node(-1).canReplaceWith(S.index(),S.index()+1,v)&&r.setNodeMarkup(r.mapping.map(i.before()),v)}t&&pSe(s,a.extensionManager.splittableMarks),r.scrollIntoView()}return N},rbt=(t,r={})=>({tr:s,state:n,dispatch:a,editor:o})=>{var l;const i=Vd(t,n.schema),{$from:d,$to:m}=n.selection,g=n.selection.node;if(g&&g.isBlock||d.depth<2||!d.sameParent(m))return!1;const y=d.node(-1);if(y.type!==i)return!1;const v=o.extensionManager.attributes;if(d.parent.content.size===0&&d.node(-1).childCount===d.indexAfter(-1)){if(d.depth===2||d.node(-3).type!==i||d.index(-2)!==d.node(-2).childCount-1)return!1;if(a){let A=_s.empty;const M=d.index(-1)?1:d.index(-2)?2:3;for(let H=d.depth-M;H>=d.depth-3;H-=1)A=_s.from(d.node(H).copy(A));const I=d.indexAfter(-1){if($>-1)return!1;H.isTextblock&&H.content.size===0&&($=W+1)}),$>-1&&s.setSelection(Na.near(s.doc.resolve($))),s.scrollIntoView()}return!0}const b=m.pos===d.end()?y.contentMatchAt(0).defaultType:null,N={...Qee(v,y.type.name,y.attrs),...r},j={...Qee(v,d.node().type.name,d.node().attrs),...r};s.delete(d.pos,m.pos);const S=b?[{type:i,attrs:N},{type:b,attrs:j}]:[{type:i,attrs:N}];if(!jy(s.doc,d.pos,2))return!1;if(a){const{selection:A,storedMarks:M}=n,{splittableMarks:I}=o.extensionManager,F=M||A.$to.parentOffset&&A.$from.marks();if(s.split(d.pos,2,S).scrollIntoView(),!F||!a)return!0;const O=F.filter(B=>I.includes(B.type.name));s.ensureMarks(O)}return!0},yde=(t,r)=>{const s=v0e(l=>l.type===r)(t.selection);if(!s)return!0;const n=t.doc.resolve(Math.max(0,s.pos-1)).before(s.depth);if(n===void 0)return!0;const a=t.doc.nodeAt(n);return s.node.type===(a==null?void 0:a.type)&&Ov(t.doc,s.pos)&&t.join(s.pos),!0},vde=(t,r)=>{const s=v0e(l=>l.type===r)(t.selection);if(!s)return!0;const n=t.doc.resolve(s.start).after(s.depth);if(n===void 0)return!0;const a=t.doc.nodeAt(n);return s.node.type===(a==null?void 0:a.type)&&Ov(t.doc,n)&&t.join(n),!0},sbt=(t,r,s,n={})=>({editor:a,tr:o,state:l,dispatch:i,chain:d,commands:m,can:g})=>{const{extensions:y,splittableMarks:v}=a.extensionManager,b=Vd(t,l.schema),N=Vd(r,l.schema),{selection:j,storedMarks:S}=l,{$from:A,$to:M}=j,I=A.blockRange(M),F=S||j.$to.parentOffset&&j.$from.marks();if(!I)return!1;const O=v0e(B=>mSe(B.type.name,y))(j);if(I.depth>=1&&O&&I.depth-O.depth<=1){if(O.node.type===b)return m.liftListItem(N);if(mSe(O.node.type.name,y)&&b.validContent(O.node.content)&&i)return d().command(()=>(o.setNodeMarkup(O.pos,b),!0)).command(()=>yde(o,b)).command(()=>vde(o,b)).run()}return!s||!F||!i?d().command(()=>g().wrapInList(b,n)?!0:m.clearNodes()).wrapInList(b,n).command(()=>yde(o,b)).command(()=>vde(o,b)).run():d().command(()=>{const B=g().wrapInList(b,n),$=F.filter(H=>v.includes(H.type.name));return o.ensureMarks($),B?!0:m.clearNodes()}).wrapInList(b,n).command(()=>yde(o,b)).command(()=>vde(o,b)).run()},nbt=(t,r={},s={})=>({state:n,commands:a})=>{const{extendEmptyMarkRange:o=!1}=s,l=Rv(t,n.schema);return spe(n,l,r)?a.unsetMark(l,{extendEmptyMarkRange:o}):a.setMark(l,r)},abt=(t,r,s={})=>({state:n,commands:a})=>{const o=Vd(t,n.schema),l=Vd(r,n.schema),i=lI(n,o,s);let d;return n.selection.$anchor.sameParent(n.selection.$head)&&(d=n.selection.$anchor.parent.attrs),i?a.setNode(l,d):a.setNode(o,{...d,...s})},ibt=(t,r={})=>({state:s,commands:n})=>{const a=Vd(t,s.schema);return lI(s,a,r)?n.lift(a):n.wrapIn(a,r)},obt=()=>({state:t,dispatch:r})=>{const s=t.plugins;for(let n=0;n=0;d-=1)l.step(i.steps[d].invert(i.docs[d]));if(o.text){const d=l.doc.resolve(o.from).marks();l.replaceWith(o.from,o.to,t.schema.text(o.text,d))}else l.delete(o.from,o.to)}return!0}}return!1},lbt=()=>({tr:t,dispatch:r})=>{const{selection:s}=t,{empty:n,ranges:a}=s;return n||r&&a.forEach(o=>{t.removeMark(o.$from.pos,o.$to.pos)}),!0},cbt=(t,r={})=>({tr:s,state:n,dispatch:a})=>{var o;const{extendEmptyMarkRange:l=!1}=r,{selection:i}=s,d=Rv(t,n.schema),{$from:m,empty:g,ranges:y}=i;if(!a)return!0;if(g&&l){let{from:v,to:b}=i;const N=(o=m.marks().find(S=>S.type===d))===null||o===void 0?void 0:o.attrs,j=x0e(m,d,N);j&&(v=j.from,b=j.to),s.removeMark(v,b,d)}else y.forEach(v=>{s.removeMark(v.$from.pos,v.$to.pos,d)});return s.removeStoredMark(d),!0},dbt=(t,r={})=>({tr:s,state:n,dispatch:a})=>{let o=null,l=null;const i=Pae(typeof t=="string"?t:t.name,n.schema);return i?(i==="node"&&(o=Vd(t,n.schema)),i==="mark"&&(l=Rv(t,n.schema)),a&&s.selection.ranges.forEach(d=>{const m=d.$from.pos,g=d.$to.pos;let y,v,b,N;s.selection.empty?n.doc.nodesBetween(m,g,(j,S)=>{o&&o===j.type&&(b=Math.max(S,m),N=Math.min(S+j.nodeSize,g),y=S,v=j)}):n.doc.nodesBetween(m,g,(j,S)=>{S=m&&S<=g&&(o&&o===j.type&&s.setNodeMarkup(S,void 0,{...j.attrs,...r}),l&&j.marks.length&&j.marks.forEach(A=>{if(l===A.type){const M=Math.max(S,m),I=Math.min(S+j.nodeSize,g);s.addMark(M,I,l.create({...A.attrs,...r}))}}))}),v&&(y!==void 0&&s.setNodeMarkup(y,void 0,{...v.attrs,...r}),l&&v.marks.length&&v.marks.forEach(j=>{l===j.type&&s.addMark(b,N,l.create({...j.attrs,...r}))}))}),!0):!1},ubt=(t,r={})=>({state:s,dispatch:n})=>{const a=Vd(t,s.schema);return kvt(a,r)(s,n)},hbt=(t,r={})=>({state:s,dispatch:n})=>{const a=Vd(t,s.schema);return Nvt(a,r)(s,n)};var mbt=Object.freeze({__proto__:null,blur:Kvt,clearContent:Zvt,clearNodes:Yvt,command:Xvt,createParagraphNear:Qvt,cut:Jvt,deleteCurrentNode:e_t,deleteNode:t_t,deleteRange:r_t,deleteSelection:s_t,enter:n_t,exitCode:a_t,extendMarkRange:i_t,first:o_t,focus:c_t,forEach:d_t,insertContent:u_t,insertContentAt:p_t,joinBackward:x_t,joinDown:g_t,joinForward:y_t,joinItemBackward:v_t,joinItemForward:__t,joinTextblockBackward:b_t,joinTextblockForward:w_t,joinUp:f_t,keyboardShortcut:k_t,lift:N_t,liftEmptyBlock:S_t,liftListItem:C_t,newlineInCode:M_t,resetAttributes:T_t,scrollIntoView:A_t,selectAll:E_t,selectNodeBackward:I_t,selectNodeForward:P_t,selectParentNode:L_t,selectTextblockEnd:O_t,selectTextblockStart:D_t,setContent:R_t,setMark:Z_t,setMeta:Y_t,setNode:X_t,setNodeSelection:Q_t,setTextSelection:J_t,sinkListItem:ebt,splitBlock:tbt,splitListItem:rbt,toggleList:sbt,toggleMark:nbt,toggleNode:abt,toggleWrap:ibt,undoInputRule:obt,unsetAllMarks:lbt,unsetMark:cbt,updateAttributes:dbt,wrapIn:ubt,wrapInList:hbt});const pbt=cu.create({name:"commands",addCommands(){return{...mbt}}}),fbt=cu.create({name:"drop",addProseMirrorPlugins(){return[new wd({key:new Iu("tiptapDrop"),props:{handleDrop:(t,r,s,n)=>{this.editor.emit("drop",{editor:this.editor,event:r,slice:s,moved:n})}}})]}}),gbt=cu.create({name:"editable",addProseMirrorPlugins(){return[new wd({key:new Iu("editable"),props:{editable:()=>this.editor.options.editable}})]}}),xbt=new Iu("focusEvents"),ybt=cu.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new wd({key:xbt,props:{handleDOMEvents:{focus:(r,s)=>{t.isFocused=!0;const n=t.state.tr.setMeta("focus",{event:s}).setMeta("addToHistory",!1);return r.dispatch(n),!1},blur:(r,s)=>{t.isFocused=!1;const n=t.state.tr.setMeta("blur",{event:s}).setMeta("addToHistory",!1);return r.dispatch(n),!1}}}})]}}),vbt=cu.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:i})=>{const{selection:d,doc:m}=i,{empty:g,$anchor:y}=d,{pos:v,parent:b}=y,N=y.parent.isTextblock&&v>0?i.doc.resolve(v-1):y,j=N.parent.type.spec.isolating,S=y.pos-y.parentOffset,A=j&&N.parent.childCount===1?S===y.pos:$a.atStart(m).from===v;return!g||!b.type.isTextblock||b.textContent.length||!A||A&&y.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),r=()=>this.editor.commands.first(({commands:l})=>[()=>l.deleteSelection(),()=>l.deleteCurrentNode(),()=>l.joinForward(),()=>l.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:l})=>[()=>l.newlineInCode(),()=>l.createParagraphNear(),()=>l.liftEmptyBlock(),()=>l.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:r,"Mod-Delete":r,"Mod-a":()=>this.editor.commands.selectAll()},a={...n},o={...n,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":r,"Ctrl-Alt-Backspace":r,"Alt-Delete":r,"Alt-d":r,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return y0e()||g7e()?o:a},addProseMirrorPlugins(){return[new wd({key:new Iu("clearDocument"),appendTransaction:(t,r,s)=>{if(t.some(j=>j.getMeta("composition")))return;const n=t.some(j=>j.docChanged)&&!r.doc.eq(s.doc),a=t.some(j=>j.getMeta("preventClearDocument"));if(!n||a)return;const{empty:o,from:l,to:i}=r.selection,d=$a.atStart(r.doc).from,m=$a.atEnd(r.doc).to;if(o||!(l===d&&i===m)||!b0e(s.doc))return;const v=s.tr,b=Mae({state:s,transaction:v}),{commands:N}=new Tae({editor:this.editor,state:b});if(N.clearNodes(),!!v.steps.length)return v}})]}}),_bt=cu.create({name:"paste",addProseMirrorPlugins(){return[new wd({key:new Iu("tiptapPaste"),props:{handlePaste:(t,r,s)=>{this.editor.emit("paste",{editor:this.editor,event:r,slice:s})}}})]}}),bbt=cu.create({name:"tabindex",addProseMirrorPlugins(){return[new wd({key:new Iu("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class ij{get name(){return this.node.type.name}constructor(r,s,n=!1,a=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=r,this.editor=s,this.currentNode=a}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var r;return(r=this.actualDepth)!==null&&r!==void 0?r:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(r){let s=this.from,n=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}s=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:s,to:n},r)}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 r=this.resolvedPos.start(this.resolvedPos.depth-1),s=this.resolvedPos.doc.resolve(r);return new ij(s,this.editor)}get before(){let r=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return r.depth!==this.depth&&(r=this.resolvedPos.doc.resolve(this.from-3)),new ij(r,this.editor)}get after(){let r=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return r.depth!==this.depth&&(r=this.resolvedPos.doc.resolve(this.to+3)),new ij(r,this.editor)}get children(){const r=[];return this.node.content.forEach((s,n)=>{const a=s.isBlock&&!s.isTextblock,o=s.isAtom&&!s.isText,l=this.pos+n+(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 d=new ij(i,this.editor,a,a?s:null);a&&(d.actualDepth=this.depth+1),r.push(new ij(i,this.editor,a,a?s:null))}),r}get firstChild(){return this.children[0]||null}get lastChild(){const r=this.children;return r[r.length-1]||null}closest(r,s={}){let n=null,a=this.parent;for(;a&&!n;){if(a.node.type.name===r)if(Object.keys(s).length>0){const o=a.node.attrs,l=Object.keys(s);for(let i=0;i{n&&a.length>0||(l.node.type.name===r&&o.every(d=>s[d]===l.node.attrs[d])&&a.push(l),!(n&&a.length>0)&&(a=a.concat(l.querySelectorAll(r,s,n))))}),a}setAttribute(r){const{tr:s}=this.editor.state;s.setNodeMarkup(this.from,void 0,{...this.node.attrs,...r}),this.editor.view.dispatch(s)}}const wbt=`.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 jbt(t,r,s){const n=document.querySelector("style[data-tiptap-style]");if(n!==null)return n;const a=document.createElement("style");return r&&a.setAttribute("nonce",r),a.setAttribute("data-tiptap-style",""),a.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(a),a}class kbt extends Ivt{constructor(r={}){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:s})=>{throw s},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(r),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:s,slice:n,moved:a})=>this.options.onDrop(s,n,a)),this.on("paste",({event:s,slice:n})=>this.options.onPaste(s,n)),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=jbt(wbt,this.options.injectNonce))}setOptions(r={}){this.options={...this.options,...r},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(r,s=!0){this.setOptions({editable:r}),s&&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(r,s){const n=c7e(s)?s(r,[...this.state.plugins]):[...this.state.plugins,r],a=this.state.reconfigure({plugins:n});return this.view.updateState(a),a}unregisterPlugin(r){if(this.isDestroyed)return;const s=this.state.plugins;let n=s;if([].concat(r).forEach(o=>{const l=typeof o=="string"?`${o}$`:o.key;n=n.filter(i=>!i.key.startsWith(l))}),s.length===n.length)return;const a=this.state.reconfigure({plugins:n});return this.view.updateState(a),a}createExtensionManager(){var r,s;const a=[...this.options.enableCoreExtensions?[gbt,Gvt.configure({blockSeparator:(s=(r=this.options.coreExtensionOptions)===null||r===void 0?void 0:r.clipboardTextSerializer)===null||s===void 0?void 0:s.blockSeparator}),pbt,ybt,vbt,bbt,fbt,_bt].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 yS(a,this)}createCommandManager(){this.commandManager=new Tae({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var r;let s;try{s=rpe(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()}}),s=rpe(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const n=p7e(s,this.options.autofocus);this.view=new Zze(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(r=this.options.editorProps)===null||r===void 0?void 0:r.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:xS.create({doc:s,selection:n||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(r){this.isCapturingTransaction=!0,r(),this.isCapturingTransaction=!1;const s=this.capturedTransaction;return this.capturedTransaction=null,s}dispatchTransaction(r){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=r;return}r.steps.forEach(l=>{var i;return(i=this.capturedTransaction)===null||i===void 0?void 0:i.step(l)});return}const s=this.state.apply(r),n=!this.state.selection.eq(s.selection);this.emit("beforeTransaction",{editor:this,transaction:r,nextState:s}),this.view.updateState(s),this.emit("transaction",{editor:this,transaction:r}),n&&this.emit("selectionUpdate",{editor:this,transaction:r});const a=r.getMeta("focus"),o=r.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:r}),o&&this.emit("blur",{editor:this,event:o.event,transaction:r}),!(!r.docChanged||r.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:r})}getAttributes(r){return v7e(this.state,r)}isActive(r,s){const n=typeof r=="string"?r:null,a=typeof r=="string"?s:r;return W_t(this.state,n,a)}getJSON(){return this.state.doc.toJSON()}getHTML(){return f0e(this.state.doc.content,this.schema)}getText(r){const{blockSeparator:s=` `,textSerializers:n={}}=r||{};return $_t(this.state.doc,{blockSeparator:s,textSerializers:{...u7e(this.schema),...n}})}get isEmpty(){return b0e(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 r=this.view.dom;r&&r.editor&&delete r.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var r;return!(!((r=this.view)===null||r===void 0)&&r.docView)}$node(r,s){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelector(r,s))||null}$nodes(r,s){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelectorAll(r,s))||null}$pos(r){const s=this.state.doc.resolve(r);return new ij(s,this)}get $doc(){return this.$pos(0)}}function JC(t){return new Eae({find:t.find,handler:({state:r,range:s,match:n})=>{const a=Si(t.getAttributes,void 0,n);if(a===!1||a===null)return null;const{tr:o}=r,l=n[n.length-1],i=n[0];if(l){const d=i.search(/\S/),m=s.from+i.indexOf(l),g=m+l.length;if(_0e(s.from,s.to,r.doc).filter(b=>b.mark.type.excluded.find(j=>j===t.type&&j!==b.mark.type)).filter(b=>b.to>m).length)return null;gs.from&&o.delete(s.from+d,m);const v=s.from+d+l.length;o.addMark(s.from+d,v,t.type.create(a||{})),o.removeStoredMark(t.type)}}})}function _7e(t){return new Eae({find:t.find,handler:({state:r,range:s,match:n})=>{const a=Si(t.getAttributes,void 0,n)||{},{tr:o}=r,l=s.from;let i=s.to;const d=t.type.create(a);if(n[1]){const m=n[0].lastIndexOf(n[1]);let g=l+m;g>i?g=i:i=g+n[1].length;const y=n[0][n[0].length-1];o.insertText(y,l+n[0].length-1),o.replaceWith(g,i,d)}else if(n[0]){const m=t.type.isInline?l:l-1;o.insert(m,t.type.create(a)).delete(o.mapping.map(l),o.mapping.map(i))}o.scrollIntoView()}})}function npe(t){return new Eae({find:t.find,handler:({state:r,range:s,match:n})=>{const a=r.doc.resolve(s.from),o=Si(t.getAttributes,void 0,n)||{};if(!a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),t.type))return null;r.tr.delete(s.from,s.to).setBlockType(s.from,s.from,t.type,o)}})}function cI(t){return new Eae({find:t.find,handler:({state:r,range:s,match:n,chain:a})=>{const o=Si(t.getAttributes,void 0,n)||{},l=r.tr.delete(s.from,s.to),d=l.doc.resolve(s.from).blockRange(),m=d&&Xye(d,t.type,o);if(!m)return null;if(l.wrap(d,m),t.keepMarks&&t.editor){const{selection:y,storedMarks:v}=r,{splittableMarks:b}=t.editor.extensionManager,N=v||y.$to.parentOffset&&y.$from.marks();if(N){const j=N.filter(S=>b.includes(S.type.name));l.ensureMarks(j)}}if(t.keepAttributes){const y=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";a().updateAttributes(y,o).run()}const g=l.doc.resolve(s.from-1).nodeBefore;g&&g.type===t.type&&Ov(l.doc,s.from-1)&&(!t.joinPredicate||t.joinPredicate(n,g))&&l.join(s.from-1)}})}let Pu=class ape{constructor(r={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...r},this.name=this.config.name,r.defaultOptions&&Object.keys(r.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=Si(Bn(this,"addOptions",{name:this.name}))),this.storage=Si(Bn(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(r={}){return new ape(r)}configure(r={}){const s=this.extend({...this.config,addOptions:()=>Iae(this.options,r)});return s.name=this.name,s.parent=this.parent,s}extend(r={}){const s=new ape(r);return s.parent=this,this.child=s,s.name=r.name?r.name:s.parent.name,r.defaultOptions&&Object.keys(r.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${s.name}".`),s.options=Si(Bn(s,"addOptions",{name:s.name})),s.storage=Si(Bn(s,"addStorage",{name:s.name,options:s.options})),s}};function Mk(t){return new $vt({find:t.find,handler:({state:r,range:s,match:n,pasteEvent:a})=>{const o=Si(t.getAttributes,void 0,n,a);if(o===!1||o===null)return null;const{tr:l}=r,i=n[n.length-1],d=n[0];let m=s.to;if(i){const g=d.search(/\S/),y=s.from+d.indexOf(i),v=y+i.length;if(_0e(s.from,s.to,r.doc).filter(N=>N.mark.type.excluded.find(S=>S===t.type&&S!==N.mark.type)).filter(N=>N.to>y).length)return null;vs.from&&l.delete(s.from+g,y),m=s.from+g+i.length,l.addMark(s.from+g,m,t.type.create(o||{})),l.removeStoredMark(t.type)}}})}function Nbt(t,r){const{selection:s}=t,{$from:n}=s;if(s instanceof va){const o=n.index();return n.parent.canReplaceWith(o,o+1,r)}let a=n.depth;for(;a>=0;){const o=n.index(a);if(n.node(a).contentMatchAt(o).matchType(r))return!0;a-=1}return!1}function Sbt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var b7e={exports:{}},_de={};/** * @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 fSe;function Cbt(){if(fSe)return _de;fSe=1;var t=lt;function r(y,v){return y===v&&(y!==0||1/y===1/v)||y!==y&&v!==v}var s=typeof Object.is=="function"?Object.is:r,n=t.useState,a=t.useEffect,o=t.useLayoutEffect,l=t.useDebugValue;function i(y,v){var b=v(),N=n({inst:{value:b,getSnapshot:v}}),j=N[0].inst,S=N[1];return o(function(){j.value=b,j.getSnapshot=v,d(j)&&S({inst:j})},[y,b,v]),a(function(){return d(j)&&S({inst:j}),y(function(){d(j)&&S({inst:j})})},[y]),l(b),b}function d(y){var v=y.getSnapshot;y=y.value;try{var b=v();return!s(y,b)}catch{return!0}}function m(y,v){return v()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:i;return _de.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:g,_de}b7e.exports=Cbt();var w0e=b7e.exports;const Mbt=(...t)=>r=>{t.forEach(s=>{typeof s=="function"?s(r):s&&(s.current=r)})},Tbt=({contentComponent:t})=>{const r=w0e.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return lt.createElement(lt.Fragment,null,Object.values(r))};function Abt(){const t=new Set;let r={};return{subscribe(s){return t.add(s),()=>{t.delete(s)}},getSnapshot(){return r},getServerSnapshot(){return r},setRenderer(s,n){r={...r,[s]:oxe.createPortal(n.reactElement,n.element,s)},t.forEach(a=>a())},removeRenderer(s){const n={...r};delete n[s],r=n,t.forEach(a=>a())}}}class Ebt extends lt.Component{constructor(r){var s;super(r),this.editorContentRef=lt.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((s=r.editor)===null||s===void 0)&&s.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const r=this.props.editor;if(r&&!r.isDestroyed&&r.options.element){if(r.contentComponent)return;const s=this.editorContentRef.current;s.append(...r.options.element.childNodes),r.setOptions({element:s}),r.contentComponent=Abt(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=r.contentComponent.subscribe(()=>{this.setState(n=>n.hasContentComponentInitialized?n:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),r.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const r=this.props.editor;if(!r||(this.initialized=!1,r.isDestroyed||r.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),r.contentComponent=null,!r.options.element.firstChild))return;const s=document.createElement("div");s.append(...r.options.element.childNodes),r.setOptions({element:s})}render(){const{editor:r,innerRef:s,...n}=this.props;return lt.createElement(lt.Fragment,null,lt.createElement("div",{ref:Mbt(s,this.editorContentRef),...n}),(r==null?void 0:r.contentComponent)&<.createElement(Tbt,{contentComponent:r.contentComponent}))}}const Ibt=E.forwardRef((t,r)=>{const s=lt.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return lt.createElement(Ebt,{key:s,innerRef:r,...t})}),w7e=lt.memo(Ibt);var Pbt=function t(r,s){if(r===s)return!0;if(r&&s&&typeof r=="object"&&typeof s=="object"){if(r.constructor!==s.constructor)return!1;var n,a,o;if(Array.isArray(r)){if(n=r.length,n!=s.length)return!1;for(a=n;a--!==0;)if(!t(r[a],s[a]))return!1;return!0}if(r instanceof Map&&s instanceof Map){if(r.size!==s.size)return!1;for(a of r.entries())if(!s.has(a[0]))return!1;for(a of r.entries())if(!t(a[1],s.get(a[0])))return!1;return!0}if(r instanceof Set&&s instanceof Set){if(r.size!==s.size)return!1;for(a of r.entries())if(!s.has(a[0]))return!1;return!0}if(ArrayBuffer.isView(r)&&ArrayBuffer.isView(s)){if(n=r.length,n!=s.length)return!1;for(a=n;a--!==0;)if(r[a]!==s[a])return!1;return!0}if(r.constructor===RegExp)return r.source===s.source&&r.flags===s.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===s.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===s.toString();if(o=Object.keys(r),n=o.length,n!==Object.keys(s).length)return!1;for(a=n;a--!==0;)if(!Object.prototype.hasOwnProperty.call(s,o[a]))return!1;for(a=n;a--!==0;){var l=o[a];if(!(l==="_owner"&&r.$$typeof)&&!t(r[l],s[l]))return!1}return!0}return r!==r&&s!==s},Lbt=Sbt(Pbt),j7e={exports:{}},bde={};/** * @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 gSe;function Obt(){if(gSe)return bde;gSe=1;var t=lt,r=w0e;function s(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:s,a=r.useSyncExternalStore,o=t.useRef,l=t.useEffect,i=t.useMemo,d=t.useDebugValue;return bde.useSyncExternalStoreWithSelector=function(m,g,y,v,b){var N=o(null);if(N.current===null){var j={hasValue:!1,value:null};N.current=j}else j=N.current;N=i(function(){function A(B){if(!M){if(M=!0,I=B,B=v(B),b!==void 0&&j.hasValue){var $=j.value;if(b($,B))return F=$}return F=B}if($=F,n(I,B))return $;var H=v(B);return b!==void 0&&b($,H)?$:(I=B,F=H)}var M=!1,I,F,O=y===void 0?null:y;return[function(){return A(g())},O===null?void 0:function(){return A(O())}]},[g,y,v,b]);var S=a(m,N[0],N[1]);return l(function(){j.hasValue=!0,j.value=S},[S]),d(S),S},bde}j7e.exports=Obt();var Dbt=j7e.exports;const Rbt=typeof window<"u"?E.useLayoutEffect:E.useEffect;class Fbt{constructor(r){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=r,this.lastSnapshot={editor:r,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(r){return this.subscribers.add(r),()=>{this.subscribers.delete(r)}}watch(r){if(this.editor=r,this.editor){const s=()=>{this.transactionNumber+=1,this.subscribers.forEach(a=>a())},n=this.editor;return n.on("transaction",s),()=>{n.off("transaction",s)}}}}function zbt(t){var r;const[s]=E.useState(()=>new Fbt(t.editor)),n=Dbt.useSyncExternalStoreWithSelector(s.subscribe,s.getSnapshot,s.getServerSnapshot,t.selector,(r=t.equalityFn)!==null&&r!==void 0?r:Lbt);return Rbt(()=>s.watch(t.editor),[t.editor,s]),E.useDebugValue(n),n}const Bbt=!1,ipe=typeof window>"u",$bt=ipe||!!(typeof window<"u"&&window.next);class j0e{constructor(r){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=r,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(r){this.editor=r,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(s=>s())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?ipe||$bt?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const r={...this.options.current,onBeforeCreate:(...n)=>{var a,o;return(o=(a=this.options.current).onBeforeCreate)===null||o===void 0?void 0:o.call(a,...n)},onBlur:(...n)=>{var a,o;return(o=(a=this.options.current).onBlur)===null||o===void 0?void 0:o.call(a,...n)},onCreate:(...n)=>{var a,o;return(o=(a=this.options.current).onCreate)===null||o===void 0?void 0:o.call(a,...n)},onDestroy:(...n)=>{var a,o;return(o=(a=this.options.current).onDestroy)===null||o===void 0?void 0:o.call(a,...n)},onFocus:(...n)=>{var a,o;return(o=(a=this.options.current).onFocus)===null||o===void 0?void 0:o.call(a,...n)},onSelectionUpdate:(...n)=>{var a,o;return(o=(a=this.options.current).onSelectionUpdate)===null||o===void 0?void 0:o.call(a,...n)},onTransaction:(...n)=>{var a,o;return(o=(a=this.options.current).onTransaction)===null||o===void 0?void 0:o.call(a,...n)},onUpdate:(...n)=>{var a,o;return(o=(a=this.options.current).onUpdate)===null||o===void 0?void 0:o.call(a,...n)},onContentError:(...n)=>{var a,o;return(o=(a=this.options.current).onContentError)===null||o===void 0?void 0:o.call(a,...n)},onDrop:(...n)=>{var a,o;return(o=(a=this.options.current).onDrop)===null||o===void 0?void 0:o.call(a,...n)},onPaste:(...n)=>{var a,o;return(o=(a=this.options.current).onPaste)===null||o===void 0?void 0:o.call(a,...n)}};return new kbt(r)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(r){return this.subscriptions.add(r),()=>{this.subscriptions.delete(r)}}static compareOptions(r,s){return Object.keys(r).every(n=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)?!0:n==="extensions"&&r.extensions&&s.extensions?r.extensions.length!==s.extensions.length?!1:r.extensions.every((a,o)=>{var l;return a===((l=s.extensions)===null||l===void 0?void 0:l[o])}):r[n]===s[n])}onRender(r){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&r.length===0?j0e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(r),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(r){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=r;return}if(this.previousDeps.length===r.length&&this.previousDeps.every((n,a)=>n===r[a]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=r}scheduleDestroy(){const r=this.instanceId,s=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===r){s&&s.setOptions(this.options.current);return}s&&!s.isDestroyed&&(s.destroy(),this.instanceId===r&&this.setEditor(null))},1)}}function k7e(t={},r=[]){const s=E.useRef(t);s.current=t;const[n]=E.useState(()=>new j0e(s)),a=w0e.useSyncExternalStore(n.subscribe,n.getEditor,n.getServerSnapshot);return E.useDebugValue(a),E.useEffect(n.onRender(r)),zbt({editor:a,selector:({transactionNumber:o})=>t.shouldRerenderOnTransaction===!1?null:t.immediatelyRender&&o===0?0:o+1}),a}const Ubt=E.createContext({editor:null});Ubt.Consumer;const qbt=E.createContext({onDragStart:void 0}),Vbt=()=>E.useContext(qbt);lt.forwardRef((t,r)=>{const{onDragStart:s}=Vbt(),n=t.as||"div";return lt.createElement(n,{...t,ref:r,"data-node-view-wrapper":"",onDragStart:s,style:{whiteSpace:"normal",...t.style}})});const Hbt=/^\s*>\s$/,Wbt=Pu.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Yl(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[cI({find:Hbt,type:this.type})]}}),Gbt=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Kbt=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Zbt=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Ybt=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Xbt=ox.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",Yl(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[JC({find:Gbt,type:this.type}),JC({find:Zbt,type:this.type})]},addPasteRules(){return[Mk({find:Kbt,type:this.type}),Mk({find:Ybt,type:this.type})]}}),Qbt="listItem",xSe="textStyle",ySe=/^\s*([-+*])\s$/,Jbt=Pu.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Yl(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:r})=>this.options.keepAttributes?r().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Qbt,this.editor.getAttributes(xSe)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=cI({find:ySe,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=cI({find:ySe,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(xSe),editor:this.editor})),[t]}}),e2t=/(^|[^`])`([^`]+)`(?!`)/,t2t=/(^|[^`])`([^`]+)`(?!`)/g,r2t=ox.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Yl(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[JC({find:e2t,type:this.type})]},addPasteRules(){return[Mk({find:t2t,type:this.type})]}}),s2t=/^```([a-z]+)?[\s\n]$/,n2t=/^~~~([a-z]+)?[\s\n]$/,a2t=Pu.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var r;const{languageClassPrefix:s}=this.options,o=[...((r=t.firstElementChild)===null||r===void 0?void 0:r.classList)||[]].filter(l=>l.startsWith(s)).map(l=>l.replace(s,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:r}){return["pre",Yl(this.options.HTMLAttributes,r),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:r})=>r.setNode(this.name,t),toggleCodeBlock:t=>({commands:r})=>r.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:r}=this.editor.state.selection,s=r.pos===1;return!t||r.parent.type.name!==this.name?!1:s||!r.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:r}=t,{selection:s}=r,{$from:n,empty:a}=s;if(!a||n.parent.type!==this.type)return!1;const o=n.parentOffset===n.parent.nodeSize-2,l=n.parent.textContent.endsWith(` `);return!o||!l?!1:t.chain().command(({tr:i})=>(i.delete(n.pos-2,n.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:r}=t,{selection:s,doc:n}=r,{$from:a,empty:o}=s;if(!o||a.parent.type!==this.type||!(a.parentOffset===a.parent.nodeSize-2))return!1;const i=a.after();return i===void 0?!1:n.nodeAt(i)?t.commands.command(({tr:m})=>(m.setSelection($a.near(n.resolve(i))),!0)):t.commands.exitCode()}}},addInputRules(){return[npe({find:s2t,type:this.type,getAttributes:t=>({language:t[1]})}),npe({find:n2t,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new wd({key:new Iu("codeBlockVSCodeHandler"),props:{handlePaste:(t,r)=>{if(!r.clipboardData||this.editor.isActive(this.type.name))return!1;const s=r.clipboardData.getData("text/plain"),n=r.clipboardData.getData("vscode-editor-data"),a=n?JSON.parse(n):void 0,o=a==null?void 0:a.mode;if(!s||!o)return!1;const{tr:l,schema:i}=t.state,d=i.text(s.replace(/\r\n?/g,` `));return l.replaceSelectionWith(this.type.create({language:o},d)),l.selection.$from.parent.type!==this.type&&l.setSelection(Na.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),t.dispatch(l),!0}}})]}}),i2t=Pu.create({name:"doc",topNode:!0,content:"block+"});function o2t(t={}){return new wd({view(r){return new l2t(r,t)}})}class l2t{constructor(r,s){var n;this.editorView=r,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=s.width)!==null&&n!==void 0?n:1,this.color=s.color===!1?void 0:s.color||"black",this.class=s.class,this.handlers=["dragover","dragend","drop","dragleave"].map(a=>{let o=l=>{this[a](l)};return r.dom.addEventListener(a,o),{name:a,handler:o}})}destroy(){this.handlers.forEach(({name:r,handler:s})=>this.editorView.dom.removeEventListener(r,s))}update(r,s){this.cursorPos!=null&&s.doc!=r.state.doc&&(this.cursorPos>r.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(r){r!=this.cursorPos&&(this.cursorPos=r,r==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let r=this.editorView.state.doc.resolve(this.cursorPos),s=!r.parent.inlineContent,n,a=this.editorView.dom,o=a.getBoundingClientRect(),l=o.width/a.offsetWidth,i=o.height/a.offsetHeight;if(s){let y=r.nodeBefore,v=r.nodeAfter;if(y||v){let b=this.editorView.nodeDOM(this.cursorPos-(y?y.nodeSize:0));if(b){let N=b.getBoundingClientRect(),j=y?N.bottom:N.top;y&&v&&(j=(j+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let S=this.width/2*i;n={left:N.left,right:N.right,top:j-S,bottom:j+S}}}}if(!n){let y=this.editorView.coordsAtPos(this.cursorPos),v=this.width/2*l;n={left:y.left-v,right:y.left+v,top:y.top,bottom:y.bottom}}let d=this.editorView.dom.offsetParent;this.element||(this.element=d.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",s),this.element.classList.toggle("prosemirror-dropcursor-inline",!s);let m,g;if(!d||d==document.body&&getComputedStyle(d).position=="static")m=-pageXOffset,g=-pageYOffset;else{let y=d.getBoundingClientRect(),v=y.width/d.offsetWidth,b=y.height/d.offsetHeight;m=y.left-d.scrollLeft*v,g=y.top-d.scrollTop*b}this.element.style.left=(n.left-m)/l+"px",this.element.style.top=(n.top-g)/i+"px",this.element.style.width=(n.right-n.left)/l+"px",this.element.style.height=(n.bottom-n.top)/i+"px"}scheduleRemoval(r){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),r)}dragover(r){if(!this.editorView.editable)return;let s=this.editorView.posAtCoords({left:r.clientX,top:r.clientY}),n=s&&s.inside>=0&&this.editorView.state.doc.nodeAt(s.inside),a=n&&n.type.spec.disableDropCursor,o=typeof a=="function"?a(this.editorView,s,r):a;if(s&&!o){let l=s.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let i=oze(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(r){this.editorView.dom.contains(r.relatedTarget)||this.setCursor(null)}}const c2t=cu.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[o2t(this.options)]}});class ic extends $a{constructor(r){super(r,r)}map(r,s){let n=r.resolve(s.map(this.head));return ic.valid(n)?new ic(n):$a.near(n)}content(){return sn.empty}eq(r){return r instanceof ic&&r.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(r,s){if(typeof s.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ic(r.resolve(s.pos))}getBookmark(){return new k0e(this.anchor)}static valid(r){let s=r.parent;if(s.isTextblock||!d2t(r)||!u2t(r))return!1;let n=s.type.spec.allowGapCursor;if(n!=null)return n;let a=s.contentMatchAt(r.index()).defaultType;return a&&a.isTextblock}static findGapCursorFrom(r,s,n=!1){e:for(;;){if(!n&&ic.valid(r))return r;let a=r.pos,o=null;for(let l=r.depth;;l--){let i=r.node(l);if(s>0?r.indexAfter(l)0){o=i.child(s>0?r.indexAfter(l):r.index(l)-1);break}else if(l==0)return null;a+=s;let d=r.doc.resolve(a);if(ic.valid(d))return d}for(;;){let l=s>0?o.firstChild:o.lastChild;if(!l){if(o.isAtom&&!o.isText&&!va.isSelectable(o)){r=r.doc.resolve(a+o.nodeSize*s),n=!1;continue e}break}o=l,a+=s;let i=r.doc.resolve(a);if(ic.valid(i))return i}return null}}}ic.prototype.visible=!1;ic.findFrom=ic.findGapCursorFrom;$a.jsonID("gapcursor",ic);class k0e{constructor(r){this.pos=r}map(r){return new k0e(r.map(this.pos))}resolve(r){let s=r.resolve(this.pos);return ic.valid(s)?new ic(s):$a.near(s)}}function N7e(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function d2t(t){for(let r=t.depth;r>=0;r--){let s=t.index(r),n=t.node(r);if(s==0){if(n.type.spec.isolating)return!0;continue}for(let a=n.child(s-1);;a=a.lastChild){if(a.childCount==0&&!a.inlineContent||N7e(a.type))return!0;if(a.inlineContent)return!1}}return!0}function u2t(t){for(let r=t.depth;r>=0;r--){let s=t.indexAfter(r),n=t.node(r);if(s==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let a=n.child(s);;a=a.firstChild){if(a.childCount==0&&!a.inlineContent||N7e(a.type))return!0;if(a.inlineContent)return!1}}return!0}function h2t(){return new wd({props:{decorations:g2t,createSelectionBetween(t,r,s){return r.pos==s.pos&&ic.valid(s)?new ic(s):null},handleClick:p2t,handleKeyDown:m2t,handleDOMEvents:{beforeinput:f2t}}})}const m2t=c0e({ArrowLeft:T8("horiz",-1),ArrowRight:T8("horiz",1),ArrowUp:T8("vert",-1),ArrowDown:T8("vert",1)});function T8(t,r){const s=t=="vert"?r>0?"down":"up":r>0?"right":"left";return function(n,a,o){let l=n.selection,i=r>0?l.$to:l.$from,d=l.empty;if(l instanceof Na){if(!o.endOfTextblock(s)||i.depth==0)return!1;d=!1,i=n.doc.resolve(r>0?i.after():i.before())}let m=ic.findGapCursorFrom(i,r,d);return m?(a&&a(n.tr.setSelection(new ic(m))),!0):!1}}function p2t(t,r,s){if(!t||!t.editable)return!1;let n=t.state.doc.resolve(r);if(!ic.valid(n))return!1;let a=t.posAtCoords({left:s.clientX,top:s.clientY});return a&&a.inside>-1&&va.isSelectable(t.state.doc.nodeAt(a.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ic(n))),!0)}function f2t(t,r){if(r.inputType!="insertCompositionText"||!(t.state.selection instanceof ic))return!1;let{$from:s}=t.state.selection,n=s.parent.contentMatchAt(s.index()).findWrapping(t.state.schema.nodes.text);if(!n)return!1;let a=_s.empty;for(let l=n.length-1;l>=0;l--)a=_s.from(n[l].createAndFill(null,a));let o=t.state.tr.replace(s.pos,s.pos,new sn(a,0,0));return o.setSelection(Na.near(o.doc.resolve(s.pos+1))),t.dispatch(o),!1}function g2t(t){if(!(t.selection instanceof ic))return null;let r=document.createElement("div");return r.className="ProseMirror-gapcursor",ac.create(t.doc,[eh.widget(t.selection.head,r,{key:"gapcursor"})])}const x2t=cu.create({name:"gapCursor",addProseMirrorPlugins(){return[h2t()]},extendNodeSchema(t){var r;const s={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(r=Si(Bn(t,"allowGapCursor",s)))!==null&&r!==void 0?r:null}}}),y2t=Pu.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Yl(this.options.HTMLAttributes,t)]},renderText(){return` `},addCommands(){return{setHardBreak:()=>({commands:t,chain:r,state:s,editor:n})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:a,storedMarks:o}=s;if(a.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:i}=n.extensionManager,d=o||a.$to.parentOffset&&a.$from.marks();return r().insertContent({type:this.name}).command(({tr:m,dispatch:g})=>{if(g&&d&&l){const y=d.filter(v=>i.includes(v.type.name));m.ensureMarks(y)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),v2t=Pu.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:r}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Yl(this.options.HTMLAttributes,r),0]},addCommands(){return{setHeading:t=>({commands:r})=>this.options.levels.includes(t.level)?r.setNode(this.name,t):!1,toggleHeading:t=>({commands:r})=>this.options.levels.includes(t.level)?r.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,r)=>({...t,[`Mod-Alt-${r}`]:()=>this.editor.commands.toggleHeading({level:r})}),{})},addInputRules(){return this.options.levels.map(t=>npe({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var kre=200,qd=function(){};qd.prototype.append=function(r){return r.length?(r=qd.from(r),!this.length&&r||r.length=s?qd.empty:this.sliceInner(Math.max(0,r),Math.min(this.length,s))};qd.prototype.get=function(r){if(!(r<0||r>=this.length))return this.getInner(r)};qd.prototype.forEach=function(r,s,n){s===void 0&&(s=0),n===void 0&&(n=this.length),s<=n?this.forEachInner(r,s,n,0):this.forEachInvertedInner(r,s,n,0)};qd.prototype.map=function(r,s,n){s===void 0&&(s=0),n===void 0&&(n=this.length);var a=[];return this.forEach(function(o,l){return a.push(r(o,l))},s,n),a};qd.from=function(r){return r instanceof qd?r:r&&r.length?new S7e(r):qd.empty};var S7e=function(t){function r(n){t.call(this),this.values=n}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var s={length:{configurable:!0},depth:{configurable:!0}};return r.prototype.flatten=function(){return this.values},r.prototype.sliceInner=function(a,o){return a==0&&o==this.length?this:new r(this.values.slice(a,o))},r.prototype.getInner=function(a){return this.values[a]},r.prototype.forEachInner=function(a,o,l,i){for(var d=o;d=l;d--)if(a(this.values[d],i+d)===!1)return!1},r.prototype.leafAppend=function(a){if(this.length+a.length<=kre)return new r(this.values.concat(a.flatten()))},r.prototype.leafPrepend=function(a){if(this.length+a.length<=kre)return new r(a.flatten().concat(this.values))},s.length.get=function(){return this.values.length},s.depth.get=function(){return 0},Object.defineProperties(r.prototype,s),r}(qd);qd.empty=new S7e([]);var _2t=function(t){function r(s,n){t.call(this),this.left=s,this.right=n,this.length=s.length+n.length,this.depth=Math.max(s.depth,n.depth)+1}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},r.prototype.getInner=function(n){return ni&&this.right.forEachInner(n,Math.max(a-i,0),Math.min(this.length,o)-i,l+i)===!1)return!1},r.prototype.forEachInvertedInner=function(n,a,o,l){var i=this.left.length;if(a>i&&this.right.forEachInvertedInner(n,a-i,Math.max(o,i)-i,l+i)===!1||o=o?this.right.slice(n-o,a-o):this.left.slice(n,o).append(this.right.slice(0,a-o))},r.prototype.leafAppend=function(n){var a=this.right.leafAppend(n);if(a)return new r(this.left,a)},r.prototype.leafPrepend=function(n){var a=this.left.leafPrepend(n);if(a)return new r(a,this.right)},r.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new r(this.left,new r(this.right,n)):new r(this,n)},r}(qd);const b2t=500;class Cf{constructor(r,s){this.items=r,this.eventCount=s}popEvent(r,s){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let a,o;s&&(a=this.remapping(n,this.items.length),o=a.maps.length);let l=r.tr,i,d,m=[],g=[];return this.items.forEach((y,v)=>{if(!y.step){a||(a=this.remapping(n,v+1),o=a.maps.length),o--,g.push(y);return}if(a){g.push(new Sg(y.map));let b=y.step.map(a.slice(o)),N;b&&l.maybeStep(b).doc&&(N=l.mapping.maps[l.mapping.maps.length-1],m.push(new Sg(N,void 0,void 0,m.length+g.length))),o--,N&&a.appendMap(N,o)}else l.maybeStep(y.step);if(y.selection)return i=a?y.selection.map(a.slice(o)):y.selection,d=new Cf(this.items.slice(0,n).append(g.reverse().concat(m)),this.eventCount-1),!1},this.items.length,0),{remaining:d,transform:l,selection:i}}addTransform(r,s,n,a){let o=[],l=this.eventCount,i=this.items,d=!a&&i.length?i.get(i.length-1):null;for(let g=0;gj2t&&(i=w2t(i,m),l-=m),new Cf(i.append(o),l)}remapping(r,s){let n=new rI;return this.items.forEach((a,o)=>{let l=a.mirrorOffset!=null&&o-a.mirrorOffset>=r?n.maps.length-a.mirrorOffset:void 0;n.appendMap(a.map,l)},r,s),n}addMaps(r){return this.eventCount==0?this:new Cf(this.items.append(r.map(s=>new Sg(s))),this.eventCount)}rebased(r,s){if(!this.eventCount)return this;let n=[],a=Math.max(0,this.items.length-s),o=r.mapping,l=r.steps.length,i=this.eventCount;this.items.forEach(v=>{v.selection&&i--},a);let d=s;this.items.forEach(v=>{let b=o.getMirror(--d);if(b==null)return;l=Math.min(l,b);let N=o.maps[b];if(v.step){let j=r.steps[b].invert(r.docs[b]),S=v.selection&&v.selection.map(o.slice(d+1,b));S&&i++,n.push(new Sg(N,j,S))}else n.push(new Sg(N))},a);let m=[];for(let v=s;vb2t&&(y=y.compress(this.items.length-n.length)),y}emptyItemCount(){let r=0;return this.items.forEach(s=>{s.step||r++}),r}compress(r=this.items.length){let s=this.remapping(0,r),n=s.maps.length,a=[],o=0;return this.items.forEach((l,i)=>{if(i>=r)a.push(l),l.selection&&o++;else if(l.step){let d=l.step.map(s.slice(n)),m=d&&d.getMap();if(n--,m&&s.appendMap(m,n),d){let g=l.selection&&l.selection.map(s.slice(n));g&&o++;let y=new Sg(m.invert(),d,g),v,b=a.length-1;(v=a.length&&a[b].merge(y))?a[b]=v:a.push(y)}}else l.map&&n--},this.items.length,0),new Cf(qd.from(a.reverse()),o)}}Cf.empty=new Cf(qd.empty,0);function w2t(t,r){let s;return t.forEach((n,a)=>{if(n.selection&&r--==0)return s=a,!1}),t.slice(s)}class Sg{constructor(r,s,n,a){this.map=r,this.step=s,this.selection=n,this.mirrorOffset=a}merge(r){if(this.step&&r.step&&!r.selection){let s=r.step.merge(this.step);if(s)return new Sg(s.getMap().invert(),s,this.selection)}}}class n1{constructor(r,s,n,a,o){this.done=r,this.undone=s,this.prevRanges=n,this.prevTime=a,this.prevComposition=o}}const j2t=20;function k2t(t,r,s,n){let a=s.getMeta(ok),o;if(a)return a.historyState;s.getMeta(C2t)&&(t=new n1(t.done,t.undone,null,0,-1));let l=s.getMeta("appendedTransaction");if(s.steps.length==0)return t;if(l&&l.getMeta(ok))return l.getMeta(ok).redo?new n1(t.done.addTransform(s,void 0,n,Jee(r)),t.undone,vSe(s.mapping.maps),t.prevTime,t.prevComposition):new n1(t.done,t.undone.addTransform(s,void 0,n,Jee(r)),null,t.prevTime,t.prevComposition);if(s.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let i=s.getMeta("composition"),d=t.prevTime==0||!l&&t.prevComposition!=i&&(t.prevTime<(s.time||0)-n.newGroupDelay||!N2t(s,t.prevRanges)),m=l?wde(t.prevRanges,s.mapping):vSe(s.mapping.maps);return new n1(t.done.addTransform(s,d?r.selection.getBookmark():void 0,n,Jee(r)),Cf.empty,m,s.time,i??t.prevComposition)}else return(o=s.getMeta("rebased"))?new n1(t.done.rebased(s,o),t.undone.rebased(s,o),wde(t.prevRanges,s.mapping),t.prevTime,t.prevComposition):new n1(t.done.addMaps(s.mapping.maps),t.undone.addMaps(s.mapping.maps),wde(t.prevRanges,s.mapping),t.prevTime,t.prevComposition)}function N2t(t,r){if(!r)return!1;if(!t.docChanged)return!0;let s=!1;return t.mapping.maps[0].forEach((n,a)=>{for(let o=0;o=r[o]&&(s=!0)}),s}function vSe(t){let r=[];for(let s=t.length-1;s>=0&&r.length==0;s--)t[s].forEach((n,a,o,l)=>r.push(o,l));return r}function wde(t,r){if(!t)return null;let s=[];for(let n=0;n{let a=ok.getState(s);if(!a||(t?a.undone:a.done).eventCount==0)return!1;if(n){let o=S2t(a,s,t);o&&n(r?o.scrollIntoView():o)}return!0}}const M7e=C7e(!1,!0),T7e=C7e(!0,!0),T2t=cu.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:r})=>M7e(t,r),redo:()=>({state:t,dispatch:r})=>T7e(t,r)}},addProseMirrorPlugins(){return[M2t(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()}}}),A2t=Pu.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Yl(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:r})=>{if(!Nbt(r,r.schema.nodes[this.name]))return!1;const{selection:s}=r,{$from:n,$to:a}=s,o=t();return n.parentOffset===0?o.insertContentAt({from:Math.max(n.pos-1,0),to:a.pos},{type:this.name}):G_t(s)?o.insertContentAt(a.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:l,dispatch:i})=>{var d;if(i){const{$to:m}=l.selection,g=m.end();if(m.nodeAfter)m.nodeAfter.isTextblock?l.setSelection(Na.create(l.doc,m.pos+1)):m.nodeAfter.isBlock?l.setSelection(va.create(l.doc,m.pos)):l.setSelection(Na.create(l.doc,m.pos));else{const y=(d=m.parent.type.contentMatch.defaultType)===null||d===void 0?void 0:d.create();y&&(l.insert(g,y),l.setSelection(Na.create(l.doc,g+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[_7e({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),E2t=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,I2t=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,P2t=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,L2t=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,O2t=ox.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Yl(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[JC({find:E2t,type:this.type}),JC({find:P2t,type:this.type})]},addPasteRules(){return[Mk({find:I2t,type:this.type}),Mk({find:L2t,type:this.type})]}}),D2t=Pu.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Yl(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),R2t="listItem",bSe="textStyle",wSe=/^(\d+)\.\s$/,F2t=Pu.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:r,...s}=t;return r===1?["ol",Yl(this.options.HTMLAttributes,s),0]:["ol",Yl(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:r})=>this.options.keepAttributes?r().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(R2t,this.editor.getAttributes(bSe)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=cI({find:wSe,type:this.type,getAttributes:r=>({start:+r[1]}),joinPredicate:(r,s)=>s.childCount+s.attrs.start===+r[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=cI({find:wSe,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:r=>({start:+r[1],...this.editor.getAttributes(bSe)}),joinPredicate:(r,s)=>s.childCount+s.attrs.start===+r[1],editor:this.editor})),[t]}}),z2t=Pu.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Yl(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),B2t=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,$2t=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,U2t=ox.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Yl(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[JC({find:B2t,type:this.type})]},addPasteRules(){return[Mk({find:$2t,type:this.type})]}}),q2t=Pu.create({name:"text",group:"inline"}),A7e=cu.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(Xbt.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(Wbt.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(Jbt.configure(this.options.bulletList)),this.options.code!==!1&&t.push(r2t.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(a2t.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(i2t.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(c2t.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(x2t.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(y2t.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(v2t.configure(this.options.heading)),this.options.history!==!1&&t.push(T2t.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(A2t.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(O2t.configure(this.options.italic)),this.options.listItem!==!1&&t.push(D2t.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(F2t.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(z2t.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(U2t.configure(this.options.strike)),this.options.text!==!1&&t.push(q2t.configure(this.options.text)),t}}),V2t="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",H2t="ελ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",ope="numeric",lpe="ascii",cpe="alpha",iE="asciinumeric",JT="alphanumeric",dpe="domain",E7e="emoji",W2t="scheme",G2t="slashscheme",kde="whitespace";function K2t(t,r){return t in r||(r[t]=[]),r[t]}function xj(t,r,s){r[ope]&&(r[iE]=!0,r[JT]=!0),r[lpe]&&(r[iE]=!0,r[cpe]=!0),r[iE]&&(r[JT]=!0),r[cpe]&&(r[JT]=!0),r[JT]&&(r[dpe]=!0),r[E7e]&&(r[dpe]=!0);for(const n in r){const a=K2t(n,s);a.indexOf(t)<0&&a.push(t)}}function Z2t(t,r){const s={};for(const n in r)r[n].indexOf(t)>=0&&(s[n]=!0);return s}function Eh(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Eh.groups={};Eh.prototype={accepts(){return!!this.t},go(t){const r=this,s=r.j[t];if(s)return s;for(let n=0;nt.ta(r,s,n,a),Jl=(t,r,s,n,a)=>t.tr(r,s,n,a),jSe=(t,r,s,n,a)=>t.ts(r,s,n,a),Ls=(t,r,s,n,a)=>t.tt(r,s,n,a),Gx="WORD",upe="UWORD",I7e="ASCIINUMERICAL",P7e="ALPHANUMERICAL",dI="LOCALHOST",hpe="TLD",mpe="UTLD",ete="SCHEME",nS="SLASH_SCHEME",N0e="NUM",ppe="WS",S0e="NL",oE="OPENBRACE",lE="CLOSEBRACE",Nre="OPENBRACKET",Sre="CLOSEBRACKET",Cre="OPENPAREN",Mre="CLOSEPAREN",Tre="OPENANGLEBRACKET",Are="CLOSEANGLEBRACKET",Ere="FULLWIDTHLEFTPAREN",Ire="FULLWIDTHRIGHTPAREN",Pre="LEFTCORNERBRACKET",Lre="RIGHTCORNERBRACKET",Ore="LEFTWHITECORNERBRACKET",Dre="RIGHTWHITECORNERBRACKET",Rre="FULLWIDTHLESSTHAN",Fre="FULLWIDTHGREATERTHAN",zre="AMPERSAND",Bre="APOSTROPHE",$re="ASTERISK",a1="AT",Ure="BACKSLASH",qre="BACKTICK",Vre="CARET",p1="COLON",C0e="COMMA",Hre="DOLLAR",Cg="DOT",Wre="EQUALS",M0e="EXCLAMATION",ep="HYPHEN",cE="PERCENT",Gre="PIPE",Kre="PLUS",Zre="POUND",dE="QUERY",T0e="QUOTE",L7e="FULLWIDTHMIDDLEDOT",A0e="SEMI",Mg="SLASH",uE="TILDE",Yre="UNDERSCORE",O7e="EMOJI",Xre="SYM";var D7e=Object.freeze({__proto__:null,ALPHANUMERICAL:P7e,AMPERSAND:zre,APOSTROPHE:Bre,ASCIINUMERICAL:I7e,ASTERISK:$re,AT:a1,BACKSLASH:Ure,BACKTICK:qre,CARET:Vre,CLOSEANGLEBRACKET:Are,CLOSEBRACE:lE,CLOSEBRACKET:Sre,CLOSEPAREN:Mre,COLON:p1,COMMA:C0e,DOLLAR:Hre,DOT:Cg,EMOJI:O7e,EQUALS:Wre,EXCLAMATION:M0e,FULLWIDTHGREATERTHAN:Fre,FULLWIDTHLEFTPAREN:Ere,FULLWIDTHLESSTHAN:Rre,FULLWIDTHMIDDLEDOT:L7e,FULLWIDTHRIGHTPAREN:Ire,HYPHEN:ep,LEFTCORNERBRACKET:Pre,LEFTWHITECORNERBRACKET:Ore,LOCALHOST:dI,NL:S0e,NUM:N0e,OPENANGLEBRACKET:Tre,OPENBRACE:oE,OPENBRACKET:Nre,OPENPAREN:Cre,PERCENT:cE,PIPE:Gre,PLUS:Kre,POUND:Zre,QUERY:dE,QUOTE:T0e,RIGHTCORNERBRACKET:Lre,RIGHTWHITECORNERBRACKET:Dre,SCHEME:ete,SEMI:A0e,SLASH:Mg,SLASH_SCHEME:nS,SYM:Xre,TILDE:uE,TLD:hpe,UNDERSCORE:Yre,UTLD:mpe,UWORD:upe,WORD:Gx,WS:ppe});const Ux=/[a-z]/,CT=new RegExp("\\p{L}","u"),Nde=new RegExp("\\p{Emoji}","u"),qx=/\d/,Sde=/\s/,kSe="\r",Cde=` `,Y2t="️",X2t="‍",Mde="";let A8=null,E8=null;function Q2t(t=[]){const r={};Eh.groups=r;const s=new Eh;A8==null&&(A8=NSe(V2t)),E8==null&&(E8=NSe(H2t)),Ls(s,"'",Bre),Ls(s,"{",oE),Ls(s,"}",lE),Ls(s,"[",Nre),Ls(s,"]",Sre),Ls(s,"(",Cre),Ls(s,")",Mre),Ls(s,"<",Tre),Ls(s,">",Are),Ls(s,"(",Ere),Ls(s,")",Ire),Ls(s,"「",Pre),Ls(s,"」",Lre),Ls(s,"『",Ore),Ls(s,"』",Dre),Ls(s,"<",Rre),Ls(s,">",Fre),Ls(s,"&",zre),Ls(s,"*",$re),Ls(s,"@",a1),Ls(s,"`",qre),Ls(s,"^",Vre),Ls(s,":",p1),Ls(s,",",C0e),Ls(s,"$",Hre),Ls(s,".",Cg),Ls(s,"=",Wre),Ls(s,"!",M0e),Ls(s,"-",ep),Ls(s,"%",cE),Ls(s,"|",Gre),Ls(s,"+",Kre),Ls(s,"#",Zre),Ls(s,"?",dE),Ls(s,'"',T0e),Ls(s,"/",Mg),Ls(s,";",A0e),Ls(s,"~",uE),Ls(s,"_",Yre),Ls(s,"\\",Ure),Ls(s,"・",L7e);const n=Jl(s,qx,N0e,{[ope]:!0});Jl(n,qx,n);const a=Jl(n,Ux,I7e,{[iE]:!0}),o=Jl(n,CT,P7e,{[JT]:!0}),l=Jl(s,Ux,Gx,{[lpe]:!0});Jl(l,qx,a),Jl(l,Ux,l),Jl(a,qx,a),Jl(a,Ux,a);const i=Jl(s,CT,upe,{[cpe]:!0});Jl(i,Ux),Jl(i,qx,o),Jl(i,CT,i),Jl(o,qx,o),Jl(o,Ux),Jl(o,CT,o);const d=Ls(s,Cde,S0e,{[kde]:!0}),m=Ls(s,kSe,ppe,{[kde]:!0}),g=Jl(s,Sde,ppe,{[kde]:!0});Ls(s,Mde,g),Ls(m,Cde,d),Ls(m,Mde,g),Jl(m,Sde,g),Ls(g,kSe),Ls(g,Cde),Jl(g,Sde,g),Ls(g,Mde,g);const y=Jl(s,Nde,O7e,{[E7e]:!0});Ls(y,"#"),Jl(y,Nde,y),Ls(y,Y2t,y);const v=Ls(y,X2t);Ls(v,"#"),Jl(v,Nde,y);const b=[[Ux,l],[qx,a]],N=[[Ux,null],[CT,i],[qx,o]];for(let j=0;jj[0]>S[0]?1:-1);for(let j=0;j=0?M[dpe]=!0:Ux.test(S)?qx.test(S)?M[iE]=!0:M[lpe]=!0:M[ope]=!0,jSe(s,S,S,M)}return jSe(s,"localhost",dI,{ascii:!0}),s.jd=new Eh(Xre),{start:s,tokens:Object.assign({groups:r},D7e)}}function R7e(t,r){const s=J2t(r.replace(/[A-Z]/g,i=>i.toLowerCase())),n=s.length,a=[];let o=0,l=0;for(;l=0&&(y+=s[l].length,v++),m+=s[l].length,o+=s[l].length,l++;o-=y,l-=v,m-=y,a.push({t:g.t,v:r.slice(o-m,o),s:o-m,e:o})}return a}function J2t(t){const r=[],s=t.length;let n=0;for(;n56319||n+1===s||(o=t.charCodeAt(n+1))<56320||o>57343?t[n]:t.slice(n,n+2);r.push(l),n+=l.length}return r}function V0(t,r,s,n,a){let o;const l=r.length;for(let i=0;i=0;)o++;if(o>0){r.push(s.join(""));for(let l=parseInt(t.substring(n,n+o),10);l>0;l--)s.pop();n+=o}else s.push(t[n]),n++}return r}const uI={defaultProtocol:"http",events:null,format:SSe,formatHref:SSe,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function E0e(t,r=null){let s=Object.assign({},uI);t&&(s=Object.assign(s,t instanceof E0e?t.o:t));const n=s.ignoreTags,a=[];for(let o=0;os?n.substring(0,s)+"…":n},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=uI.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const r=this,s=this.toHref(t.get("defaultProtocol")),n=t.get("formatHref",s,this),a=t.get("tagName",s,r),o=this.toFormattedString(t),l={},i=t.get("className",s,r),d=t.get("target",s,r),m=t.get("rel",s,r),g=t.getObj("attributes",s,r),y=t.getObj("events",s,r);return l.href=n,i&&(l.class=i),d&&(l.target=d),m&&(l.rel=m),g&&Object.assign(l,g),{tagName:a,attributes:l,content:o,eventListeners:y}}};function Lae(t,r){class s extends F7e{constructor(a,o){super(a,o),this.t=t}}for(const n in r)s.prototype[n]=r[n];return s.t=t,s}const CSe=Lae("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),MSe=Lae("text"),ewt=Lae("nl"),I8=Lae("url",{isLink:!0,toHref(t=uI.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==dI&&t[1].t===p1}}),Ym=t=>new Eh(t);function twt({groups:t}){const r=t.domain.concat([zre,$re,a1,Ure,qre,Vre,Hre,Wre,ep,N0e,cE,Gre,Kre,Zre,Mg,Xre,uE,Yre]),s=[Bre,p1,C0e,Cg,M0e,cE,dE,T0e,A0e,Tre,Are,oE,lE,Sre,Nre,Cre,Mre,Ere,Ire,Pre,Lre,Ore,Dre,Rre,Fre],n=[zre,Bre,$re,Ure,qre,Vre,Hre,Wre,ep,oE,lE,cE,Gre,Kre,Zre,dE,Mg,Xre,uE,Yre],a=Ym(),o=Ls(a,uE);Ni(o,n,o),Ni(o,t.domain,o);const l=Ym(),i=Ym(),d=Ym();Ni(a,t.domain,l),Ni(a,t.scheme,i),Ni(a,t.slashscheme,d),Ni(l,n,o),Ni(l,t.domain,l);const m=Ls(l,a1);Ls(o,a1,m),Ls(i,a1,m),Ls(d,a1,m);const g=Ls(o,Cg);Ni(g,n,o),Ni(g,t.domain,o);const y=Ym();Ni(m,t.domain,y),Ni(y,t.domain,y);const v=Ls(y,Cg);Ni(v,t.domain,y);const b=Ym(CSe);Ni(v,t.tld,b),Ni(v,t.utld,b),Ls(m,dI,b);const N=Ls(y,ep);Ls(N,ep,N),Ni(N,t.domain,y),Ni(b,t.domain,y),Ls(b,Cg,v),Ls(b,ep,N);const j=Ls(b,p1);Ni(j,t.numeric,CSe);const S=Ls(l,ep),A=Ls(l,Cg);Ls(S,ep,S),Ni(S,t.domain,l),Ni(A,n,o),Ni(A,t.domain,l);const M=Ym(I8);Ni(A,t.tld,M),Ni(A,t.utld,M),Ni(M,t.domain,l),Ni(M,n,o),Ls(M,Cg,A),Ls(M,ep,S),Ls(M,a1,m);const I=Ls(M,p1),F=Ym(I8);Ni(I,t.numeric,F);const O=Ym(I8),B=Ym();Ni(O,r,O),Ni(O,s,B),Ni(B,r,O),Ni(B,s,B),Ls(M,Mg,O),Ls(F,Mg,O);const $=Ls(i,p1),H=Ls(d,p1),W=Ls(H,Mg),X=Ls(W,Mg);Ni(i,t.domain,l),Ls(i,Cg,A),Ls(i,ep,S),Ni(d,t.domain,l),Ls(d,Cg,A),Ls(d,ep,S),Ni($,t.domain,O),Ls($,Mg,O),Ls($,dE,O),Ni(X,t.domain,O),Ni(X,r,O),Ls(X,Mg,O);const se=[[oE,lE],[Nre,Sre],[Cre,Mre],[Tre,Are],[Ere,Ire],[Pre,Lre],[Ore,Dre],[Rre,Fre]];for(let ae=0;ae=0&&v++,a++,g++;if(v<0)a-=g,a0&&(o.push(Tde(MSe,r,l)),l=[]),a-=v,g-=v;const b=y.t,N=s.slice(a-g,a);o.push(Tde(b,r,N))}}return l.length>0&&o.push(Tde(MSe,r,l)),o}function Tde(t,r,s){const n=s[0].s,a=s[s.length-1].e,o=r.slice(n,a);return new t(o,s)}const swt=typeof console<"u"&&console&&console.warn||(()=>{}),nwt="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",yl={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function awt(){return Eh.groups={},yl.scanner=null,yl.parser=null,yl.tokenQueue=[],yl.pluginQueue=[],yl.customSchemes=[],yl.initialized=!1,yl}function TSe(t,r=!1){if(yl.initialized&&swt(`linkifyjs: already initialized - will not register custom scheme "${t}" ${nwt}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. 1. Must only contain digits, lowercase ASCII letters or "-" 2. Cannot start or end with "-" 3. "-" cannot repeat`);yl.customSchemes.push([t,r])}function iwt(){yl.scanner=Q2t(yl.customSchemes);for(let t=0;t{const a=r.some(m=>m.docChanged)&&!s.doc.eq(n.doc),o=r.some(m=>m.getMeta("preventAutolink"));if(!a||o)return;const{tr:l}=n,i=F_t(s.doc,[...r]);if(H_t(i).forEach(({newRange:m})=>{const g=B_t(n.doc,m,b=>b.isTextblock);let y,v;if(g.length>1)y=g[0],v=n.doc.textBetween(y.pos,y.pos+y.node.nodeSize,void 0," ");else if(g.length){const b=n.doc.textBetween(m.from,m.to," "," ");if(!lwt.test(b))return;y=g[0],v=n.doc.textBetween(y.pos,m.to,void 0," ")}if(y&&v){const b=v.split(owt).filter(Boolean);if(b.length<=0)return!1;const N=b[b.length-1],j=y.pos+v.lastIndexOf(N);if(!N)return!1;const S=I0e(N).map(A=>A.toObject(t.defaultProtocol));if(!dwt(S))return!1;S.filter(A=>A.isLink).map(A=>({...A,from:j+A.start+1,to:j+A.end+1})).filter(A=>n.schema.marks.code?!n.doc.rangeHasMark(A.from,A.to,n.schema.marks.code):!0).filter(A=>t.validate(A.value)).filter(A=>t.shouldAutoLink(A.value)).forEach(A=>{_0e(A.from,A.to,n.doc).some(M=>M.mark.type===t.type)||l.addMark(A.from,A.to,t.type.create({href:A.href}))})}}),!!l.steps.length)return l}})}function hwt(t){return new wd({key:new Iu("handleClickLink"),props:{handleClick:(r,s,n)=>{var a,o;if(n.button!==0||!r.editable)return!1;let l=n.target;const i=[];for(;l.nodeName!=="DIV";)i.push(l),l=l.parentNode;if(!i.find(v=>v.nodeName==="A"))return!1;const d=v7e(r.state,t.type.name),m=n.target,g=(a=m==null?void 0:m.href)!==null&&a!==void 0?a:d.href,y=(o=m==null?void 0:m.target)!==null&&o!==void 0?o:d.target;return m&&g?(window.open(g,y),!0):!1}}})}function mwt(t){return new wd({key:new Iu("handlePasteLink"),props:{handlePaste:(r,s,n)=>{const{state:a}=r,{selection:o}=a,{empty:l}=o;if(l)return!1;let i="";n.content.forEach(m=>{i+=m.textContent});const d=z7e(i,{defaultProtocol:t.defaultProtocol}).find(m=>m.isLink&&m.value===i);return!i||!d?!1:t.editor.commands.setMark(t.type,{href:d.href})}}})}function L_(t,r){const s=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return r&&r.forEach(n=>{const a=typeof n=="string"?n:n.scheme;a&&s.push(a)}),!t||t.replace(cwt,"").match(new RegExp(`^(?:(?:${s.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const B7e=ox.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){TSe(t);return}TSe(t.scheme,t.optionalSlashes)})},onDestroy(){awt()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,r)=>!!L_(t,r.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const r=t.getAttribute("href");return!r||!this.options.isAllowedUri(r,{defaultValidate:s=>!!L_(s,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:r=>!!L_(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Yl(this.options.HTMLAttributes,t),0]:["a",Yl(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:r})=>{const{href:s}=t;return this.options.isAllowedUri(s,{defaultValidate:n=>!!L_(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?r().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:r})=>{const{href:s}=t;return this.options.isAllowedUri(s,{defaultValidate:n=>!!L_(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?r().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Mk({find:t=>{const r=[];if(t){const{protocols:s,defaultProtocol:n}=this.options,a=z7e(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:l=>!!L_(l,s),protocols:s,defaultProtocol:n}));a.length&&a.forEach(o=>r.push({text:o.value,data:{href:o.href},index:o.start}))}return r},type:this.type,getAttributes:t=>{var r;return{href:(r=t.data)===null||r===void 0?void 0:r.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:r,defaultProtocol:s}=this.options;return this.options.autolink&&t.push(uwt({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:n=>this.options.isAllowedUri(n,{defaultValidate:a=>!!L_(a,r),protocols:r,defaultProtocol:s}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(hwt({type:this.type})),this.options.linkOnPaste&&t.push(mwt({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),$7e=cu.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const r=t.style.textAlign;return this.options.alignments.includes(r)?r:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:r})=>this.options.alignments.includes(t)?this.options.types.map(s=>r.updateAttributes(s,{textAlign:t})).every(s=>s):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(r=>t.resetAttributes(r,"textAlign")).every(r=>r),toggleTextAlign:t=>({editor:r,commands:s})=>this.options.alignments.includes(t)?r.isActive({textAlign:t})?s.unsetTextAlign():s.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),pwt=t=>{if(!t.children.length)return;const r=t.querySelectorAll("span");r&&r.forEach(s=>{var n,a;const o=s.getAttribute("style"),l=(a=(n=s.parentElement)===null||n===void 0?void 0:n.closest("span"))===null||a===void 0?void 0:a.getAttribute("style");s.setAttribute("style",`${l};${o}`)})},U7e=ox.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&pwt(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",Yl(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:t})=>{const{selection:r}=t;return t.doc.nodesBetween(r.from,r.to,(s,n)=>{if(s.isTextblock)return!0;s.marks.filter(a=>a.type===this.type).some(a=>Object.values(a.attrs).some(o=>!!o))||t.removeMark(n,n+s.nodeSize,this.type)}),!0}}}}),fwt=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,gwt=Pu.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Yl(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:r})=>r.insertContent({type:this.name,attrs:t})}},addInputRules(){return[_7e({find:fwt,type:this.type,getAttributes:t=>{const[,,r,s,n]=t;return{src:s,alt:r,title:n}}})]}});let fpe,gpe;if(typeof WeakMap<"u"){let t=new WeakMap;fpe=r=>t.get(r),gpe=(r,s)=>(t.set(r,s),s)}else{const t=[];let s=0;fpe=n=>{for(let a=0;a(s==10&&(s=0),t[s++]=n,t[s++]=a)}var lc=class{constructor(t,r,s,n){this.width=t,this.height=r,this.map=s,this.problems=n}findCell(t){for(let r=0;r=s){(o||(o=[])).push({type:"overlong_rowspan",pos:g,n:A-I});break}const F=a+I*r;for(let O=0;On&&(o+=m.attrs.colspan)}}for(let l=0;l1&&(s=!0)}r==-1?r=o:r!=o&&(r=Math.max(r,o))}return r}function vwt(t,r,s){t.problems||(t.problems=[]);const n={};for(let a=0;a0;r--)if(t.node(r).type.spec.tableRole=="row")return t.node(0).resolve(t.before(r+1));return null}function bwt(t){for(let r=t.depth;r>0;r--){const s=t.node(r).type.spec.tableRole;if(s==="cell"||s==="header_cell")return t.node(r)}return null}function Jf(t){const r=t.selection.$head;for(let s=r.depth;s>0;s--)if(r.node(s).type.spec.tableRole=="row")return!0;return!1}function Oae(t){const r=t.selection;if("$anchorCell"in r&&r.$anchorCell)return r.$anchorCell.pos>r.$headCell.pos?r.$anchorCell:r.$headCell;if("node"in r&&r.node&&r.node.type.spec.tableRole=="cell")return r.$anchor;const s=W3(r.$head)||wwt(r.$head);if(s)return s;throw new RangeError(`No cell found around position ${r.head}`)}function wwt(t){for(let r=t.nodeAfter,s=t.pos;r;r=r.firstChild,s++){const n=r.type.spec.tableRole;if(n=="cell"||n=="header_cell")return t.doc.resolve(s)}for(let r=t.nodeBefore,s=t.pos;r;r=r.lastChild,s--){const n=r.type.spec.tableRole;if(n=="cell"||n=="header_cell")return t.doc.resolve(s-r.nodeSize)}}function xpe(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function jwt(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function L0e(t,r){return t.depth==r.depth&&t.pos>=r.start(-1)&&t.pos<=r.end(-1)}function q7e(t,r,s){const n=t.node(-1),a=lc.get(n),o=t.start(-1),l=a.nextCell(t.pos-o,r,s);return l==null?null:t.node(0).resolve(o+l)}function Tk(t,r,s=1){const n={...t,colspan:t.colspan-s};return n.colwidth&&(n.colwidth=n.colwidth.slice(),n.colwidth.splice(r,s),n.colwidth.some(a=>a>0)||(n.colwidth=null)),n}function V7e(t,r,s=1){const n={...t,colspan:t.colspan+s};if(n.colwidth){n.colwidth=n.colwidth.slice();for(let a=0;ag!=s.pos-o);d.unshift(s.pos-o);const m=d.map(g=>{const y=n.nodeAt(g);if(!y)throw new RangeError(`No cell with offset ${g} found`);const v=o+g+1;return new hze(i.resolve(v),i.resolve(v+y.content.size))});super(m[0].$from,m[0].$to,m),this.$anchorCell=r,this.$headCell=s}map(r,s){const n=r.resolve(s.map(this.$anchorCell.pos)),a=r.resolve(s.map(this.$headCell.pos));if(xpe(n)&&xpe(a)&&L0e(n,a)){const o=this.$anchorCell.node(-1)!=n.node(-1);return o&&this.isRowSelection()?Kx.rowSelection(n,a):o&&this.isColSelection()?Kx.colSelection(n,a):new Kx(n,a)}return Na.between(n,a)}content(){const r=this.$anchorCell.node(-1),s=lc.get(r),n=this.$anchorCell.start(-1),a=s.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),o={},l=[];for(let d=a.top;d0||S>0){let A=N.attrs;if(j>0&&(A=Tk(A,0,j)),S>0&&(A=Tk(A,A.colspan-S,S)),b.lefta.bottom){const A={...N.attrs,rowspan:Math.min(b.bottom,a.bottom)-Math.max(b.top,a.top)};b.top0)return!1;const n=r+this.$anchorCell.nodeAfter.attrs.rowspan,a=s+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,a)==this.$headCell.node(-1).childCount}static colSelection(r,s=r){const n=r.node(-1),a=lc.get(n),o=r.start(-1),l=a.findCell(r.pos-o),i=a.findCell(s.pos-o),d=r.node(0);return l.top<=i.top?(l.top>0&&(r=d.resolve(o+a.map[l.left])),i.bottom0&&(s=d.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)==s.width}eq(r){return r instanceof Kx&&r.$anchorCell.pos==this.$anchorCell.pos&&r.$headCell.pos==this.$headCell.pos}static rowSelection(r,s=r){const n=r.node(-1),a=lc.get(n),o=r.start(-1),l=a.findCell(r.pos-o),i=a.findCell(s.pos-o),d=r.node(0);return l.left<=i.left?(l.left>0&&(r=d.resolve(o+a.map[l.top*a.width])),i.right0&&(s=d.resolve(o+a.map[i.top*a.width])),l.right{r.push(eh.node(n,n+s.nodeSize,{class:"selectedCell"}))}),ac.create(t.doc,r)}function Cwt({$from:t,$to:r}){if(t.pos==r.pos||t.pos=0&&!(t.after(a+1)=0&&!(r.before(o+1)>r.start(o));o--,n--);return s==n&&/row|table/.test(t.node(a).type.spec.tableRole)}function Mwt({$from:t,$to:r}){let s,n;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}}for(let a=r.depth;a>0;a--){const o=r.node(a);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){n=o;break}}return s!==n&&r.parentOffset===0}function Twt(t,r,s){const n=(r||t).selection,a=(r||t).doc;let o,l;if(n instanceof va&&(l=n.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")o=dl.create(a,n.from);else if(l=="row"){const i=a.resolve(n.from+1);o=dl.rowSelection(i,i)}else if(!s){const i=lc.get(n.node),d=n.from+1,m=d+i.map[i.width*i.height-1];o=dl.create(a,d+1,m)}}else n instanceof Na&&Cwt(n)?o=Na.create(a,n.from):n instanceof Na&&Mwt(n)&&(o=Na.create(a,n.$from.start(),n.$from.end()));return o&&(r||(r=t.tr)).setSelection(o),r}const Awt=new Iu("fix-tables");function W7e(t,r,s,n){const a=t.childCount,o=r.childCount;e:for(let l=0,i=0;l{a.type.spec.tableRole=="table"&&(s=Ewt(t,a,o,s))};return r?r.doc!=t.doc&&W7e(r.doc,t.doc,0,n):t.doc.descendants(n),s}function Ewt(t,r,s,n){const a=lc.get(r);if(!a.problems)return n;n||(n=t.tr);const o=[];for(let d=0;d0){let b="cell";g.firstChild&&(b=g.firstChild.type.spec.tableRole);const N=[];for(let S=0;S0?-1:0;kwt(r,n,a+o)&&(o=a==0||a==r.width?null:0);for(let l=0;l0&&a0&&r.map[i-1]==d||a0?-1:0;Dwt(r,n,a+i)&&(i=a==0||a==r.height?null:0);for(let m=0,g=r.width*a;m0&&a0&&y==r.map[g-r.width]){const v=s.nodeAt(y).attrs;t.setNodeMarkup(t.mapping.slice(i).map(y+n),null,{...v,rowspan:v.rowspan-1}),m+=v.colspan-1}else if(a0&&s[o]==s[o-1]||n.right0&&s[a]==s[a-t]||n.bottom0){const g=d+1+m.content.size,y=ASe(m)?d+1:g;o.replaceWith(y+n.tableStart,g+n.tableStart,i)}o.setSelection(new dl(o.doc.resolve(d+n.tableStart))),r(o)}return!0}function ISe(t,r){const s=Tu(t.schema);return Uwt(({node:n})=>s[n.type.spec.tableRole])(t,r)}function Uwt(t){return(r,s)=>{const n=r.selection;let a,o;if(n instanceof dl){if(n.$anchorCell.pos!=n.$headCell.pos)return!1;a=n.$anchorCell.nodeAfter,o=n.$anchorCell.pos}else{var l;if(a=bwt(n.$from),!a)return!1;o=(l=W3(n.$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(s){let i=a.attrs;const d=[],m=i.colwidth;i.rowspan>1&&(i={...i,rowspan:1}),i.colspan>1&&(i={...i,colspan:1});const g=px(r),y=r.tr;for(let b=0;b{l.attrs[t]!==r&&o.setNodeMarkup(i,null,{...l.attrs,[t]:r})}):o.setNodeMarkup(a.pos,null,{...a.nodeAfter.attrs,[t]:r}),n(o)}return!0}}function Vwt(t){return function(r,s){if(!Jf(r))return!1;if(s){const n=Tu(r.schema),a=px(r),o=r.tr,l=a.map.cellsInRect(t=="column"?{left:a.left,top:0,right:a.right,bottom:a.map.height}:t=="row"?{left:0,top:a.top,right:a.map.width,bottom:a.bottom}:a),i=l.map(d=>a.table.nodeAt(d));for(let d=0;d{const b=v+o.tableStart,N=l.doc.nodeAt(b);N&&l.setNodeMarkup(b,y,N.attrs)}),n(l)}return!0}}hI("row",{useDeprecatedLogic:!0});hI("column",{useDeprecatedLogic:!0});const Hwt=hI("cell",{useDeprecatedLogic:!0});function Wwt(t,r){if(r<0){const s=t.nodeBefore;if(s)return t.pos-s.nodeSize;for(let n=t.index(-1)-1,a=t.before();n>=0;n--){const o=t.node(-1).child(n),l=o.lastChild;if(l)return a-1-l.nodeSize;a-=o.nodeSize}}else{if(t.index()0;n--)if(s.node(n).type.spec.tableRole=="table")return r&&r(t.tr.delete(s.before(n),s.after(n)).scrollIntoView()),!0;return!1}function P8(t,r){const s=t.selection;if(!(s instanceof dl))return!1;if(r){const n=t.tr,a=Tu(t.schema).cell.createAndFill().content;s.forEachCell((o,l)=>{o.content.eq(a)||n.replace(n.mapping.map(l+1),n.mapping.map(l+o.nodeSize-1),new sn(a,0,0))}),n.docChanged&&r(n)}return!0}function Kwt(t){if(t.size===0)return null;let{content:r,openStart:s,openEnd:n}=t;for(;r.childCount==1&&(s>0&&n>0||r.child(0).type.spec.tableRole=="table");)s--,n--,r=r.child(0).content;const a=r.child(0),o=a.type.spec.tableRole,l=a.type.schema,i=[];if(o=="row")for(let d=0;d=0;l--){const{rowspan:i,colspan:d}=o.child(l).attrs;for(let m=a;m=r.length&&r.push(_s.empty),s[a]n&&(v=v.type.createChecked(Tk(v.attrs,v.attrs.colspan,g+v.attrs.colspan-n),v.content)),m.push(v),g+=v.attrs.colspan;for(let b=1;ba&&(y=y.type.create({...y.attrs,rowspan:Math.max(1,a-y.attrs.rowspan)},y.content)),d.push(y)}o.push(_s.from(d))}s=o,r=a}return{width:t,height:r,rows:s}}function Xwt(t,r,s,n,a,o,l){const i=t.doc.type.schema,d=Tu(i);let m,g;if(a>r.width)for(let y=0,v=0;yr.height){const y=[];for(let N=0,j=(r.height-1)*r.width;N=r.width?!1:s.nodeAt(r.map[j+N]).type==d.header_cell;y.push(S?g||(g=d.header_cell.createAndFill()):m||(m=d.cell.createAndFill()))}const v=d.row.create(null,_s.from(y)),b=[];for(let N=r.height;N{if(!a)return!1;const o=s.selection;if(o instanceof dl)return tte(s,n,$a.near(o.$headCell,r));if(t!="horiz"&&!o.empty)return!1;const l=Y7e(a,t,r);if(l==null)return!1;if(t=="horiz")return tte(s,n,$a.near(s.doc.resolve(o.head+r),r));{const i=s.doc.resolve(l),d=q7e(i,t,r);let m;return d?m=$a.near(d,1):r<0?m=$a.near(s.doc.resolve(i.before(-1)),-1):m=$a.near(s.doc.resolve(i.after(-1)),1),tte(s,n,m)}}}function O8(t,r){return(s,n,a)=>{if(!a)return!1;const o=s.selection;let l;if(o instanceof dl)l=o;else{const d=Y7e(a,t,r);if(d==null)return!1;l=new dl(s.doc.resolve(d))}const i=q7e(l.$headCell,t,r);return i?tte(s,n,new dl(l.$anchorCell,i)):!1}}function Jwt(t,r){const s=t.state.doc,n=W3(s.resolve(r));return n?(t.dispatch(t.state.tr.setSelection(new dl(n))),!0):!1}function ejt(t,r,s){if(!Jf(t.state))return!1;let n=Kwt(s);const a=t.state.selection;if(a instanceof dl){n||(n={width:1,height:1,rows:[_s.from(ype(Tu(t.state.schema).cell,s))]});const o=a.$anchorCell.node(-1),l=a.$anchorCell.start(-1),i=lc.get(o).rectBetween(a.$anchorCell.pos-l,a.$headCell.pos-l);return n=Ywt(n,i.right-i.left,i.bottom-i.top),RSe(t.state,t.dispatch,l,i,n),!0}else if(n){const o=Oae(t.state),l=o.start(-1);return RSe(t.state,t.dispatch,l,lc.get(o.node(-1)).findCell(o.pos-l),n),!0}else return!1}function tjt(t,r){var s;if(r.ctrlKey||r.metaKey)return;const n=FSe(t,r.target);let a;if(r.shiftKey&&t.state.selection instanceof dl)o(t.state.selection.$anchorCell,r),r.preventDefault();else if(r.shiftKey&&n&&(a=W3(t.state.selection.$anchor))!=null&&((s=Ade(t,r))===null||s===void 0?void 0:s.pos)!=a.pos)o(a,r),r.preventDefault();else if(!n)return;function o(d,m){let g=Ade(t,m);const y=f1.getState(t.state)==null;if(!g||!L0e(d,g))if(y)g=d;else return;const v=new dl(d,g);if(y||!t.state.selection.eq(v)){const b=t.state.tr.setSelection(v);y&&b.setMeta(f1,d.pos),t.dispatch(b)}}function l(){t.root.removeEventListener("mouseup",l),t.root.removeEventListener("dragstart",l),t.root.removeEventListener("mousemove",i),f1.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(f1,-1))}function i(d){const m=d,g=f1.getState(t.state);let y;if(g!=null)y=t.state.doc.resolve(g);else if(FSe(t,m.target)!=n&&(y=Ade(t,r),!y))return l();y&&o(y,m)}t.root.addEventListener("mouseup",l),t.root.addEventListener("dragstart",l),t.root.addEventListener("mousemove",i)}function Y7e(t,r,s){if(!(t.state.selection instanceof Na))return null;const{$head:n}=t.state.selection;for(let a=n.depth-1;a>=0;a--){const o=n.node(a);if((s<0?n.index(a):n.indexAfter(a))!=(s<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){const l=n.before(a),i=r=="vert"?s>0?"down":"up":s>0?"right":"left";return t.endOfTextblock(i)?l:null}}return null}function FSe(t,r){for(;r&&r!=t.dom;r=r.parentNode)if(r.nodeName=="TD"||r.nodeName=="TH")return r;return null}function Ade(t,r){const s=t.posAtCoords({left:r.clientX,top:r.clientY});if(!s)return null;const n=s.inside>=0?s.inside:s.pos;return W3(t.state.doc.resolve(n))}var rjt=class{constructor(r,s){this.node=r,this.defaultCellMinWidth=s,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",`${s}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),vpe(r,this.colgroup,this.table,s),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(r){return r.type!=this.node.type?!1:(this.node=r,vpe(r,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(r){return r.type=="attributes"&&(r.target==this.table||this.colgroup.contains(r.target))}};function vpe(t,r,s,n,a,o){let l=0,i=!0,d=r.firstChild;const m=t.firstChild;if(m){for(let y=0,v=0;ynew n(y,s,v)),new njt(-1,!1)},apply(l,i){return i.apply(l)}},props:{attributes:l=>{const i=pm.getState(l);return i&&i.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,i)=>{ajt(l,i,t,a)},mouseleave:l=>{ijt(l)},mousedown:(l,i)=>{ojt(l,i,r,s)}},decorations:l=>{const i=pm.getState(l);if(i&&i.activeHandle>-1)return hjt(l,i.activeHandle)},nodeViews:{}}});return o}var njt=class rte{constructor(r,s){this.activeHandle=r,this.dragging=s}apply(r){const s=this,n=r.getMeta(pm);if(n&&n.setHandle!=null)return new rte(n.setHandle,!1);if(n&&n.setDragging!==void 0)return new rte(s.activeHandle,n.setDragging);if(s.activeHandle>-1&&r.docChanged){let a=r.mapping.map(s.activeHandle,-1);return xpe(r.doc.resolve(a))||(a=-1),new rte(a,s.dragging)}return s}};function ajt(t,r,s,n){if(!t.editable)return;const a=pm.getState(t.state);if(a&&!a.dragging){const o=cjt(r.target);let l=-1;if(o){const{left:i,right:d}=o.getBoundingClientRect();r.clientX-i<=s?l=zSe(t,r,"left",s):d-r.clientX<=s&&(l=zSe(t,r,"right",s))}if(l!=a.activeHandle){if(!n&&l!==-1){const i=t.state.doc.resolve(l),d=i.node(-1),m=lc.get(d),g=i.start(-1);if(m.colCount(i.pos-g)+i.nodeAfter.attrs.colspan-1==m.width-1)return}X7e(t,l)}}}function ijt(t){if(!t.editable)return;const r=pm.getState(t.state);r&&r.activeHandle>-1&&!r.dragging&&X7e(t,-1)}function ojt(t,r,s,n){var a;if(!t.editable)return!1;const o=(a=t.dom.ownerDocument.defaultView)!==null&&a!==void 0?a:window,l=pm.getState(t.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const i=t.state.doc.nodeAt(l.activeHandle),d=ljt(t,l.activeHandle,i.attrs);t.dispatch(t.state.tr.setMeta(pm,{setDragging:{startX:r.clientX,startWidth:d}}));function m(y){o.removeEventListener("mouseup",m),o.removeEventListener("mousemove",g);const v=pm.getState(t.state);v!=null&&v.dragging&&(djt(t,v.activeHandle,BSe(v.dragging,y,s)),t.dispatch(t.state.tr.setMeta(pm,{setDragging:null})))}function g(y){if(!y.which)return m(y);const v=pm.getState(t.state);if(v&&v.dragging){const b=BSe(v.dragging,y,s);$Se(t,v.activeHandle,b,n)}}return $Se(t,l.activeHandle,d,n),o.addEventListener("mouseup",m),o.addEventListener("mousemove",g),r.preventDefault(),!0}function ljt(t,r,{colspan:s,colwidth:n}){const a=n&&n[n.length-1];if(a)return a;const o=t.domAtPos(r);let l=o.node.childNodes[o.offset].offsetWidth,i=s;if(n)for(let d=0;d{const n=t.nodes[s];n.spec.tableRole&&(r[n.spec.tableRole]=n)}),t.cached.tableNodeTypes=r,r}function xjt(t,r,s,n,a){const o=gjt(t),l=[],i=[];for(let m=0;m{const{selection:r}=t.state;if(!yjt(r))return!1;let s=0;const n=y7e(r.ranges[0].$from,o=>o.type.name==="table");return n==null||n.node.descendants(o=>{if(o.type.name==="table")return!1;["tableCell","tableHeader"].includes(o.type.name)&&(s+=1)}),s===r.ranges.length?(t.commands.deleteTable(),!0):!1},vjt=Pu.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:pjt,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:r}){const{colgroup:s,tableWidth:n,tableMinWidth:a}=fjt(t,this.options.cellMinWidth),o=["table",Yl(this.options.HTMLAttributes,r,{style:n?`width: ${n}`:`min-width: ${a}`}),s,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},o]:o},addCommands(){return{insertTable:({rows:t=3,cols:r=3,withHeaderRow:s=!0}={})=>({tr:n,dispatch:a,editor:o})=>{const l=xjt(o.schema,t,r,s);if(a){const i=n.selection.from+1;n.replaceSelectionWith(l).scrollIntoView().setSelection(Na.near(n.doc.resolve(i)))}return!0},addColumnBefore:()=>({state:t,dispatch:r})=>Iwt(t,r),addColumnAfter:()=>({state:t,dispatch:r})=>Pwt(t,r),deleteColumn:()=>({state:t,dispatch:r})=>Owt(t,r),addRowBefore:()=>({state:t,dispatch:r})=>Rwt(t,r),addRowAfter:()=>({state:t,dispatch:r})=>Fwt(t,r),deleteRow:()=>({state:t,dispatch:r})=>Bwt(t,r),deleteTable:()=>({state:t,dispatch:r})=>Gwt(t,r),mergeCells:()=>({state:t,dispatch:r})=>ESe(t,r),splitCell:()=>({state:t,dispatch:r})=>ISe(t,r),toggleHeaderColumn:()=>({state:t,dispatch:r})=>hI("column")(t,r),toggleHeaderRow:()=>({state:t,dispatch:r})=>hI("row")(t,r),toggleHeaderCell:()=>({state:t,dispatch:r})=>Hwt(t,r),mergeOrSplit:()=>({state:t,dispatch:r})=>ESe(t,r)?!0:ISe(t,r),setCellAttribute:(t,r)=>({state:s,dispatch:n})=>qwt(t,r)(s,n),goToNextCell:()=>({state:t,dispatch:r})=>LSe(1)(t,r),goToPreviousCell:()=>({state:t,dispatch:r})=>LSe(-1)(t,r),fixTables:()=>({state:t,dispatch:r})=>(r&&G7e(t),!0),setCellSelection:t=>({tr:r,dispatch:s})=>{if(s){const n=dl.create(r.doc,t.anchorCell,t.headCell);r.setSelection(n)}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:D8,"Mod-Backspace":D8,Delete:D8,"Mod-Delete":D8}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[sjt({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],mjt({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const r={name:t.name,options:t.options,storage:t.storage};return{tableRole:Si(Bn(t,"tableRole",r))}}}),_jt=Pu.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Yl(this.options.HTMLAttributes,t),0]}}),bjt=Pu.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const r=t.getAttribute("colwidth");return r?r.split(",").map(n=>parseInt(n,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Yl(this.options.HTMLAttributes,t),0]}}),wjt=Pu.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const r=t.getAttribute("colwidth");return r?r.split(",").map(n=>parseInt(n,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Yl(this.options.HTMLAttributes,t),0]}});function eg({content:t,onChange:r,placeholder:s="Enter content...",minHeight:n="150px",compact:a=!1}){const[o,l]=E.useState(!1),[i,d]=E.useState(""),[m,g]=E.useState(!0),y=k7e({extensions:[A7e,B7e.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),$7e.configure({types:["heading","paragraph"]}),U7e,gwt.extend({addAttributes(){var j;return{...(j=this.parent)==null?void 0:j.call(this),width:{default:null},height:{default:null},style:{default:null}}}}).configure({inline:!0,allowBase64:!0}),vjt.extend({addAttributes(){var j;return{...(j=this.parent)==null?void 0:j.call(this),style:{default:null},width:{default:null},cellpadding:{default:null},cellspacing:{default:null},border:{default:null}}}}).configure({resizable:!1}),_jt.extend({addAttributes(){var j;return{...(j=this.parent)==null?void 0:j.call(this),style:{default:null}}}}),bjt.extend({addAttributes(){var j;return{...(j=this.parent)==null?void 0:j.call(this),style:{default:null},width:{default:null},colspan:{default:1},rowspan:{default:1},valign:{default:null}}}}),wjt.extend({addAttributes(){var j;return{...(j=this.parent)==null?void 0:j.call(this),style:{default:null},width:{default:null},colspan:{default:1},rowspan:{default:1}}}})],content:t,onUpdate:({editor:j})=>{r(j.getHTML())},editorProps:{attributes:{class:"outline-none","data-placeholder":s},handlePaste:(j,S)=>{var M;const A=(M=S.clipboardData)==null?void 0:M.items;if(!A)return!1;for(const I of Array.from(A))if(I.type.startsWith("image/")){S.preventDefault();const F=I.getAsFile();if(!F)continue;const O=new FileReader;return O.onload=B=>{var H;const $=(H=B.target)==null?void 0:H.result;j.dispatch(j.state.tr.replaceSelectionWith(j.state.schema.nodes.image.create({src:$})))},O.readAsDataURL(F),!0}return!1}}});E.useEffect(()=>{y&&t!==y.getHTML()&&y.commands.setContent(t)},[t,y]);const v=()=>{if(!y)return;const j=y.getAttributes("link").href||"",S=y.getAttributes("link").target;d(j),g(S==="_blank"),l(!0)},b=()=>{y&&(i===""?y.chain().focus().extendMarkRange("link").unsetLink().run():y.chain().focus().extendMarkRange("link").setLink({href:i,target:m?"_blank":null,rel:m?"noopener noreferrer nofollow":null}).run(),l(!1),d(""))},N=()=>{y&&y.chain().focus().extendMarkRange("link").unsetLink().run()};return y?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 p-2 border-b bg-muted/30",children:[e.jsx(Q,{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:e.jsx(_A,{className:"h-4 w-4"})}),e.jsx(Q,{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:e.jsx(bA,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-6 bg-border mx-1"}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleBold().run(),className:y.isActive("bold")?"bg-muted":"",title:"Bold",children:e.jsx(LS,{className:"h-4 w-4"})}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleItalic().run(),className:y.isActive("italic")?"bg-muted":"",title:"Italic",children:e.jsx($S,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-6 bg-border mx-1"}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleBulletList().run(),className:y.isActive("bulletList")?"bg-muted":"",title:"Bullet List",children:e.jsx(vp,{className:"h-4 w-4"})}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleOrderedList().run(),className:y.isActive("orderedList")?"bg-muted":"",title:"Numbered List",children:e.jsx(VS,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-6 bg-border mx-1"}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().setTextAlign("left").run(),className:y.isActive({textAlign:"left"})?"bg-muted":"",title:"Align Left",children:e.jsx(IS,{className:"h-4 w-4"})}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().setTextAlign("center").run(),className:y.isActive({textAlign:"center"})?"bg-muted":"",title:"Align Center",children:e.jsx(ES,{className:"h-4 w-4"})}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().setTextAlign("right").run(),className:y.isActive({textAlign:"right"})?"bg-muted":"",title:"Align Right",children:e.jsx(PS,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-6 bg-border mx-1"}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:v,className:y.isActive("link")?"bg-muted":"",title:"Add Link",children:e.jsx(Bo,{className:"h-4 w-4"})}),y.isActive("link")&&e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:N,title:"Remove Link",children:e.jsx(Bo,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-6 bg-border mx-1"}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().undo().run(),disabled:!y.can().undo(),title:"Undo",children:e.jsx(XS,{className:"h-4 w-4"})}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().redo().run(),disabled:!y.can().redo(),title:"Redo",children:e.jsx(ZS,{className:"h-4 w-4"})})]}),e.jsx(w7e,{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:n}})]}),e.jsx(Dr,{open:o,onOpenChange:l,children:e.jsxs(Lr,{className:"sm:max-w-md",children:[e.jsx(Ur,{children:e.jsx(Br,{children:"Insert Link"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"link-url",children:"URL"}),e.jsx(Qe,{id:"link-url",value:i,onChange:j=>d(j.target.value),placeholder:"https://example.com"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(xn,{id:"link-new-tab",checked:m,onCheckedChange:g}),e.jsx(Ee,{htmlFor:"link-new-tab",children:"Open in new tab"})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(Q,{type:"button",onClick:b,children:i?"Apply Link":"Remove Link"})]})]})})]}):null}var jjt=Object.defineProperty,kjt=(t,r,s)=>r in t?jjt(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s,Sl=(t,r,s)=>kjt(t,typeof r!="symbol"?r+"":r,s);const Qre={x:0,y:0,width:0,height:0,unit:"px"},H4=(t,r,s)=>Math.min(Math.max(t,r),s),Njt=(...t)=>t.filter(r=>r&&typeof r=="string").join(" "),VSe=(t,r)=>t===r||t.width===r.width&&t.height===r.height&&t.x===r.x&&t.y===r.y&&t.unit===r.unit;function Sjt(t,r,s,n){const a=Tg(t,s,n);return t.width&&(a.height=a.width/r),t.height&&(a.width=a.height*r),a.y+a.height>n&&(a.height=n-a.y,a.width=a.height*r),a.x+a.width>s&&(a.width=s-a.x,a.height=a.width/r),t.unit==="%"?i1(a,s,n):a}function Cjt(t,r,s){const n=Tg(t,r,s);return n.x=(r-n.width)/2,n.y=(s-n.height)/2,t.unit==="%"?i1(n,r,s):n}function i1(t,r,s){return t.unit==="%"?{...Qre,...t,unit:"%"}:{unit:"%",x:t.x?t.x/r*100:0,y:t.y?t.y/s*100:0,width:t.width?t.width/r*100:0,height:t.height?t.height/s*100:0}}function Tg(t,r,s){return t.unit?t.unit==="px"?{...Qre,...t,unit:"px"}:{unit:"px",x:t.x?t.x*r/100:0,y:t.y?t.y*s/100:0,width:t.width?t.width*r/100:0,height:t.height?t.height*s/100:0}:{...Qre,...t,unit:"px"}}function HSe(t,r,s,n,a,o=0,l=0,i=n,d=a){const m={...t};let g=Math.min(o,n),y=Math.min(l,a),v=Math.min(i,n),b=Math.min(d,a);r&&(r>1?(g=l?l*r:g,y=g/r,v=i*r):(y=o?o/r:y,g=y*r,b=d/r)),m.y<0&&(m.height=Math.max(m.height+m.y,y),m.y=0),m.x<0&&(m.width=Math.max(m.width+m.x,g),m.x=0);const N=n-(m.x+m.width);N<0&&(m.x=Math.min(m.x,n-g),m.width+=N);const j=a-(m.y+m.height);if(j<0&&(m.y=Math.min(m.y,a-y),m.height+=j),m.widthv&&((s==="sw"||s=="nw")&&(m.x-=v-m.width),m.width=v),m.height>b&&((s==="nw"||s=="ne")&&(m.y-=b-m.height),m.height=b),r){const S=m.width/m.height;if(Sr){const A=Math.max(m.height*r,g);(s==="sw"||s=="nw")&&(m.x-=A-m.width),m.width=A}}return m}function Mjt(t,r,s,n){const a={...t};return r==="ArrowLeft"?n==="nw"?(a.x-=s,a.y-=s,a.width+=s,a.height+=s):n==="w"?(a.x-=s,a.width+=s):n==="sw"?(a.x-=s,a.width+=s,a.height+=s):n==="ne"?(a.y+=s,a.width-=s,a.height-=s):n==="e"?a.width-=s:n==="se"&&(a.width-=s,a.height-=s):r==="ArrowRight"&&(n==="nw"?(a.x+=s,a.y+=s,a.width-=s,a.height-=s):n==="w"?(a.x+=s,a.width-=s):n==="sw"?(a.x+=s,a.width-=s,a.height-=s):n==="ne"?(a.y-=s,a.width+=s,a.height+=s):n==="e"?a.width+=s:n==="se"&&(a.width+=s,a.height+=s)),r==="ArrowUp"?n==="nw"?(a.x-=s,a.y-=s,a.width+=s,a.height+=s):n==="n"?(a.y-=s,a.height+=s):n==="ne"?(a.y-=s,a.width+=s,a.height+=s):n==="sw"?(a.x+=s,a.width-=s,a.height-=s):n==="s"?a.height-=s:n==="se"&&(a.width-=s,a.height-=s):r==="ArrowDown"&&(n==="nw"?(a.x+=s,a.y+=s,a.width-=s,a.height-=s):n==="n"?(a.y+=s,a.height-=s):n==="ne"?(a.y+=s,a.width-=s,a.height-=s):n==="sw"?(a.x-=s,a.width+=s,a.height+=s):n==="s"?a.height+=s:n==="se"&&(a.width+=s,a.height+=s)),a}const W4={capture:!0,passive:!1};let Tjt=0;const K0=class mf extends E.PureComponent{constructor(){super(...arguments),Sl(this,"docMoveBound",!1),Sl(this,"mouseDownOnCrop",!1),Sl(this,"dragStarted",!1),Sl(this,"evData",{startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0}),Sl(this,"componentRef",E.createRef()),Sl(this,"mediaRef",E.createRef()),Sl(this,"resizeObserver"),Sl(this,"initChangeCalled",!1),Sl(this,"instanceId",`rc-${Tjt++}`),Sl(this,"state",{cropIsActive:!1,newCropIsBeingDrawn:!1}),Sl(this,"onCropPointerDown",r=>{const{crop:s,disabled:n}=this.props,a=this.getBox();if(!s)return;const o=Tg(s,a.width,a.height);if(n)return;r.cancelable&&r.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const l=r.target.dataset.ord,i=!!l;let d=r.clientX,m=r.clientY,g=o.x,y=o.y;if(l){const v=r.clientX-a.x,b=r.clientY-a.y;let N=0,j=0;l==="ne"||l=="e"?(N=v-(o.x+o.width),j=b-o.y,g=o.x,y=o.y+o.height):l==="se"||l==="s"?(N=v-(o.x+o.width),j=b-(o.y+o.height),g=o.x,y=o.y):l==="sw"||l=="w"?(N=v-o.x,j=b-(o.y+o.height),g=o.x+o.width,y=o.y):(l==="nw"||l=="n")&&(N=v-o.x,j=b-o.y,g=o.x+o.width,y=o.y+o.height),d=g+a.x+N,m=y+a.y+j}this.evData={startClientX:d,startClientY:m,startCropX:g,startCropY:y,clientX:r.clientX,clientY:r.clientY,isResize:i,ord:l},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})}),Sl(this,"onComponentPointerDown",r=>{const{crop:s,disabled:n,locked:a,keepSelection:o,onChange:l}=this.props,i=this.getBox();if(n||a||o&&s)return;r.cancelable&&r.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const d=r.clientX-i.x,m=r.clientY-i.y,g={unit:"px",x:d,y:m,width:0,height:0};this.evData={startClientX:r.clientX,startClientY:r.clientY,startCropX:d,startCropY:m,clientX:r.clientX,clientY:r.clientY,isResize:!0},this.mouseDownOnCrop=!0,l(Tg(g,i.width,i.height),i1(g,i.width,i.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})}),Sl(this,"onDocPointerMove",r=>{const{crop:s,disabled:n,onChange:a,onDragStart:o}=this.props,l=this.getBox();if(n||!s||!this.mouseDownOnCrop)return;r.cancelable&&r.preventDefault(),this.dragStarted||(this.dragStarted=!0,o&&o(r));const{evData:i}=this;i.clientX=r.clientX,i.clientY=r.clientY;let d;i.isResize?d=this.resizeCrop():d=this.dragCrop(),VSe(s,d)||a(Tg(d,l.width,l.height),i1(d,l.width,l.height))}),Sl(this,"onComponentKeyDown",r=>{const{crop:s,disabled:n,onChange:a,onComplete:o}=this.props;if(n)return;const l=r.key;let i=!1;if(!s)return;const d=this.getBox(),m=this.makePixelCrop(d),g=(navigator.platform.match("Mac")?r.metaKey:r.ctrlKey)?mf.nudgeStepLarge:r.shiftKey?mf.nudgeStepMedium:mf.nudgeStep;if(l==="ArrowLeft"?(m.x-=g,i=!0):l==="ArrowRight"?(m.x+=g,i=!0):l==="ArrowUp"?(m.y-=g,i=!0):l==="ArrowDown"&&(m.y+=g,i=!0),i){r.cancelable&&r.preventDefault(),m.x=H4(m.x,0,d.width-m.width),m.y=H4(m.y,0,d.height-m.height);const y=Tg(m,d.width,d.height),v=i1(m,d.width,d.height);a(y,v),o&&o(y,v)}}),Sl(this,"onHandlerKeyDown",(r,s)=>{const{aspect:n=0,crop:a,disabled:o,minWidth:l=0,minHeight:i=0,maxWidth:d,maxHeight:m,onChange:g,onComplete:y}=this.props,v=this.getBox();if(o||!a)return;if(r.key==="ArrowUp"||r.key==="ArrowDown"||r.key==="ArrowLeft"||r.key==="ArrowRight")r.stopPropagation(),r.preventDefault();else return;const b=(navigator.platform.match("Mac")?r.metaKey:r.ctrlKey)?mf.nudgeStepLarge:r.shiftKey?mf.nudgeStepMedium:mf.nudgeStep,N=Tg(a,v.width,v.height),j=Mjt(N,r.key,b,s),S=HSe(j,n,s,v.width,v.height,l,i,d,m);if(!VSe(a,S)){const A=i1(S,v.width,v.height);g(S,A),y&&y(S,A)}}),Sl(this,"onDocPointerDone",r=>{const{crop:s,disabled:n,onComplete:a,onDragEnd:o}=this.props,l=this.getBox();this.unbindDocMove(),!(n||!s)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,o&&o(r),a&&a(Tg(s,l.width,l.height),i1(s,l.width,l.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))}),Sl(this,"onDragFocus",()=>{var r;(r=this.componentRef.current)==null||r.scrollTo(0,0)})}get document(){return document}getBox(){const r=this.mediaRef.current;if(!r)return{x:0,y:0,width:0,height:0};const{x:s,y:n,width:a,height:o}=r.getBoundingClientRect();return{x:s,y:n,width:a,height:o}}componentDidUpdate(r){const{crop:s,onComplete:n}=this.props;if(n&&!r.crop&&s){const{width:a,height:o}=this.getBox();a&&o&&n(Tg(s,a,o),i1(s,a,o))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,W4),this.document.addEventListener("pointerup",this.onDocPointerDone,W4),this.document.addEventListener("pointercancel",this.onDocPointerDone,W4),this.docMoveBound=!0)}unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,W4),this.document.removeEventListener("pointerup",this.onDocPointerDone,W4),this.document.removeEventListener("pointercancel",this.onDocPointerDone,W4),this.docMoveBound=!1)}getCropStyle(){const{crop:r}=this.props;if(r)return{top:`${r.y}${r.unit}`,left:`${r.x}${r.unit}`,width:`${r.width}${r.unit}`,height:`${r.height}${r.unit}`}}dragCrop(){const{evData:r}=this,s=this.getBox(),n=this.makePixelCrop(s),a=r.clientX-r.startClientX,o=r.clientY-r.startClientY;return n.x=H4(r.startCropX+a,0,s.width-n.width),n.y=H4(r.startCropY+o,0,s.height-n.height),n}getPointRegion(r,s,n,a){const{evData:o}=this,l=o.clientX-r.x,i=o.clientY-r.y;let d;a&&s?d=s==="nw"||s==="n"||s==="ne":d=i1?o?[o,o/s]:[l*s,l]:l?[l*s,l]:[o,o/s]}resizeCrop(){const{evData:r}=this,{aspect:s=0,maxWidth:n,maxHeight:a}=this.props,o=this.getBox(),[l,i]=this.resolveMinDimensions(o,s,this.props.minWidth,this.props.minHeight);let d=this.makePixelCrop(o);const m=this.getPointRegion(o,r.ord,l,i),g=r.ord||m;let y=r.clientX-r.startClientX,v=r.clientY-r.startClientY;(l&&g==="nw"||g==="w"||g==="sw")&&(y=Math.min(y,-l)),(i&&g==="nw"||g==="n"||g==="ne")&&(v=Math.min(v,-i));const b={unit:"px",x:0,y:0,width:0,height:0};m==="ne"?(b.x=r.startCropX,b.width=y,s?(b.height=b.width/s,b.y=r.startCropY-b.height):(b.height=Math.abs(v),b.y=r.startCropY-b.height)):m==="se"?(b.x=r.startCropX,b.y=r.startCropY,b.width=y,s?b.height=b.width/s:b.height=v):m==="sw"?(b.x=r.startCropX+y,b.y=r.startCropY,b.width=Math.abs(y),s?b.height=b.width/s:b.height=v):m==="nw"&&(b.x=r.startCropX+y,b.width=Math.abs(y),s?(b.height=b.width/s,b.y=r.startCropY-b.height):(b.height=Math.abs(v),b.y=r.startCropY+v));const N=HSe(b,s,m,o.width,o.height,l,i,n,a);return s||mf.xyOrds.indexOf(g)>-1?d=N:mf.xOrds.indexOf(g)>-1?(d.x=N.x,d.width=N.width):mf.yOrds.indexOf(g)>-1&&(d.y=N.y,d.height=N.height),d.x=H4(d.x,0,o.width-d.width),d.y=H4(d.y,0,o.height-d.height),d}renderCropSelection(){const{ariaLabels:r=mf.defaultProps.ariaLabels,disabled:s,locked:n,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":r.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!s&&!n&<.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":r.nwDragHandle,onKeyDown:d=>this.onHandlerKeyDown(d,"nw"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":r.nDragHandle,onKeyDown:d=>this.onHandlerKeyDown(d,"n"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":r.neDragHandle,onKeyDown:d=>this.onHandlerKeyDown(d,"ne"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":r.eDragHandle,onKeyDown:d=>this.onHandlerKeyDown(d,"e"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":r.seDragHandle,onKeyDown:d=>this.onHandlerKeyDown(d,"se"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":r.sDragHandle,onKeyDown:d=>this.onHandlerKeyDown(d,"s"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":r.swDragHandle,onKeyDown:d=>this.onHandlerKeyDown(d,"sw"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":r.wDragHandle,onKeyDown:d=>this.onHandlerKeyDown(d,"w"),role:"button"})),a&<.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:d=>d.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(r){const s={...Qre,...this.props.crop||{}};return Tg(s,r.width,r.height)}render(){const{aspect:r,children:s,circularCrop:n,className:a,crop:o,disabled:l,locked:i,style:d,ruleOfThirds:m}=this.props,{cropIsActive:g,newCropIsBeingDrawn:y}=this.state,v=o?this.renderCropSelection():null,b=Njt("ReactCrop",a,g&&"ReactCrop--active",l&&"ReactCrop--disabled",i&&"ReactCrop--locked",y&&"ReactCrop--new-crop",o&&r&&"ReactCrop--fixed-aspect",o&&n&&"ReactCrop--circular-crop",o&&m&&"ReactCrop--rule-of-thirds",!this.dragStarted&&o&&!o.width&&!o.height&&"ReactCrop--invisible-crop",n&&"ReactCrop--no-animate");return lt.createElement("div",{ref:this.componentRef,className:b,style:d},lt.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},s),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"}),n?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,v)}};Sl(K0,"xOrds",["e","w"]),Sl(K0,"yOrds",["n","s"]),Sl(K0,"xyOrds",["nw","ne","se","sw"]),Sl(K0,"nudgeStep",1),Sl(K0,"nudgeStepMedium",10),Sl(K0,"nudgeStepLarge",100),Sl(K0,"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 Ajt=K0;var Q7e=["PageUp","PageDown"],J7e=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],e9e={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},G3="Slider",[bpe,Ejt,Ijt]=oP(G3),[t9e]=fc(G3,[Ijt]),[Pjt,Dae]=t9e(G3),r9e=E.forwardRef((t,r)=>{const{name:s,min:n=0,max:a=100,step:o=1,orientation:l="horizontal",disabled:i=!1,minStepsBetweenThumbs:d=0,defaultValue:m=[n],value:g,onValueChange:y=()=>{},onValueCommit:v=()=>{},inverted:b=!1,form:N,...j}=t,S=E.useRef(new Set),A=E.useRef(0),I=l==="horizontal"?Ljt:Ojt,[F=[],O]=oh({prop:g,defaultProp:m,onChange:se=>{var le;(le=[...S.current][A.current])==null||le.focus(),y(se)}}),B=E.useRef(F);function $(se){const ae=Bjt(F,se);X(se,ae)}function H(se){X(se,A.current)}function W(){const se=B.current[A.current];F[A.current]!==se&&v(F)}function X(se,ae,{commit:le}={commit:!1}){const ne=Vjt(o),fe=Hjt(Math.round((se-n)/o)*o+n,ne),oe=YE(fe,[n,a]);O((de=[])=>{const ue=Fjt(de,oe,ae);if(qjt(ue,d*o)){A.current=ue.indexOf(oe);const xe=String(ue)!==String(de);return xe&&le&&v(ue),xe?ue:de}else return de})}return e.jsx(Pjt,{scope:t.__scopeSlider,name:s,disabled:i,min:n,max:a,valueIndexToChangeRef:A,thumbs:S.current,values:F,orientation:l,form:N,children:e.jsx(bpe.Provider,{scope:t.__scopeSlider,children:e.jsx(bpe.Slot,{scope:t.__scopeSlider,children:e.jsx(I,{"aria-disabled":i,"data-disabled":i?"":void 0,...j,ref:r,onPointerDown:bs(j.onPointerDown,()=>{i||(B.current=F)}),min:n,max:a,inverted:b,onSlideStart:i?void 0:$,onSlideMove:i?void 0:H,onSlideEnd:i?void 0:W,onHomeKeyDown:()=>!i&&X(n,0,{commit:!0}),onEndKeyDown:()=>!i&&X(a,F.length-1,{commit:!0}),onStepKeyDown:({event:se,direction:ae})=>{if(!i){const fe=Q7e.includes(se.key)||se.shiftKey&&J7e.includes(se.key)?10:1,oe=A.current,de=F[oe],ue=o*fe*ae;X(de+ue,oe,{commit:!0})}}})})})})});r9e.displayName=G3;var[s9e,n9e]=t9e(G3,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Ljt=E.forwardRef((t,r)=>{const{min:s,max:n,dir:a,inverted:o,onSlideStart:l,onSlideMove:i,onSlideEnd:d,onStepKeyDown:m,...g}=t,[y,v]=E.useState(null),b=ga(r,I=>v(I)),N=E.useRef(void 0),j=Bk(a),S=j==="ltr",A=S&&!o||!S&&o;function M(I){const F=N.current||y.getBoundingClientRect(),O=[0,F.width],$=O0e(O,A?[s,n]:[n,s]);return N.current=F,$(I-F.left)}return e.jsx(s9e,{scope:t.__scopeSlider,startEdge:A?"left":"right",endEdge:A?"right":"left",direction:A?1:-1,size:"width",children:e.jsx(a9e,{dir:j,"data-orientation":"horizontal",...g,ref:b,style:{...g.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:I=>{const F=M(I.clientX);l==null||l(F)},onSlideMove:I=>{const F=M(I.clientX);i==null||i(F)},onSlideEnd:()=>{N.current=void 0,d==null||d()},onStepKeyDown:I=>{const O=e9e[A?"from-left":"from-right"].includes(I.key);m==null||m({event:I,direction:O?-1:1})}})})}),Ojt=E.forwardRef((t,r)=>{const{min:s,max:n,inverted:a,onSlideStart:o,onSlideMove:l,onSlideEnd:i,onStepKeyDown:d,...m}=t,g=E.useRef(null),y=ga(r,g),v=E.useRef(void 0),b=!a;function N(j){const S=v.current||g.current.getBoundingClientRect(),A=[0,S.height],I=O0e(A,b?[n,s]:[s,n]);return v.current=S,I(j-S.top)}return e.jsx(s9e,{scope:t.__scopeSlider,startEdge:b?"bottom":"top",endEdge:b?"top":"bottom",size:"height",direction:b?1:-1,children:e.jsx(a9e,{"data-orientation":"vertical",...m,ref:y,style:{...m.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:j=>{const S=N(j.clientY);o==null||o(S)},onSlideMove:j=>{const S=N(j.clientY);l==null||l(S)},onSlideEnd:()=>{v.current=void 0,i==null||i()},onStepKeyDown:j=>{const A=e9e[b?"from-bottom":"from-top"].includes(j.key);d==null||d({event:j,direction:A?-1:1})}})})}),a9e=E.forwardRef((t,r)=>{const{__scopeSlider:s,onSlideStart:n,onSlideMove:a,onSlideEnd:o,onHomeKeyDown:l,onEndKeyDown:i,onStepKeyDown:d,...m}=t,g=Dae(G3,s);return e.jsx(qs.span,{...m,ref:r,onKeyDown:bs(t.onKeyDown,y=>{y.key==="Home"?(l(y),y.preventDefault()):y.key==="End"?(i(y),y.preventDefault()):Q7e.concat(J7e).includes(y.key)&&(d(y),y.preventDefault())}),onPointerDown:bs(t.onPointerDown,y=>{const v=y.target;v.setPointerCapture(y.pointerId),y.preventDefault(),g.thumbs.has(v)?v.focus():n(y)}),onPointerMove:bs(t.onPointerMove,y=>{y.target.hasPointerCapture(y.pointerId)&&a(y)}),onPointerUp:bs(t.onPointerUp,y=>{const v=y.target;v.hasPointerCapture(y.pointerId)&&(v.releasePointerCapture(y.pointerId),o(y))})})}),i9e="SliderTrack",o9e=E.forwardRef((t,r)=>{const{__scopeSlider:s,...n}=t,a=Dae(i9e,s);return e.jsx(qs.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...n,ref:r})});o9e.displayName=i9e;var wpe="SliderRange",l9e=E.forwardRef((t,r)=>{const{__scopeSlider:s,...n}=t,a=Dae(wpe,s),o=n9e(wpe,s),l=E.useRef(null),i=ga(r,l),d=a.values.length,m=a.values.map(v=>u9e(v,a.min,a.max)),g=d>1?Math.min(...m):0,y=100-Math.max(...m);return e.jsx(qs.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...n,ref:i,style:{...t.style,[o.startEdge]:g+"%",[o.endEdge]:y+"%"}})});l9e.displayName=wpe;var jpe="SliderThumb",c9e=E.forwardRef((t,r)=>{const s=Ejt(t.__scopeSlider),[n,a]=E.useState(null),o=ga(r,i=>a(i)),l=E.useMemo(()=>n?s().findIndex(i=>i.ref.current===n):-1,[s,n]);return e.jsx(Djt,{...t,ref:o,index:l})}),Djt=E.forwardRef((t,r)=>{const{__scopeSlider:s,index:n,name:a,...o}=t,l=Dae(jpe,s),i=n9e(jpe,s),[d,m]=E.useState(null),g=ga(r,M=>m(M)),y=d?l.form||!!d.closest("form"):!0,v=dP(d),b=l.values[n],N=b===void 0?0:u9e(b,l.min,l.max),j=zjt(n,l.values.length),S=v==null?void 0:v[i.size],A=S?$jt(S,N,i.direction):0;return E.useEffect(()=>{if(d)return l.thumbs.add(d),()=>{l.thumbs.delete(d)}},[d,l.thumbs]),e.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[i.startEdge]:`calc(${N}% + ${A}px)`},children:[e.jsx(bpe.ItemSlot,{scope:t.__scopeSlider,children:e.jsx(qs.span,{role:"slider","aria-label":t["aria-label"]||j,"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:g,style:b===void 0?{display:"none"}:t.style,onFocus:bs(t.onFocus,()=>{l.valueIndexToChangeRef.current=n})})}),y&&e.jsx(d9e,{name:a??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:b},n)]})});c9e.displayName=jpe;var Rjt="RadioBubbleInput",d9e=E.forwardRef(({__scopeSlider:t,value:r,...s},n)=>{const a=E.useRef(null),o=ga(a,n),l=wP(r);return E.useEffect(()=>{const i=a.current;if(!i)return;const d=window.HTMLInputElement.prototype,g=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==r&&g){const y=new Event("input",{bubbles:!0});g.call(i,r),i.dispatchEvent(y)}},[l,r]),e.jsx(qs.input,{style:{display:"none"},...s,ref:o,defaultValue:r})});d9e.displayName=Rjt;function Fjt(t=[],r,s){const n=[...t];return n[s]=r,n.sort((a,o)=>a-o)}function u9e(t,r,s){const o=100/(s-r)*(t-r);return YE(o,[0,100])}function zjt(t,r){return r>2?`Value ${t+1} of ${r}`:r===2?["Minimum","Maximum"][t]:void 0}function Bjt(t,r){if(t.length===1)return 0;const s=t.map(a=>Math.abs(a-r)),n=Math.min(...s);return s.indexOf(n)}function $jt(t,r,s){const n=t/2,o=O0e([0,50],[0,n]);return(n-o(r)*s)*s}function Ujt(t){return t.slice(0,-1).map((r,s)=>t[s+1]-r)}function qjt(t,r){if(r>0){const s=Ujt(t);return Math.min(...s)>=r}return!0}function O0e(t,r){return s=>{if(t[0]===t[1]||r[0]===r[1])return r[0];const n=(r[1]-r[0])/(t[1]-t[0]);return r[0]+n*(s-t[0])}}function Vjt(t){return(String(t).split(".")[1]||"").length}function Hjt(t,r){const s=Math.pow(10,r);return Math.round(t*s)/s}var h9e=r9e,Wjt=o9e,Gjt=l9e,Kjt=c9e;const If=E.forwardRef(({className:t,...r},s)=>e.jsxs(h9e,{ref:s,className:qt("relative flex w-full touch-none select-none items-center",t),...r,children:[e.jsx(Wjt,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:e.jsx(Gjt,{className:"absolute h-full bg-primary"})}),e.jsx(Kjt,{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"})]}));If.displayName=h9e.displayName;function Zjt(t,r,s){return Cjt(Sjt({unit:"%",width:90},s,t,r),t,r)}const D0e=({open:t,onClose:r,imageSrc:s,onCropComplete:n,aspectRatio:a=1})=>{const o=E.useRef(null),[l,i]=E.useState(),[d,m]=E.useState(),[g,y]=E.useState(1),[v,b]=E.useState(0),N=E.useCallback(A=>{const{width:M,height:I}=A.currentTarget;i(Zjt(M,I,a))},[a]),j=E.useCallback(async()=>{const A=o.current;if(!A||!d)return;const M=document.createElement("canvas"),I=M.getContext("2d");if(!I)return;const F=A.naturalWidth/A.width,O=A.naturalHeight/A.height,B=400;M.width=B,M.height=B,I.imageSmoothingQuality="high";const $=d.x*F,H=d.y*O,W=d.width*F,X=d.height*O,se=v*Math.PI/180,ae=M.width/2,le=M.height/2;return I.save(),I.translate(ae,le),I.rotate(se),I.scale(g,g),I.translate(-ae,-le),I.drawImage(A,$,H,W,X,0,0,B,B),I.restore(),new Promise((ne,fe)=>{M.toBlob(oe=>{oe?ne(oe):fe(new Error("Canvas is empty"))},"image/jpeg",.95)})},[d,g,v]),S=async()=>{try{const A=await j();A&&(n(A),r())}catch(A){console.error("Error cropping image:",A)}};return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"max-w-lg",children:[e.jsx(Ur,{children:e.jsx(Br,{children:"Crop Your Photo"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"relative max-h-[400px] overflow-hidden rounded-lg bg-muted flex items-center justify-center",children:e.jsx(Ajt,{crop:l,onChange:(A,M)=>i(M),onComplete:A=>m(A),aspect:a,circularCrop:!0,className:"max-h-[400px]",children:e.jsx("img",{ref:o,src:s,alt:"Crop preview",style:{transform:`scale(${g}) rotate(${v}deg)`,maxHeight:"400px",width:"auto"},onLoad:N})})}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(JS,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(If,{value:[g],min:.5,max:3,step:.1,onValueChange:([A])=>y(A),className:"flex-1"}),e.jsx(QS,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(RA,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(If,{value:[v],min:-180,max:180,step:1,onValueChange:([A])=>b(A),className:"flex-1"}),e.jsxs("span",{className:"text-sm text-muted-foreground w-12",children:[v,"°"]})]})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:r,children:"Cancel"}),e.jsx(Q,{onClick:S,children:"Save Photo"})]})]})})},Yjt=()=>{const{user:t}=Gr(),{toast:r}=fi(),[s,n]=E.useState(!1),[a,o]=E.useState(!1),[l,i]=E.useState(null);E.useEffect(()=>{t&&d()},[t]);const d=async()=>{n(!0);try{const{data:y}=await Z.from("profiles").select("subscription_status, subscription_product_id, subscription_end_date, is_grandfathered").eq("id",t==null?void 0:t.id).single();y&&i({status:y.subscription_status||"none",productId:y.subscription_product_id,endDate:y.subscription_end_date,isGrandfathered:y.is_grandfathered||!1})}catch(y){console.error("Error loading subscription:",y)}finally{n(!1)}},m=async()=>{o(!0);try{const{data:{session:y}}=await Z.auth.getSession();if(!y)throw new Error("Not authenticated");const{data:v,error:b}=await Z.functions.invoke("customer-portal",{headers:{Authorization:`Bearer ${y.access_token}`}});if(b)throw b;v!=null&&v.url&&window.open(v.url,"_blank")}catch(y){console.error("Error opening customer portal:",y),r({title:"Error",description:y.message||"Failed to open billing portal",variant:"destructive"})}finally{o(!1)}},g=()=>{if(l!=null&&l.isGrandfathered)return e.jsx(bt,{className:"bg-amber-500",children:"Grandfathered"});switch(l==null?void 0:l.status){case"active":return e.jsx(bt,{className:"bg-green-500",children:"Active"});case"trialing":return e.jsx(bt,{className:"bg-blue-500",children:"Trial"});case"past_due":return e.jsx(bt,{variant:"destructive",children:"Past Due"});case"canceled":return e.jsx(bt,{variant:"secondary",children:"Canceled"});default:return e.jsx(bt,{variant:"outline",children:"No Subscription"})}};return s?e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(gp,{className:"h-5 w-5"}),"Subscription"]})}),e.jsx(qe,{children:e.jsx("div",{className:"flex items-center justify-center py-4",children:e.jsx(Hr,{className:"h-6 w-6 animate-spin text-muted-foreground"})})})]}):e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(gp,{className:"h-5 w-5"}),"Subscription"]}),e.jsx(Ss,{children:"Manage your subscription and billing"})]}),e.jsxs(qe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Status"}),e.jsx("div",{className:"mt-1",children:g()})]}),(l==null?void 0:l.endDate)&&l.status==="active"&&e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Next billing date"}),e.jsx("p",{className:"font-medium",children:new Date(l.endDate).toLocaleDateString()})]})]}),l!=null&&l.isGrandfathered?e.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"?e.jsxs(e.Fragment,{children:[(l==null?void 0:l.status)==="trialing"&&(l==null?void 0:l.endDate)&&e.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."]}),e.jsxs(Q,{onClick:m,variant:"outline",disabled:a,children:[a?e.jsx(Hr,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(En,{className:"mr-2 h-4 w-4"}),"Manage Billing"]})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"You don't have an active subscription."})]})]})},Xjt=()=>{const{user:t}=Gr(),r=Ws(),{toast:s}=fi(),[n]=Bc(),a=n.get("setup")==="true",o=n.get("reset")==="true",{isSupported:l,isSubscribed:i,isLoading:d,subscribe:m,unsubscribe:g}=ERe(),[y,v]=E.useState(!1),[b,N]=E.useState(""),[j,S]=E.useState(!1),[A,M]=E.useState(!1),[I,F]=E.useState(""),[O,B]=E.useState({name:"",email:"",title:"",bio:"",areas_served:"",years_experience:"",instagram_url:"",facebook_url:"",linkedin_url:"",email_signature:"",use_email_signature:!1}),[$,H]=E.useState(!1),[W,X]=E.useState(!1),[se,ae]=E.useState({newPassword:"",confirmPassword:""});E.useEffect(()=>{t&&le()},[t]),E.useEffect(()=>{o&&t&&setTimeout(()=>{var ue;(ue=document.getElementById("change-password-section"))==null||ue.scrollIntoView({behavior:"smooth",block:"center"})},500)},[o,t]);const le=async()=>{var ue,xe,Te;if(!(t!=null&&t.id)){console.log("No user ID available yet");return}try{console.log("Loading profile for user:",t.id);const{data:be,error:we}=await Z.from("profiles").select("name, email, digest_opt_out, title, bio, areas_served, years_experience, instagram_url, facebook_url, linkedin_url, email_signature, use_email_signature").eq("id",t.id).maybeSingle();if(we)throw console.error("Profile query error:",we),we;be?(console.log("Profile loaded successfully:",be),B({name:be.name||"",email:be.email||"",title:be.title||"",bio:be.bio||"",areas_served:be.areas_served||"",years_experience:((ue=be.years_experience)==null?void 0:ue.toString())||"",instagram_url:be.instagram_url||"",facebook_url:be.facebook_url||"",linkedin_url:be.linkedin_url||"",email_signature:be.email_signature||"",use_email_signature:be.use_email_signature||!1}),H(be.digest_opt_out||!1)):(console.warn("No profile found for user"),B({name:((xe=t.user_metadata)==null?void 0:xe.name)||((Te=t.email)==null?void 0:Te.split("@")[0])||"",email:t.email||"",title:"",bio:"",areas_served:"",years_experience:"",instagram_url:"",facebook_url:"",linkedin_url:"",email_signature:"",use_email_signature:!1}));const{data:ve}=await Z.storage.from("avatars").list(`${t.id}`);if(ve&&ve.length>0){const{data:tt}=Z.storage.from("avatars").getPublicUrl(`${t.id}/${ve[0].name}`);N(tt.publicUrl)}}catch(be){console.error("Error loading profile:",be),s({title:"Error",description:be.message||"Failed to load profile",variant:"destructive"})}},ne=ue=>{var be;const xe=(be=ue.target.files)==null?void 0:be[0];if(!xe)return;const Te=new FileReader;Te.onloadend=()=>{F(Te.result),M(!0)},Te.readAsDataURL(xe),ue.target.value=""},fe=async ue=>{if(t){S(!0);try{const{data:xe}=await Z.storage.from("avatars").list(`${t.id}`);xe&&xe.length>0&&await Z.storage.from("avatars").remove(xe.map(tt=>`${t.id}/${tt.name}`));const be=`${t.id}/avatar.jpg`,{error:we}=await Z.storage.from("avatars").upload(be,ue,{upsert:!0,contentType:"image/jpeg"});if(we)throw we;const{data:ve}=Z.storage.from("avatars").getPublicUrl(be);N(`${ve.publicUrl}?t=${Date.now()}`),s({title:"Success",description:"Profile photo updated successfully"})}catch(xe){console.error("Error uploading avatar:",xe),s({title:"Error",description:xe.message||"Failed to upload photo",variant:"destructive"})}finally{S(!1)}}},oe=async()=>{if(!O.name.trim()||!O.email.trim()){s({title:"Error",description:"Name and email are required",variant:"destructive"});return}v(!0);try{const{error:ue}=await Z.from("profiles").update({name:O.name.trim(),email:O.email.trim(),title:O.title.trim()||null,bio:O.bio.trim()||null,areas_served:O.areas_served.trim()||null,years_experience:O.years_experience?parseInt(O.years_experience):null,instagram_url:O.instagram_url.trim()||null,facebook_url:O.facebook_url.trim()||null,linkedin_url:O.linkedin_url.trim()||null,email_signature:O.email_signature||"",use_email_signature:O.use_email_signature}).eq("id",t==null?void 0:t.id);if(ue)throw ue;s({title:"Success",description:"Profile updated successfully"})}catch(ue){console.error("Error updating profile:",ue),s({title:"Error",description:ue.message||"Failed to update profile",variant:"destructive"})}finally{v(!1)}},de=async()=>{if(!se.newPassword){s({title:"Error",description:"Please enter a new password",variant:"destructive"});return}if(se.newPassword.length<6){s({title:"Error",description:"Password must be at least 6 characters",variant:"destructive"});return}if(se.newPassword!==se.confirmPassword){s({title:"Error",description:"Passwords do not match",variant:"destructive"});return}v(!0);try{const{error:ue}=await Z.auth.updateUser({password:se.newPassword});if(ue)throw ue;s({title:"Success",description:"Password updated successfully"}),ae({newPassword:"",confirmPassword:""}),a&&setTimeout(()=>r("/dashboard"),1e3)}catch(ue){console.error("Error updating password:",ue),s({title:"Error",description:ue.message||"Failed to update password",variant:"destructive"})}finally{v(!1)}};return e.jsx(Fr,{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:e.jsxs("div",{className:"mx-auto max-w-4xl",children:[!a&&!o&&e.jsx("div",{className:"mb-6",children:e.jsxs(Q,{variant:"outline",onClick:()=>{var ue;(ue=document.getElementById("change-password-section"))==null||ue.scrollIntoView({behavior:"smooth",block:"center"})},className:"gap-2",children:[e.jsx(qj,{className:"h-4 w-4"}),"Change Password"]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsx(Zt,{children:"Profile Photo"}),e.jsx(Ss,{children:"Upload a professional photo for your profile"})]}),e.jsxs(qe,{className:"flex items-center gap-6",children:[e.jsxs(ln,{className:"h-24 w-24",children:[e.jsx(pa,{src:b}),e.jsx(cn,{className:"text-2xl",children:O.name.split(" ").map(ue=>ue[0]).join("").toUpperCase()||"U"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("input",{type:"file",id:"avatar-upload",accept:"image/*",className:"hidden",onChange:ne,disabled:j}),e.jsxs(Q,{variant:"outline",onClick:()=>{var ue;return(ue=document.getElementById("avatar-upload"))==null?void 0:ue.click()},disabled:j,children:[e.jsx(to,{className:"mr-2 h-4 w-4"}),j?"Uploading...":"Upload Photo"]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Upload an image and crop it to your liking."})]})]})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsx(Zt,{children:"Personal Information"}),e.jsx(Ss,{children:"Update your profile details"})]}),e.jsxs(qe,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"name",children:"Name"}),e.jsx(Qe,{id:"name",value:O.name,onChange:ue=>B({...O,name:ue.target.value}),maxLength:100})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"email",children:"Email"}),e.jsx(Qe,{id:"email",type:"email",value:O.email,onChange:ue=>B({...O,email:ue.target.value}),maxLength:255})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"title",children:"Job Title"}),e.jsx(Qe,{id:"title",value:O.title,onChange:ue=>B({...O,title:ue.target.value}),placeholder:"e.g., Broker Associate, Team Lead",maxLength:100})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"bio",children:"Bio"}),e.jsx(Ks,{id:"bio",value:O.bio,onChange:ue=>B({...O,bio:ue.target.value}),placeholder:"A short description about yourself",maxLength:500,className:"min-h-[120px] resize-y"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"areas_served",children:"Areas Served"}),e.jsx(Qe,{id:"areas_served",value:O.areas_served,onChange:ue=>B({...O,areas_served:ue.target.value}),placeholder:"e.g., Downtown, Suburbs"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"years_experience",children:"Years Experience"}),e.jsx(Qe,{id:"years_experience",type:"number",min:"0",value:O.years_experience,onChange:ue=>B({...O,years_experience:ue.target.value}),placeholder:"e.g., 5"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Social Links"}),e.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[e.jsx(Qe,{value:O.linkedin_url,onChange:ue=>B({...O,linkedin_url:ue.target.value}),placeholder:"LinkedIn URL"}),e.jsx(Qe,{value:O.instagram_url,onChange:ue=>B({...O,instagram_url:ue.target.value}),placeholder:"Instagram URL"}),e.jsx(Qe,{value:O.facebook_url,onChange:ue=>B({...O,facebook_url:ue.target.value}),placeholder:"Facebook URL"})]})]}),e.jsxs(Q,{onClick:oe,disabled:y,children:[e.jsx(_p,{className:"mr-2 h-4 w-4"}),"Save Changes"]})]})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(Q0,{className:"h-5 w-5"}),"Email Signature"]}),e.jsx(Ss,{children:"Add a signature that will be appended to emails sent via Gmail"})]}),e.jsxs(qe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Use email signature in all emails"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:O.use_email_signature?"Your signature will be added to every email sent via Gmail":"Signature is currently disabled"})]}),e.jsx(xn,{checked:O.use_email_signature,onCheckedChange:ue=>B({...O,use_email_signature:ue})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Signature"}),e.jsx(eg,{content:O.email_signature,onChange:ue=>B({...O,email_signature:ue}),placeholder:"Paste your Gmail signature here or create one...",minHeight:"120px",compact:!0}),e.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."})]}),e.jsxs(Q,{onClick:oe,disabled:y,children:[e.jsx(_p,{className:"mr-2 h-4 w-4"}),"Save Signature"]})]})]}),e.jsxs(ze,{id:"change-password-section",children:[e.jsxs(Wt,{children:[e.jsx(Zt,{children:a?"Set Your Password":"Change Password"}),e.jsx(Ss,{children:a?"Create a secure password for your account":"Update your password to keep your account secure"})]}),e.jsxs(qe,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"newPassword",children:"New Password"}),e.jsx(Qe,{id:"newPassword",type:"password",value:se.newPassword,onChange:ue=>ae({...se,newPassword:ue.target.value}),placeholder:"Min 6 characters"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"confirmPassword",children:"Confirm Password"}),e.jsx(Qe,{id:"confirmPassword",type:"password",value:se.confirmPassword,onChange:ue=>ae({...se,confirmPassword:ue.target.value}),placeholder:"Re-enter your new password"})]}),e.jsxs(Q,{onClick:de,disabled:y,children:[e.jsx(_p,{className:"mr-2 h-4 w-4"}),a?"Complete Setup":"Update Password"]}),a&&e.jsx(Q,{variant:"outline",onClick:()=>r("/dashboard"),className:"ml-2",children:"Skip for Now"})]})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[i?e.jsx(Df,{className:"h-5 w-5"}):e.jsx(Lj,{className:"h-5 w-5"}),"Push Notifications"]}),e.jsx(Ss,{children:"Receive browser notifications when new content is added"})]}),e.jsx(qe,{children:l?e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:i?"Notifications enabled":"Notifications disabled"}),e.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"})]}),e.jsx(xn,{checked:i,onCheckedChange:ue=>{ue?m():g()},disabled:d})]}):e.jsxs("div",{className:"text-sm text-muted-foreground space-y-2",children:[e.jsx("p",{children:"Push notifications are not supported in this browser."}),e.jsxs("p",{className:"text-xs",children:[e.jsx("strong",{children:"Desktop:"})," Use Chrome, Firefox, or Edge.",e.jsx("br",{}),e.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.']})]})})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[$?e.jsx(jA,{className:"h-5 w-5"}):e.jsx(mn,{className:"h-5 w-5"}),"Email Preferences"]}),e.jsx(Ss,{children:"Manage your email subscription settings"})]}),e.jsx(qe,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Weekly Digest"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:$?"You won't receive weekly digest emails":"Receive a weekly summary of new content, events, and your progress"})]}),e.jsx(xn,{checked:!$,onCheckedChange:async ue=>{X(!0);try{const{error:xe}=await Z.from("profiles").update({digest_opt_out:!ue}).eq("id",t==null?void 0:t.id);if(xe)throw xe;H(!ue),s({title:ue?"Subscribed":"Unsubscribed",description:ue?"You will now receive weekly digest emails":"You will no longer receive weekly digest emails"})}catch(xe){s({title:"Error",description:xe.message||"Failed to update preference",variant:"destructive"})}finally{X(!1)}},disabled:W})]})})]}),e.jsx(Myt,{}),e.jsx(Yjt,{})]}),e.jsx(D0e,{open:A,onClose:()=>M(!1),imageSrc:I,onCropComplete:fe,aspectRatio:1})]})})};var Qjt="AspectRatio",m9e=E.forwardRef((t,r)=>{const{ratio:s=1/1,style:n,...a}=t;return e.jsx("div",{style:{position:"relative",width:"100%",paddingBottom:`${100/s}%`},"data-radix-aspect-ratio-wrapper":"",children:e.jsx(qs.div,{...a,ref:r,style:{...n,position:"absolute",top:0,right:0,bottom:0,left:0}})})});m9e.displayName=Qjt;var Jjt=m9e;const ekt=Jjt;function tkt(){const{user:t}=Gr(),r=qr(),[s,n]=E.useState(!1),[a,o]=E.useState(!1),{data:l,isLoading:i}=Ht({queryKey:["calendar-token",t==null?void 0:t.id],queryFn:async()=>{const{data:N,error:j}=await Z.from("profiles").select("calendar_token").eq("id",t==null?void 0:t.id).single();if(j)throw j;return N},enabled:!!t&&a}),d=Jt({mutationFn:async()=>{const N=new Uint8Array(12);crypto.getRandomValues(N);const j=btoa(String.fromCharCode(...N)).replace(/\+/g,"x").replace(/\//g,"y").replace(/=/g,"").substring(0,16),{error:S}=await Z.from("profiles").update({calendar_token:j}).eq("id",t==null?void 0:t.id);if(S)throw S;return j},onSuccess:()=>{r.invalidateQueries({queryKey:["calendar-token",t==null?void 0:t.id]}),Se.success("Calendar subscription URL generated!")},onError:N=>{Se.error("Failed to generate calendar URL: "+N.message)}}),m=l!=null&&l.calendar_token?`https://dashboard.relevelup.com/api/calendar/${l.calendar_token}.ics`:null,g=async()=>{m&&(await navigator.clipboard.writeText(m),n(!0),Se.success("Calendar URL copied to clipboard!"),setTimeout(()=>n(!1),2e3))},y=()=>{m&&(window.location.href=m.replace("https://","webcal://"))},v=()=>{if(m){const N=m.replace("https://","webcal://"),j=`https://calendar.google.com/calendar/r?cid=${encodeURIComponent(N)}`;window.open(j,"_blank")}},b=()=>{if(m){const N=`https://outlook.live.com/calendar/0/addfromweb?url=${encodeURIComponent(m)}&name=Level%20Up%20Events`;window.open(N,"_blank")}};return e.jsxs(Dr,{open:a,onOpenChange:o,children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{variant:"outline",className:"gap-2",children:[e.jsx(Mn,{className:"h-4 w-4"}),"Subscribe to Calendar"]})}),e.jsxs(Lr,{className:"sm:max-w-md",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{className:"flex items-center gap-2",children:[e.jsx(Mn,{className:"h-5 w-5 text-primary"}),"Subscribe to Events Calendar"]}),e.jsx(Gs,{children:"Add all Level Up events to your personal calendar. Events will sync automatically and update when we add or change events."})]}),e.jsx("div",{className:"space-y-4 py-4",children:i?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Hr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):m?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Your Calendar URL"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Qe,{value:m,readOnly:!0,className:"text-xs font-mono"}),e.jsx(Q,{variant:"outline",size:"icon",onClick:g,children:s?e.jsx(li,{className:"h-4 w-4 text-green-500"}):e.jsx(fo,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Quick Add"}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(Q,{variant:"outline",className:"w-full justify-start gap-2",onClick:y,children:[e.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:e.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",e.jsx(En,{className:"h-3 w-3 ml-auto opacity-50"})]}),e.jsxs(Q,{variant:"outline",className:"w-full justify-start gap-2",onClick:v,children:[e.jsxs("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:[e.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"}),e.jsx("path",{d:"M12 2v8.5a1.5 1.5 0 0 0 1.5 1.5H22V2h-10z",fill:"#4285F4"}),e.jsx("path",{d:"M12 12V2H4.5A2.5 2.5 0 0 0 2 4.5V12h10z",fill:"#34A853"}),e.jsx("path",{d:"M2 12v7.5A2.5 2.5 0 0 0 4.5 22H12v-10H2z",fill:"#FBBC05"}),e.jsx("path",{d:"M12 22h7.5a2.5 2.5 0 0 0 2.5-2.5V12h-10v10z",fill:"#EA4335"})]}),"Add to Google Calendar",e.jsx(En,{className:"h-3 w-3 ml-auto opacity-50"})]}),e.jsxs(Q,{variant:"outline",className:"w-full justify-start gap-2",onClick:b,children:[e.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:e.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",e.jsx(En,{className:"h-3 w-3 ml-auto opacity-50"})]})]})]}),e.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."})]}):e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Generate your personal calendar subscription URL to get started."}),e.jsx(Q,{onClick:()=>d.mutate(),disabled:d.isPending,className:"w-full",children:d.isPending?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Mn,{className:"h-4 w-4 mr-2"}),"Generate Calendar URL"]})})]})})]})]})}var Rae="Tabs",[rkt]=fc(Rae,[$3]),p9e=$3(),[skt,R0e]=rkt(Rae),f9e=E.forwardRef((t,r)=>{const{__scopeTabs:s,value:n,onValueChange:a,defaultValue:o,orientation:l="horizontal",dir:i,activationMode:d="automatic",...m}=t,g=Bk(i),[y,v]=oh({prop:n,onChange:a,defaultProp:o??"",caller:Rae});return e.jsx(skt,{scope:s,baseId:bd(),value:y,onValueChange:v,orientation:l,dir:g,activationMode:d,children:e.jsx(qs.div,{dir:g,"data-orientation":l,...m,ref:r})})});f9e.displayName=Rae;var g9e="TabsList",x9e=E.forwardRef((t,r)=>{const{__scopeTabs:s,loop:n=!0,...a}=t,o=R0e(g9e,s),l=p9e(s);return e.jsx(Wxe,{asChild:!0,...l,orientation:o.orientation,dir:o.dir,loop:n,children:e.jsx(qs.div,{role:"tablist","aria-orientation":o.orientation,...a,ref:r})})});x9e.displayName=g9e;var y9e="TabsTrigger",v9e=E.forwardRef((t,r)=>{const{__scopeTabs:s,value:n,disabled:a=!1,...o}=t,l=R0e(y9e,s),i=p9e(s),d=w9e(l.baseId,n),m=j9e(l.baseId,n),g=n===l.value;return e.jsx(Gxe,{asChild:!0,...i,focusable:!a,active:g,children:e.jsx(qs.button,{type:"button",role:"tab","aria-selected":g,"aria-controls":m,"data-state":g?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:d,...o,ref:r,onMouseDown:bs(t.onMouseDown,y=>{!a&&y.button===0&&y.ctrlKey===!1?l.onValueChange(n):y.preventDefault()}),onKeyDown:bs(t.onKeyDown,y=>{[" ","Enter"].includes(y.key)&&l.onValueChange(n)}),onFocus:bs(t.onFocus,()=>{const y=l.activationMode!=="manual";!g&&!a&&y&&l.onValueChange(n)})})})});v9e.displayName=y9e;var _9e="TabsContent",b9e=E.forwardRef((t,r)=>{const{__scopeTabs:s,value:n,forceMount:a,children:o,...l}=t,i=R0e(_9e,s),d=w9e(i.baseId,n),m=j9e(i.baseId,n),g=n===i.value,y=E.useRef(g);return E.useEffect(()=>{const v=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(v)},[]),e.jsx(zc,{present:a||g,children:({present:v})=>e.jsx(qs.div,{"data-state":g?"active":"inactive","data-orientation":i.orientation,role:"tabpanel","aria-labelledby":d,hidden:!v,id:m,tabIndex:0,...l,ref:r,style:{...t.style,animationDuration:y.current?"0s":void 0},children:v&&o})})});b9e.displayName=_9e;function w9e(t,r){return`${t}-trigger-${r}`}function j9e(t,r){return`${t}-content-${r}`}var nkt=f9e,k9e=x9e,N9e=v9e,S9e=b9e;const ci=nkt,ri=E.forwardRef(({className:t,...r},s)=>e.jsx(k9e,{ref:s,className:qt("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...r}));ri.displayName=k9e.displayName;const Kr=E.forwardRef(({className:t,...r},s)=>e.jsx(N9e,{ref:s,className:qt("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",t),...r}));Kr.displayName=N9e.displayName;const ms=E.forwardRef(({className:t,...r},s)=>e.jsx(S9e,{ref:s,className:qt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...r}));ms.displayName=S9e.displayName;const akt={first_timer:Ln,regular:vy,dedicated:ql,veteran:ho,streak_master:_m,century:ho},ikt={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 WSe(t){return t===1?e.jsx(ho,{className:"h-5 w-5 text-yellow-500"}):t===2?e.jsx(vy,{className:"h-5 w-5 text-gray-400"}):t===3?e.jsx(ql,{className:"h-5 w-5 text-amber-600"}):e.jsx("span",{className:"w-5 text-center text-sm font-medium text-muted-foreground",children:t})}function C9e({showUserStats:t=!0,compact:r=!1,brokerageId:s,title:n="Event Leaderboard"}){const{user:a}=Gr(),{data:o,isLoading:l}=tFe(r?5:10,s),{data:i}=rFe(a==null?void 0:a.id),{data:d}=nFe(a==null?void 0:a.id),{data:m}=sFe(a==null?void 0:a.id);return l?e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(ho,{className:"h-5 w-5 text-yellow-500"}),n]})}),e.jsx(qe,{children:e.jsx("div",{className:"space-y-3",children:[...Array(5)].map((g,y)=>e.jsx(fr,{className:"h-12 w-full"},y))})})]}):e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-3",children:e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(ho,{className:"h-5 w-5 text-yellow-500"}),n]})}),e.jsxs(qe,{children:[t&&i&&e.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-primary/5 border border-primary/10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium",children:"Your Stats"}),d&&e.jsxs(bt,{variant:"secondary",className:"text-xs",children:["Rank #",d]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-lg font-bold text-primary",children:i.total_points}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Points"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-lg font-bold",children:i.total_events_attended}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Events"})]}),e.jsxs("div",{className:"flex items-center justify-center gap-1",children:[e.jsx(_m,{className:"h-4 w-4 text-orange-500"}),e.jsx("div",{className:"text-lg font-bold",children:i.current_streak}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Streak"})]})]}),m&&m.length>0&&e.jsxs("div",{className:"mt-3 flex flex-wrap gap-1",children:[m.slice(0,4).map(g=>{const y=akt[g.badge_type]||Ln;return e.jsxs(bt,{variant:"outline",className:`text-xs ${ikt[g.badge_type]||""}`,title:g.badge_description||"",children:[e.jsx(y,{className:"h-3 w-3 mr-1"}),g.badge_name]},g.id)}),m.length>4&&e.jsxs(bt,{variant:"outline",className:"text-xs",children:["+",m.length-4," more"]})]})]}),e.jsxs(ci,{defaultValue:"points",className:"w-full",children:[e.jsxs(ri,{className:"w-full mb-3",children:[e.jsx(Kr,{value:"points",className:"flex-1",children:"By Points"}),e.jsx(Kr,{value:"events",className:"flex-1",children:"By Events"})]}),e.jsx(ms,{value:"points",className:"mt-0",children:e.jsxs("div",{className:"space-y-2",children:[o==null?void 0:o.map((g,y)=>{var v,b,N;return e.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg ${g.user_id===(a==null?void 0:a.id)?"bg-primary/5 border border-primary/10":""} ${y===0?"bg-yellow-500/5":""}`,children:[e.jsx("div",{className:"w-6 flex justify-center",children:WSe(y+1)}),e.jsx(ln,{className:"h-8 w-8",children:e.jsx(cn,{className:"text-xs",children:((b=(v=g.profile)==null?void 0:v.name)==null?void 0:b.charAt(0))||"?"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"font-medium text-sm truncate",children:[((N=g.profile)==null?void 0:N.name)||"Unknown",g.user_id===(a==null?void 0:a.id)&&e.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(You)"})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[g.total_events_attended," events"]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"font-bold text-primary",children:g.total_points}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"pts"})]})]},g.user_id)}),(!o||o.length===0)&&e.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!"})]})}),e.jsx(ms,{value:"events",className:"mt-0",children:e.jsx("div",{className:"space-y-2",children:[...o||[]].sort((g,y)=>y.total_events_attended-g.total_events_attended).map((g,y)=>{var v,b,N;return e.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg ${g.user_id===(a==null?void 0:a.id)?"bg-primary/5 border border-primary/10":""} ${y===0?"bg-yellow-500/5":""}`,children:[e.jsx("div",{className:"w-6 flex justify-center",children:WSe(y+1)}),e.jsx(ln,{className:"h-8 w-8",children:e.jsx(cn,{className:"text-xs",children:((b=(v=g.profile)==null?void 0:v.name)==null?void 0:b.charAt(0))||"?"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"font-medium text-sm truncate",children:[((N=g.profile)==null?void 0:N.name)||"Unknown",g.user_id===(a==null?void 0:a.id)&&e.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(You)"})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[g.total_points," points"]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"font-bold",children:g.total_events_attended}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"events"})]})]},g.user_id)})})})]})]})]})}function okt(){const t=Ws(),{user:r,isAdmin:s}=Gr(),n=qr(),{data:a,isLoading:o}=Ht({queryKey:["public-events"],queryFn:async()=>{const{data:j,error:S}=await Z.from("events").select("*").order("event_date",{ascending:!0});if(S)throw S;return j}}),{data:l}=Ht({queryKey:["my-registrations"],queryFn:async()=>{if(!r)return[];const{data:j,error:S}=await Z.from("event_registrations").select("event_id, zoom_join_url").eq("user_id",r.id);if(S)throw S;return j},enabled:!!r}),{data:i}=Ht({queryKey:["event-registration-counts"],queryFn:async()=>{const{data:j,error:S}=await Z.from("event_registrations").select("event_id");if(S)throw S;const A={};return j.forEach(M=>{A[M.event_id]=(A[M.event_id]||0)+1}),A}}),d=Jt({mutationFn:async j=>{const{data:S,error:A}=await Z.functions.invoke("zoom-register",{body:{event_id:j}});if(A)throw A;if(S!=null&&S.error)throw new Error(S.error);return S},onSuccess:j=>{n.invalidateQueries({queryKey:["my-registrations"]}),n.invalidateQueries({queryKey:["event-registration-counts"]}),j!=null&&j.join_url?Se.success("Successfully registered! You'll receive a Zoom confirmation email."):Se.success("Successfully registered for the event!")},onError:j=>{Se.error("Failed to register: "+j.message)}}),m=Jt({mutationFn:async j=>{const{data:S,error:A}=await Z.functions.invoke("zoom-unregister",{body:{event_id:j}});if(A)throw A;if(S!=null&&S.error)throw new Error(S.error);return S},onSuccess:()=>{n.invalidateQueries({queryKey:["my-registrations"]}),n.invalidateQueries({queryKey:["event-registration-counts"]}),Se.success("Registration cancelled and removed from Zoom")},onError:j=>{Se.error("Failed to cancel: "+j.message)}}),g=j=>l==null?void 0:l.some(S=>S.event_id===j),y=j=>{const S=l==null?void 0:l.find(A=>A.event_id===j);return S==null?void 0:S.zoom_join_url},v=j=>j.capacity?((i==null?void 0:i[j.id])||0)>=j.capacity:!1,b=(a==null?void 0:a.filter(j=>oC(j.event_date)!=="ended"))||[],N=(a==null?void 0:a.filter(j=>oC(j.event_date)==="ended"))||[];return e.jsx(Fr,{title:"Events",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-foreground",children:"Events"}),e.jsx("p",{className:"text-muted-foreground",children:"Browse and register for upcoming events"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(tkt,{}),s&&e.jsx(Q,{variant:"outline",onClick:()=>t("/admin/events"),children:"Manage Events"})]})]}),e.jsxs("div",{className:`grid grid-cols-1 ${s?"lg:grid-cols-3":""} gap-6`,children:[e.jsxs("div",{className:s?"lg:col-span-2":"",children:[o?e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading events..."}):b.length===0?e.jsx(ze,{className:"text-center py-12",children:e.jsx(qe,{children:e.jsx("p",{className:"text-muted-foreground",children:"No upcoming events at the moment. Check back soon!"})})}):e.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:b.map(j=>{const S=oC(j.event_date),A=$ye(j.event_date),M=S==="live",I=S==="starting_soon";return e.jsxs(ze,{className:`flex flex-col overflow-hidden cursor-pointer hover:shadow-lg transition-all ${M?"border-red-500 ring-2 ring-red-500/20":I?"border-amber-500 ring-2 ring-amber-500/20":"hover:border-primary/50"}`,onClick:()=>t(`/events/${j.id}`),children:[A&&e.jsxs("div",{className:`${M?"bg-red-500":"bg-amber-500"} text-white px-3 py-1.5 flex items-center gap-2 text-sm font-medium`,children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-white opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-white"})]}),M?e.jsxs(e.Fragment,{children:[e.jsx(Yj,{className:"h-3.5 w-3.5"}),"LIVE NOW"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ea,{className:"h-3.5 w-3.5"}),"STARTING SOON"]})]}),j.image_url&&e.jsx(ekt,{ratio:3/2,className:"overflow-hidden",children:e.jsx("img",{src:j.image_url,alt:j.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform"})}),e.jsxs(Wt,{children:[e.jsx(Zt,{className:"line-clamp-2",children:j.title}),j.description&&e.jsx(Ss,{className:"line-clamp-2",children:j.description.replace(/<[^>]*>/g,"")})]}),e.jsxs(qe,{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Mn,{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(j.event_date))]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Ea,{className:"h-4 w-4"}),JE(new Date(j.event_date))]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(ws,{className:"h-4 w-4"}),(i==null?void 0:i[j.id])||0," registered",j.capacity&&` / ${j.capacity} spots`]})]}),e.jsx(XA,{className:"flex gap-2",onClick:F=>F.stopPropagation(),children:g(j.id)?e.jsxs(e.Fragment,{children:[e.jsxs(Q,{variant:"outline",className:"flex-1",onClick:()=>m.mutate(j.id),disabled:m.isPending,children:[e.jsx(rn,{className:"h-4 w-4 mr-2"}),"Cancel"]}),e.jsxs(Q,{className:"flex-1",onClick:()=>window.open(y(j.id)||j.zoom_link,"_blank"),children:[e.jsx(En,{className:"h-4 w-4 mr-2"}),"Join Zoom"]})]}):e.jsx(Q,{className:"w-full",onClick:()=>d.mutate(j.id),disabled:d.isPending||v(j),children:v(j)?"Event Full":e.jsxs(e.Fragment,{children:[e.jsx(li,{className:"h-4 w-4 mr-2"}),"Register"]})})})]},j.id)})}),N.length>0&&e.jsxs("div",{className:"mt-12",children:[e.jsx("h3",{className:"text-xl font-semibold mb-4 text-muted-foreground",children:"Past Events"}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:N.map(j=>e.jsx(ze,{className:"opacity-60 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>t(`/events/${j.id}`),children:e.jsxs(Wt,{children:[e.jsx(Zt,{className:"text-base line-clamp-1",children:j.title}),e.jsx(Ss,{children:new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long",day:"numeric",timeZone:"America/New_York"}).format(new Date(j.event_date))})]})},j.id))})]})]}),s&&e.jsx("div",{className:"lg:col-span-1",children:e.jsx(C9e,{showUserStats:!0})})]})]})})}const Ede=[{value:"all",label:"All Roles",icon:ws},{value:"brokerage_manager",label:"Brokerage Managers",icon:HA},{value:"admin",label:"Admins",icon:Nu}];function lkt({open:t,onOpenChange:r,resourceType:s,resourceId:n,resourceTitle:a}){var et,It;const{user:o,isAdmin:l,isBrokerageManager:i}=Gr(),[d,m]=E.useState([]),[g,y]=E.useState([]),[v,b]=E.useState([]),[N,j]=E.useState([]),[S,A]=E.useState(""),[M,I]=E.useState(""),[F,O]=E.useState(""),[B,$]=E.useState(!1),[H,W]=E.useState(!1),[X,se]=E.useState("agents"),[ae,le]=E.useState("all"),[ne,fe]=E.useState({}),oe=l||i;E.useEffect(()=>{t&&o&&(l?de():ue())},[t,o,l]),E.useEffect(()=>{t||(b([]),j([]),A(""),I(""),O(""),se("agents"),le("all"))},[t]);const de=async()=>{if(o){$(!0);try{const{data:Pe,error:at}=await Z.from("brokerages").select("id, name").order("name");if(at)throw at;const ce=1e3,$e={};let Ge=0,rt=!0;for(;rt;){const{data:Me,error:Je}=await Z.from("profiles").select("brokerage_id").range(Ge*ce,(Ge+1)*ce-1);if(Je)throw Je;Me==null||Me.forEach(Xe=>{Xe.brokerage_id&&($e[Xe.brokerage_id]=($e[Xe.brokerage_id]||0)+1)}),rt=(Me==null?void 0:Me.length)===ce,Ge++}y((Pe==null?void 0:Pe.map(Me=>({...Me,agent_count:$e[Me.id]||0})))||[]);const je=[];for(Ge=0,rt=!0;rt;){const{data:Me,error:Je}=await Z.from("profiles").select("id, name, email, brokerage_id, brokerages(name)").neq("id",o.id).order("name").range(Ge*ce,(Ge+1)*ce-1);if(Je)throw Je;Me&&je.push(...Me),rt=(Me==null?void 0:Me.length)===ce,Ge++}const it={};for(Ge=0,rt=!0;rt;){const{data:Me,error:Je}=await Z.from("user_roles").select("user_id, role").range(Ge*ce,(Ge+1)*ce-1);if(Je)throw Je;Me==null||Me.forEach(Xe=>{it[Xe.user_id]||(it[Xe.user_id]=[]),it[Xe.user_id].push(Xe.role)}),rt=(Me==null?void 0:Me.length)===ce,Ge++}fe(it),m(je.map(Me=>{var Je;return{id:Me.id,name:Me.name,email:Me.email,brokerage_name:((Je=Me.brokerages)==null?void 0:Je.name)||"No Brokerage",roles:it[Me.id]||[]}}))}catch(Pe){console.error("Error loading data:",Pe),Se.error("Failed to load agents and brokerages")}finally{$(!1)}}},ue=async()=>{if(o){$(!0);try{const{data:Pe}=await Z.from("profiles").select("brokerage_id").eq("id",o.id).single();if(!(Pe!=null&&Pe.brokerage_id)){Se.error("You must be part of a brokerage to share resources"),r(!1);return}const{data:at,error:ce}=await Z.from("profiles").select("id, name, email").eq("brokerage_id",Pe.brokerage_id).neq("id",o.id).order("name");if(ce)throw ce;m(at||[])}catch(Pe){console.error("Error loading agents:",Pe),Se.error("Failed to load agents")}finally{$(!1)}}},xe=d.filter(Pe=>{var ce;const at=Pe.name.toLowerCase().includes(S.toLowerCase())||Pe.email.toLowerCase().includes(S.toLowerCase())||((ce=Pe.brokerage_name)==null?void 0:ce.toLowerCase().includes(S.toLowerCase()));if(l&&ae!=="all"){const $e=ne[Pe.id]||[];return at&&$e.includes(ae)}return at}),Te=g.filter(Pe=>Pe.name.toLowerCase().includes(M.toLowerCase())),be=()=>{v.length===xe.length?b([]):b(xe.map(Pe=>Pe.id))},we=()=>{N.length===Te.length?j([]):j(Te.map(Pe=>Pe.id))},ve=Pe=>{if(!oe){b([Pe]);return}b(at=>at.includes(Pe)?at.filter(ce=>ce!==Pe):[...at,Pe])},tt=Pe=>{j(at=>at.includes(Pe)?at.filter(ce=>ce!==Pe):[...at,Pe])},Ae=async()=>{if(!(v.length>0||N.length>0)){Se.error("Please select at least one agent or brokerage to share with");return}W(!0);try{const{data:at,error:ce}=await Z.functions.invoke("send-share-notification",{body:{recipientIds:v,brokerageIds:N,resourceType:s,resourceId:n,resourceTitle:a,message:F.trim()||void 0}});if(ce)throw ce;const $e=(at==null?void 0:at.sharesCreated)||v.length;Se.success(`Shared with ${$e} agent${$e!==1?"s":""}`),r(!1)}catch(at){console.error("Error sharing resource:",at),Se.error("Failed to share resource")}finally{W(!1)}},Le=Pe=>Pe.split(" ").map(at=>at[0]).join("").toUpperCase().slice(0,2),Ue=Pe=>{const at=ne[Pe]||[];return at.includes("admin")?e.jsx(bt,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:"Admin"}):at.includes("brokerage_manager")?e.jsx(bt,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:"Manager"}):null},Ye=v.length+N.length,Ie=ae!=="all"?xe.length:null;return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"sm:max-w-lg max-h-[90vh] overflow-hidden flex flex-col",children:[e.jsxs(Ur,{className:"flex-shrink-0",children:[e.jsxs(Br,{className:"flex items-center gap-2",children:[e.jsx(Mi,{className:"h-5 w-5 text-primary"}),"Share Resource"]}),e.jsxs(Gs,{className:"line-clamp-2",children:['Share "',a,'" with ',l?"agents or brokerages":"agents in your brokerage"]})]}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[l?e.jsxs(ci,{value:X,onValueChange:se,className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs(ri,{className:"grid w-full grid-cols-2 flex-shrink-0",children:[e.jsxs(Kr,{value:"agents",className:"flex items-center gap-2",children:[e.jsx(ws,{className:"h-4 w-4"}),e.jsx("span",{children:"Agents"}),v.length>0&&e.jsx(bt,{variant:"default",className:"h-5 min-w-5 px-1.5 text-xs",children:v.length})]}),e.jsxs(Kr,{value:"brokerages",className:"flex items-center gap-2",children:[e.jsx(bi,{className:"h-4 w-4"}),e.jsx("span",{children:"Brokerages"}),N.length>0&&e.jsx(bt,{variant:"default",className:"h-5 min-w-5 px-1.5 text-xs",children:N.length})]})]}),e.jsxs(ms,{value:"agents",className:"flex-1 flex flex-col space-y-3 mt-3 overflow-hidden",children:[e.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search by name, email, or brokerage...",value:S,onChange:Pe=>A(Pe.target.value),className:"pl-9"})]}),e.jsxs(ds,{value:ae,onValueChange:le,children:[e.jsxs(ls,{className:"w-[180px]",children:[e.jsx(Z1,{className:"h-4 w-4 mr-2 text-muted-foreground"}),e.jsx(us,{placeholder:"Filter by role"})]}),e.jsx(cs,{children:Ede.map(Pe=>e.jsx(Ut,{value:Pe.value,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Pe.icon,{className:"h-4 w-4"}),e.jsx("span",{children:Pe.label})]})},Pe.value))})]})]}),e.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[e.jsxs(Q,{variant:"ghost",size:"sm",onClick:be,className:"text-xs h-8",disabled:xe.length===0,children:[e.jsx(ws,{className:"h-3.5 w-3.5 mr-1.5"}),v.length===xe.length&&xe.length>0?"Deselect All":"Select All"]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[Ie!==null&&e.jsxs("span",{className:"text-primary font-medium",children:[Ie," ",(et=Ede.find(Pe=>Pe.value===ae))==null?void 0:et.label]}),e.jsxs("span",{className:"font-medium",children:[v.length," selected"]})]})]}),e.jsx(Eo,{className:"h-[300px] border rounded-lg",children:B?e.jsx("div",{className:"flex items-center justify-center h-[200px]",children:e.jsx(Hr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):xe.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-[200px] text-muted-foreground",children:[e.jsx(ws,{className:"h-8 w-8 mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:ae!=="all"?`No ${(It=Ede.find(Pe=>Pe.value===ae))==null?void 0:It.label.toLowerCase()} found`:"No agents found"})]}):e.jsx("div",{className:"p-2 space-y-1",children:xe.map(Pe=>e.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${v.includes(Pe.id)?"bg-accent":""}`,onClick:()=>ve(Pe.id),children:[e.jsx(Yo,{checked:v.includes(Pe.id),onCheckedChange:()=>ve(Pe.id),className:"flex-shrink-0"}),e.jsx(ln,{className:"h-9 w-9 flex-shrink-0",children:e.jsx(cn,{className:"text-xs bg-primary/10 text-primary",children:Le(Pe.name)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:Pe.name}),Ue(Pe.id)]}),e.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[Pe.email,Pe.brokerage_name&&e.jsxs("span",{className:"ml-1 opacity-75",children:["• ",Pe.brokerage_name]})]})]})]},Pe.id))})})]}),e.jsxs(ms,{value:"brokerages",className:"flex-1 flex flex-col space-y-3 mt-3 overflow-hidden",children:[e.jsxs("div",{className:"relative flex-shrink-0",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search brokerages...",value:M,onChange:Pe=>I(Pe.target.value),className:"pl-9"})]}),e.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[e.jsxs(Q,{variant:"ghost",size:"sm",onClick:we,className:"text-xs h-8",disabled:Te.length===0,children:[e.jsx(bi,{className:"h-3.5 w-3.5 mr-1.5"}),N.length===Te.length&&Te.length>0?"Deselect All":"Select All"]}),e.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[N.length," selected"]})]}),e.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."}),e.jsx(Eo,{className:"h-[250px] border rounded-lg",children:B?e.jsx("div",{className:"flex items-center justify-center h-[180px]",children:e.jsx(Hr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):Te.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-[180px] text-muted-foreground",children:[e.jsx(bi,{className:"h-8 w-8 mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"No brokerages found"})]}):e.jsx("div",{className:"p-2 space-y-1",children:Te.map(Pe=>e.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${N.includes(Pe.id)?"bg-accent":""}`,onClick:()=>tt(Pe.id),children:[e.jsx(Yo,{checked:N.includes(Pe.id),onCheckedChange:()=>tt(Pe.id),className:"flex-shrink-0"}),e.jsx("div",{className:"h-9 w-9 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:e.jsx(bi,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:Pe.name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[Pe.agent_count," agent",Pe.agent_count!==1?"s":""]})]})]},Pe.id))})})]})]}):e.jsxs("div",{className:"flex-1 flex flex-col space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"relative flex-shrink-0",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search agents...",value:S,onChange:Pe=>A(Pe.target.value),className:"pl-9"})]}),oe&&e.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[e.jsxs(Q,{variant:"ghost",size:"sm",onClick:be,className:"text-xs h-8",disabled:xe.length===0,children:[e.jsx(ws,{className:"h-3.5 w-3.5 mr-1.5"}),v.length===xe.length&&xe.length>0?"Deselect All":"Select All"]}),e.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[v.length," selected"]})]}),e.jsx(Eo,{className:"h-[300px] border rounded-lg",children:B?e.jsx("div",{className:"flex items-center justify-center h-[200px]",children:e.jsx(Hr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):xe.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-[200px] text-muted-foreground",children:[e.jsx(ws,{className:"h-8 w-8 mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"No agents found"})]}):e.jsx("div",{className:"p-2 space-y-1",children:xe.map(Pe=>e.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${v.includes(Pe.id)?"bg-accent":""}`,onClick:()=>ve(Pe.id),children:[e.jsx(Yo,{checked:v.includes(Pe.id),onCheckedChange:()=>ve(Pe.id),className:"flex-shrink-0"}),e.jsx(ln,{className:"h-9 w-9 flex-shrink-0",children:e.jsx(cn,{className:"text-xs bg-primary/10 text-primary",children:Le(Pe.name)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:Pe.name}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Pe.email})]})]},Pe.id))})})]}),e.jsxs("div",{className:"space-y-2 flex-shrink-0",children:[e.jsx(Ee,{htmlFor:"message",className:"text-sm font-medium",children:"Add a message (optional)"}),e.jsx(Ks,{id:"message",placeholder:"I thought you might find this useful...",value:F,onChange:Pe=>O(Pe.target.value),rows:2,className:"resize-none"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2 flex-shrink-0",children:[e.jsx(Q,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsx(Q,{onClick:Ae,disabled:Ye===0||H,children:H?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),"Sharing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Mi,{className:"h-4 w-4 mr-2"}),"Share"]})})]})]})]})})}function K3({resourceType:t,resourceId:r,resourceTitle:s,variant:n="outline",size:a="sm",className:o=""}){const[l,i]=E.useState(!1),{user:d}=Gr();return d?e.jsxs(e.Fragment,{children:[e.jsxs(Q,{variant:n,size:a,onClick:()=>i(!0),className:o,children:[e.jsx(Oc,{className:"h-4 w-4 mr-2"}),"Share"]}),e.jsx(lkt,{open:l,onOpenChange:i,resourceType:t,resourceId:r,resourceTitle:s})]}):null}function ckt(){const{eventId:t}=Xl(),r=Ws(),{user:s}=Gr(),[n,a]=E.useState(null),[o,l]=E.useState(null),[i,d]=E.useState(0),[m,g]=E.useState(!0),[y,v]=E.useState(!1);E.useEffect(()=>{t&&b()},[t,s]);const b=async()=>{try{const{data:I,error:F}=await Z.from("events").select("*").eq("id",t).single();if(F)throw F;a(I);const{count:O}=await Z.from("event_registrations").select("*",{count:"exact",head:!0}).eq("event_id",t);if(d(O||0),s){const{data:B}=await Z.from("event_registrations").select("id, zoom_join_url").eq("event_id",t).eq("user_id",s.id).maybeSingle();l(B)}}catch(I){console.error("Error loading event:",I),Se.error("Failed to load event"),r("/events")}finally{g(!1)}},N=async()=>{if(!(!s||!n)){v(!0);try{if(o){const{error:I}=await Z.functions.invoke("zoom-unregister",{body:{event_id:n.id}});if(I)throw I;Se.success("Successfully cancelled registration"),l(null),d(F=>F-1)}else{const{data:I,error:F}=await Z.functions.invoke("zoom-register",{body:{event_id:n.id}});if(F)throw F;Se.success("Successfully registered for event!"),l({id:I.registration_id,zoom_join_url:I.zoom_join_url}),d(O=>O+1)}}catch(I){console.error("Registration error:",I),Se.error(o?"Failed to cancel registration":"Failed to register for event")}finally{v(!1)}}},j=I=>{var F,O,B;if(I.includes("iframe.mediadelivery.net")||I.includes("video.bunnycdn.com")){const $=I.match(/embed\/(\d+)\/([a-f0-9-]+)/);if($)return`https://iframe.mediadelivery.net/embed/${$[1]}/${$[2]}?autoplay=false&preload=true`}if(I.includes("youtube.com")||I.includes("youtu.be")){const $=I.includes("youtu.be")?(F=I.split("youtu.be/")[1])==null?void 0:F.split("?")[0]:(O=I.split("v=")[1])==null?void 0:O.split("&")[0];if($)return`https://www.youtube.com/embed/${$}`}if(I.includes("vimeo.com")){const $=(B=I.split("vimeo.com/")[1])==null?void 0:B.split("?")[0];if($)return`https://player.vimeo.com/video/${$}`}return I};if(m)return e.jsx(Fr,{title:"Event",children:e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Loading event..."})]})})});if(!n)return e.jsx(Fr,{title:"Event Not Found",children:e.jsxs("div",{className:"text-center py-16",children:[e.jsx("p",{className:"text-muted-foreground",children:"Event not found"}),e.jsx(Q,{onClick:()=>r("/events"),className:"mt-4",children:"Back to Events"})]})});const S=cDe(new Date(n.event_date)),A=n.capacity&&i>=n.capacity,M=(o==null?void 0:o.zoom_join_url)||n.zoom_link;return e.jsx(Fr,{title:n.title,children:e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsxs(Q,{variant:"ghost",className:"mb-6 gap-2",onClick:()=>r("/events"),children:[e.jsx(_i,{className:"h-4 w-4"}),"Back to Events"]}),n.image_url&&e.jsxs("div",{className:"relative aspect-video rounded-xl overflow-hidden mb-6",children:[e.jsx("img",{src:n.image_url,alt:n.title,className:"w-full h-full object-cover"}),S&&e.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:e.jsx(bt,{variant:"secondary",className:"text-lg px-4 py-2",children:"Event Ended"})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 mb-4",children:[e.jsx("h1",{className:"text-3xl font-bold text-foreground",children:n.title}),e.jsx(K3,{resourceType:"event",resourceId:n.id,resourceTitle:n.title})]}),n.description&&e.jsx("div",{className:"prose prose-sm max-w-none text-muted-foreground dark:prose-invert",dangerouslySetInnerHTML:{__html:n.description}})]}),n.video_url&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(lp,{className:"h-5 w-5"}),"Event Preview"]}),e.jsx("div",{className:"relative w-full aspect-video rounded-xl overflow-hidden border bg-muted",children:e.jsx("iframe",{src:j(n.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"})})]})]}),e.jsx("div",{className:"space-y-4",children:e.jsx(ze,{children:e.jsxs(qe,{className:"p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Mn,{className:"h-5 w-5 text-primary mt-0.5"}),e.jsxs("div",{children:[e.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(n.event_date))}),e.jsx("p",{className:"text-sm text-muted-foreground",children:JE(new Date(n.event_date))})]})]}),n.capacity&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ws,{className:"h-5 w-5 text-primary mt-0.5"}),e.jsxs("div",{children:[e.jsxs("p",{className:"font-medium",children:[i," / ",n.capacity]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Registered"})]})]}),o&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-green-500/10 rounded-lg",children:[e.jsx(ui,{className:"h-5 w-5 text-green-600"}),e.jsx("span",{className:"text-sm font-medium text-green-700",children:"You're registered!"})]}),e.jsxs("div",{className:"space-y-2 pt-2",children:[!S&&e.jsx(e.Fragment,{children:o?e.jsxs(e.Fragment,{children:[e.jsxs(Q,{className:"w-full gap-2",onClick:()=>window.open(M,"_blank"),children:[e.jsx(En,{className:"h-4 w-4"}),"Join Event"]}),e.jsxs(Q,{variant:"outline",className:"w-full",onClick:N,disabled:y,children:[y?e.jsx(Hr,{className:"h-4 w-4 animate-spin mr-2"}):null,"Cancel Registration"]})]}):e.jsx(Q,{className:"w-full gap-2",onClick:N,disabled:y||(A??!1),children:y?e.jsx(Hr,{className:"h-4 w-4 animate-spin"}):A?"Event Full":"Register Now"})}),S&&o&&e.jsxs(Q,{variant:"outline",className:"w-full gap-2",onClick:()=>window.open(n.zoom_link,"_blank"),children:[e.jsx(En,{className:"h-4 w-4"}),"View Recording"]})]})]})})})]})]})})}const dkt=()=>{const{user:t,isAdmin:r}=Gr(),s=Ws(),[n,a]=E.useState([]),[o,l]=E.useState(!0),[i,d]=E.useState(""),[m,g]=E.useState("all"),[y,v]=E.useState(new Set);E.useEffect(()=>{b()},[t]);const b=async()=>{try{const{data:M}=await Z.from("user_tags").select("tag").eq("user_id",t==null?void 0:t.id),I=(M==null?void 0:M.map(X=>X.tag))||[],{data:F,error:O}=await Z.from("app_tiles").select("*").order("name");if(O)throw O;const{data:B}=await Z.from("user_favorites").select("app_id").eq("user_id",t==null?void 0:t.id),$=new Set((B==null?void 0:B.map(X=>X.app_id))||[]);v($);const W=((F==null?void 0:F.filter(X=>!X.required_tags||X.required_tags.length===0?!0:X.required_tags.some(se=>I.includes(se))))||[]).sort((X,se)=>X.name==="LevelUp Members Portal"?-1:se.name==="LevelUp Members Portal"?1:0);a(W)}catch(M){console.error("Error loading apps:",M),Se.error("Failed to load apps")}finally{l(!1)}},N=async M=>{var F;const I=window.open("about:blank","_blank");try{const{data:O,error:B}=await Z.auth.getSession();if(B||!O.session){I==null||I.close(),Se.error("Session expired. Please refresh the page and try again.");return}const $=O.session.access_token;await Z.from("activity_logs").insert({user_id:t==null?void 0:t.id,app_id:M.app_id,app_name:M.name,user_agent:navigator.userAgent});const{data:H,error:W}=await Z.functions.invoke("sso-launch",{body:{app_id:M.app_id},headers:{Authorization:`Bearer ${$}`}});if(W)throw W;H!=null&&H.redirect_url?I&&!I.closed?(I.location.href=H.redirect_url,(F=I.focus)==null||F.call(I)):window.location.assign(H.redirect_url):(I==null||I.close(),Se.error("Launch link unavailable"))}catch(O){I==null||I.close(),console.error("Error launching app:",O),Se.error("Failed to launch app. Please try again.")}},j=async(M,I)=>{M.stopPropagation();const F=y.has(I);try{if(F){const{error:O}=await Z.from("user_favorites").delete().eq("user_id",t==null?void 0:t.id).eq("app_id",I);if(O)throw O;v(B=>{const $=new Set(B);return $.delete(I),$}),Se.success("Removed from favorites")}else{const{error:O}=await Z.from("user_favorites").insert({user_id:t==null?void 0:t.id,app_id:I});if(O)throw O;v(B=>new Set(B).add(I)),Se.success("Added to favorites")}}catch(O){console.error("Error toggling favorite:",O),Se.error("Failed to update favorites")}},S=n.filter(M=>{var F;const I=M.name.toLowerCase().includes(i.toLowerCase())||((F=M.description)==null?void 0:F.toLowerCase().includes(i.toLowerCase()));return m==="favorites"?I&&y.has(M.id):I}),A=[{id:"all",label:"All"},{id:"favorites",label:"Favorites"}];return o?e.jsx(Fr,{title:"Apps",children:e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Loading apps..."})]})})}):e.jsxs(Fr,{title:"Apps",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6",children:[e.jsx("h2",{className:"text-2xl font-bold text-foreground",children:"Apps"}),e.jsxs("div",{className:"relative max-w-sm w-full",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search apps...",className:"pl-10 bg-muted/50 border-0 focus-visible:ring-1",value:i,onChange:M=>d(M.target.value)})]})]}),e.jsx("div",{className:"flex gap-6 border-b border-border mb-8",children:A.map(M=>e.jsxs("button",{onClick:()=>g(M.id),className:qt("pb-3 text-sm font-medium transition-colors relative",m===M.id?"text-primary":"text-muted-foreground hover:text-foreground"),children:[M.label,m===M.id&&e.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]},M.id))}),S.length===0?e.jsx("div",{className:"flex flex-col items-center justify-center py-16 bg-card rounded-xl border border-border",children:m==="favorites"?e.jsxs(e.Fragment,{children:[e.jsx(Rf,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("p",{className:"text-lg font-medium mb-2 text-foreground",children:"No favorites yet"}),e.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"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ku,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("p",{className:"text-lg font-medium mb-2 text-foreground",children:"No apps available"}),e.jsx("p",{className:"text-sm text-muted-foreground text-center max-w-md",children:r?"Get started by adding apps in the admin panel":"Contact your administrator to get access to apps"}),r&&e.jsx(Q,{className:"mt-4",onClick:()=>s("/admin/apps"),children:"Add Apps"})]})}):e.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:S.map(M=>{const I=y.has(M.id),F=M.name.toLowerCase().includes("agent review")||M.app_id==="agent_review";return e.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:[e.jsxs("div",{className:"flex items-start gap-4 cursor-pointer",onClick:()=>N(M),children:[e.jsx("div",{className:"flex-shrink-0 w-14 h-14 rounded-xl bg-primary/10 flex items-center justify-center text-3xl",children:M.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-semibold text-foreground group-hover:text-primary transition-colors truncate",children:M.name}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:M.description})]}),e.jsx("button",{className:qt("flex-shrink-0 p-1 transition-colors",I?"text-primary":"text-muted-foreground/50 hover:text-primary"),onClick:O=>j(O,M.id),children:e.jsx(Rf,{className:qt("h-5 w-5",I&&"fill-current")})})]}),F&&e.jsx("a",{href:"https://forms.gle/vXnrzgSnPbw7CKPV6",target:"_blank",rel:"noopener noreferrer",onClick:O=>O.stopPropagation(),className:"mt-3 text-sm text-primary hover:underline flex items-center gap-1",children:"Create your account with this link →"})]},M.id)})})]})},ukt=()=>{const t=Ws(),[r,s]=E.useState(""),[n,a]=E.useState("all"),[o,l]=E.useState("all"),[i,d]=E.useState("grid"),{data:m=[]}=Ht({queryKey:["template-categories"],queryFn:async()=>{const{data:A,error:M}=await Z.from("template_categories").select("*").order("name");if(M)throw M;return A}}),{data:g=[]}=Ht({queryKey:["template-types"],queryFn:async()=>{const{data:A,error:M}=await Z.from("template_types").select("*").order("name");if(M)throw M;return A}}),{data:y=[],isLoading:v}=Ht({queryKey:["canva-templates"],queryFn:async()=>{const{data:A,error:M}=await Z.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).order("publish_date",{ascending:!1});if(M)throw M;const{data:I,error:F}=await Z.from("template_links").select("*").order("sort_order");if(F)throw F;const{data:O}=await Z.from("template_likes").select("template_id"),{data:B}=await Z.from("template_comments").select("template_id"),$=new Map;O==null||O.forEach(X=>{$.set(X.template_id,($.get(X.template_id)||0)+1)});const H=new Map;return B==null||B.forEach(X=>{H.set(X.template_id,(H.get(X.template_id)||0)+1)}),(A||[]).map(X=>({...X,links:(I||[]).filter(se=>se.template_id===X.id)||[],likesCount:$.get(X.id)||0,commentsCount:H.get(X.id)||0}))}}),b=y.filter(A=>{var O;const M=A.name.toLowerCase().includes(r.toLowerCase())||((O=A.description)==null?void 0:O.toLowerCase().includes(r.toLowerCase())),I=n==="all"||A.category_id===n,F=o==="all"||A.type_id===o;return M&&I&&F}),N=()=>{s(""),a("all"),l("all")},j=r||n!=="all"||o!=="all",S=A=>{t(`/templates/${A}`)};return e.jsx(Fr,{title:"Canva Templates",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-bold text-foreground text-5xl",children:"Canva Templates"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Browse and use our collection of professionally designed templates"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search templates...",value:r,onChange:A=>s(A.target.value),className:"pl-9"})]}),e.jsxs(ds,{value:n,onValueChange:a,children:[e.jsx(ls,{className:"w-full sm:w-48",children:e.jsx(us,{placeholder:"All Categories"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Categories"}),m.map(A=>e.jsx(Ut,{value:A.id,children:A.name},A.id))]})]}),e.jsxs(ds,{value:o,onValueChange:l,children:[e.jsx(ls,{className:"w-full sm:w-48",children:e.jsx(us,{placeholder:"All Types"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Types"}),g.map(A=>e.jsx(Ut,{value:A.id,children:A.name},A.id))]})]}),e.jsxs("div",{className:"flex gap-2",children:[j&&e.jsx(Q,{variant:"outline",size:"sm",onClick:N,children:"Clear Filters"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(Q,{variant:i==="grid"?"secondary":"outline",size:"icon",onClick:()=>d("grid"),className:"rounded-full",children:e.jsx(yp,{className:"h-4 w-4"})}),e.jsx(Q,{variant:i==="list"?"secondary":"outline",size:"icon",onClick:()=>d("list"),className:"rounded-full",children:e.jsx(vp,{className:"h-4 w-4"})})]})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[b.length," template",b.length!==1?"s":""," found"]}),v&&e.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((A,M)=>e.jsx(ze,{children:e.jsxs(qe,{className:"p-4",children:[e.jsx(fr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),e.jsx(fr,{className:"h-5 w-3/4 mb-2"}),e.jsx(fr,{className:"h-4 w-full mb-4"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(fr,{className:"h-5 w-16"}),e.jsx(fr,{className:"h-5 w-20"})]})]})},M))}),!v&&b.length===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"text-muted-foreground mb-4",children:j?"No templates match your filters":"No templates available yet"}),j&&e.jsx(Q,{variant:"outline",onClick:N,children:"Clear Filters"})]}),!v&&b.length>0&&e.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(A=>e.jsxs(ze,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${i==="list"?"flex flex-row":""}`,onClick:()=>S(A.id),children:[e.jsxs("div",{className:`relative overflow-hidden bg-muted ${i==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:[A.preview_image_url?e.jsx("img",{src:A.preview_image_url,alt:A.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No Preview"}),A.links.length>1&&e.jsx("div",{className:"absolute top-2 right-2",children:e.jsxs(bt,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm !text-secondary",children:[e.jsx(Bo,{className:"h-3 w-3"}),A.links.length]})})]}),e.jsxs(qe,{className:`p-4 flex flex-col ${i==="list"?"flex-1":""}`,children:[e.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:A.name}),A.description&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:kne(A.description)}),e.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[A.category&&e.jsx(bt,{variant:"secondary",className:"text-xs",children:A.category.name}),A.type&&e.jsx(bt,{variant:"outline",className:"text-xs",children:A.type.name})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(_d,{className:"h-3.5 w-3.5"}),A.likesCount]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Pl,{className:"h-3.5 w-3.5"}),A.commentsCount]})]}),e.jsxs(Q,{size:"sm",className:"w-full gap-2",onClick:M=>{M.stopPropagation(),S(A.id)},children:[e.jsx(En,{className:"h-4 w-4"}),"View Template"]})]})]},A.id))})]})})};var hkt="Separator",GSe="horizontal",mkt=["horizontal","vertical"],M9e=E.forwardRef((t,r)=>{const{decorative:s,orientation:n=GSe,...a}=t,o=pkt(n)?n:GSe,i=s?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return e.jsx(qs.div,{"data-orientation":o,...i,...a,ref:r})});M9e.displayName=hkt;function pkt(t){return mkt.includes(t)}var T9e=M9e;const gd=E.forwardRef(({className:t,orientation:r="horizontal",decorative:s=!0,...n},a)=>e.jsx(T9e,{ref:a,decorative:s,orientation:r,className:qt("shrink-0 bg-border",r==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...n}));gd.displayName=T9e.displayName;const TP=()=>({trackEngagement:E.useCallback(async(r,s,n,a="view")=>{try{const{data:{user:o}}=await Z.auth.getUser();if(!o)return;await Z.from("content_engagement_logs").insert({user_id:o.id,resource_type:r,resource_id:s,resource_title:n,action_type:a})}catch(o){console.error("Error tracking engagement:",o)}},[])}),fkt=()=>{const{templateId:t}=Xl(),{user:r,isAdmin:s}=Gr(),{toast:n}=fi(),a=qr(),{trackEngagement:o}=TP(),[l,i]=E.useState(""),{data:d,isLoading:m}=Ht({queryKey:["template-detail",t],queryFn:async()=>{const{data:M,error:I}=await Z.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).eq("id",t).single();if(I)throw I;const{data:F}=await Z.from("template_links").select("*").eq("template_id",t).order("sort_order"),{data:O}=await Z.from("template_guides").select("*").eq("template_id",t).order("sort_order");return{...M,links:F||[],guides:O||[]}},enabled:!!t});E.useEffect(()=>{d&&o("template",d.id,d.name,"view")},[d==null?void 0:d.id]);const{data:g=[]}=Ht({queryKey:["template-likes",t],queryFn:async()=>{const{data:M,error:I}=await Z.from("template_likes").select("*").eq("template_id",t);if(I)throw I;return M},enabled:!!t}),{data:y=[]}=Ht({queryKey:["template-comments",t],queryFn:async()=>{const{data:M,error:I}=await Z.from("template_comments").select("*").eq("template_id",t).order("created_at",{ascending:!1});if(I)throw I;const F=[...new Set(M.map($=>$.user_id))],{data:O}=await Z.from("profiles").select("id, name").in("id",F),B=new Map((O==null?void 0:O.map($=>[$.id,$.name]))||[]);return M.map($=>({...$,user_name:B.get($.user_id)||"Unknown User"}))},enabled:!!t}),v=Jt({mutationFn:async M=>{const{error:I}=await Z.from("template_comments").insert({template_id:t,user_id:r.id,content:M});if(I)throw I},onSuccess:()=>{a.invalidateQueries({queryKey:["template-comments",t]}),i(""),n({title:"Comment added!"})},onError:M=>{n({title:"Error adding comment",description:M.message,variant:"destructive"})}}),b=Jt({mutationFn:async M=>{const{error:I}=await Z.from("template_comments").delete().eq("id",M);if(I)throw I},onSuccess:()=>{a.invalidateQueries({queryKey:["template-comments",t]}),n({title:"Comment deleted"})}}),N=Jt({mutationFn:async()=>{const M=g.find(I=>I.user_id===(r==null?void 0:r.id));if(M){const{error:I}=await Z.from("template_likes").delete().eq("id",M.id);if(I)throw I}else{const{error:I}=await Z.from("template_likes").insert({template_id:t,user_id:r.id});if(I)throw I}},onSuccess:()=>{a.invalidateQueries({queryKey:["template-likes",t]})}}),j=g.some(M=>M.user_id===(r==null?void 0:r.id)),S=M=>M.split(" ").map(I=>I[0]).join("").toUpperCase().slice(0,2),A=M=>{M.preventDefault(),!(!l.trim()||!r)&&v.mutate(l.trim())};return m?e.jsx(Fr,{title:"Templates",children:e.jsx("div",{className:"flex justify-center py-12",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):d?e.jsx(Fr,{title:d.name,children:e.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[e.jsx(Q,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(go,{to:"/templates",children:[e.jsx(_i,{className:"h-4 w-4"}),"Back to Templates"]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:d.name}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.category&&e.jsx(bt,{variant:"secondary",children:d.category.name}),d.type&&e.jsx(bt,{variant:"outline",children:d.type.name})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[s&&e.jsx(Q,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:e.jsxs(go,{to:`/admin/templates?edit=${d.id}`,children:[e.jsx(ei,{className:"h-4 w-4"}),e.jsx("span",{children:"Edit"})]})}),e.jsx(K3,{resourceType:"template",resourceId:d.id,resourceTitle:d.name,size:"default",className:"rounded-full"}),e.jsxs(Q,{variant:j?"default":"outline",className:"gap-2 rounded-full",onClick:()=>N.mutate(),disabled:!r||N.isPending,children:[e.jsx(_d,{className:`h-4 w-4 ${j?"fill-current":""}`}),g.length," ",g.length===1?"Like":"Likes"]})]})]}),d.description&&e.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:d.description}})]}),e.jsx(ze,{children:e.jsxs(qe,{className:"pt-6",children:[e.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[e.jsx(Bo,{className:"h-4 w-4"}),d.links.length===1?"Template Link":"Template Links"]}),e.jsx("div",{className:"grid gap-2",children:d.links.map(M=>e.jsxs(Q,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{o("template",d.id,d.name,"click_canva"),window.open(M.canva_share_link,"_blank")},children:[e.jsx("span",{className:"font-medium",children:M.title}),e.jsx(En,{className:"h-4 w-4 text-muted-foreground"})]},M.id))})]})}),d.video_url&&e.jsx(ze,{children:e.jsx(qe,{className:"pt-6",children:e.jsx("div",{className:"aspect-video w-full rounded-lg overflow-hidden",children:e.jsx("iframe",{src:d.video_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})})}),d.guides&&d.guides.length>0&&e.jsx(ze,{children:e.jsxs(qe,{className:"pt-6",children:[e.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[e.jsx(fa,{className:"h-4 w-4"}),"Guide Files"]}),e.jsx("div",{className:"grid gap-2",children:d.guides.map(M=>e.jsxs(Q,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{o("template",d.id,d.name,"click_pdf"),window.open(M.file_url,"_blank")},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fa,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:M.name}),M.file_size&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",(M.file_size/1024).toFixed(0)," KB)"]})]}),e.jsx(Oi,{className:"h-4 w-4 text-muted-foreground"})]},M.id))})]})}),e.jsx(gd,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[e.jsx(Pl,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),r?e.jsxs("form",{onSubmit:A,className:"flex gap-2",children:[e.jsx(Ks,{placeholder:"Add a comment...",value:l,onChange:M=>i(M.target.value),className:"min-h-[80px] resize-none flex-1"}),e.jsx(Q,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!l.trim()||v.isPending,children:e.jsx(Mi,{className:"h-4 w-4"})})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),e.jsx("div",{className:"space-y-4",children:y.length===0?e.jsx(ze,{children:e.jsx(qe,{className:"py-8 text-center",children:e.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):y.map(M=>e.jsx(ze,{children:e.jsx(qe,{className:"pt-4 pb-4",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(ln,{className:"h-10 w-10 flex-shrink-0",children:e.jsx(cn,{className:"text-sm",children:S(M.user_name||"U")})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-medium",children:M.user_name}),e.jsx("span",{className:"text-sm text-muted-foreground",children:Su(new Date(M.created_at),{addSuffix:!0})}),M.user_id===(r==null?void 0:r.id)&&e.jsx(Q,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>b.mutate(M.id),children:e.jsx(Rs,{className:"h-3 w-3 text-muted-foreground"})})]}),e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:M.content})]})]})})},M.id))})]})]})}):e.jsx(Fr,{title:"Templates",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(Bo,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold",children:"Template not found"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"This template may have been removed or is not available."}),e.jsx(Q,{asChild:!0,className:"mt-4",children:e.jsx(go,{to:"/templates",children:"Back to Templates"})})]})})},gkt=()=>{const{user:t}=Gr(),[r,s]=E.useState(""),[n,a]=E.useState("all"),{data:o=[]}=Ht({queryKey:["academy-categories"],queryFn:async()=>{const{data:v,error:b}=await Z.from("academy_categories").select("*").order("sort_order",{ascending:!0});if(b)throw b;return v}}),{data:l=[],isLoading:i}=Ht({queryKey:["academy-videos"],queryFn:async()=>{const{data:v,error:b}=await Z.from("academy_videos").select(` *, category:academy_categories(id, name) `).eq("is_published",!0).order("publish_date",{ascending:!1});if(b)throw b;const{data:N,error:j}=await Z.from("academy_resources").select("*").order("sort_order");if(j)throw j;return v.map(A=>({...A,resources:(N==null?void 0:N.filter(M=>M.video_id===A.id))||[]}))}}),{data:d=[]}=Ht({queryKey:["academy-video-likes"],queryFn:async()=>{const{data:v,error:b}=await Z.from("academy_video_likes").select("video_id, user_id");if(b)throw b;return v}}),m=l.filter(v=>{var j;const b=r===""||v.title.toLowerCase().includes(r.toLowerCase())||((j=v.description)==null?void 0:j.toLowerCase().includes(r.toLowerCase())),N=n==="all"||v.category_id===n;return b&&N}),g=v=>d.filter(b=>b.video_id===v).length,y=v=>d.some(b=>b.video_id===v&&b.user_id===(t==null?void 0:t.id));return e.jsx(Fr,{title:"Academy",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Academy"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"On-demand training videos and resources"})]}),e.jsx("div",{className:"flex flex-col sm:flex-row gap-4",children:e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search videos...",value:r,onChange:v=>s(v.target.value),className:"pl-10"})]})}),e.jsx(ci,{value:n,onValueChange:a,children:e.jsxs(ri,{className:"w-full justify-start flex-wrap h-auto gap-2 bg-transparent p-0",children:[e.jsx(Kr,{value:"all",className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:"All Videos"}),o.map(v=>e.jsx(Kr,{value:v.id,className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:v.name},v.id))]})}),i?e.jsx("div",{className:"flex justify-center py-12",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):m.length===0?e.jsx(ze,{children:e.jsxs(qe,{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(ya,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold",children:"No videos found"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:r?"Try adjusting your search terms":"Check back soon for new content"})]})}):e.jsx("div",{className:"grid gap-6 sm:grid-cols-2 lg:grid-cols-3",children:m.map(v=>e.jsx(go,{to:`/academy/${v.id}`,children:e.jsxs(ze,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow group h-full",children:[e.jsxs("div",{className:"relative aspect-video bg-muted",children:[v.thumbnail_url?e.jsx("img",{src:v.thumbnail_url,alt:v.title,className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(ya,{className:"h-12 w-12 text-muted-foreground"})}),e.jsx("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:e.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/90 flex items-center justify-center",children:e.jsx(Gl,{className:"h-8 w-8 text-primary-foreground ml-1"})})}),v.duration&&e.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:[e.jsx(Ea,{className:"h-3 w-3"}),v.duration]})]}),e.jsxs(Wt,{className:"pb-2",children:[e.jsx("div",{className:"flex items-start justify-between gap-2",children:e.jsx(Zt,{className:"text-lg line-clamp-2",children:v.title})}),v.category&&e.jsx(bt,{variant:"secondary",className:"w-fit",children:v.category.name})]}),e.jsxs(qe,{className:"pt-0",children:[v.description&&e.jsx(Ss,{className:"line-clamp-2",children:v.description.replace(/<[^>]*>/g,"")}),e.jsxs("div",{className:"flex items-center gap-4 mt-3 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(_d,{className:`h-4 w-4 ${y(v.id)?"fill-primary text-primary":""}`}),g(v.id)]}),v.resources&&v.resources.length>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(fa,{className:"h-4 w-4"}),v.resources.length]})]})]})]})},v.id))})]})})};function A9e({resourceType:t,resourceId:r}){const{data:s=[]}=Ht({queryKey:["linked-templates",t,r],queryFn:async()=>{if(t==="academy_video"){const{data:n,error:a}=await Z.from("academy_video_templates").select("template_id, canva_templates:template_id(id, name, preview_image_url)").eq("video_id",r);if(a)throw a;return(n||[]).map(o=>o.canva_templates).filter(Boolean)}else{const{data:n,error:a}=await Z.from("resource_kit_templates").select("template_id, canva_templates:template_id(id, name, preview_image_url)").eq("kit_id",r);if(a)throw a;return(n||[]).map(o=>o.canva_templates).filter(Boolean)}},enabled:!!r});return s.length===0?null:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-sm",children:[e.jsx(ed,{className:"h-4 w-4"}),"Related Templates"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.map(n=>e.jsx(go,{to:`/templates/${n.id}`,children:e.jsxs(bt,{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:[e.jsx(ed,{className:"h-3 w-3"}),n.name]})},n.id))})]})}const xkt=(t,r)=>{if(r==="bunny_stream"){let s=t.replace("iframe.mediadelivery.net","player.mediadelivery.net");return s.includes("?")||(s+="?autoplay=false&loop=false&muted=false&preload=true&responsive=true"),s}if(r==="youtube"){const s=/(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,n=t.match(s);if(n)return`https://www.youtube.com/embed/${n[1]}`}if(r==="vimeo"){const s=/vimeo\.com\/(?:video\/)?(\d+)/,n=t.match(s);if(n)return`https://player.vimeo.com/video/${n[1]}`}if(r==="loom"){const s=/loom\.com\/share\/([a-zA-Z0-9]+)/,n=t.match(s);if(n)return`https://www.loom.com/embed/${n[1]}`}return t},ykt=()=>{const{videoId:t}=Xl();Ws();const{user:r,isAdmin:s}=Gr(),{toast:n}=fi(),a=qr(),{trackEngagement:o}=TP(),[l,i]=E.useState(""),{data:d,isLoading:m}=Ht({queryKey:["academy-video",t],queryFn:async()=>{const{data:I,error:F}=await Z.from("academy_videos").select(` *, category:academy_categories(id, name) `).eq("id",t).eq("is_published",!0).single();if(F)throw F;const{data:O}=await Z.from("academy_resources").select("*").eq("video_id",t).order("sort_order");return{...I,resources:O||[]}},enabled:!!t});E.useEffect(()=>{d&&o("academy_video",d.id,d.title,"view")},[d==null?void 0:d.id]);const{data:g=[]}=Ht({queryKey:["academy-video-likes",t],queryFn:async()=>{const{data:I,error:F}=await Z.from("academy_video_likes").select("*").eq("video_id",t);if(F)throw F;return I},enabled:!!t}),{data:y=[]}=Ht({queryKey:["academy-video-comments",t],queryFn:async()=>{const{data:I,error:F}=await Z.from("academy_video_comments").select("*").eq("video_id",t).order("created_at",{ascending:!1});if(F)throw F;const O=[...new Set(I.map(H=>H.user_id))],{data:B}=await Z.from("profiles").select("id, name").in("id",O),$=new Map((B==null?void 0:B.map(H=>[H.id,H.name]))||[]);return I.map(H=>({...H,user_name:$.get(H.user_id)||"Unknown User"}))},enabled:!!t}),v=Jt({mutationFn:async I=>{const{error:F}=await Z.from("academy_video_comments").insert({video_id:t,user_id:r.id,content:I});if(F)throw F},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-video-comments",t]}),i(""),n({title:"Comment added!"})},onError:I=>{n({title:"Error adding comment",description:I.message,variant:"destructive"})}}),b=Jt({mutationFn:async I=>{const{error:F}=await Z.from("academy_video_comments").delete().eq("id",I);if(F)throw F},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-video-comments",t]}),n({title:"Comment deleted"})}}),N=Jt({mutationFn:async()=>{const I=g.find(F=>F.user_id===(r==null?void 0:r.id));if(I){const{error:F}=await Z.from("academy_video_likes").delete().eq("id",I.id);if(F)throw F}else{const{error:F}=await Z.from("academy_video_likes").insert({video_id:t,user_id:r.id});if(F)throw F}},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-video-likes",t]})}}),j=g.some(I=>I.user_id===(r==null?void 0:r.id)),S=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"📁"}},A=I=>I.split(" ").map(F=>F[0]).join("").toUpperCase().slice(0,2),M=I=>{I.preventDefault(),!(!l.trim()||!r)&&v.mutate(l.trim())};return m?e.jsx(Fr,{title:"Academy",children:e.jsx("div",{className:"flex justify-center py-12",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):d?e.jsx(Fr,{title:d.title,children:e.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[e.jsx(Q,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(go,{to:"/academy",children:[e.jsx(_i,{className:"h-4 w-4"}),"Back to Academy"]})}),e.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-black",style:{paddingTop:"56.25%"},children:["youtube","vimeo","loom","bunny_stream"].includes(d.video_type)?e.jsx("iframe",{src:xkt(d.video_url,d.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}):e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-white gap-4",children:[e.jsx(ya,{className:"h-16 w-16 opacity-50"}),e.jsx(Q,{variant:"secondary",asChild:!0,children:e.jsxs("a",{href:d.video_url,target:"_blank",rel:"noopener noreferrer",className:"gap-2",children:[e.jsx(En,{className:"h-4 w-4"}),"Open Video"]})})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:d.title}),d.category&&e.jsx(bt,{variant:"secondary",children:d.category.name})]}),e.jsxs("div",{className:"flex gap-2",children:[s&&e.jsx(Q,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:e.jsxs(go,{to:`/admin/academy?edit=${d.id}`,children:[e.jsx(ei,{className:"h-4 w-4"}),e.jsx("span",{children:"Edit"})]})}),e.jsx(K3,{resourceType:"academy_video",resourceId:d.id,resourceTitle:d.title}),e.jsxs(Q,{variant:j?"default":"outline",className:"gap-2 w-fit",onClick:()=>N.mutate(),disabled:!r||N.isPending,children:[e.jsx(_d,{className:`h-4 w-4 ${j?"fill-current":""}`}),g.length," ",g.length===1?"Like":"Likes"]})]})]}),d.description&&e.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:d.description}})]}),d.resources&&d.resources.length>0&&e.jsx(ze,{children:e.jsxs(qe,{className:"pt-6",children:[e.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[e.jsx(fa,{className:"h-4 w-4"}),"Resources"]}),e.jsx("div",{className:"grid gap-2",children:d.resources.map(I=>e.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:[e.jsx("span",{className:"text-2xl",children:S(I.file_type)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:I.title}),e.jsx("p",{className:"text-xs text-muted-foreground uppercase",children:I.file_type})]}),e.jsx(Oi,{className:"h-4 w-4 text-muted-foreground"})]},I.id))})]})}),e.jsx(A9e,{resourceType:"academy_video",resourceId:d.id}),e.jsx(gd,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[e.jsx(Pl,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),r?e.jsxs("form",{onSubmit:M,className:"flex gap-2",children:[e.jsx(Ks,{placeholder:"Add a comment...",value:l,onChange:I=>i(I.target.value),className:"min-h-[80px] resize-none flex-1"}),e.jsx(Q,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!l.trim()||v.isPending,children:e.jsx(Mi,{className:"h-4 w-4"})})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),e.jsx("div",{className:"space-y-4",children:y.length===0?e.jsx(ze,{children:e.jsx(qe,{className:"py-8 text-center",children:e.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):y.map(I=>e.jsx(ze,{children:e.jsx(qe,{className:"pt-4 pb-4",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(ln,{className:"h-10 w-10 flex-shrink-0",children:e.jsx(cn,{className:"text-sm",children:A(I.user_name||"U")})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-medium",children:I.user_name}),e.jsx("span",{className:"text-sm text-muted-foreground",children:Su(new Date(I.created_at),{addSuffix:!0})}),I.user_id===(r==null?void 0:r.id)&&e.jsx(Q,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>b.mutate(I.id),children:e.jsx(Rs,{className:"h-3 w-3 text-muted-foreground"})})]}),e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:I.content})]})]})})},I.id))})]})]})}):e.jsx(Fr,{title:"Academy",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(ya,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold",children:"Video not found"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"This video may have been removed or is not available."}),e.jsx(Q,{asChild:!0,className:"mt-4",children:e.jsx(go,{to:"/academy",children:"Back to Academy"})})]})})};function vkt(){const t=Ws(),[r,s]=E.useState(""),{data:n,isLoading:a}=Ht({queryKey:["resource-kits-published"],queryFn:async()=>{const{data:b,error:N}=await Z.from("resource_kits").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(N)throw N;return b}}),{data:o}=Ht({queryKey:["resource-kit-files-all"],queryFn:async()=>{const{data:b,error:N}=await Z.from("resource_kit_files").select("*").order("sort_order",{ascending:!0});if(N)throw N;return b}}),{data:l}=Ht({queryKey:["resource-kit-likes-all"],queryFn:async()=>{const{data:b,error:N}=await Z.from("resource_kit_likes").select("kit_id");if(N)throw N;return b}}),{data:i}=Ht({queryKey:["resource-kit-comments-all"],queryFn:async()=>{const{data:b,error:N}=await Z.from("resource_kit_comments").select("kit_id");if(N)throw N;return b}}),d=n==null?void 0:n.filter(b=>{var N;return b.name.toLowerCase().includes(r.toLowerCase())||((N=b.description)==null?void 0:N.toLowerCase().includes(r.toLowerCase()))}),m=b=>(o==null?void 0:o.filter(N=>N.kit_id===b))||[],g=b=>(l==null?void 0:l.filter(N=>N.kit_id===b).length)||0,y=b=>(i==null?void 0:i.filter(N=>N.kit_id===b).length)||0,v=b=>{t(`/toolbox/${b}`)};return e.jsx(Fr,{title:"Toolbox",description:"Download resource kits and tools to help grow your business",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Toolbox"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Download resource kits and tools to help grow your business"})]}),e.jsxs("div",{className:"relative max-w-md",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search resource kits...",value:r,onChange:b=>s(b.target.value),className:"pl-10"})]}),!a&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:[(d==null?void 0:d.length)||0," resource kit",(d==null?void 0:d.length)!==1?"s":""," available"]}),a?e.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,N)=>e.jsx(ze,{children:e.jsxs(qe,{className:"p-4",children:[e.jsx(fr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),e.jsx(fr,{className:"h-5 w-3/4 mb-2"}),e.jsx(fr,{className:"h-4 w-full mb-4"}),e.jsx(fr,{className:"h-4 w-2/3"})]})},N))}):(d==null?void 0:d.length)===0?e.jsxs(ze,{className:"p-12 text-center",children:[e.jsx(Wl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No resource kits found"}),e.jsx("p",{className:"text-muted-foreground",children:r?"Try adjusting your search terms":"Check back later for new resources"})]}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:d==null?void 0:d.map(b=>{const N=m(b.id).length,j=g(b.id),S=y(b.id);return e.jsxs(ze,{className:"group overflow-hidden cursor-pointer hover:shadow-lg transition-all duration-200",onClick:()=>v(b.id),children:[e.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:b.featured_image_url?e.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"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(Wl,{className:"h-16 w-16 text-muted-foreground"})})}),e.jsxs(qe,{className:"p-4",children:[e.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:b.name}),b.description&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:kne(b.description)}),e.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(fa,{className:"h-4 w-4"}),N," file",N!==1?"s":""]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(_d,{className:"h-3.5 w-3.5"}),j]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Pl,{className:"h-3.5 w-3.5"}),S]})]})]})]})]},b.id)})})]})})}const _kt=()=>{const{kitId:t}=Xl(),{user:r,isAdmin:s}=Gr(),{toast:n}=fi(),a=qr(),{trackEngagement:o}=TP(),[l,i]=E.useState(""),{data:d,isLoading:m}=Ht({queryKey:["resource-kit-detail",t],queryFn:async()=>{const{data:I,error:F}=await Z.from("resource_kits").select("*").eq("id",t).eq("is_published",!0).single();if(F)throw F;const{data:O}=await Z.from("resource_kit_files").select("*").eq("kit_id",t).order("sort_order"),{data:B}=await Z.from("resource_kit_links").select("*").eq("kit_id",t).order("sort_order");return{...I,files:O||[],links:B||[]}},enabled:!!t});E.useEffect(()=>{d&&o("toolbox",d.id,d.name,"view")},[d==null?void 0:d.id]);const{data:g=[]}=Ht({queryKey:["resource-kit-likes",t],queryFn:async()=>{const{data:I,error:F}=await Z.from("resource_kit_likes").select("*").eq("kit_id",t);if(F)throw F;return I},enabled:!!t}),{data:y=[]}=Ht({queryKey:["resource-kit-comments",t],queryFn:async()=>{const{data:I,error:F}=await Z.from("resource_kit_comments").select("*").eq("kit_id",t).order("created_at",{ascending:!1});if(F)throw F;const O=[...new Set(I.map(H=>H.user_id))],{data:B}=await Z.from("profiles").select("id, name").in("id",O),$=new Map((B==null?void 0:B.map(H=>[H.id,H.name]))||[]);return I.map(H=>({...H,user_name:$.get(H.user_id)||"Unknown User"}))},enabled:!!t}),v=Jt({mutationFn:async I=>{const{error:F}=await Z.from("resource_kit_comments").insert({kit_id:t,user_id:r.id,content:I});if(F)throw F},onSuccess:()=>{a.invalidateQueries({queryKey:["resource-kit-comments",t]}),i(""),n({title:"Comment added!"})},onError:I=>{n({title:"Error adding comment",description:I.message,variant:"destructive"})}}),b=Jt({mutationFn:async I=>{const{error:F}=await Z.from("resource_kit_comments").delete().eq("id",I);if(F)throw F},onSuccess:()=>{a.invalidateQueries({queryKey:["resource-kit-comments",t]}),n({title:"Comment deleted"})}}),N=Jt({mutationFn:async()=>{const I=g.find(F=>F.user_id===(r==null?void 0:r.id));if(I){const{error:F}=await Z.from("resource_kit_likes").delete().eq("id",I.id);if(F)throw F}else{const{error:F}=await Z.from("resource_kit_likes").insert({kit_id:t,user_id:r.id});if(F)throw F}},onSuccess:()=>{a.invalidateQueries({queryKey:["resource-kit-likes",t]})}}),j=g.some(I=>I.user_id===(r==null?void 0:r.id)),S=I=>I.split(" ").map(F=>F[0]).join("").toUpperCase().slice(0,2),A=I=>I?I<1024?I+" B":I<1024*1024?(I/1024).toFixed(1)+" KB":(I/(1024*1024)).toFixed(1)+" MB":"",M=I=>{I.preventDefault(),!(!l.trim()||!r)&&v.mutate(l.trim())};return m?e.jsx(Fr,{title:"Toolbox",children:e.jsx("div",{className:"flex justify-center py-12",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):d?e.jsx(Fr,{title:d.name,children:e.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[e.jsx(Q,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(go,{to:"/toolbox",children:[e.jsx(_i,{className:"h-4 w-4"}),"Back to Toolbox"]})}),d.featured_image_url&&e.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:e.jsx("img",{src:d.featured_image_url,alt:d.name,className:"w-full max-h-[400px] object-cover"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsx("div",{className:"space-y-2",children:e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:d.name})}),e.jsxs("div",{className:"flex items-center gap-2",children:[s&&e.jsx(Q,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:e.jsxs(go,{to:`/admin/toolbox?edit=${d.id}`,children:[e.jsx(ei,{className:"h-4 w-4"}),e.jsx("span",{children:"Edit"})]})}),e.jsx(K3,{resourceType:"resource_kit",resourceId:d.id,resourceTitle:d.name,size:"default",className:"rounded-full"}),e.jsxs(Q,{variant:j?"default":"outline",className:"gap-2 rounded-full",onClick:()=>N.mutate(),disabled:!r||N.isPending,children:[e.jsx(_d,{className:`h-4 w-4 ${j?"fill-current":""}`}),g.length," ",g.length===1?"Like":"Likes"]})]})]}),d.description&&e.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:d.description}})]}),d.files&&d.files.length>0&&e.jsx(ze,{children:e.jsxs(qe,{className:"pt-6",children:[e.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[e.jsx(fa,{className:"h-4 w-4"}),"Included Resources (",d.files.length,")"]}),e.jsx("div",{className:"grid gap-2",children:d.files.map(I=>e.jsxs("a",{href:I.file_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("toolbox",d.id,d.name,"click_pdf"),className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-md bg-primary/10",children:e.jsx(fa,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-sm",children:I.name}),I.file_size&&e.jsx("div",{className:"text-xs text-muted-foreground",children:A(I.file_size)})]})]}),e.jsx(Oi,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},I.id))})]})}),d.links&&d.links.length>0&&e.jsx(ze,{children:e.jsxs(qe,{className:"pt-6",children:[e.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[e.jsx(En,{className:"h-4 w-4"}),"Canva Templates (",d.links.length,")"]}),e.jsx("div",{className:"grid gap-2",children:d.links.map(I=>e.jsxs("a",{href:I.canva_share_link,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("toolbox",d.id,d.name,"click_canva"),className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-md bg-purple-500/10",children:e.jsx(En,{className:"h-4 w-4 text-purple-600"})}),e.jsx("div",{className:"font-medium text-sm",children:I.title})]}),e.jsx("span",{className:"text-xs text-muted-foreground group-hover:text-primary transition-colors",children:"Open in Canva"})]},I.id))})]})}),e.jsx(A9e,{resourceType:"resource_kit",resourceId:d.id}),e.jsx(gd,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[e.jsx(Pl,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),r?e.jsxs("form",{onSubmit:M,className:"flex gap-2",children:[e.jsx(Ks,{placeholder:"Add a comment...",value:l,onChange:I=>i(I.target.value),className:"min-h-[80px] resize-none flex-1"}),e.jsx(Q,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!l.trim()||v.isPending,children:e.jsx(Mi,{className:"h-4 w-4"})})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),e.jsx("div",{className:"space-y-4",children:y.length===0?e.jsx(ze,{children:e.jsx(qe,{className:"py-8 text-center",children:e.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):y.map(I=>e.jsx(ze,{children:e.jsx(qe,{className:"pt-4 pb-4",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(ln,{className:"h-10 w-10 flex-shrink-0",children:e.jsx(cn,{className:"text-sm",children:S(I.user_name||"U")})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-medium",children:I.user_name}),e.jsx("span",{className:"text-sm text-muted-foreground",children:Su(new Date(I.created_at),{addSuffix:!0})}),I.user_id===(r==null?void 0:r.id)&&e.jsx(Q,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>b.mutate(I.id),children:e.jsx(Rs,{className:"h-3 w-3 text-muted-foreground"})})]}),e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:I.content})]})]})})},I.id))})]})]})}):e.jsx(Fr,{title:"Toolbox",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(Wl,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold",children:"Resource kit not found"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"This resource kit may have been removed or is not available."}),e.jsx(Q,{asChild:!0,className:"mt-4",children:e.jsx(go,{to:"/toolbox",children:"Back to Toolbox"})})]})})},bkt=()=>{const t=Ws(),[r,s]=E.useState(""),[n,a]=E.useState("grid"),{data:o=[],isLoading:l}=Ht({queryKey:["social-swag"],queryFn:async()=>{const{data:m,error:g}=await Z.from("social_swag").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(g)throw g;const{data:y,error:v}=await Z.from("social_swag_links").select("*").order("sort_order");if(v)throw v;const{data:b}=await Z.from("social_swag_likes").select("swag_id"),{data:N}=await Z.from("social_swag_comments").select("swag_id"),j=new Map;b==null||b.forEach(M=>{j.set(M.swag_id,(j.get(M.swag_id)||0)+1)});const S=new Map;return N==null||N.forEach(M=>{S.set(M.swag_id,(S.get(M.swag_id)||0)+1)}),(m||[]).map(M=>({...M,links:(y||[]).filter(I=>I.swag_id===M.id)||[],likesCount:j.get(M.id)||0,commentsCount:S.get(M.id)||0}))}}),i=o.filter(m=>{var y;return m.title.toLowerCase().includes(r.toLowerCase())||((y=m.description)==null?void 0:y.toLowerCase().includes(r.toLowerCase()))}),d=m=>{t(`/social-swag/${m}`)};return e.jsx(Fr,{title:"Social Swag",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Social Swag"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Browse our collection of social media content and graphics"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search social swag...",value:r,onChange:m=>s(m.target.value),className:"pl-9"})]}),e.jsxs("div",{className:"flex gap-2",children:[r&&e.jsx(Q,{variant:"outline",size:"sm",onClick:()=>s(""),children:"Clear"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(Q,{variant:n==="grid"?"secondary":"outline",size:"icon",onClick:()=>a("grid"),className:"rounded-full",children:e.jsx(yp,{className:"h-4 w-4"})}),e.jsx(Q,{variant:n==="list"?"secondary":"outline",size:"icon",onClick:()=>a("list"),className:"rounded-full",children:e.jsx(vp,{className:"h-4 w-4"})})]})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[i.length," item",i.length!==1?"s":""," found"]}),l&&e.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(8)].map((m,g)=>e.jsx(ze,{children:e.jsxs(qe,{className:"p-4",children:[e.jsx(fr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),e.jsx(fr,{className:"h-5 w-3/4 mb-2"}),e.jsx(fr,{className:"h-4 w-full mb-4"})]})},g))}),!l&&i.length===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"text-muted-foreground mb-4",children:r?"No items match your search":"No social swag available yet"}),r&&e.jsx(Q,{variant:"outline",onClick:()=>s(""),children:"Clear Search"})]}),!l&&i.length>0&&e.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(m=>e.jsxs(ze,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${n==="list"?"flex flex-row":""}`,onClick:()=>d(m.id),children:[e.jsxs("div",{className:`relative overflow-hidden bg-muted ${n==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:[m.preview_image_url?e.jsx("img",{src:m.preview_image_url,alt:m.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No Preview"}),m.links.length>1&&e.jsx("div",{className:"absolute top-2 right-2",children:e.jsxs(bt,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm",children:[e.jsx(Bo,{className:"h-3 w-3"}),m.links.length]})})]}),e.jsxs(qe,{className:`p-4 flex flex-col ${n==="list"?"flex-1":""}`,children:[e.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:m.title}),m.description&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:m.description.replace(/<[^>]*>/g,"")}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(_d,{className:"h-3.5 w-3.5"}),m.likesCount]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Pl,{className:"h-3.5 w-3.5"}),m.commentsCount]})]}),e.jsxs(Q,{size:"sm",className:"w-full gap-2",onClick:g=>{g.stopPropagation(),d(m.id)},children:[e.jsx(En,{className:"h-4 w-4"}),"View Details"]})]})]},m.id))})]})})};var Wa=function(){return Wa=Object.assign||function(r){for(var s,n=1,a=arguments.length;n1&&(d||!m),y=r>1&&(m||!d),v=function(){n&&o(n)},b=function(){a&&o(a)};return e.jsx(eNt,{displayMonth:t.displayMonth,hideNext:g,hidePrevious:y,nextMonth:a,previousMonth:n,onPreviousClick:v,onNextClick:b})}function tNt(t){var r,s=ul(),n=s.classNames,a=s.disableNavigation,o=s.styles,l=s.captionLayout,i=s.components,d=(r=i==null?void 0:i.CaptionLabel)!==null&&r!==void 0?r:P9e,m;return a?m=e.jsx(d,{id:t.id,displayMonth:t.displayMonth}):l==="dropdown"?m=e.jsx(KSe,{displayMonth:t.displayMonth,id:t.id}):l==="dropdown-buttons"?m=e.jsxs(e.Fragment,{children:[e.jsx(KSe,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id}),e.jsx(ZSe,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id})]}):m=e.jsxs(e.Fragment,{children:[e.jsx(d,{id:t.id,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),e.jsx(ZSe,{displayMonth:t.displayMonth,id:t.id})]}),e.jsx("div",{className:n.caption,style:o.caption,children:m})}function rNt(t){var r=ul(),s=r.footer,n=r.styles,a=r.classNames.tfoot;return s?e.jsx("tfoot",{className:a,style:n.tfoot,children:e.jsx("tr",{children:e.jsx("td",{colSpan:8,children:s})})}):e.jsx(e.Fragment,{})}function sNt(t,r,s){for(var n=s?Oy(new Date):Am(new Date,{locale:t,weekStartsOn:r}),a=[],o=0;o<7;o++){var l=sc(n,o);a.push(l)}return a}function nNt(){var t=ul(),r=t.classNames,s=t.styles,n=t.showWeekNumber,a=t.locale,o=t.weekStartsOn,l=t.ISOWeek,i=t.formatters.formatWeekdayName,d=t.labels.labelWeekday,m=sNt(a,o,l);return e.jsxs("tr",{style:s.head_row,className:r.head_row,children:[n&&e.jsx("td",{style:s.head_cell,className:r.head_cell}),m.map(function(g,y){return e.jsx("th",{scope:"col",className:r.head_cell,style:s.head_cell,"aria-label":d(g,{locale:a}),children:i(g,{locale:a})},y)})]})}function aNt(){var t,r=ul(),s=r.classNames,n=r.styles,a=r.components,o=(t=a==null?void 0:a.HeadRow)!==null&&t!==void 0?t:nNt;return e.jsx("thead",{style:n.head,className:s.head,children:e.jsx(o,{})})}function iNt(t){var r=ul(),s=r.locale,n=r.formatters.formatDay;return e.jsx(e.Fragment,{children:n(t.date,{locale:s})})}var F0e=E.createContext(void 0);function oNt(t){if(!AP(t.initialProps)){var r={selected:void 0,modifiers:{disabled:[]}};return e.jsx(F0e.Provider,{value:r,children:t.children})}return e.jsx(lNt,{initialProps:t.initialProps,children:t.children})}function lNt(t){var r=t.initialProps,s=t.children,n=r.selected,a=r.min,o=r.max,l=function(m,g,y){var v,b;(v=r.onDayClick)===null||v===void 0||v.call(r,m,g,y);var N=!!(g.selected&&a&&(n==null?void 0:n.length)===a);if(!N){var j=!!(!g.selected&&o&&(n==null?void 0:n.length)===o);if(!j){var S=n?E9e([],n):[];if(g.selected){var A=S.findIndex(function(M){return Vl(m,M)});S.splice(A,1)}else S.push(m);(b=r.onSelect)===null||b===void 0||b.call(r,S,m,g,y)}}},i={disabled:[]};n&&i.disabled.push(function(m){var g=o&&n.length>o-1,y=n.some(function(v){return Vl(v,m)});return!!(g&&!y)});var d={selected:n,onDayClick:l,modifiers:i};return e.jsx(F0e.Provider,{value:d,children:s})}function z0e(){var t=E.useContext(F0e);if(!t)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return t}function cNt(t,r){var s=r||{},n=s.from,a=s.to;return n&&a?Vl(a,t)&&Vl(n,t)?void 0:Vl(a,t)?{from:a,to:void 0}:Vl(n,t)?void 0:Zte(n,t)?{from:t,to:a}:{from:n,to:t}:a?Zte(t,a)?{from:a,to:t}:{from:t,to:a}:n?Jne(t,n)?{from:t,to:n}:{from:n,to:t}:{from:t,to:void 0}}var B0e=E.createContext(void 0);function dNt(t){if(!EP(t.initialProps)){var r={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return e.jsx(B0e.Provider,{value:r,children:t.children})}return e.jsx(uNt,{initialProps:t.initialProps,children:t.children})}function uNt(t){var r=t.initialProps,s=t.children,n=r.selected,a=n||{},o=a.from,l=a.to,i=r.min,d=r.max,m=function(b,N,j){var S,A;(S=r.onDayClick)===null||S===void 0||S.call(r,b,N,j);var M=cNt(b,n);(A=r.onSelect)===null||A===void 0||A.call(r,M,b,N,j)},g={range_start:[],range_end:[],range_middle:[],disabled:[]};if(o?(g.range_start=[o],l?(g.range_end=[l],Vl(o,l)||(g.range_middle=[{after:o,before:l}])):g.range_end=[o]):l&&(g.range_start=[l],g.range_end=[l]),i&&(o&&!l&&g.disabled.push({after:Zce(o,i-1),before:sc(o,i-1)}),o&&l&&g.disabled.push({after:o,before:sc(o,i-1)}),!o&&l&&g.disabled.push({after:Zce(l,i-1),before:sc(l,i-1)})),d){if(o&&!l&&(g.disabled.push({before:sc(o,-d+1)}),g.disabled.push({after:sc(o,d-1)})),o&&l){var y=Ef(l,o)+1,v=d-y;g.disabled.push({before:Zce(o,v)}),g.disabled.push({after:sc(l,v)})}!o&&l&&(g.disabled.push({before:sc(l,-d+1)}),g.disabled.push({after:sc(l,d-1)}))}return e.jsx(B0e.Provider,{value:{selected:n,onDayClick:m,modifiers:g},children:s})}function $0e(){var t=E.useContext(B0e);if(!t)throw new Error("useSelectRange must be used within a SelectRangeProvider");return t}function ste(t){return Array.isArray(t)?E9e([],t):t!==void 0?[t]:[]}function hNt(t){var r={};return Object.entries(t).forEach(function(s){var n=s[0],a=s[1];r[n]=ste(a)}),r}var Zf;(function(t){t.Outside="outside",t.Disabled="disabled",t.Selected="selected",t.Hidden="hidden",t.Today="today",t.RangeStart="range_start",t.RangeEnd="range_end",t.RangeMiddle="range_middle"})(Zf||(Zf={}));var mNt=Zf.Selected,Vx=Zf.Disabled,pNt=Zf.Hidden,fNt=Zf.Today,Ide=Zf.RangeEnd,Pde=Zf.RangeMiddle,Lde=Zf.RangeStart,gNt=Zf.Outside;function xNt(t,r,s){var n,a=(n={},n[mNt]=ste(t.selected),n[Vx]=ste(t.disabled),n[pNt]=ste(t.hidden),n[fNt]=[t.today],n[Ide]=[],n[Pde]=[],n[Lde]=[],n[gNt]=[],n);return t.fromDate&&a[Vx].push({before:t.fromDate}),t.toDate&&a[Vx].push({after:t.toDate}),AP(t)?a[Vx]=a[Vx].concat(r.modifiers[Vx]):EP(t)&&(a[Vx]=a[Vx].concat(s.modifiers[Vx]),a[Lde]=s.modifiers[Lde],a[Pde]=s.modifiers[Pde],a[Ide]=s.modifiers[Ide]),a}var D9e=E.createContext(void 0);function yNt(t){var r=ul(),s=z0e(),n=$0e(),a=xNt(r,s,n),o=hNt(r.modifiers),l=Wa(Wa({},a),o);return e.jsx(D9e.Provider,{value:l,children:t.children})}function R9e(){var t=E.useContext(D9e);if(!t)throw new Error("useModifiers must be used within a ModifiersProvider");return t}function vNt(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function _Nt(t){return!!(t&&typeof t=="object"&&"from"in t)}function bNt(t){return!!(t&&typeof t=="object"&&"after"in t)}function wNt(t){return!!(t&&typeof t=="object"&&"before"in t)}function jNt(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function kNt(t,r){var s,n=r.from,a=r.to;if(n&&a){var o=Ef(a,n)<0;o&&(s=[a,n],n=s[0],a=s[1]);var l=Ef(t,n)>=0&&Ef(a,t)>=0;return l}return a?Vl(a,t):n?Vl(n,t):!1}function NNt(t){return dye(t)}function SNt(t){return Array.isArray(t)&&t.every(dye)}function CNt(t,r){return r.some(function(s){if(typeof s=="boolean")return s;if(NNt(s))return Vl(t,s);if(SNt(s))return s.includes(t);if(_Nt(s))return kNt(t,s);if(jNt(s))return s.dayOfWeek.includes(t.getDay());if(vNt(s)){var n=Ef(s.before,t),a=Ef(s.after,t),o=n>0,l=a<0,i=Zte(s.before,s.after);return i?l&&o:o||l}return bNt(s)?Ef(t,s.after)>0:wNt(s)?Ef(s.before,t)>0:typeof s=="function"?s(t):!1})}function U0e(t,r,s){var n=Object.keys(r).reduce(function(o,l){var i=r[l];return CNt(t,i)&&o.push(l),o},[]),a={};return n.forEach(function(o){return a[o]=!0}),s&&!yye(t,s)&&(a.outside=!0),a}function MNt(t,r){for(var s=zh(t[0]),n=Xne(t[t.length-1]),a,o,l=s;l<=n;){var i=U0e(l,r),d=!i.disabled&&!i.hidden;if(!d){l=sc(l,1);continue}if(i.selected)return l;i.today&&!o&&(o=l),a||(a=l),l=sc(l,1)}return o||a}var TNt=365;function F9e(t,r){var s=r.moveBy,n=r.direction,a=r.context,o=r.modifiers,l=r.retry,i=l===void 0?{count:0,lastFocused:t}:l,d=a.weekStartsOn,m=a.fromDate,g=a.toDate,y=a.locale,v={day:sc,week:hj,month:$h,year:Kdt,startOfWeek:function(S){return a.ISOWeek?Oy(S):Am(S,{locale:y,weekStartsOn:d})},endOfWeek:function(S){return a.ISOWeek?tDe(S):uye(S,{locale:y,weekStartsOn:d})}},b=v[s](t,n==="after"?1:-1);n==="before"&&m?b=Zdt([m,b]):n==="after"&&g&&(b=Ydt([g,b]));var N=!0;if(o){var j=U0e(b,o);N=!j.disabled&&!j.hidden}return N?b:i.count>TNt?i.lastFocused:F9e(b,{moveBy:s,direction:n,context:a,modifiers:o,retry:Wa(Wa({},i),{count:i.count+1})})}var z9e=E.createContext(void 0);function ANt(t){var r=IP(),s=R9e(),n=E.useState(),a=n[0],o=n[1],l=E.useState(),i=l[0],d=l[1],m=MNt(r.displayMonths,s),g=a??(i&&r.isDateDisplayed(i))?i:m,y=function(){d(a),o(void 0)},v=function(S){o(S)},b=ul(),N=function(S,A){if(a){var M=F9e(a,{moveBy:S,direction:A,context:b,modifiers:s});Vl(a,M)||(r.goToDate(M,a),v(M))}},j={focusedDay:a,focusTarget:g,blur:y,focus:v,focusDayAfter:function(){return N("day","after")},focusDayBefore:function(){return N("day","before")},focusWeekAfter:function(){return N("week","after")},focusWeekBefore:function(){return N("week","before")},focusMonthBefore:function(){return N("month","before")},focusMonthAfter:function(){return N("month","after")},focusYearBefore:function(){return N("year","before")},focusYearAfter:function(){return N("year","after")},focusStartOfWeek:function(){return N("startOfWeek","before")},focusEndOfWeek:function(){return N("endOfWeek","after")}};return e.jsx(z9e.Provider,{value:j,children:t.children})}function q0e(){var t=E.useContext(z9e);if(!t)throw new Error("useFocusContext must be used within a FocusProvider");return t}function ENt(t,r){var s=R9e(),n=U0e(t,s,r);return n}var V0e=E.createContext(void 0);function INt(t){if(!Fae(t.initialProps)){var r={selected:void 0};return e.jsx(V0e.Provider,{value:r,children:t.children})}return e.jsx(PNt,{initialProps:t.initialProps,children:t.children})}function PNt(t){var r=t.initialProps,s=t.children,n=function(o,l,i){var d,m,g;if((d=r.onDayClick)===null||d===void 0||d.call(r,o,l,i),l.selected&&!r.required){(m=r.onSelect)===null||m===void 0||m.call(r,void 0,o,l,i);return}(g=r.onSelect)===null||g===void 0||g.call(r,o,o,l,i)},a={selected:r.selected,onDayClick:n};return e.jsx(V0e.Provider,{value:a,children:s})}function B9e(){var t=E.useContext(V0e);if(!t)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return t}function LNt(t,r){var s=ul(),n=B9e(),a=z0e(),o=$0e(),l=q0e(),i=l.focusDayAfter,d=l.focusDayBefore,m=l.focusWeekAfter,g=l.focusWeekBefore,y=l.blur,v=l.focus,b=l.focusMonthBefore,N=l.focusMonthAfter,j=l.focusYearBefore,S=l.focusYearAfter,A=l.focusStartOfWeek,M=l.focusEndOfWeek,I=function(de){var ue,xe,Te,be;Fae(s)?(ue=n.onDayClick)===null||ue===void 0||ue.call(n,t,r,de):AP(s)?(xe=a.onDayClick)===null||xe===void 0||xe.call(a,t,r,de):EP(s)?(Te=o.onDayClick)===null||Te===void 0||Te.call(o,t,r,de):(be=s.onDayClick)===null||be===void 0||be.call(s,t,r,de)},F=function(de){var ue;v(t),(ue=s.onDayFocus)===null||ue===void 0||ue.call(s,t,r,de)},O=function(de){var ue;y(),(ue=s.onDayBlur)===null||ue===void 0||ue.call(s,t,r,de)},B=function(de){var ue;(ue=s.onDayMouseEnter)===null||ue===void 0||ue.call(s,t,r,de)},$=function(de){var ue;(ue=s.onDayMouseLeave)===null||ue===void 0||ue.call(s,t,r,de)},H=function(de){var ue;(ue=s.onDayPointerEnter)===null||ue===void 0||ue.call(s,t,r,de)},W=function(de){var ue;(ue=s.onDayPointerLeave)===null||ue===void 0||ue.call(s,t,r,de)},X=function(de){var ue;(ue=s.onDayTouchCancel)===null||ue===void 0||ue.call(s,t,r,de)},se=function(de){var ue;(ue=s.onDayTouchEnd)===null||ue===void 0||ue.call(s,t,r,de)},ae=function(de){var ue;(ue=s.onDayTouchMove)===null||ue===void 0||ue.call(s,t,r,de)},le=function(de){var ue;(ue=s.onDayTouchStart)===null||ue===void 0||ue.call(s,t,r,de)},ne=function(de){var ue;(ue=s.onDayKeyUp)===null||ue===void 0||ue.call(s,t,r,de)},fe=function(de){var ue;switch(de.key){case"ArrowLeft":de.preventDefault(),de.stopPropagation(),s.dir==="rtl"?i():d();break;case"ArrowRight":de.preventDefault(),de.stopPropagation(),s.dir==="rtl"?d():i();break;case"ArrowDown":de.preventDefault(),de.stopPropagation(),m();break;case"ArrowUp":de.preventDefault(),de.stopPropagation(),g();break;case"PageUp":de.preventDefault(),de.stopPropagation(),de.shiftKey?j():b();break;case"PageDown":de.preventDefault(),de.stopPropagation(),de.shiftKey?S():N();break;case"Home":de.preventDefault(),de.stopPropagation(),A();break;case"End":de.preventDefault(),de.stopPropagation(),M();break}(ue=s.onDayKeyDown)===null||ue===void 0||ue.call(s,t,r,de)},oe={onClick:I,onFocus:F,onBlur:O,onKeyDown:fe,onKeyUp:ne,onMouseEnter:B,onMouseLeave:$,onPointerEnter:H,onPointerLeave:W,onTouchCancel:X,onTouchEnd:se,onTouchMove:ae,onTouchStart:le};return oe}function ONt(){var t=ul(),r=B9e(),s=z0e(),n=$0e(),a=Fae(t)?r.selected:AP(t)?s.selected:EP(t)?n.selected:void 0;return a}function DNt(t){return Object.values(Zf).includes(t)}function RNt(t,r){var s=[t.classNames.day];return Object.keys(r).forEach(function(n){var a=t.modifiersClassNames[n];if(a)s.push(a);else if(DNt(n)){var o=t.classNames["day_".concat(n)];o&&s.push(o)}}),s}function FNt(t,r){var s=Wa({},t.styles.day);return Object.keys(r).forEach(function(n){var a;s=Wa(Wa({},s),(a=t.modifiersStyles)===null||a===void 0?void 0:a[n])}),s}function zNt(t,r,s){var n,a,o,l=ul(),i=q0e(),d=ENt(t,r),m=LNt(t,d),g=ONt(),y=!!(l.onDayClick||l.mode!=="default");E.useEffect(function(){var B;d.outside||i.focusedDay&&y&&Vl(i.focusedDay,t)&&((B=s.current)===null||B===void 0||B.focus())},[i.focusedDay,t,s,y,d.outside]);var v=RNt(l,d).join(" "),b=FNt(l,d),N=!!(d.outside&&!l.showOutsideDays||d.hidden),j=(o=(a=l.components)===null||a===void 0?void 0:a.DayContent)!==null&&o!==void 0?o:iNt,S=e.jsx(j,{date:t,displayMonth:r,activeModifiers:d}),A={style:b,className:v,children:S,role:"gridcell"},M=i.focusTarget&&Vl(i.focusTarget,t)&&!d.outside,I=i.focusedDay&&Vl(i.focusedDay,t),F=Wa(Wa(Wa({},A),(n={disabled:d.disabled,role:"gridcell"},n["aria-selected"]=d.selected,n.tabIndex=I||M?0:-1,n)),m),O={isButton:y,isHidden:N,activeModifiers:d,selectedDays:g,buttonProps:F,divProps:A};return O}function BNt(t){var r=E.useRef(null),s=zNt(t.date,t.displayMonth,r);return s.isHidden?e.jsx("div",{role:"gridcell"}):s.isButton?e.jsx(Jre,Wa({name:"day",ref:r},s.buttonProps)):e.jsx("div",Wa({},s.divProps))}function $Nt(t){var r=t.number,s=t.dates,n=ul(),a=n.onWeekNumberClick,o=n.styles,l=n.classNames,i=n.locale,d=n.labels.labelWeekNumber,m=n.formatters.formatWeekNumber,g=m(Number(r),{locale:i});if(!a)return e.jsx("span",{className:l.weeknumber,style:o.weeknumber,children:g});var y=d(Number(r),{locale:i}),v=function(b){a(r,s,b)};return e.jsx(Jre,{name:"week-number","aria-label":y,className:l.weeknumber,style:o.weeknumber,onClick:v,children:g})}function UNt(t){var r,s,n=ul(),a=n.styles,o=n.classNames,l=n.showWeekNumber,i=n.components,d=(r=i==null?void 0:i.Day)!==null&&r!==void 0?r:BNt,m=(s=i==null?void 0:i.WeekNumber)!==null&&s!==void 0?s:$Nt,g;return l&&(g=e.jsx("td",{className:o.cell,style:a.cell,children:e.jsx(m,{number:t.weekNumber,dates:t.dates})})),e.jsxs("tr",{className:o.row,style:a.row,children:[g,t.dates.map(function(y){return e.jsx("td",{className:o.cell,style:a.cell,role:"presentation",children:e.jsx(d,{displayMonth:t.displayMonth,date:y})},Jut(y))})]})}function YSe(t,r,s){for(var n=s!=null&&s.ISOWeek?tDe(r):uye(r,s),a=s!=null&&s.ISOWeek?Oy(t):Am(t,s),o=Ef(n,a),l=[],i=0;i<=o;i++)l.push(sc(a,i));var d=l.reduce(function(m,g){var y=s!=null&&s.ISOWeek?hye(g):pye(g,s),v=m.find(function(b){return b.weekNumber===y});return v?(v.dates.push(g),m):(m.push({weekNumber:y,dates:[g]}),m)},[]);return d}function qNt(t,r){var s=YSe(zh(t),Xne(t),r);if(r!=null&&r.useFixedWeeks){var n=tht(t,r);if(n<6){var a=s[s.length-1],o=a.dates[a.dates.length-1],l=hj(o,6-n),i=YSe(hj(o,1),l,r);s.push.apply(s,i)}}return s}function VNt(t){var r,s,n,a=ul(),o=a.locale,l=a.classNames,i=a.styles,d=a.hideHead,m=a.fixedWeeks,g=a.components,y=a.weekStartsOn,v=a.firstWeekContainsDate,b=a.ISOWeek,N=qNt(t.displayMonth,{useFixedWeeks:!!m,ISOWeek:b,locale:o,weekStartsOn:y,firstWeekContainsDate:v}),j=(r=g==null?void 0:g.Head)!==null&&r!==void 0?r:aNt,S=(s=g==null?void 0:g.Row)!==null&&s!==void 0?s:UNt,A=(n=g==null?void 0:g.Footer)!==null&&n!==void 0?n:rNt;return e.jsxs("table",{id:t.id,className:l.table,style:i.table,role:"grid","aria-labelledby":t["aria-labelledby"],children:[!d&&e.jsx(j,{}),e.jsx("tbody",{className:l.tbody,style:i.tbody,children:N.map(function(M){return e.jsx(S,{displayMonth:t.displayMonth,dates:M.dates,weekNumber:M.weekNumber},M.weekNumber)})}),e.jsx(A,{displayMonth:t.displayMonth})]})}function HNt(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var WNt=HNt()?E.useLayoutEffect:E.useEffect,Ode=!1,GNt=0;function XSe(){return"react-day-picker-".concat(++GNt)}function KNt(t){var r,s=t??(Ode?XSe():null),n=E.useState(s),a=n[0],o=n[1];return WNt(function(){a===null&&o(XSe())},[]),E.useEffect(function(){Ode===!1&&(Ode=!0)},[]),(r=t??a)!==null&&r!==void 0?r:void 0}function ZNt(t){var r,s,n=ul(),a=n.dir,o=n.classNames,l=n.styles,i=n.components,d=IP().displayMonths,m=KNt(n.id?"".concat(n.id,"-").concat(t.displayIndex):void 0),g=n.id?"".concat(n.id,"-grid-").concat(t.displayIndex):void 0,y=[o.month],v=l.month,b=t.displayIndex===0,N=t.displayIndex===d.length-1,j=!b&&!N;a==="rtl"&&(r=[b,N],N=r[0],b=r[1]),b&&(y.push(o.caption_start),v=Wa(Wa({},v),l.caption_start)),N&&(y.push(o.caption_end),v=Wa(Wa({},v),l.caption_end)),j&&(y.push(o.caption_between),v=Wa(Wa({},v),l.caption_between));var S=(s=i==null?void 0:i.Caption)!==null&&s!==void 0?s:tNt;return e.jsxs("div",{className:y.join(" "),style:v,children:[e.jsx(S,{id:m,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),e.jsx(VNt,{id:g,"aria-labelledby":m,displayMonth:t.displayMonth})]},t.displayIndex)}function YNt(t){var r=ul(),s=r.classNames,n=r.styles;return e.jsx("div",{className:s.months,style:n.months,children:t.children})}function XNt(t){var r,s,n=t.initialProps,a=ul(),o=q0e(),l=IP(),i=E.useState(!1),d=i[0],m=i[1];E.useEffect(function(){a.initialFocus&&o.focusTarget&&(d||(o.focus(o.focusTarget),m(!0)))},[a.initialFocus,d,o.focus,o.focusTarget,o]);var g=[a.classNames.root,a.className];a.numberOfMonths>1&&g.push(a.classNames.multiple_months),a.showWeekNumber&&g.push(a.classNames.with_weeknumber);var y=Wa(Wa({},a.styles.root),a.style),v=Object.keys(n).filter(function(N){return N.startsWith("data-")}).reduce(function(N,j){var S;return Wa(Wa({},N),(S={},S[j]=n[j],S))},{}),b=(s=(r=n.components)===null||r===void 0?void 0:r.Months)!==null&&s!==void 0?s:YNt;return e.jsx("div",Wa({className:g.join(" "),style:y,dir:a.dir,id:a.id,nonce:n.nonce,title:n.title,lang:n.lang},v,{children:e.jsx(b,{children:l.displayMonths.map(function(N,j){return e.jsx(ZNt,{displayIndex:j,displayMonth:N},j)})})}))}function QNt(t){var r=t.children,s=wkt(t,["children"]);return e.jsx($kt,{initialProps:s,children:e.jsx(Xkt,{children:e.jsx(INt,{initialProps:s,children:e.jsx(oNt,{initialProps:s,children:e.jsx(dNt,{initialProps:s,children:e.jsx(yNt,{children:e.jsx(ANt,{children:r})})})})})})})}function JNt(t){return e.jsx(QNt,Wa({},t,{children:e.jsx(XNt,{initialProps:t})}))}function Vf({className:t,classNames:r,showOutsideDays:s=!0,...n}){return e.jsx(JNt,{showOutsideDays:s,className:qt("p-3",t),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:qt(GE({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:qt(GE({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",...r},components:{IconLeft:({...a})=>e.jsx(uc,{className:"h-4 w-4"}),IconRight:({...a})=>e.jsx(Wi,{className:"h-4 w-4"})},...n})}Vf.displayName="Calendar";var zae="Popover",[$9e]=fc(zae,[ux]),PP=ux(),[e4t,Fv]=$9e(zae),U9e=t=>{const{__scopePopover:r,children:s,open:n,defaultOpen:a,onOpenChange:o,modal:l=!1}=t,i=PP(r),d=E.useRef(null),[m,g]=E.useState(!1),[y,v]=oh({prop:n,defaultProp:a??!1,onChange:o,caller:zae});return e.jsx(uP,{...i,children:e.jsx(e4t,{scope:r,contentId:bd(),triggerRef:d,open:y,onOpenChange:v,onOpenToggle:E.useCallback(()=>v(b=>!b),[v]),hasCustomAnchor:m,onCustomAnchorAdd:E.useCallback(()=>g(!0),[]),onCustomAnchorRemove:E.useCallback(()=>g(!1),[]),modal:l,children:s})})};U9e.displayName=zae;var q9e="PopoverAnchor",t4t=E.forwardRef((t,r)=>{const{__scopePopover:s,...n}=t,a=Fv(q9e,s),o=PP(s),{onCustomAnchorAdd:l,onCustomAnchorRemove:i}=a;return E.useEffect(()=>(l(),()=>i()),[l,i]),e.jsx(P3,{...o,...n,ref:r})});t4t.displayName=q9e;var V9e="PopoverTrigger",H9e=E.forwardRef((t,r)=>{const{__scopePopover:s,...n}=t,a=Fv(V9e,s),o=PP(s),l=ga(r,a.triggerRef),i=e.jsx(qs.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Y9e(a.open),...n,ref:l,onClick:bs(t.onClick,a.onOpenToggle)});return a.hasCustomAnchor?i:e.jsx(P3,{asChild:!0,...o,children:i})});H9e.displayName=V9e;var H0e="PopoverPortal",[r4t,s4t]=$9e(H0e,{forceMount:void 0}),W9e=t=>{const{__scopePopover:r,forceMount:s,children:n,container:a}=t,o=Fv(H0e,r);return e.jsx(r4t,{scope:r,forceMount:s,children:e.jsx(zc,{present:s||o.open,children:e.jsx(M3,{asChild:!0,container:a,children:n})})})};W9e.displayName=H0e;var e3="PopoverContent",G9e=E.forwardRef((t,r)=>{const s=s4t(e3,t.__scopePopover),{forceMount:n=s.forceMount,...a}=t,o=Fv(e3,t.__scopePopover);return e.jsx(zc,{present:n||o.open,children:o.modal?e.jsx(a4t,{...a,ref:r}):e.jsx(i4t,{...a,ref:r})})});G9e.displayName=e3;var n4t=fv("PopoverContent.RemoveScroll"),a4t=E.forwardRef((t,r)=>{const s=Fv(e3,t.__scopePopover),n=E.useRef(null),a=ga(r,n),o=E.useRef(!1);return E.useEffect(()=>{const l=n.current;if(l)return One(l)},[]),e.jsx(xP,{as:n4t,allowPinchZoom:!0,children:e.jsx(K9e,{...t,ref:a,trapFocus:s.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:bs(t.onCloseAutoFocus,l=>{var i;l.preventDefault(),o.current||(i=s.triggerRef.current)==null||i.focus()}),onPointerDownOutside:bs(t.onPointerDownOutside,l=>{const i=l.detail.originalEvent,d=i.button===0&&i.ctrlKey===!0,m=i.button===2||d;o.current=m},{checkForDefaultPrevented:!1}),onFocusOutside:bs(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),i4t=E.forwardRef((t,r)=>{const s=Fv(e3,t.__scopePopover),n=E.useRef(!1),a=E.useRef(!1);return e.jsx(K9e,{...t,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,i;(l=t.onCloseAutoFocus)==null||l.call(t,o),o.defaultPrevented||(n.current||(i=s.triggerRef.current)==null||i.focus(),o.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:o=>{var d,m;(d=t.onInteractOutside)==null||d.call(t,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=o.target;((m=s.triggerRef.current)==null?void 0:m.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}})}),K9e=E.forwardRef((t,r)=>{const{__scopePopover:s,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEscapeKeyDown:i,onPointerDownOutside:d,onFocusOutside:m,onInteractOutside:g,...y}=t,v=Fv(e3,s),b=PP(s);return Lne(),e.jsx(fP,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:o,children:e.jsx(Sv,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:g,onEscapeKeyDown:i,onPointerDownOutside:d,onFocusOutside:m,onDismiss:()=>v.onOpenChange(!1),children:e.jsx(hP,{"data-state":Y9e(v.open),role:"dialog",id:v.contentId,...b,...y,ref:r,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)"}})})})}),Z9e="PopoverClose",o4t=E.forwardRef((t,r)=>{const{__scopePopover:s,...n}=t,a=Fv(Z9e,s);return e.jsx(qs.button,{type:"button",...n,ref:r,onClick:bs(t.onClick,()=>a.onOpenChange(!1))})});o4t.displayName=Z9e;var l4t="PopoverArrow",c4t=E.forwardRef((t,r)=>{const{__scopePopover:s,...n}=t,a=PP(s);return e.jsx(mP,{...a,...n,ref:r})});c4t.displayName=l4t;function Y9e(t){return t?"open":"closed"}var d4t=U9e,u4t=H9e,h4t=W9e,X9e=G9e;const rd=d4t,sd=u4t,Fc=E.forwardRef(({className:t,align:r="center",sideOffset:s=4,...n},a)=>e.jsx(h4t,{children:e.jsx(X9e,{ref:a,align:r,sideOffset:s,className:qt("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));Fc.displayName=X9e.displayName;const m4t=T3("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"}}),W0e=E.forwardRef(({className:t,variant:r,...s},n)=>e.jsx("div",{ref:n,role:"alert",className:qt(m4t({variant:r}),t),...s}));W0e.displayName="Alert";const p4t=E.forwardRef(({className:t,...r},s)=>e.jsx("h5",{ref:s,className:qt("mb-1 font-medium leading-none tracking-tight",t),...r}));p4t.displayName="AlertTitle";const G0e=E.forwardRef(({className:t,...r},s)=>e.jsx("div",{ref:s,className:qt("text-sm [&_p]:leading-relaxed",t),...r}));G0e.displayName="AlertDescription";function f4t({open:t,onOpenChange:r,imageUrl:s,imageId:n,defaultCaption:a="",swagItemId:o,reelId:l}){const i=qr(),[d,m]=E.useState(a),[g,y]=E.useState([]),[v,b]=E.useState(null),[N,j]=E.useState("now"),[S,A]=E.useState(cNe(gNe(new Date),1)),[M,I]=E.useState("12"),[F,O]=E.useState("00"),[B,$]=E.useState("PM");E.useEffect(()=>{if(t){m(a),j("now"),y([]);const ve=cNe(gNe(new Date),1);A(ve);const tt=ve.getHours();I(String(tt>12?tt-12:tt===0?12:tt)),O("00"),$(tt>=12?"PM":"AM")}},[t,a]);const H=()=>{if(!S)return null;let ve=parseInt(M);const tt=parseInt(F);return B==="PM"&&ve!==12&&(ve+=12),B==="AM"&&ve===12&&(ve=0),uDe(dDe(S,ve),tt)},{data:W,isLoading:X}=Ht({queryKey:["social-accounts-for-post"],queryFn:async()=>{const{data:{user:ve}}=await Z.auth.getUser();if(!ve)return[];const{data:tt,error:Ae}=await Z.from("social_accounts").select("*").eq("user_id",ve.id).eq("is_active",!0).order("platform",{ascending:!0});if(Ae)throw Ae;return console.log("Fetched social accounts for posting:",tt),tt},enabled:t,staleTime:0}),se=Jt({mutationFn:async({accountId:ve,platform:tt})=>{b(ve);const{data:Ae,error:Le}=await Z.functions.invoke("social-post",{body:{platform:tt,accountId:ve,imageUrl:s,caption:d}});if(Le)throw Le;if(Ae!=null&&Ae.error)throw new Error(Ae.error);return Ae},onSuccess:ve=>{const tt=ve.platform==="facebook"?"Facebook":ve.platform==="instagram"?"Instagram":ve.platform==="linkedin"?"LinkedIn":"Google Business";Se.success(`Posted to ${tt}!`)},onError:ve=>{Se.error(`Failed to post: ${ve.message}`)},onSettled:()=>{b(null)}}),ae=Jt({mutationFn:async({accountId:ve,platform:tt,scheduledFor:Ae})=>{const{data:{user:Le}}=await Z.auth.getUser();if(!Le)throw new Error("Not authenticated");const{error:Ue}=await Z.from("scheduled_posts").insert({user_id:Le.id,social_account_id:ve,platform:tt,image_url:s,caption:d,swag_item_id:o||null,reel_id:l||null,scheduled_for:Ae.toISOString(),status:"scheduled"});if(Ue)throw Ue;return{platform:tt}},onSuccess:ve=>{const tt=ve.platform==="facebook"?"Facebook":ve.platform==="instagram"?"Instagram":"LinkedIn";Se.success(`Post scheduled for ${tt}!`)},onError:ve=>{Se.error(`Failed to schedule: ${ve.message}`)}}),le=async()=>{if(g.length===0){Se.error("Please select at least one account");return}if(N==="schedule"){const ve=H();if(!ve||ve<=new Date){Se.error("Please select a future date and time");return}for(const tt of g){const Ae=W==null?void 0:W.find(Le=>Le.id===tt);Ae&&await ae.mutateAsync({accountId:tt,platform:Ae.platform,scheduledFor:ve})}i.invalidateQueries({queryKey:["scheduled-posts"]}),Se.success(`${g.length} post(s) scheduled for ${Xr(ve,"PPp")}`)}else for(const ve of g){const tt=W==null?void 0:W.find(Ae=>Ae.id===ve);tt&&await se.mutateAsync({accountId:ve,platform:tt.platform})}i.invalidateQueries({queryKey:["scheduled-posts"]}),m(""),y([]),r(!1)},ne=ve=>{y(tt=>tt.includes(ve)?tt.filter(Ae=>Ae!==ve):[...tt,ve])},fe=(W==null?void 0:W.filter(ve=>ve.platform==="facebook"))||[],oe=(W==null?void 0:W.filter(ve=>ve.platform==="instagram"))||[],de=(W==null?void 0:W.filter(ve=>ve.platform==="linkedin"))||[],ue=(W==null?void 0:W.filter(ve=>ve.platform==="google_business"))||[],xe=((W==null?void 0:W.length)||0)>0,Te=se.isPending||ae.isPending,be=Array.from({length:12},(ve,tt)=>String(tt+1)),we=["00","15","30","45"];return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Create Social Post"}),e.jsx(Gs,{children:"Share this image to your connected social accounts"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsx("div",{className:"aspect-square w-full max-w-[200px] mx-auto overflow-hidden rounded-lg border",children:e.jsx("img",{src:s,alt:"Post preview",className:"h-full w-full object-cover"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"caption",children:"Caption"}),e.jsx(Ks,{id:"caption",placeholder:"Write a caption for your post...",value:d,onChange:ve=>m(ve.target.value),rows:3}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[d.length,"/2200 characters"]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(Ee,{children:"Publish Time"}),e.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted rounded-lg",children:[e.jsx("button",{type:"button",onClick:()=>j("now"),className:qt("flex-1 px-4 py-2 rounded-md text-sm font-medium transition-all",N==="now"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Post Now"}),e.jsx("button",{type:"button",onClick:()=>j("schedule"),className:qt("flex-1 px-4 py-2 rounded-md text-sm font-medium transition-all",N==="schedule"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Schedule"})]})]}),N==="schedule"&&e.jsxs("div",{className:"space-y-3 p-4 border rounded-lg bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[e.jsx(Ea,{className:"h-4 w-4"}),"Schedule for"]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsxs(rd,{children:[e.jsx(sd,{asChild:!0,children:e.jsxs(Q,{variant:"outline",className:qt("justify-start text-left font-normal flex-1",!S&&"text-muted-foreground"),children:[e.jsx(Mn,{className:"mr-2 h-4 w-4"}),S?Xr(S,"PPP"):e.jsx("span",{children:"Pick a date"})]})}),e.jsx(Fc,{className:"w-auto p-0",align:"start",children:e.jsx(Vf,{mode:"single",selected:S,onSelect:A,disabled:ve=>vee.jsx(Ut,{value:ve,children:ve},ve))})]}),e.jsx("span",{className:"text-muted-foreground",children:":"}),e.jsxs(ds,{value:F,onValueChange:O,children:[e.jsx(ls,{className:"w-[70px]",children:e.jsx(us,{})}),e.jsx(cs,{children:we.map(ve=>e.jsx(Ut,{value:ve,children:ve},ve))})]}),e.jsxs(ds,{value:B,onValueChange:ve=>$(ve),children:[e.jsx(ls,{className:"w-[70px]",children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"AM",children:"AM"}),e.jsx(Ut,{value:"PM",children:"PM"})]})]})]})]}),S&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Post will be published on ",Xr(H()||new Date,"PPP 'at' p")]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(Ee,{children:"Post to"}),X&&e.jsx("div",{className:"flex items-center justify-center py-4",children:e.jsx(Hr,{className:"h-6 w-6 animate-spin"})}),!X&&!xe&&e.jsxs(W0e,{children:[e.jsx(_l,{className:"h-4 w-4"}),e.jsxs(G0e,{className:"flex flex-col gap-2",children:[e.jsx("span",{children:"No social accounts connected yet."}),e.jsxs(go,{to:"/social-connections",className:"inline-flex items-center gap-1.5 text-primary hover:underline font-medium",children:[e.jsx(vd,{className:"h-3.5 w-3.5"}),"Connect your Facebook, Instagram & LinkedIn"]})]})]}),fe.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[e.jsx(iu,{className:"h-4 w-4 text-blue-600"})," Facebook"]}),fe.map(ve=>e.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[e.jsx(Yo,{checked:g.includes(ve.id),onCheckedChange:()=>ne(ve.id),disabled:v===ve.id}),e.jsxs(ln,{className:"h-8 w-8",children:[e.jsx(pa,{src:ve.profile_picture_url||""}),e.jsx(cn,{children:e.jsx(iu,{className:"h-4 w-4"})})]}),e.jsx("span",{className:"flex-1 text-sm font-medium",children:ve.page_name||ve.platform_username}),v===ve.id&&e.jsx(Hr,{className:"h-4 w-4 animate-spin"})]},ve.id))]}),oe.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[e.jsx(ju,{className:"h-4 w-4 text-pink-600"})," Instagram"]}),oe.map(ve=>e.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[e.jsx(Yo,{checked:g.includes(ve.id),onCheckedChange:()=>ne(ve.id),disabled:v===ve.id}),e.jsxs(ln,{className:"h-8 w-8",children:[e.jsx(pa,{src:ve.profile_picture_url||""}),e.jsx(cn,{children:e.jsx(ju,{className:"h-4 w-4"})})]}),e.jsxs("span",{className:"flex-1 text-sm font-medium",children:["@",ve.platform_username]}),v===ve.id&&e.jsx(Hr,{className:"h-4 w-4 animate-spin"})]},ve.id))]}),de.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[e.jsx(km,{className:"h-4 w-4 text-blue-700"})," LinkedIn"]}),de.map(ve=>e.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[e.jsx(Yo,{checked:g.includes(ve.id),onCheckedChange:()=>ne(ve.id),disabled:v===ve.id}),e.jsxs(ln,{className:"h-8 w-8",children:[e.jsx(pa,{src:ve.profile_picture_url||""}),e.jsx(cn,{children:e.jsx(km,{className:"h-4 w-4"})})]}),e.jsx("span",{className:"flex-1 text-sm font-medium",children:ve.platform_username}),v===ve.id&&e.jsx(Hr,{className:"h-4 w-4 animate-spin"})]},ve.id))]}),ue.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[e.jsx(eo,{className:"h-4 w-4 text-red-600"})," Google Business"]}),ue.map(ve=>e.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[e.jsx(Yo,{checked:g.includes(ve.id),onCheckedChange:()=>ne(ve.id),disabled:v===ve.id}),e.jsxs(ln,{className:"h-8 w-8",children:[e.jsx(pa,{src:ve.profile_picture_url||""}),e.jsx(cn,{children:e.jsx(eo,{className:"h-4 w-4"})})]}),e.jsx("span",{className:"flex-1 text-sm font-medium",children:ve.page_name||ve.platform_username}),v===ve.id&&e.jsx(Hr,{className:"h-4 w-4 animate-spin"})]},ve.id))]})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsxs(Q,{onClick:le,disabled:g.length===0||Te,className:"gap-2",children:[Te?e.jsx(Hr,{className:"h-4 w-4 animate-spin"}):N==="schedule"?e.jsx(Mn,{className:"h-4 w-4"}):e.jsx(Mi,{className:"h-4 w-4"}),N==="schedule"?`Schedule ${g.length} post${g.length!==1?"s":""}`:`Post to ${g.length} account${g.length!==1?"s":""}`]})]})]})})}function g4t(){const t=qr(),[r,s]=E.useState(void 0),[n,a]=E.useState("all"),[o,l]=E.useState(null),[i,d]=E.useState(""),[m,g]=E.useState(void 0),[y,v]=E.useState("12"),[b,N]=E.useState("00"),[j,S]=E.useState("PM"),{data:A=[],isLoading:M}=Ht({queryKey:["scheduled-posts"],queryFn:async()=>{const{data:ue,error:xe}=await Z.from("scheduled_posts").select(` *, social_accounts ( page_name, platform_username, profile_picture_url ) `).order("scheduled_for",{ascending:!1});if(xe)throw xe;return ue}}),I=A.filter(ue=>{if(n!=="all"&&ue.status!==n)return!1;if(r&&ue.scheduled_for){const xe=new Date(ue.scheduled_for);if(!Vl(xe,r))return!1}return!0}),F=A.filter(ue=>ue.scheduled_for).map(ue=>Em(new Date(ue.scheduled_for))),O=Jt({mutationFn:async ue=>{const{error:xe}=await Z.from("scheduled_posts").update({caption:ue.caption,scheduled_for:ue.scheduled_for}).eq("id",ue.id);if(xe)throw xe},onSuccess:()=>{Se.success("Post updated!"),t.invalidateQueries({queryKey:["scheduled-posts"]}),l(null)},onError:ue=>{Se.error(`Failed to update: ${ue.message}`)}}),B=Jt({mutationFn:async ue=>{const{error:xe}=await Z.from("scheduled_posts").update({status:"cancelled"}).eq("id",ue);if(xe)throw xe},onSuccess:()=>{Se.success("Post cancelled"),t.invalidateQueries({queryKey:["scheduled-posts"]})},onError:ue=>{Se.error(`Failed to cancel: ${ue.message}`)}}),$=Jt({mutationFn:async ue=>{const{error:xe}=await Z.from("scheduled_posts").delete().eq("id",ue);if(xe)throw xe},onSuccess:()=>{Se.success("Post deleted"),t.invalidateQueries({queryKey:["scheduled-posts"]})},onError:ue=>{Se.error(`Failed to delete: ${ue.message}`)}}),H=Jt({mutationFn:async ue=>{const{data:xe,error:Te}=await Z.functions.invoke("social-post",{body:{platform:ue.platform,accountId:ue.social_account_id,imageUrl:ue.image_url,caption:ue.caption}});if(Te)throw Te;if(xe!=null&&xe.error)throw new Error(xe.error);return await Z.from("scheduled_posts").update({status:"posted",posted_at:new Date().toISOString(),post_id:xe.postId}).eq("id",ue.id),xe},onSuccess:ue=>{const xe=ue.platform==="facebook"?"Facebook":ue.platform==="instagram"?"Instagram":"LinkedIn";Se.success(`Posted to ${xe}!`),t.invalidateQueries({queryKey:["scheduled-posts"]})},onError:ue=>{Se.error(`Failed to post: ${ue.message}`)}}),W=ue=>{if(l(ue),d(ue.caption||""),ue.scheduled_for){const xe=new Date(ue.scheduled_for);g(xe);const Te=xe.getHours();v(String(Te>12?Te-12:Te===0?12:Te)),N(String(xe.getMinutes()).padStart(2,"0")),S(Te>=12?"PM":"AM")}},X=()=>{if(!o||!m)return;let ue=parseInt(y);const xe=parseInt(b);j==="PM"&&ue!==12&&(ue+=12),j==="AM"&&ue===12&&(ue=0);const Te=uDe(dDe(m,ue),xe);O.mutate({id:o.id,caption:i,scheduled_for:Te.toISOString()})},se=ue=>{switch(ue){case"facebook":return e.jsx(iu,{className:"h-4 w-4 text-blue-600"});case"instagram":return e.jsx(ju,{className:"h-4 w-4 text-pink-600"});case"linkedin":return e.jsx(km,{className:"h-4 w-4 text-blue-700"});default:return null}},ae=ue=>{switch(ue){case"scheduled":return e.jsxs(bt,{variant:"secondary",className:"gap-1",children:[e.jsx(Ea,{className:"h-3 w-3"}),"Scheduled"]});case"posted":return e.jsxs(bt,{variant:"default",className:"gap-1 bg-green-600",children:[e.jsx(ui,{className:"h-3 w-3"}),"Posted"]});case"failed":return e.jsxs(bt,{variant:"destructive",className:"gap-1",children:[e.jsx(Sc,{className:"h-3 w-3"}),"Failed"]});case"cancelled":return e.jsxs(bt,{variant:"outline",className:"gap-1 text-muted-foreground",children:[e.jsx(_l,{className:"h-3 w-3"}),"Cancelled"]});default:return e.jsx(bt,{variant:"outline",children:ue})}},le=Array.from({length:12},(ue,xe)=>String(xe+1)),ne=["00","15","30","45"],fe=A.filter(ue=>ue.status==="scheduled").length,oe=A.filter(ue=>ue.status==="posted").length,de=A.filter(ue=>ue.status==="scheduled"&&ue.scheduled_for&&rht(new Date(ue.scheduled_for))).length;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs(ze,{className:"p-4",children:[e.jsx("div",{className:"text-2xl font-bold",children:fe}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Scheduled"})]}),e.jsxs(ze,{className:"p-4",children:[e.jsx("div",{className:"text-2xl font-bold",children:de}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Upcoming"})]}),e.jsxs(ze,{className:"p-4",children:[e.jsx("div",{className:"text-2xl font-bold",children:oe}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Posted"})]}),e.jsxs(ze,{className:"p-4",children:[e.jsx("div",{className:"text-2xl font-bold",children:A.length}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Total"})]})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[e.jsxs(ze,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(Ff,{className:"h-5 w-5"}),e.jsx("h3",{className:"font-semibold",children:"Calendar"})]}),e.jsx(Vf,{mode:"single",selected:r,onSelect:s,className:qt("pointer-events-auto"),modifiers:{hasPost:F},modifiersStyles:{hasPost:{fontWeight:"bold",backgroundColor:"hsl(var(--primary) / 0.1)",borderRadius:"50%"}}}),r&&e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>s(void 0),className:"w-full mt-2",children:"Clear date filter"})]}),e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z1,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:["all","scheduled","posted","failed","cancelled"].map(ue=>e.jsx(Q,{variant:n===ue?"default":"outline",size:"sm",onClick:()=>a(ue),className:"capitalize",children:ue},ue))})]}),M&&e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Hr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}),!M&&I.length===0&&e.jsxs(ze,{className:"p-8 text-center",children:[e.jsx(Mn,{className:"h-12 w-12 mx-auto text-muted-foreground/50 mb-4"}),e.jsx("h3",{className:"font-medium mb-2",children:"No posts found"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:r?`No posts scheduled for ${Xr(r,"PPP")}`:"Schedule a post from Social Swag to get started!"})]}),e.jsx("div",{className:"space-y-4",children:I.map(ue=>{var xe,Te;return e.jsx(ze,{className:"overflow-hidden",children:e.jsxs("div",{className:"flex flex-col sm:flex-row",children:[e.jsx("div",{className:"sm:w-32 h-32 sm:h-auto bg-muted flex-shrink-0",children:e.jsx("img",{src:ue.image_url,alt:"Post preview",className:"w-full h-full object-cover"})}),e.jsxs(qe,{className:"flex-1 p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2 mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[se(ue.platform),e.jsx("span",{className:"font-medium",children:((xe=ue.social_accounts)==null?void 0:xe.page_name)||((Te=ue.social_accounts)==null?void 0:Te.platform_username)||"Unknown"}),ae(ue.status)]}),e.jsxs("div",{className:"flex items-center gap-1",children:[ue.status==="scheduled"&&e.jsxs(L3,{children:[e.jsxs(Uf,{children:[e.jsx(qf,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>W(ue),children:e.jsx(ei,{className:"h-4 w-4"})})}),e.jsx(wp,{children:"Edit post"})]}),e.jsxs(Uf,{children:[e.jsx(qf,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>H.mutate(ue),disabled:H.isPending,children:H.isPending?e.jsx(Hr,{className:"h-4 w-4 animate-spin"}):e.jsx(Mi,{className:"h-4 w-4"})})}),e.jsx(wp,{children:"Post now"})]}),e.jsxs(Xc,{children:[e.jsx(xm,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive",children:e.jsx(Rs,{className:"h-4 w-4"})})}),e.jsxs(Tc,{children:[e.jsxs(Ac,{children:[e.jsx(Ic,{children:"Cancel this scheduled post?"}),e.jsx(Pc,{children:"This will cancel the post. You can delete it entirely or keep it in your history."})]}),e.jsxs(Ec,{children:[e.jsx(Lc,{children:"Keep"}),e.jsx(dc,{onClick:()=>B.mutate(ue.id),className:"bg-amber-600 hover:bg-amber-700",children:"Cancel Post"}),e.jsx(dc,{onClick:()=>$.mutate(ue.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]}),(ue.status==="posted"||ue.status==="cancelled"||ue.status==="failed")&&e.jsxs(Xc,{children:[e.jsx(xm,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive",children:e.jsx(Rs,{className:"h-4 w-4"})})}),e.jsxs(Tc,{children:[e.jsxs(Ac,{children:[e.jsx(Ic,{children:"Delete this post?"}),e.jsx(Pc,{children:"This will permanently remove this post from your history."})]}),e.jsxs(Ec,{children:[e.jsx(Lc,{children:"Cancel"}),e.jsx(dc,{onClick:()=>$.mutate(ue.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]})]}),ue.caption&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-2",children:ue.caption}),e.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(Ea,{className:"h-3 w-3"}),ue.status==="posted"&&ue.posted_at?`Posted ${Xr(new Date(ue.posted_at),"PPp")}`:ue.scheduled_for?`Scheduled for ${Xr(new Date(ue.scheduled_for),"PPp")}`:"Not scheduled"]}),ue.status==="failed"&&ue.error_message&&e.jsxs("p",{className:"text-xs text-destructive mt-2",children:["Error: ",ue.error_message]})]})]})},ue.id)})})]})]}),e.jsx(Dr,{open:!!o,onOpenChange:ue=>!ue&&l(null),children:e.jsxs(Lr,{className:"max-w-lg",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Edit Scheduled Post"}),e.jsx(Gs,{children:"Update the caption or reschedule this post"})]}),o&&e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsx("div",{className:"aspect-square w-32 mx-auto overflow-hidden rounded-lg border",children:e.jsx("img",{src:o.image_url,alt:"Post preview",className:"h-full w-full object-cover"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Caption"}),e.jsx(Ks,{value:i,onChange:ue=>d(ue.target.value),rows:3})]}),e.jsxs("div",{className:"space-y-3 p-4 border rounded-lg",children:[e.jsx(Ee,{children:"Schedule for"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsxs(rd,{children:[e.jsx(sd,{asChild:!0,children:e.jsxs(Q,{variant:"outline",className:qt("justify-start text-left font-normal flex-1",!m&&"text-muted-foreground"),children:[e.jsx(Mn,{className:"mr-2 h-4 w-4"}),m?Xr(m,"PPP"):"Pick a date"]})}),e.jsx(Fc,{className:"w-auto p-0",align:"start",children:e.jsx(Vf,{mode:"single",selected:m,onSelect:g,disabled:ue=>uee.jsx(Ut,{value:ue,children:ue},ue))})]}),e.jsx("span",{className:"text-muted-foreground",children:":"}),e.jsxs(ds,{value:b,onValueChange:N,children:[e.jsx(ls,{className:"w-[70px]",children:e.jsx(us,{})}),e.jsx(cs,{children:ne.map(ue=>e.jsx(Ut,{value:ue,children:ue},ue))})]}),e.jsxs(ds,{value:j,onValueChange:ue=>S(ue),children:[e.jsx(ls,{className:"w-[70px]",children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"AM",children:"AM"}),e.jsx(Ut,{value:"PM",children:"PM"})]})]})]})]})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>l(null),children:"Cancel"}),e.jsxs(Q,{onClick:X,disabled:O.isPending,children:[O.isPending?e.jsx(Hr,{className:"h-4 w-4 animate-spin mr-2"}):null,"Save Changes"]})]})]})})]})}function R8(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Q9e={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files (c) 2009-2016 Stuart Knightley Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE */(function(t,r){(function(s){t.exports=s()})(function(){return function s(n,a,o){function l(m,g){if(!a[m]){if(!n[m]){var y=typeof R8=="function"&&R8;if(!g&&y)return y(m,!0);if(i)return i(m,!0);var v=new Error("Cannot find module '"+m+"'");throw v.code="MODULE_NOT_FOUND",v}var b=a[m]={exports:{}};n[m][0].call(b.exports,function(N){var j=n[m][1][N];return l(j||N)},b,b.exports,s,n,a,o)}return a[m].exports}for(var i=typeof R8=="function"&&R8,d=0;d>2,b=(3&m)<<4|g>>4,N=1>6:64,j=2>4,g=(15&v)<<4|(b=i.indexOf(d.charAt(j++)))>>2,y=(3&b)<<6|(N=i.indexOf(d.charAt(j++))),M[S++]=m,b!==64&&(M[S++]=g),N!==64&&(M[S++]=y);return M}},{"./support":30,"./utils":32}],2:[function(s,n,a){var o=s("./external"),l=s("./stream/DataWorker"),i=s("./stream/Crc32Probe"),d=s("./stream/DataLengthProbe");function m(g,y,v,b,N){this.compressedSize=g,this.uncompressedSize=y,this.crc32=v,this.compression=b,this.compressedContent=N}m.prototype={getContentWorker:function(){var g=new l(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new d("data_length")),y=this;return g.on("end",function(){if(this.streamInfo.data_length!==y.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),g},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)}},m.createWorkerFrom=function(g,y,v){return g.pipe(new i).pipe(new d("uncompressedSize")).pipe(y.compressWorker(v)).pipe(new d("compressedSize")).withStreamInfo("compression",y)},n.exports=m},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(s,n,a){var o=s("./stream/GenericWorker");a.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},a.DEFLATE=s("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(s,n,a){var o=s("./utils"),l=function(){for(var i,d=[],m=0;m<256;m++){i=m;for(var g=0;g<8;g++)i=1&i?3988292384^i>>>1:i>>>1;d[m]=i}return d}();n.exports=function(i,d){return i!==void 0&&i.length?o.getTypeOf(i)!=="string"?function(m,g,y,v){var b=l,N=v+y;m^=-1;for(var j=v;j>>8^b[255&(m^g[j])];return-1^m}(0|d,i,i.length,0):function(m,g,y,v){var b=l,N=v+y;m^=-1;for(var j=v;j>>8^b[255&(m^g.charCodeAt(j))];return-1^m}(0|d,i,i.length,0):0}},{"./utils":32}],5:[function(s,n,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(s,n,a){var o=null;o=typeof Promise<"u"?Promise:s("lie"),n.exports={Promise:o}},{lie:37}],7:[function(s,n,a){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",l=s("pako"),i=s("./utils"),d=s("./stream/GenericWorker"),m=o?"uint8array":"array";function g(y,v){d.call(this,"FlateWorker/"+y),this._pako=null,this._pakoAction=y,this._pakoOptions=v,this.meta={}}a.magic="\b\0",i.inherits(g,d),g.prototype.processChunk=function(y){this.meta=y.meta,this._pako===null&&this._createPako(),this._pako.push(i.transformTo(m,y.data),!1)},g.prototype.flush=function(){d.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},g.prototype.cleanUp=function(){d.prototype.cleanUp.call(this),this._pako=null},g.prototype._createPako=function(){this._pako=new l[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var y=this;this._pako.onData=function(v){y.push({data:v,meta:y.meta})}},a.compressWorker=function(y){return new g("Deflate",y)},a.uncompressWorker=function(){return new g("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(s,n,a){function o(b,N){var j,S="";for(j=0;j>>=8;return S}function l(b,N,j,S,A,M){var I,F,O=b.file,B=b.compression,$=M!==m.utf8encode,H=i.transformTo("string",M(O.name)),W=i.transformTo("string",m.utf8encode(O.name)),X=O.comment,se=i.transformTo("string",M(X)),ae=i.transformTo("string",m.utf8encode(X)),le=W.length!==O.name.length,ne=ae.length!==X.length,fe="",oe="",de="",ue=O.dir,xe=O.date,Te={crc32:0,compressedSize:0,uncompressedSize:0};N&&!j||(Te.crc32=b.crc32,Te.compressedSize=b.compressedSize,Te.uncompressedSize=b.uncompressedSize);var be=0;N&&(be|=8),$||!le&&!ne||(be|=2048);var we=0,ve=0;ue&&(we|=16),A==="UNIX"?(ve=798,we|=function(Ae,Le){var Ue=Ae;return Ae||(Ue=Le?16893:33204),(65535&Ue)<<16}(O.unixPermissions,ue)):(ve=20,we|=function(Ae){return 63&(Ae||0)}(O.dosPermissions)),I=xe.getUTCHours(),I<<=6,I|=xe.getUTCMinutes(),I<<=5,I|=xe.getUTCSeconds()/2,F=xe.getUTCFullYear()-1980,F<<=4,F|=xe.getUTCMonth()+1,F<<=5,F|=xe.getUTCDate(),le&&(oe=o(1,1)+o(g(H),4)+W,fe+="up"+o(oe.length,2)+oe),ne&&(de=o(1,1)+o(g(se),4)+ae,fe+="uc"+o(de.length,2)+de);var tt="";return tt+=` \0`,tt+=o(be,2),tt+=B.magic,tt+=o(I,2),tt+=o(F,2),tt+=o(Te.crc32,4),tt+=o(Te.compressedSize,4),tt+=o(Te.uncompressedSize,4),tt+=o(H.length,2),tt+=o(fe.length,2),{fileRecord:y.LOCAL_FILE_HEADER+tt+H+fe,dirRecord:y.CENTRAL_FILE_HEADER+o(ve,2)+tt+o(se.length,2)+"\0\0\0\0"+o(we,4)+o(S,4)+H+fe+se}}var i=s("../utils"),d=s("../stream/GenericWorker"),m=s("../utf8"),g=s("../crc32"),y=s("../signature");function v(b,N,j,S){d.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=N,this.zipPlatform=j,this.encodeFileName=S,this.streamFiles=b,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}i.inherits(v,d),v.prototype.push=function(b){var N=b.meta.percent||0,j=this.entriesCount,S=this._sources.length;this.accumulate?this.contentBuffer.push(b):(this.bytesWritten+=b.data.length,d.prototype.push.call(this,{data:b.data,meta:{currentFile:this.currentFile,percent:j?(N+100*(j-S-1))/j:100}}))},v.prototype.openedSource=function(b){this.currentSourceOffset=this.bytesWritten,this.currentFile=b.file.name;var N=this.streamFiles&&!b.file.dir;if(N){var j=l(b,N,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:j.fileRecord,meta:{percent:0}})}else this.accumulate=!0},v.prototype.closedSource=function(b){this.accumulate=!1;var N=this.streamFiles&&!b.file.dir,j=l(b,N,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(j.dirRecord),N)this.push({data:function(S){return y.DATA_DESCRIPTOR+o(S.crc32,4)+o(S.compressedSize,4)+o(S.uncompressedSize,4)}(b),meta:{percent:100}});else for(this.push({data:j.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},v.prototype.flush=function(){for(var b=this.bytesWritten,N=0;N=this.index;d--)m=(m<<8)+this.byteAt(d);return this.index+=i,m},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))}},n.exports=l},{"../utils":32}],19:[function(s,n,a){var o=s("./Uint8ArrayReader");function l(i){o.call(this,i)}s("../utils").inherits(l,o),l.prototype.readData=function(i){this.checkOffset(i);var d=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,d},n.exports=l},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(s,n,a){var o=s("./DataReader");function l(i){o.call(this,i)}s("../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 d=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,d},n.exports=l},{"../utils":32,"./DataReader":18}],21:[function(s,n,a){var o=s("./ArrayReader");function l(i){o.call(this,i)}s("../utils").inherits(l,o),l.prototype.readData=function(i){if(this.checkOffset(i),i===0)return new Uint8Array(0);var d=this.data.subarray(this.zero+this.index,this.zero+this.index+i);return this.index+=i,d},n.exports=l},{"../utils":32,"./ArrayReader":17}],22:[function(s,n,a){var o=s("../utils"),l=s("../support"),i=s("./ArrayReader"),d=s("./StringReader"),m=s("./NodeBufferReader"),g=s("./Uint8ArrayReader");n.exports=function(y){var v=o.getTypeOf(y);return o.checkSupport(v),v!=="string"||l.uint8array?v==="nodebuffer"?new m(y):l.uint8array?new g(o.transformTo("uint8array",y)):new i(o.transformTo("array",y)):new d(y)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(s,n,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(s,n,a){var o=s("./GenericWorker"),l=s("../utils");function i(d){o.call(this,"ConvertWorker to "+d),this.destType=d}l.inherits(i,o),i.prototype.processChunk=function(d){this.push({data:l.transformTo(this.destType,d.data),meta:d.meta})},n.exports=i},{"../utils":32,"./GenericWorker":28}],25:[function(s,n,a){var o=s("./GenericWorker"),l=s("../crc32");function i(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}s("../utils").inherits(i,o),i.prototype.processChunk=function(d){this.streamInfo.crc32=l(d.data,this.streamInfo.crc32||0),this.push(d)},n.exports=i},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(s,n,a){var o=s("../utils"),l=s("./GenericWorker");function i(d){l.call(this,"DataLengthProbe for "+d),this.propName=d,this.withStreamInfo(d,0)}o.inherits(i,l),i.prototype.processChunk=function(d){if(d){var m=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=m+d.data.length}l.prototype.processChunk.call(this,d)},n.exports=i},{"../utils":32,"./GenericWorker":28}],27:[function(s,n,a){var o=s("../utils"),l=s("./GenericWorker");function i(d){l.call(this,"DataWorker");var m=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,d.then(function(g){m.dataIsReady=!0,m.data=g,m.max=g&&g.length||0,m.type=o.getTypeOf(g),m.isPaused||m._tickAndRepeat()},function(g){m.error(g)})}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 d=null,m=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":d=this.data.substring(this.index,m);break;case"uint8array":d=this.data.subarray(this.index,m);break;case"array":case"nodebuffer":d=this.data.slice(this.index,m)}return this.index=m,this.push({data:d,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=i},{"../utils":32,"./GenericWorker":28}],28:[function(s,n,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 d=0;d "+l:l}},n.exports=o},{}],29:[function(s,n,a){var o=s("../utils"),l=s("./ConvertWorker"),i=s("./GenericWorker"),d=s("../base64"),m=s("../support"),g=s("../external"),y=null;if(m.nodestream)try{y=s("../nodejs/NodejsStreamOutputAdapter")}catch{}function v(N,j){return new g.Promise(function(S,A){var M=[],I=N._internalType,F=N._outputType,O=N._mimeType;N.on("data",function(B,$){M.push(B),j&&j($)}).on("error",function(B){M=[],A(B)}).on("end",function(){try{var B=function($,H,W){switch($){case"blob":return o.newBlob(o.transformTo("arraybuffer",H),W);case"base64":return d.encode(H);default:return o.transformTo($,H)}}(F,function($,H){var W,X=0,se=null,ae=0;for(W=0;W"u")a.blob=!1;else{var o=new ArrayBuffer(0);try{a.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var l=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);l.append(o),a.blob=l.getBlob("application/zip").size===0}catch{a.blob=!1}}}try{a.nodestream=!!s("readable-stream").Readable}catch{a.nodestream=!1}},{"readable-stream":16}],31:[function(s,n,a){for(var o=s("./utils"),l=s("./support"),i=s("./nodejsUtils"),d=s("./stream/GenericWorker"),m=new Array(256),g=0;g<256;g++)m[g]=252<=g?6:248<=g?5:240<=g?4:224<=g?3:192<=g?2:1;m[254]=m[254]=1;function y(){d.call(this,"utf-8 decode"),this.leftOver=null}function v(){d.call(this,"utf-8 encode")}a.utf8encode=function(b){return l.nodebuffer?i.newBufferFrom(b,"utf-8"):function(N){var j,S,A,M,I,F=N.length,O=0;for(M=0;M>>6:(S<65536?j[I++]=224|S>>>12:(j[I++]=240|S>>>18,j[I++]=128|S>>>12&63),j[I++]=128|S>>>6&63),j[I++]=128|63&S);return j}(b)},a.utf8decode=function(b){return l.nodebuffer?o.transformTo("nodebuffer",b).toString("utf-8"):function(N){var j,S,A,M,I=N.length,F=new Array(2*I);for(j=S=0;j>10&1023,F[S++]=56320|1023&A)}return F.length!==S&&(F.subarray?F=F.subarray(0,S):F.length=S),o.applyFromCharCode(F)}(b=o.transformTo(l.uint8array?"uint8array":"array",b))},o.inherits(y,d),y.prototype.processChunk=function(b){var N=o.transformTo(l.uint8array?"uint8array":"array",b.data);if(this.leftOver&&this.leftOver.length){if(l.uint8array){var j=N;(N=new Uint8Array(j.length+this.leftOver.length)).set(this.leftOver,0),N.set(j,this.leftOver.length)}else N=this.leftOver.concat(N);this.leftOver=null}var S=function(M,I){var F;for((I=I||M.length)>M.length&&(I=M.length),F=I-1;0<=F&&(192&M[F])==128;)F--;return F<0||F===0?I:F+m[M[F]]>I?F:I}(N),A=N;S!==N.length&&(l.uint8array?(A=N.subarray(0,S),this.leftOver=N.subarray(S,N.length)):(A=N.slice(0,S),this.leftOver=N.slice(S,N.length))),this.push({data:a.utf8decode(A),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(v,d),v.prototype.processChunk=function(b){this.push({data:a.utf8encode(b.data),meta:b.meta})},a.Utf8EncodeWorker=v},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(s,n,a){var o=s("./support"),l=s("./base64"),i=s("./nodejsUtils"),d=s("./external");function m(j){return j}function g(j,S){for(var A=0;A>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 N,j,S,A=b.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});b.index+4>>6:(b<65536?v[S++]=224|b>>>12:(v[S++]=240|b>>>18,v[S++]=128|b>>>12&63),v[S++]=128|b>>>6&63),v[S++]=128|63&b);return v},a.buf2binstring=function(y){return g(y,y.length)},a.binstring2buf=function(y){for(var v=new o.Buf8(y.length),b=0,N=v.length;b>10&1023,M[N++]=56320|1023&j)}return g(M,N)},a.utf8border=function(y,v){var b;for((v=v||y.length)>y.length&&(v=y.length),b=v-1;0<=b&&(192&y[b])==128;)b--;return b<0||b===0?v:b+d[y[b]]>v?b:v}},{"./common":41}],43:[function(s,n,a){n.exports=function(o,l,i,d){for(var m=65535&o|0,g=o>>>16&65535|0,y=0;i!==0;){for(i-=y=2e3>>1:l>>>1;i[d]=l}return i}();n.exports=function(l,i,d,m){var g=o,y=m+d;l^=-1;for(var v=m;v>>8^g[255&(l^i[v])];return-1^l}},{}],46:[function(s,n,a){var o,l=s("../utils/common"),i=s("./trees"),d=s("./adler32"),m=s("./crc32"),g=s("./messages"),y=0,v=4,b=0,N=-2,j=-1,S=4,A=2,M=8,I=9,F=286,O=30,B=19,$=2*F+1,H=15,W=3,X=258,se=X+W+1,ae=42,le=113,ne=1,fe=2,oe=3,de=4;function ue(ce,$e){return ce.msg=g[$e],$e}function xe(ce){return(ce<<1)-(4ce.avail_out&&(Ge=ce.avail_out),Ge!==0&&(l.arraySet(ce.output,$e.pending_buf,$e.pending_out,Ge,ce.next_out),ce.next_out+=Ge,$e.pending_out+=Ge,ce.total_out+=Ge,ce.avail_out-=Ge,$e.pending-=Ge,$e.pending===0&&($e.pending_out=0))}function we(ce,$e){i._tr_flush_block(ce,0<=ce.block_start?ce.block_start:-1,ce.strstart-ce.block_start,$e),ce.block_start=ce.strstart,be(ce.strm)}function ve(ce,$e){ce.pending_buf[ce.pending++]=$e}function tt(ce,$e){ce.pending_buf[ce.pending++]=$e>>>8&255,ce.pending_buf[ce.pending++]=255&$e}function Ae(ce,$e){var Ge,rt,je=ce.max_chain_length,it=ce.strstart,Me=ce.prev_length,Je=ce.nice_match,Xe=ce.strstart>ce.w_size-se?ce.strstart-(ce.w_size-se):0,Ve=ce.window,ot=ce.w_mask,mt=ce.prev,ft=ce.strstart+X,ct=Ve[it+Me-1],Mt=Ve[it+Me];ce.prev_length>=ce.good_match&&(je>>=2),Je>ce.lookahead&&(Je=ce.lookahead);do if(Ve[(Ge=$e)+Me]===Mt&&Ve[Ge+Me-1]===ct&&Ve[Ge]===Ve[it]&&Ve[++Ge]===Ve[it+1]){it+=2,Ge++;do;while(Ve[++it]===Ve[++Ge]&&Ve[++it]===Ve[++Ge]&&Ve[++it]===Ve[++Ge]&&Ve[++it]===Ve[++Ge]&&Ve[++it]===Ve[++Ge]&&Ve[++it]===Ve[++Ge]&&Ve[++it]===Ve[++Ge]&&Ve[++it]===Ve[++Ge]&&itXe&&--je!=0);return Me<=ce.lookahead?Me:ce.lookahead}function Le(ce){var $e,Ge,rt,je,it,Me,Je,Xe,Ve,ot,mt=ce.w_size;do{if(je=ce.window_size-ce.lookahead-ce.strstart,ce.strstart>=mt+(mt-se)){for(l.arraySet(ce.window,ce.window,mt,mt,0),ce.match_start-=mt,ce.strstart-=mt,ce.block_start-=mt,$e=Ge=ce.hash_size;rt=ce.head[--$e],ce.head[$e]=mt<=rt?rt-mt:0,--Ge;);for($e=Ge=mt;rt=ce.prev[--$e],ce.prev[$e]=mt<=rt?rt-mt:0,--Ge;);je+=mt}if(ce.strm.avail_in===0)break;if(Me=ce.strm,Je=ce.window,Xe=ce.strstart+ce.lookahead,Ve=je,ot=void 0,ot=Me.avail_in,Ve=W)for(it=ce.strstart-ce.insert,ce.ins_h=ce.window[it],ce.ins_h=(ce.ins_h<=W&&(ce.ins_h=(ce.ins_h<=W)if(rt=i._tr_tally(ce,ce.strstart-ce.match_start,ce.match_length-W),ce.lookahead-=ce.match_length,ce.match_length<=ce.max_lazy_match&&ce.lookahead>=W){for(ce.match_length--;ce.strstart++,ce.ins_h=(ce.ins_h<=W&&(ce.ins_h=(ce.ins_h<=W&&ce.match_length<=ce.prev_length){for(je=ce.strstart+ce.lookahead-W,rt=i._tr_tally(ce,ce.strstart-1-ce.prev_match,ce.prev_length-W),ce.lookahead-=ce.prev_length-1,ce.prev_length-=2;++ce.strstart<=je&&(ce.ins_h=(ce.ins_h<ce.pending_buf_size-5&&(Ge=ce.pending_buf_size-5);;){if(ce.lookahead<=1){if(Le(ce),ce.lookahead===0&&$e===y)return ne;if(ce.lookahead===0)break}ce.strstart+=ce.lookahead,ce.lookahead=0;var rt=ce.block_start+Ge;if((ce.strstart===0||ce.strstart>=rt)&&(ce.lookahead=ce.strstart-rt,ce.strstart=rt,we(ce,!1),ce.strm.avail_out===0)||ce.strstart-ce.block_start>=ce.w_size-se&&(we(ce,!1),ce.strm.avail_out===0))return ne}return ce.insert=0,$e===v?(we(ce,!0),ce.strm.avail_out===0?oe:de):(ce.strstart>ce.block_start&&(we(ce,!1),ce.strm.avail_out),ne)}),new Ie(4,4,8,4,Ue),new Ie(4,5,16,8,Ue),new Ie(4,6,32,32,Ue),new Ie(4,4,16,16,Ye),new Ie(8,16,32,32,Ye),new Ie(8,16,128,128,Ye),new Ie(8,32,128,256,Ye),new Ie(32,128,258,1024,Ye),new Ie(32,258,258,4096,Ye)],a.deflateInit=function(ce,$e){return at(ce,$e,M,15,8,0)},a.deflateInit2=at,a.deflateReset=Pe,a.deflateResetKeep=It,a.deflateSetHeader=function(ce,$e){return ce&&ce.state?ce.state.wrap!==2?N:(ce.state.gzhead=$e,b):N},a.deflate=function(ce,$e){var Ge,rt,je,it;if(!ce||!ce.state||5<$e||$e<0)return ce?ue(ce,N):N;if(rt=ce.state,!ce.output||!ce.input&&ce.avail_in!==0||rt.status===666&&$e!==v)return ue(ce,ce.avail_out===0?-5:N);if(rt.strm=ce,Ge=rt.last_flush,rt.last_flush=$e,rt.status===ae)if(rt.wrap===2)ce.adler=0,ve(rt,31),ve(rt,139),ve(rt,8),rt.gzhead?(ve(rt,(rt.gzhead.text?1:0)+(rt.gzhead.hcrc?2:0)+(rt.gzhead.extra?4:0)+(rt.gzhead.name?8:0)+(rt.gzhead.comment?16:0)),ve(rt,255&rt.gzhead.time),ve(rt,rt.gzhead.time>>8&255),ve(rt,rt.gzhead.time>>16&255),ve(rt,rt.gzhead.time>>24&255),ve(rt,rt.level===9?2:2<=rt.strategy||rt.level<2?4:0),ve(rt,255&rt.gzhead.os),rt.gzhead.extra&&rt.gzhead.extra.length&&(ve(rt,255&rt.gzhead.extra.length),ve(rt,rt.gzhead.extra.length>>8&255)),rt.gzhead.hcrc&&(ce.adler=m(ce.adler,rt.pending_buf,rt.pending,0)),rt.gzindex=0,rt.status=69):(ve(rt,0),ve(rt,0),ve(rt,0),ve(rt,0),ve(rt,0),ve(rt,rt.level===9?2:2<=rt.strategy||rt.level<2?4:0),ve(rt,3),rt.status=le);else{var Me=M+(rt.w_bits-8<<4)<<8;Me|=(2<=rt.strategy||rt.level<2?0:rt.level<6?1:rt.level===6?2:3)<<6,rt.strstart!==0&&(Me|=32),Me+=31-Me%31,rt.status=le,tt(rt,Me),rt.strstart!==0&&(tt(rt,ce.adler>>>16),tt(rt,65535&ce.adler)),ce.adler=1}if(rt.status===69)if(rt.gzhead.extra){for(je=rt.pending;rt.gzindex<(65535&rt.gzhead.extra.length)&&(rt.pending!==rt.pending_buf_size||(rt.gzhead.hcrc&&rt.pending>je&&(ce.adler=m(ce.adler,rt.pending_buf,rt.pending-je,je)),be(ce),je=rt.pending,rt.pending!==rt.pending_buf_size));)ve(rt,255&rt.gzhead.extra[rt.gzindex]),rt.gzindex++;rt.gzhead.hcrc&&rt.pending>je&&(ce.adler=m(ce.adler,rt.pending_buf,rt.pending-je,je)),rt.gzindex===rt.gzhead.extra.length&&(rt.gzindex=0,rt.status=73)}else rt.status=73;if(rt.status===73)if(rt.gzhead.name){je=rt.pending;do{if(rt.pending===rt.pending_buf_size&&(rt.gzhead.hcrc&&rt.pending>je&&(ce.adler=m(ce.adler,rt.pending_buf,rt.pending-je,je)),be(ce),je=rt.pending,rt.pending===rt.pending_buf_size)){it=1;break}it=rt.gzindexje&&(ce.adler=m(ce.adler,rt.pending_buf,rt.pending-je,je)),it===0&&(rt.gzindex=0,rt.status=91)}else rt.status=91;if(rt.status===91)if(rt.gzhead.comment){je=rt.pending;do{if(rt.pending===rt.pending_buf_size&&(rt.gzhead.hcrc&&rt.pending>je&&(ce.adler=m(ce.adler,rt.pending_buf,rt.pending-je,je)),be(ce),je=rt.pending,rt.pending===rt.pending_buf_size)){it=1;break}it=rt.gzindexje&&(ce.adler=m(ce.adler,rt.pending_buf,rt.pending-je,je)),it===0&&(rt.status=103)}else rt.status=103;if(rt.status===103&&(rt.gzhead.hcrc?(rt.pending+2>rt.pending_buf_size&&be(ce),rt.pending+2<=rt.pending_buf_size&&(ve(rt,255&ce.adler),ve(rt,ce.adler>>8&255),ce.adler=0,rt.status=le)):rt.status=le),rt.pending!==0){if(be(ce),ce.avail_out===0)return rt.last_flush=-1,b}else if(ce.avail_in===0&&xe($e)<=xe(Ge)&&$e!==v)return ue(ce,-5);if(rt.status===666&&ce.avail_in!==0)return ue(ce,-5);if(ce.avail_in!==0||rt.lookahead!==0||$e!==y&&rt.status!==666){var Je=rt.strategy===2?function(Xe,Ve){for(var ot;;){if(Xe.lookahead===0&&(Le(Xe),Xe.lookahead===0)){if(Ve===y)return ne;break}if(Xe.match_length=0,ot=i._tr_tally(Xe,0,Xe.window[Xe.strstart]),Xe.lookahead--,Xe.strstart++,ot&&(we(Xe,!1),Xe.strm.avail_out===0))return ne}return Xe.insert=0,Ve===v?(we(Xe,!0),Xe.strm.avail_out===0?oe:de):Xe.last_lit&&(we(Xe,!1),Xe.strm.avail_out===0)?ne:fe}(rt,$e):rt.strategy===3?function(Xe,Ve){for(var ot,mt,ft,ct,Mt=Xe.window;;){if(Xe.lookahead<=X){if(Le(Xe),Xe.lookahead<=X&&Ve===y)return ne;if(Xe.lookahead===0)break}if(Xe.match_length=0,Xe.lookahead>=W&&0Xe.lookahead&&(Xe.match_length=Xe.lookahead)}if(Xe.match_length>=W?(ot=i._tr_tally(Xe,1,Xe.match_length-W),Xe.lookahead-=Xe.match_length,Xe.strstart+=Xe.match_length,Xe.match_length=0):(ot=i._tr_tally(Xe,0,Xe.window[Xe.strstart]),Xe.lookahead--,Xe.strstart++),ot&&(we(Xe,!1),Xe.strm.avail_out===0))return ne}return Xe.insert=0,Ve===v?(we(Xe,!0),Xe.strm.avail_out===0?oe:de):Xe.last_lit&&(we(Xe,!1),Xe.strm.avail_out===0)?ne:fe}(rt,$e):o[rt.level].func(rt,$e);if(Je!==oe&&Je!==de||(rt.status=666),Je===ne||Je===oe)return ce.avail_out===0&&(rt.last_flush=-1),b;if(Je===fe&&($e===1?i._tr_align(rt):$e!==5&&(i._tr_stored_block(rt,0,0,!1),$e===3&&(Te(rt.head),rt.lookahead===0&&(rt.strstart=0,rt.block_start=0,rt.insert=0))),be(ce),ce.avail_out===0))return rt.last_flush=-1,b}return $e!==v?b:rt.wrap<=0?1:(rt.wrap===2?(ve(rt,255&ce.adler),ve(rt,ce.adler>>8&255),ve(rt,ce.adler>>16&255),ve(rt,ce.adler>>24&255),ve(rt,255&ce.total_in),ve(rt,ce.total_in>>8&255),ve(rt,ce.total_in>>16&255),ve(rt,ce.total_in>>24&255)):(tt(rt,ce.adler>>>16),tt(rt,65535&ce.adler)),be(ce),0=Ge.w_size&&(it===0&&(Te(Ge.head),Ge.strstart=0,Ge.block_start=0,Ge.insert=0),Ve=new l.Buf8(Ge.w_size),l.arraySet(Ve,$e,ot-Ge.w_size,Ge.w_size,0),$e=Ve,ot=Ge.w_size),Me=ce.avail_in,Je=ce.next_in,Xe=ce.input,ce.avail_in=ot,ce.next_in=0,ce.input=$e,Le(Ge);Ge.lookahead>=W;){for(rt=Ge.strstart,je=Ge.lookahead-(W-1);Ge.ins_h=(Ge.ins_h<>>=W=H>>>24,I-=W,(W=H>>>16&255)===0)fe[g++]=65535&H;else{if(!(16&W)){if(!(64&W)){H=F[(65535&H)+(M&(1<>>=W,I-=W),I<15&&(M+=ne[d++]<>>=W=H>>>24,I-=W,!(16&(W=H>>>16&255))){if(!(64&W)){H=O[(65535&H)+(M&(1<>>=W,I-=W,(W=g-y)>3,M&=(1<<(I-=X<<3))-1,o.next_in=d,o.next_out=g,o.avail_in=d>>24&255)+(ae>>>8&65280)+((65280&ae)<<8)+((255&ae)<<24)}function M(){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(ae){var le;return ae&&ae.state?(le=ae.state,ae.total_in=ae.total_out=le.total=0,ae.msg="",le.wrap&&(ae.adler=1&le.wrap),le.mode=N,le.last=0,le.havedict=0,le.dmax=32768,le.head=null,le.hold=0,le.bits=0,le.lencode=le.lendyn=new o.Buf32(j),le.distcode=le.distdyn=new o.Buf32(S),le.sane=1,le.back=-1,v):b}function F(ae){var le;return ae&&ae.state?((le=ae.state).wsize=0,le.whave=0,le.wnext=0,I(ae)):b}function O(ae,le){var ne,fe;return ae&&ae.state?(fe=ae.state,le<0?(ne=0,le=-le):(ne=1+(le>>4),le<48&&(le&=15)),le&&(le<8||15=de.wsize?(o.arraySet(de.window,le,ne-de.wsize,de.wsize,0),de.wnext=0,de.whave=de.wsize):(fe<(oe=de.wsize-de.wnext)&&(oe=fe),o.arraySet(de.window,le,ne-fe,oe,de.wnext),(fe-=oe)?(o.arraySet(de.window,le,ne-fe,fe,0),de.wnext=fe,de.whave=de.wsize):(de.wnext+=oe,de.wnext===de.wsize&&(de.wnext=0),de.whave>>8&255,ne.check=i(ne.check,it,2,0),we=be=0,ne.mode=2;break}if(ne.flags=0,ne.head&&(ne.head.done=!1),!(1&ne.wrap)||(((255&be)<<8)+(be>>8))%31){ae.msg="incorrect header check",ne.mode=30;break}if((15&be)!=8){ae.msg="unknown compression method",ne.mode=30;break}if(we-=4,ce=8+(15&(be>>>=4)),ne.wbits===0)ne.wbits=ce;else if(ce>ne.wbits){ae.msg="invalid window size",ne.mode=30;break}ne.dmax=1<>8&1),512&ne.flags&&(it[0]=255&be,it[1]=be>>>8&255,ne.check=i(ne.check,it,2,0)),we=be=0,ne.mode=3;case 3:for(;we<32;){if(xe===0)break e;xe--,be+=fe[de++]<>>8&255,it[2]=be>>>16&255,it[3]=be>>>24&255,ne.check=i(ne.check,it,4,0)),we=be=0,ne.mode=4;case 4:for(;we<16;){if(xe===0)break e;xe--,be+=fe[de++]<>8),512&ne.flags&&(it[0]=255&be,it[1]=be>>>8&255,ne.check=i(ne.check,it,2,0)),we=be=0,ne.mode=5;case 5:if(1024&ne.flags){for(;we<16;){if(xe===0)break e;xe--,be+=fe[de++]<>>8&255,ne.check=i(ne.check,it,2,0)),we=be=0}else ne.head&&(ne.head.extra=null);ne.mode=6;case 6:if(1024&ne.flags&&(xe<(Ae=ne.length)&&(Ae=xe),Ae&&(ne.head&&(ce=ne.head.extra_len-ne.length,ne.head.extra||(ne.head.extra=new Array(ne.head.extra_len)),o.arraySet(ne.head.extra,fe,de,Ae,ce)),512&ne.flags&&(ne.check=i(ne.check,fe,Ae,de)),xe-=Ae,de+=Ae,ne.length-=Ae),ne.length))break e;ne.length=0,ne.mode=7;case 7:if(2048&ne.flags){if(xe===0)break e;for(Ae=0;ce=fe[de+Ae++],ne.head&&ce&&ne.length<65536&&(ne.head.name+=String.fromCharCode(ce)),ce&&Ae>9&1,ne.head.done=!0),ae.adler=ne.check=0,ne.mode=12;break;case 10:for(;we<32;){if(xe===0)break e;xe--,be+=fe[de++]<>>=7&we,we-=7&we,ne.mode=27;break}for(;we<3;){if(xe===0)break e;xe--,be+=fe[de++]<>>=1)){case 0:ne.mode=14;break;case 1:if(X(ne),ne.mode=20,le!==6)break;be>>>=2,we-=2;break e;case 2:ne.mode=17;break;case 3:ae.msg="invalid block type",ne.mode=30}be>>>=2,we-=2;break;case 14:for(be>>>=7&we,we-=7&we;we<32;){if(xe===0)break e;xe--,be+=fe[de++]<>>16^65535)){ae.msg="invalid stored block lengths",ne.mode=30;break}if(ne.length=65535&be,we=be=0,ne.mode=15,le===6)break e;case 15:ne.mode=16;case 16:if(Ae=ne.length){if(xe>>=5,we-=5,ne.ndist=1+(31&be),be>>>=5,we-=5,ne.ncode=4+(15&be),be>>>=4,we-=4,286>>=3,we-=3}for(;ne.have<19;)ne.lens[Me[ne.have++]]=0;if(ne.lencode=ne.lendyn,ne.lenbits=7,Ge={bits:ne.lenbits},$e=m(0,ne.lens,0,19,ne.lencode,0,ne.work,Ge),ne.lenbits=Ge.bits,$e){ae.msg="invalid code lengths set",ne.mode=30;break}ne.have=0,ne.mode=19;case 19:for(;ne.have>>16&255,et=65535&je,!((Ye=je>>>24)<=we);){if(xe===0)break e;xe--,be+=fe[de++]<>>=Ye,we-=Ye,ne.lens[ne.have++]=et;else{if(et===16){for(rt=Ye+2;we>>=Ye,we-=Ye,ne.have===0){ae.msg="invalid bit length repeat",ne.mode=30;break}ce=ne.lens[ne.have-1],Ae=3+(3&be),be>>>=2,we-=2}else if(et===17){for(rt=Ye+3;we>>=Ye)),be>>>=3,we-=3}else{for(rt=Ye+7;we>>=Ye)),be>>>=7,we-=7}if(ne.have+Ae>ne.nlen+ne.ndist){ae.msg="invalid bit length repeat",ne.mode=30;break}for(;Ae--;)ne.lens[ne.have++]=ce}}if(ne.mode===30)break;if(ne.lens[256]===0){ae.msg="invalid code -- missing end-of-block",ne.mode=30;break}if(ne.lenbits=9,Ge={bits:ne.lenbits},$e=m(g,ne.lens,0,ne.nlen,ne.lencode,0,ne.work,Ge),ne.lenbits=Ge.bits,$e){ae.msg="invalid literal/lengths set",ne.mode=30;break}if(ne.distbits=6,ne.distcode=ne.distdyn,Ge={bits:ne.distbits},$e=m(y,ne.lens,ne.nlen,ne.ndist,ne.distcode,0,ne.work,Ge),ne.distbits=Ge.bits,$e){ae.msg="invalid distances set",ne.mode=30;break}if(ne.mode=20,le===6)break e;case 20:ne.mode=21;case 21:if(6<=xe&&258<=Te){ae.next_out=ue,ae.avail_out=Te,ae.next_in=de,ae.avail_in=xe,ne.hold=be,ne.bits=we,d(ae,tt),ue=ae.next_out,oe=ae.output,Te=ae.avail_out,de=ae.next_in,fe=ae.input,xe=ae.avail_in,be=ne.hold,we=ne.bits,ne.mode===12&&(ne.back=-1);break}for(ne.back=0;Ie=(je=ne.lencode[be&(1<>>16&255,et=65535&je,!((Ye=je>>>24)<=we);){if(xe===0)break e;xe--,be+=fe[de++]<>It)])>>>16&255,et=65535&je,!(It+(Ye=je>>>24)<=we);){if(xe===0)break e;xe--,be+=fe[de++]<>>=It,we-=It,ne.back+=It}if(be>>>=Ye,we-=Ye,ne.back+=Ye,ne.length=et,Ie===0){ne.mode=26;break}if(32&Ie){ne.back=-1,ne.mode=12;break}if(64&Ie){ae.msg="invalid literal/length code",ne.mode=30;break}ne.extra=15&Ie,ne.mode=22;case 22:if(ne.extra){for(rt=ne.extra;we>>=ne.extra,we-=ne.extra,ne.back+=ne.extra}ne.was=ne.length,ne.mode=23;case 23:for(;Ie=(je=ne.distcode[be&(1<>>16&255,et=65535&je,!((Ye=je>>>24)<=we);){if(xe===0)break e;xe--,be+=fe[de++]<>It)])>>>16&255,et=65535&je,!(It+(Ye=je>>>24)<=we);){if(xe===0)break e;xe--,be+=fe[de++]<>>=It,we-=It,ne.back+=It}if(be>>>=Ye,we-=Ye,ne.back+=Ye,64&Ie){ae.msg="invalid distance code",ne.mode=30;break}ne.offset=et,ne.extra=15&Ie,ne.mode=24;case 24:if(ne.extra){for(rt=ne.extra;we>>=ne.extra,we-=ne.extra,ne.back+=ne.extra}if(ne.offset>ne.dmax){ae.msg="invalid distance too far back",ne.mode=30;break}ne.mode=25;case 25:if(Te===0)break e;if(Ae=tt-Te,ne.offset>Ae){if((Ae=ne.offset-Ae)>ne.whave&&ne.sane){ae.msg="invalid distance too far back",ne.mode=30;break}Le=Ae>ne.wnext?(Ae-=ne.wnext,ne.wsize-Ae):ne.wnext-Ae,Ae>ne.length&&(Ae=ne.length),Ue=ne.window}else Ue=oe,Le=ue-ne.offset,Ae=ne.length;for(Te$?(W=Le[Ue+S[le]],we[ve+S[le]]):(W=96,0),M=1<>ue)+(I-=M)]=H<<24|W<<16|X|0,I!==0;);for(M=1<>=1;if(M!==0?(be&=M-1,be+=M):be=0,le++,--tt[ae]==0){if(ae===fe)break;ae=y[v+S[le]]}if(oe>>7)]}function ve(je,it){je.pending_buf[je.pending++]=255&it,je.pending_buf[je.pending++]=it>>>8&255}function tt(je,it,Me){je.bi_valid>A-Me?(je.bi_buf|=it<>A-je.bi_valid,je.bi_valid+=Me-A):(je.bi_buf|=it<>>=1,Me<<=1,0<--it;);return Me>>>1}function Ue(je,it,Me){var Je,Xe,Ve=new Array(S+1),ot=0;for(Je=1;Je<=S;Je++)Ve[Je]=ot=ot+Me[Je-1]<<1;for(Xe=0;Xe<=it;Xe++){var mt=je[2*Xe+1];mt!==0&&(je[2*Xe]=Le(Ve[mt]++,mt))}}function Ye(je){var it;for(it=0;it>1;1<=Me;Me--)It(je,Ve,Me);for(Xe=ft;Me=je.heap[1],je.heap[1]=je.heap[je.heap_len--],It(je,Ve,1),Je=je.heap[1],je.heap[--je.heap_max]=Me,je.heap[--je.heap_max]=Je,Ve[2*Xe]=Ve[2*Me]+Ve[2*Je],je.depth[Xe]=(je.depth[Me]>=je.depth[Je]?je.depth[Me]:je.depth[Je])+1,Ve[2*Me+1]=Ve[2*Je+1]=Xe,je.heap[1]=Xe++,It(je,Ve,1),2<=je.heap_len;);je.heap[--je.heap_max]=je.heap[1],function(Mt,Ot){var rr,Ir,cr,Mr,As,At,Rt=Ot.dyn_tree,Cr=Ot.max_code,fs=Ot.stat_desc.static_tree,Vs=Ot.stat_desc.has_stree,Js=Ot.stat_desc.extra_bits,hi=Ot.stat_desc.extra_base,Ia=Ot.stat_desc.max_length,dn=0;for(Mr=0;Mr<=S;Mr++)Mt.bl_count[Mr]=0;for(Rt[2*Mt.heap[Mt.heap_max]+1]=0,rr=Mt.heap_max+1;rr>=7;Xe>>=1)if(1&ct&&mt.dyn_ltree[2*ft]!==0)return l;if(mt.dyn_ltree[18]!==0||mt.dyn_ltree[20]!==0||mt.dyn_ltree[26]!==0)return i;for(ft=32;ft>>3,(Ve=je.static_len+3+7>>>3)<=Xe&&(Xe=Ve)):Xe=Ve=Me+5,Me+4<=Xe&&it!==-1?rt(je,it,Me,Je):je.strategy===4||Ve===Xe?(tt(je,2+(Je?1:0),3),Pe(je,se,ae)):(tt(je,4+(Je?1:0),3),function(mt,ft,ct,Mt){var Ot;for(tt(mt,ft-257,5),tt(mt,ct-1,5),tt(mt,Mt-4,4),Ot=0;Ot>>8&255,je.pending_buf[je.d_buf+2*je.last_lit+1]=255&it,je.pending_buf[je.l_buf+je.last_lit]=255&Me,je.last_lit++,it===0?je.dyn_ltree[2*Me]++:(je.matches++,it--,je.dyn_ltree[2*(ne[Me]+y+1)]++,je.dyn_dtree[2*we(it)]++),je.last_lit===je.lit_bufsize-1},a._tr_align=function(je){tt(je,2,3),Ae(je,I,se),function(it){it.bi_valid===16?(ve(it,it.bi_buf),it.bi_buf=0,it.bi_valid=0):8<=it.bi_valid&&(it.pending_buf[it.pending++]=255&it.bi_buf,it.bi_buf>>=8,it.bi_valid-=8)}(je)}},{"../utils/common":41}],53:[function(s,n,a){n.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(s,n,a){(function(o){(function(l,i){if(!l.setImmediate){var d,m,g,y,v=1,b={},N=!1,j=l.document,S=Object.getPrototypeOf&&Object.getPrototypeOf(l);S=S&&S.setTimeout?S:l,d={}.toString.call(l.process)==="[object process]"?function(F){process.nextTick(function(){M(F)})}:function(){if(l.postMessage&&!l.importScripts){var F=!0,O=l.onmessage;return l.onmessage=function(){F=!1},l.postMessage("","*"),l.onmessage=O,F}}()?(y="setImmediate$"+Math.random()+"$",l.addEventListener?l.addEventListener("message",I,!1):l.attachEvent("onmessage",I),function(F){l.postMessage(y+F,"*")}):l.MessageChannel?((g=new MessageChannel).port1.onmessage=function(F){M(F.data)},function(F){g.port2.postMessage(F)}):j&&"onreadystatechange"in j.createElement("script")?(m=j.documentElement,function(F){var O=j.createElement("script");O.onreadystatechange=function(){M(F),O.onreadystatechange=null,m.removeChild(O),O=null},m.appendChild(O)}):function(F){setTimeout(M,0,F)},S.setImmediate=function(F){typeof F!="function"&&(F=new Function(""+F));for(var O=new Array(arguments.length-1),B=0;B"u"?o===void 0?this:o:self)}).call(this,typeof ny<"u"?ny:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Q9e);var x4t=Q9e.exports;const y4t=oo(x4t);function Dde(t,r=400,s=75){return t&&`${t.replace("/storage/v1/object/public/","/storage/v1/render/image/public/")}?width=${r}&quality=${s}&resize=contain`}const v4t=()=>{const{isAdmin:t}=Gr(),[r,s]=E.useState(null),[n,a]=E.useState(null),[o,l]=E.useState("all"),[i,d]=E.useState(new Set),[m,g]=E.useState(!1),[y,v]=E.useState(!1),[b,N]=E.useState("images"),[j,S]=E.useState(null),{data:A=[],isLoading:M}=Ht({queryKey:["social-swag-2"],queryFn:async()=>{const{data:xe,error:Te}=await Z.from("social_swag_2").select("*").order("month",{ascending:!1}).order("sort_order");if(Te)throw Te;return xe}}),{data:I=[]}=Ht({queryKey:["social-swag-2-months"],queryFn:async()=>{const{data:xe,error:Te}=await Z.from("social_swag_2_months").select("*").order("month",{ascending:!1});if(Te)throw Te;return xe}}),{data:F=[]}=Ht({queryKey:["social-swag-2-reels"],queryFn:async()=>{const{data:xe,error:Te}=await Z.from("social_swag_2_reels").select("*").order("month",{ascending:!1});if(Te)throw Te;return xe}}),{data:O=[]}=Ht({queryKey:["my-social-accounts-count"],queryFn:async()=>{const{data:xe,error:Te}=await Z.from("social_accounts").select("id, platform").eq("is_active",!0);if(Te)throw Te;return xe||[]}}),B=O.length>0,$=E.useMemo(()=>o==="all"?null:F.find(xe=>xe.month===o)||null,[o,F]),H=E.useMemo(()=>[...new Set(A.map(Te=>Te.month))].sort((Te,be)=>be.localeCompare(Te)),[A]);E.useEffect(()=>{H.length>0&&o==="all"&&l(H[0])},[H,o]);const W=xe=>{try{const Te=xye(xe,"yyyy-MM",new Date);return Xr(Te,"MMMM yyyy")}catch{return xe}},X=E.useMemo(()=>o==="all"?A:A.filter(xe=>xe.month===o),[o,A]),se=E.useMemo(()=>{var xe;return o==="all"?null:((xe=I.find(Te=>Te.month===o))==null?void 0:xe.canva_link)||null},[o,I]),ae=async xe=>{try{await navigator.clipboard.writeText(xe),Se.success("Caption copied to clipboard!")}catch{Se.error("Failed to copy caption")}},le=async(xe,Te)=>{try{const we=await(await fetch(xe)).blob(),ve=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),tt=navigator.canShare&&navigator.canShare({files:[new File([we],"test.jpg",{type:"image/jpeg"})]});if(ve&&tt){const Ae=new File([we],`social-swag-${Te}.jpg`,{type:"image/jpeg"});await navigator.share({files:[Ae],title:"Social Swag Image"}),Se.success("Image ready to save!")}else{const Ae=window.URL.createObjectURL(we),Le=document.createElement("a");Le.href=Ae,Le.download=`social-swag-${Te}.jpg`,document.body.appendChild(Le),Le.click(),document.body.removeChild(Le),window.URL.revokeObjectURL(Ae),Se.success("Image downloaded!")}}catch(be){be.name!=="AbortError"&&Se.error("Failed to download image")}},ne=xe=>{d(Te=>{const be=new Set(Te);return be.has(xe)?be.delete(xe):be.add(xe),be})},fe=()=>{d(new Set(X.map(xe=>xe.id)))},oe=()=>{d(new Set),g(!1)},de=async()=>{const xe=X.filter(Te=>i.has(Te.id));if(xe.length===0){Se.error("No images selected");return}v(!0),Se.info(`Preparing ${xe.length} images for download...`);try{const Te=new y4t,be=[...xe].sort((Le,Ue)=>Le.sort_order-Ue.sort_order);for(let Le=0;Le{m?ne(xe.id):s(xe)};return e.jsx(Fr,{title:"Social Swag 2.0",children:e.jsxs("div",{className:"space-y-8",children:[e.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:[e.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmYiIGZpbGwtb3BhY2l0eT0iMC4xIj48cGF0aCBkPSJNMzYgMzRjMC0yIDItNCAyLTRzMiAyIDIgNC0yIDQtMiA0LTItMi0yLTR6Ii8+PC9nPjwvZz48L3N2Zz4=')] opacity-30"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[e.jsxs(bt,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[e.jsx(An,{className:"h-3 w-3 mr-1"}),"New content monthly"]}),e.jsxs(bt,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[e.jsx(El,{className:"h-3 w-3 mr-1"}),A.length," images"]})]}),e.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-3",children:"Social Swag 📸"}),e.jsx("p",{className:"text-lg text-primary-foreground/90 max-w-2xl",children:"Ready-to-post social media images delivered to you monthly. Just download, copy the caption, and share with your audience!"})]})]}),t?e.jsxs(ci,{defaultValue:"gallery",className:"space-y-6",children:[e.jsxs(ri,{className:"grid w-full max-w-md grid-cols-2",children:[e.jsxs(Kr,{value:"gallery",className:"gap-2",children:[e.jsx(El,{className:"h-4 w-4"}),"Gallery"]}),e.jsxs(Kr,{value:"scheduled",className:"gap-2",children:[e.jsx(Ff,{className:"h-4 w-4"}),"Scheduled"]})]}),e.jsxs(ms,{value:"gallery",className:"space-y-6",children:[t?B?e.jsx(ze,{className:"border rounded-xl",children:e.jsx(qe,{className:"p-6",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"p-3 rounded-full bg-muted text-2xl",children:"📸"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-semibold text-foreground mb-1",children:"Ready to post!"}),e.jsx("p",{className:"text-muted-foreground",children:'Click any image and use "Create Post" to share directly to your connected accounts.'})]}),e.jsx(Q,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:e.jsx(go,{to:"/social-connections",children:"Manage Accounts"})})]})})}):e.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:e.jsx(qe,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:e.jsx(iu,{className:"h-5 w-5 text-blue-600"})}),e.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:e.jsx(ju,{className:"h-5 w-5 text-pink-600"})})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-semibold text-foreground mb-1",children:"Post directly to social media"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect your Facebook & Instagram accounts to post images with one click!"})]}),e.jsx(Q,{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:e.jsxs(go,{to:"/social-connections",children:[e.jsx(jm,{className:"h-4 w-4"}),"Connect Accounts"]})})]})})}):e.jsx(ze,{className:"border-2 border-dashed border-muted-foreground/20 bg-muted/30 rounded-xl",children:e.jsx(qe,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-2 rounded-full bg-muted",children:e.jsx(Ea,{className:"h-5 w-5 text-muted-foreground"})}),e.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:e.jsx(iu,{className:"h-5 w-5 text-blue-400"})}),e.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:e.jsx(ju,{className:"h-5 w-5 text-pink-400"})})]}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"font-semibold text-foreground",children:"Post directly to social media"}),e.jsx(bt,{variant:"secondary",className:"text-xs",children:"Coming Soon"})]}),e.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!"})]})]})})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex flex-wrap gap-2",children:H.map(xe=>e.jsx("button",{onClick:()=>l(xe),className:qt("px-4 py-2 rounded-full text-sm font-medium transition-all",o===xe?"bg-primary text-primary-foreground shadow-sm":"bg-muted text-muted-foreground hover:text-foreground"),children:W(xe)},xe))}),o!=="all"&&(se?e.jsxs("a",{href:se,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",W(o)," Images in Canva"]}):e.jsxs("span",{className:"inline-flex items-center gap-2 text-sm text-muted-foreground/50",children:[e.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",W(o)," Images in Canva"]}))]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted rounded-full",children:[e.jsxs("button",{onClick:()=>{N("images"),oe()},className:qt("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:[e.jsx(El,{className:"h-4 w-4"}),"Images"]}),e.jsxs("button",{onClick:()=>{N("reels"),oe()},className:qt("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:[e.jsx(Od,{className:"h-4 w-4"}),"Reels"]})]}),b==="images"&&e.jsx("div",{className:"flex flex-wrap items-center gap-3",children:m?e.jsxs(e.Fragment,{children:[e.jsxs(Q,{variant:"outline",size:"sm",onClick:fe,className:"gap-2",children:["Select All (",X.length,")"]}),e.jsxs(Q,{variant:"outline",size:"sm",onClick:oe,className:"gap-2",children:[e.jsx(rn,{className:"h-4 w-4"}),"Cancel"]}),i.size>0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(Q,{size:"sm",onClick:de,disabled:y,className:"gap-2",children:[e.jsx(Oi,{className:"h-4 w-4"}),y?"Downloading...":`Download ${i.size} Selected`]}),e.jsx("span",{className:"text-xs text-muted-foreground hidden sm:inline",children:"Please ensure your browser allows downloads from the LevelUp Dashboard."})]})]}):e.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>g(!0),className:"gap-2",children:[e.jsx(li,{className:"h-4 w-4"}),"Select Images"]})})]}),M&&e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}),!M&&b==="images"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:X.map(xe=>{const Te=i.has(xe.id);return e.jsx(ze,{className:qt("group cursor-pointer overflow-hidden border-0 shadow-md hover:shadow-xl transition-all duration-300 rounded-2xl",m&&Te&&"ring-2 ring-primary ring-offset-2"),onClick:()=>ue(xe),children:e.jsxs("div",{className:"relative aspect-[4/5] overflow-hidden",children:[e.jsx("img",{src:Dde(xe.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"}),xe.post_date&&!m&&e.jsx("div",{className:"absolute top-0 left-0 w-24 h-24 overflow-hidden pointer-events-none",children:e.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:Xr(new Date(xe.post_date+"T00:00:00"),"MMM d")})}),m&&e.jsx("div",{className:qt("absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-all",Te?"bg-primary border-primary text-primary-foreground":"bg-white/80 border-muted-foreground/50"),children:Te&&e.jsx(li,{className:"h-4 w-4"})}),!m&&e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:e.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"})})]})},xe.id)})}),X.length===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(El,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"No images available for this month yet."})]})]}),!M&&b==="reels"&&e.jsx(e.Fragment,{children:$?e.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:e.jsx(ze,{className:"group overflow-hidden rounded-2xl cursor-pointer transition-all duration-300 hover:shadow-xl hover:scale-[1.02]",onClick:()=>a($),children:e.jsxs("div",{className:"relative aspect-[9/16] overflow-hidden",children:[e.jsx("img",{src:Dde($.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"}),e.jsx("div",{className:"absolute top-2 left-2",children:e.jsxs(bt,{variant:"secondary",className:"bg-black/50 text-white border-0 backdrop-blur-sm text-xs",children:[e.jsx(Od,{className:"h-3 w-3 mr-1"}),"Reel"]})}),e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:e.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})})}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(Od,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"No reel available for this month yet."})]})})]}),e.jsx(Dr,{open:!!r,onOpenChange:()=>s(null),children:e.jsx(Lr,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:e.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:r&&e.jsxs("div",{className:"flex flex-col md:flex-row",children:[e.jsx("div",{className:"md:w-1/2 bg-muted",children:e.jsx("div",{className:"aspect-[4/5]",children:e.jsx("img",{src:Dde(r.image_url,900,85),alt:"Social swag",className:"w-full h-full object-cover",decoding:"async"})})}),e.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-muted-foreground mb-4",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Mn,{className:"h-4 w-4"}),Xr(new Date(r.created_at),"MMMM d, yyyy")]}),r.post_date&&e.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:[e.jsx(Mn,{className:"h-3.5 w-3.5"}),"Post on ",Xr(new Date(r.post_date+"T00:00:00"),"MMMM d, yyyy")]})]}),e.jsxs("div",{className:"flex-1 min-h-0",children:[e.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),e.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:e.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:r.caption})})]}),e.jsxs("div",{className:"flex flex-col gap-3 mt-6",children:[t&&e.jsxs(Q,{onClick:()=>{S({imageUrl:r.image_url,imageId:r.id,caption:r.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:[e.jsx(Mi,{className:"h-4 w-4"}),"Create Post"]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsxs(Q,{variant:"outline",onClick:()=>ae(r.caption),className:"flex-1 gap-2",children:[e.jsx(fo,{className:"h-4 w-4"}),"Copy Caption"]}),e.jsxs(Q,{variant:"outline",onClick:()=>le(r.image_url,r.id),className:"flex-1 gap-2",children:[e.jsx(Oi,{className:"h-4 w-4"}),"Download"]})]})]})]})]})})})}),e.jsx(Dr,{open:!!n,onOpenChange:()=>a(null),children:e.jsx(Lr,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:e.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:n&&e.jsxs("div",{className:"flex flex-col md:flex-row",children:[e.jsx("div",{className:"md:w-1/2 bg-black flex items-center justify-center",children:e.jsx("div",{className:"aspect-[9/16] max-h-[70vh]",children:e.jsx("img",{src:n.image_url,alt:"Reel preview",className:"w-full h-full object-contain"})})}),e.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[e.jsx(Od,{className:"h-4 w-4"}),"Monthly Reel"]}),n.caption&&e.jsxs("div",{className:"flex-1 min-h-0",children:[e.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),e.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:e.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:n.caption})})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[n.caption&&e.jsxs(Q,{onClick:()=>ae(n.caption||""),className:"flex-1 gap-2",children:[e.jsx(fo,{className:"h-4 w-4"}),"Copy Caption"]}),n.canva_link&&e.jsxs(Q,{variant:"outline",onClick:()=>window.open(n.canva_link,"_blank"),className:"flex-1 gap-2",children:[e.jsx(En,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})}),e.jsx(f4t,{open:!!j,onOpenChange:xe=>!xe&&S(null),imageUrl:(j==null?void 0:j.imageUrl)||"",imageId:(j==null?void 0:j.imageId)||"",defaultCaption:(j==null?void 0:j.caption)||"",swagItemId:j==null?void 0:j.imageId})]}),e.jsx(ms,{value:"scheduled",children:e.jsx(g4t,{})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsx(ze,{className:"border-2 border-dashed border-muted-foreground/20 bg-muted/30 rounded-xl",children:e.jsx(qe,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-2 rounded-full bg-muted",children:e.jsx(Ea,{className:"h-5 w-5 text-muted-foreground"})}),e.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:e.jsx(iu,{className:"h-5 w-5 text-blue-400"})}),e.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:e.jsx(ju,{className:"h-5 w-5 text-pink-400"})})]}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"font-semibold text-foreground",children:"Post directly to social media"}),e.jsx(bt,{variant:"secondary",className:"text-xs",children:"Coming Soon"})]}),e.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!"})]})]})})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"flex flex-wrap gap-2",children:H.map(xe=>e.jsx("button",{onClick:()=>l(xe),className:qt("px-4 py-2 rounded-full text-sm font-medium transition-all",o===xe?"bg-primary text-primary-foreground shadow-sm":"bg-muted text-muted-foreground hover:text-foreground"),children:W(xe)},xe))}),o!=="all"&&(se?e.jsxs("a",{href:se,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",W(o)," Images in Canva"]}):e.jsxs("span",{className:"inline-flex items-center gap-2 text-sm text-muted-foreground/50",children:[e.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",W(o)," Images in Canva"]}))]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted rounded-full",children:[e.jsxs("button",{onClick:()=>{N("images"),oe()},className:qt("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:[e.jsx(El,{className:"h-4 w-4"}),"Images"]}),e.jsxs("button",{onClick:()=>{N("reels"),oe()},className:qt("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:[e.jsx(Od,{className:"h-4 w-4"}),"Reels"]})]}),b==="images"&&e.jsx("div",{className:"flex flex-wrap items-center gap-3",children:m?e.jsxs(e.Fragment,{children:[e.jsxs(Q,{variant:"outline",size:"sm",onClick:fe,className:"gap-2",children:["Select All (",X.length,")"]}),e.jsxs(Q,{variant:"outline",size:"sm",onClick:oe,className:"gap-2",children:[e.jsx(rn,{className:"h-4 w-4"}),"Cancel"]}),i.size>0&&e.jsxs(Q,{size:"sm",onClick:de,disabled:y,className:"gap-2",children:[e.jsx(Oi,{className:"h-4 w-4"}),y?"Downloading...":`Download ${i.size} Selected`]})]}):e.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>g(!0),className:"gap-2",children:[e.jsx(li,{className:"h-4 w-4"}),"Select Images"]})})]}),M&&e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}),!M&&b==="images"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:X.map(xe=>{const Te=i.has(xe.id);return e.jsx(ze,{className:qt("group cursor-pointer overflow-hidden border-0 shadow-md hover:shadow-xl transition-all duration-300 rounded-2xl",m&&Te&&"ring-2 ring-primary ring-offset-2"),onClick:()=>ue(xe),children:e.jsxs("div",{className:"relative aspect-[4/5] overflow-hidden",children:[e.jsx("img",{src:xe.image_url,alt:"Social swag",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110"}),m&&e.jsx("div",{className:qt("absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-all",Te?"bg-primary border-primary text-primary-foreground":"bg-white/80 border-muted-foreground/50"),children:Te&&e.jsx(li,{className:"h-4 w-4"})}),!m&&e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:e.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"})})]})},xe.id)})}),X.length===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(El,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"No images available for this month yet."})]})]}),!M&&b==="reels"&&e.jsx(e.Fragment,{children:$?e.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:e.jsx(ze,{className:"group overflow-hidden rounded-2xl cursor-pointer transition-all duration-300 hover:shadow-xl hover:scale-[1.02]",onClick:()=>a($),children:e.jsxs("div",{className:"relative aspect-[9/16] overflow-hidden",children:[e.jsx("img",{src:$.image_url,alt:"Reel preview",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105"}),e.jsx("div",{className:"absolute top-2 left-2",children:e.jsxs(bt,{variant:"secondary",className:"bg-black/50 text-white border-0 backdrop-blur-sm text-xs",children:[e.jsx(Od,{className:"h-3 w-3 mr-1"}),"Reel"]})}),e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:e.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})})}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(Od,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"No reel available for this month yet."})]})})]}),e.jsx(Dr,{open:!!r,onOpenChange:()=>s(null),children:e.jsx(Lr,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:e.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:r&&e.jsxs("div",{className:"flex flex-col md:flex-row",children:[e.jsx("div",{className:"md:w-1/2 bg-muted",children:e.jsx("div",{className:"aspect-[4/5]",children:e.jsx("img",{src:r.image_url,alt:"Social swag",className:"w-full h-full object-cover"})})}),e.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[e.jsx(Mn,{className:"h-4 w-4"}),Xr(new Date(r.created_at),"MMMM d, yyyy")]}),e.jsxs("div",{className:"flex-1 min-h-0",children:[e.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),e.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:e.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:r.caption})})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[e.jsxs(Q,{variant:"outline",onClick:()=>ae(r.caption),className:"flex-1 gap-2",children:[e.jsx(fo,{className:"h-4 w-4"}),"Copy Caption"]}),e.jsxs(Q,{variant:"outline",onClick:()=>le(r.image_url,r.id),className:"flex-1 gap-2",children:[e.jsx(Oi,{className:"h-4 w-4"}),"Download"]})]})]})]})})})}),e.jsx(Dr,{open:!!n,onOpenChange:()=>a(null),children:e.jsx(Lr,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:e.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:n&&e.jsxs("div",{className:"flex flex-col md:flex-row",children:[e.jsx("div",{className:"md:w-1/2 bg-black flex items-center justify-center",children:e.jsx("div",{className:"aspect-[9/16] max-h-[70vh]",children:e.jsx("img",{src:n.image_url,alt:"Reel preview",className:"w-full h-full object-contain"})})}),e.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[e.jsx(Od,{className:"h-4 w-4"}),"Monthly Reel"]}),n.caption&&e.jsxs("div",{className:"flex-1 min-h-0",children:[e.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),e.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:e.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:n.caption})})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[n.caption&&e.jsxs(Q,{onClick:()=>ae(n.caption||""),className:"flex-1 gap-2",children:[e.jsx(fo,{className:"h-4 w-4"}),"Copy Caption"]}),n.canva_link&&e.jsxs(Q,{variant:"outline",onClick:()=>window.open(n.canva_link,"_blank"),className:"flex-1 gap-2",children:[e.jsx(En,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})})]})]})})},_4t=()=>{const{swagId:t}=Xl(),{user:r}=Gr(),{toast:s}=fi(),n=qr(),{trackEngagement:a}=TP(),[o,l]=E.useState(""),{data:i,isLoading:d}=Ht({queryKey:["social-swag-detail",t],queryFn:async()=>{const{data:A,error:M}=await Z.from("social_swag").select("*").eq("id",t).single();if(M)throw M;const{data:I}=await Z.from("social_swag_links").select("*").eq("swag_id",t).order("sort_order");return{...A,links:I||[]}},enabled:!!t});E.useEffect(()=>{i&&a("social_swag",i.id,i.title,"view")},[i==null?void 0:i.id]);const{data:m=[]}=Ht({queryKey:["social-swag-likes",t],queryFn:async()=>{const{data:A,error:M}=await Z.from("social_swag_likes").select("*").eq("swag_id",t);if(M)throw M;return A},enabled:!!t}),{data:g=[]}=Ht({queryKey:["social-swag-comments",t],queryFn:async()=>{const{data:A,error:M}=await Z.from("social_swag_comments").select("*").eq("swag_id",t).order("created_at",{ascending:!1});if(M)throw M;const I=[...new Set(A.map(B=>B.user_id))],{data:F}=await Z.from("profiles").select("id, name").in("id",I),O=new Map((F==null?void 0:F.map(B=>[B.id,B.name]))||[]);return A.map(B=>({...B,user_name:O.get(B.user_id)||"Unknown User"}))},enabled:!!t}),y=Jt({mutationFn:async A=>{const{error:M}=await Z.from("social_swag_comments").insert({swag_id:t,user_id:r.id,content:A});if(M)throw M},onSuccess:()=>{n.invalidateQueries({queryKey:["social-swag-comments",t]}),l(""),s({title:"Comment added!"})},onError:A=>{s({title:"Error adding comment",description:A.message,variant:"destructive"})}}),v=Jt({mutationFn:async A=>{const{error:M}=await Z.from("social_swag_comments").delete().eq("id",A);if(M)throw M},onSuccess:()=>{n.invalidateQueries({queryKey:["social-swag-comments",t]}),s({title:"Comment deleted"})}}),b=Jt({mutationFn:async()=>{const A=m.find(M=>M.user_id===(r==null?void 0:r.id));if(A){const{error:M}=await Z.from("social_swag_likes").delete().eq("id",A.id);if(M)throw M}else{const{error:M}=await Z.from("social_swag_likes").insert({swag_id:t,user_id:r.id});if(M)throw M}},onSuccess:()=>{n.invalidateQueries({queryKey:["social-swag-likes",t]})}}),N=m.some(A=>A.user_id===(r==null?void 0:r.id)),j=A=>A.split(" ").map(M=>M[0]).join("").toUpperCase().slice(0,2),S=A=>{A.preventDefault(),!(!o.trim()||!r)&&y.mutate(o.trim())};return d?e.jsx(Fr,{title:"Social Swag",children:e.jsx("div",{className:"flex justify-center py-12",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):i?e.jsx(Fr,{title:i.title,children:e.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[e.jsx(Q,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(go,{to:"/social-swag",children:[e.jsx(_i,{className:"h-4 w-4"}),"Back to Social Swag"]})}),i.preview_image_url&&e.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:e.jsx("img",{src:i.preview_image_url,alt:i.title,className:"w-full max-h-[500px] object-contain"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[e.jsx("div",{className:"space-y-2",children:e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:i.title})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(K3,{resourceType:"social_swag",resourceId:i.id,resourceTitle:i.title}),e.jsxs(Q,{variant:N?"default":"outline",className:"gap-2 w-fit",onClick:()=>b.mutate(),disabled:!r||b.isPending,children:[e.jsx(_d,{className:`h-4 w-4 ${N?"fill-current":""}`}),m.length," ",m.length===1?"Like":"Likes"]})]})]}),i.description&&e.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:i.description}})]}),i.links.length>0&&e.jsx(ze,{children:e.jsxs(qe,{className:"pt-6",children:[e.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[e.jsx(Bo,{className:"h-4 w-4"}),i.links.length===1?"Canva Link":"Canva Links"]}),e.jsx("div",{className:"grid gap-2",children:i.links.map(A=>e.jsxs(Q,{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(A.canva_share_link,"_blank")},children:[e.jsx("span",{className:"font-medium",children:A.title}),e.jsx(En,{className:"h-4 w-4 text-muted-foreground"})]},A.id))})]})}),e.jsx(gd,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[e.jsx(Pl,{className:"h-5 w-5"}),"Comments (",g.length,")"]}),r?e.jsxs("form",{onSubmit:S,className:"flex gap-2",children:[e.jsx(Ks,{placeholder:"Add a comment...",value:o,onChange:A=>l(A.target.value),className:"min-h-[80px] resize-none flex-1"}),e.jsx(Q,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!o.trim()||y.isPending,children:e.jsx(Mi,{className:"h-4 w-4"})})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),e.jsx("div",{className:"space-y-4",children:g.length===0?e.jsx(ze,{children:e.jsx(qe,{className:"py-8 text-center",children:e.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):g.map(A=>e.jsx(ze,{children:e.jsx(qe,{className:"pt-4 pb-4",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(ln,{className:"h-10 w-10 flex-shrink-0",children:e.jsx(cn,{className:"text-sm",children:j(A.user_name||"U")})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-medium",children:A.user_name}),e.jsx("span",{className:"text-sm text-muted-foreground",children:Su(new Date(A.created_at),{addSuffix:!0})}),A.user_id===(r==null?void 0:r.id)&&e.jsx(Q,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>v.mutate(A.id),children:e.jsx(Rs,{className:"h-3 w-3 text-muted-foreground"})})]}),e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:A.content})]})]})})},A.id))})]})]})}):e.jsx(Fr,{title:"Social Swag",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(Bo,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold",children:"Item not found"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"This item may have been removed or is not available."}),e.jsx(Q,{asChild:!0,className:"mt-4",children:e.jsx(go,{to:"/social-swag",children:"Back to Social Swag"})})]})})},b4t=({categories:t,privateGroups:r,selectedFilter:s,onFilterChange:n,onlineUsers:a})=>{const[o,l]=E.useState(!0),[i,d]=E.useState(!0),[m,g]=E.useState(!0),y=v=>v.split(" ").map(b=>b[0]).join("").toUpperCase().slice(0,2);return e.jsx("aside",{className:"w-64 shrink-0 hidden lg:block relative z-0",children:e.jsx("div",{className:"sticky top-4 space-y-4 max-h-[calc(100vh-8rem)] overflow-y-auto overscroll-contain",children:e.jsxs("div",{className:"space-y-2 pr-4",children:[e.jsxs(Q,{variant:s==="all"?"secondary":"ghost",className:"w-full justify-start",onClick:()=>n("all"),children:[e.jsx(zS,{className:"h-4 w-4 mr-2"}),"All Posts"]}),e.jsxs(ek,{open:o,onOpenChange:l,children:[e.jsx(tk,{asChild:!0,children:e.jsxs(Q,{variant:"ghost",className:"w-full justify-between text-muted-foreground hover:text-foreground",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",children:"Categories"}),o?e.jsx(Jc,{className:"h-4 w-4"}):e.jsx(Wi,{className:"h-4 w-4"})]})}),e.jsx(rk,{className:"space-y-1 pl-2",children:t.map(v=>e.jsxs(Q,{variant:s===v.id?"secondary":"ghost",size:"sm",className:"w-full justify-start h-9",onClick:()=>n(v.id),children:[e.jsx("span",{className:"mr-2",children:v.icon||"📂"}),e.jsx("span",{className:"truncate",children:v.name})]},v.id))})]}),r.length>0&&e.jsxs(ek,{open:i,onOpenChange:d,children:[e.jsx(tk,{asChild:!0,children:e.jsxs(Q,{variant:"ghost",className:"w-full justify-between text-muted-foreground hover:text-foreground",children:[e.jsxs("span",{className:"text-xs font-semibold uppercase tracking-wider flex items-center gap-1",children:[e.jsx(ku,{className:"h-3 w-3"}),"Your Groups"]}),i?e.jsx(Jc,{className:"h-4 w-4"}):e.jsx(Wi,{className:"h-4 w-4"})]})}),e.jsx(rk,{className:"space-y-1 pl-2",children:r.map(v=>e.jsxs(Q,{variant:s===`group:${v.id}`?"secondary":"ghost",size:"sm",className:"w-full justify-start h-9",onClick:()=>n(`group:${v.id}`),children:[e.jsx("span",{className:"mr-2",children:v.icon||"🔒"}),e.jsx("span",{className:"truncate",children:v.name})]},v.id))})]}),e.jsxs(ek,{open:m,onOpenChange:g,children:[e.jsx(tk,{asChild:!0,children:e.jsxs(Q,{variant:"ghost",className:"w-full justify-between text-muted-foreground hover:text-foreground",children:[e.jsxs("span",{className:"text-xs font-semibold uppercase tracking-wider flex items-center gap-1",children:[e.jsx(ws,{className:"h-3 w-3"}),"Online Now",a.length>0&&e.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})]}),m?e.jsx(Jc,{className:"h-4 w-4"}):e.jsx(Wi,{className:"h-4 w-4"})]})}),e.jsx(rk,{className:"pl-2 space-y-1",children:a.length===0?e.jsx("p",{className:"text-sm text-muted-foreground py-2 px-2",children:"No one else online right now"}):a.map(v=>e.jsxs("div",{className:"flex items-center gap-2 py-1.5 px-2 rounded-md hover:bg-muted transition-colors",children:[e.jsxs("div",{className:"relative",children:[e.jsxs(ln,{className:"h-7 w-7",children:[e.jsx(pa,{src:v.avatarUrl}),e.jsx(cn,{className:"text-xs",children:y(v.name)})]}),e.jsx(ah,{className:"h-2.5 w-2.5 fill-green-500 text-green-500 absolute -bottom-0.5 -right-0.5"})]}),e.jsx("span",{className:"text-sm truncate",children:v.name})]},v.id))})]})]})})})},w4t=({categories:t,privateGroups:r,selectedFilter:s,onFilterChange:n,onlineUsers:a})=>{const[o,l]=E.useState(!1),i=m=>m.split(" ").map(g=>g[0]).join("").toUpperCase().slice(0,2),d=()=>{if(s==="all")return"All Posts";if(s.startsWith("group:")){const g=s.replace("group:",""),y=r.find(v=>v.id===g);return y?`🔒 ${y.name}`:"Private Group"}const m=t.find(g=>g.id===s);return m?`${m.icon||"📂"} ${m.name}`:"Category"};return e.jsxs("div",{className:"lg:hidden flex items-center gap-2 mb-4",children:[e.jsxs(mh,{children:[e.jsx(ph,{asChild:!0,children:e.jsxs(Q,{variant:"outline",className:"flex-1 justify-between",children:[e.jsx("span",{className:"truncate",children:d()}),e.jsx(Jc,{className:"h-4 w-4 ml-2 shrink-0"})]})}),e.jsxs(Au,{className:"w-56 bg-background border",children:[e.jsxs(Ba,{onClick:()=>n("all"),children:[e.jsx(zS,{className:"h-4 w-4 mr-2"}),"All Posts"]}),e.jsx(yk,{}),e.jsx(pme,{className:"text-xs text-muted-foreground",children:"Categories"}),t.map(m=>e.jsxs(Ba,{onClick:()=>n(m.id),children:[e.jsx("span",{className:"mr-2",children:m.icon||"📂"}),m.name]},m.id)),r.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(yk,{}),e.jsxs(pme,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(ku,{className:"h-3 w-3"}),"Your Groups"]}),r.map(m=>e.jsxs(Ba,{onClick:()=>n(`group:${m.id}`),children:[e.jsx("span",{className:"mr-2",children:m.icon||"🔒"}),m.name]},m.id))]})]})]}),e.jsxs(eae,{open:o,onOpenChange:l,children:[e.jsx(_ye,{asChild:!0,children:e.jsxs(Q,{variant:"outline",size:"icon",className:"relative",children:[e.jsx(ws,{className:"h-4 w-4"}),a.length>0&&e.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})]})}),e.jsxs(jP,{children:[e.jsx(tae,{children:e.jsxs(rae,{className:"flex items-center gap-2",children:[e.jsx(ws,{className:"h-5 w-5"}),"Online Now (",a.length,")"]})}),e.jsx(Eo,{className:"h-[calc(100vh-8rem)] mt-4",children:a.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No one else online right now"}):e.jsx("div",{className:"space-y-2",children:a.map(m=>e.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg hover:bg-muted transition-colors",children:[e.jsxs("div",{className:"relative",children:[e.jsxs(ln,{className:"h-10 w-10",children:[e.jsx(pa,{src:m.avatarUrl}),e.jsx(cn,{children:i(m.name)})]}),e.jsx(ah,{className:"h-3 w-3 fill-green-500 text-green-500 absolute -bottom-0.5 -right-0.5"})]}),e.jsx("span",{className:"font-medium",children:m.name})]},m.id))})})]})]})]})};var Rde,Bae="HoverCard",[J9e]=fc(Bae,[ux]),$ae=ux(),[j4t,K0e]=J9e(Bae),eBe=t=>{const{__scopeHoverCard:r,children:s,open:n,defaultOpen:a,onOpenChange:o,openDelay:l=700,closeDelay:i=300}=t,d=$ae(r),m=E.useRef(0),g=E.useRef(0),y=E.useRef(!1),v=E.useRef(!1),[b,N]=oh({prop:n,defaultProp:a??!1,onChange:o,caller:Bae}),j=E.useCallback(()=>{clearTimeout(g.current),m.current=window.setTimeout(()=>N(!0),l)},[l,N]),S=E.useCallback(()=>{clearTimeout(m.current),!y.current&&!v.current&&(g.current=window.setTimeout(()=>N(!1),i))},[i,N]),A=E.useCallback(()=>N(!1),[N]);return E.useEffect(()=>()=>{clearTimeout(m.current),clearTimeout(g.current)},[]),e.jsx(j4t,{scope:r,open:b,onOpenChange:N,onOpen:j,onClose:S,onDismiss:A,hasSelectionRef:y,isPointerDownOnContentRef:v,children:e.jsx(uP,{...d,children:s})})};eBe.displayName=Bae;var tBe="HoverCardTrigger",rBe=E.forwardRef((t,r)=>{const{__scopeHoverCard:s,...n}=t,a=K0e(tBe,s),o=$ae(s);return e.jsx(P3,{asChild:!0,...o,children:e.jsx(qs.a,{"data-state":a.open?"open":"closed",...n,ref:r,onPointerEnter:bs(t.onPointerEnter,tse(a.onOpen)),onPointerLeave:bs(t.onPointerLeave,tse(a.onClose)),onFocus:bs(t.onFocus,a.onOpen),onBlur:bs(t.onBlur,a.onClose),onTouchStart:bs(t.onTouchStart,l=>l.preventDefault())})})});rBe.displayName=tBe;var k4t="HoverCardPortal",[Vrr,N4t]=J9e(k4t,{forceMount:void 0}),ese="HoverCardContent",sBe=E.forwardRef((t,r)=>{const s=N4t(ese,t.__scopeHoverCard),{forceMount:n=s.forceMount,...a}=t,o=K0e(ese,t.__scopeHoverCard);return e.jsx(zc,{present:n||o.open,children:e.jsx(S4t,{"data-state":o.open?"open":"closed",...a,onPointerEnter:bs(t.onPointerEnter,tse(o.onOpen)),onPointerLeave:bs(t.onPointerLeave,tse(o.onClose)),ref:r})})});sBe.displayName=ese;var S4t=E.forwardRef((t,r)=>{const{__scopeHoverCard:s,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:l,...i}=t,d=K0e(ese,s),m=$ae(s),g=E.useRef(null),y=ga(r,g),[v,b]=E.useState(!1);return E.useEffect(()=>{if(v){const N=document.body;return Rde=N.style.userSelect||N.style.webkitUserSelect,N.style.userSelect="none",N.style.webkitUserSelect="none",()=>{N.style.userSelect=Rde,N.style.webkitUserSelect=Rde}}},[v]),E.useEffect(()=>{if(g.current){const N=()=>{b(!1),d.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var S;((S=document.getSelection())==null?void 0:S.toString())!==""&&(d.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",N),()=>{document.removeEventListener("pointerup",N),d.hasSelectionRef.current=!1,d.isPointerDownOnContentRef.current=!1}}},[d.isPointerDownOnContentRef,d.hasSelectionRef]),E.useEffect(()=>{g.current&&T4t(g.current).forEach(j=>j.setAttribute("tabindex","-1"))}),e.jsx(Sv,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:bs(o,N=>{N.preventDefault()}),onDismiss:d.onDismiss,children:e.jsx(hP,{...m,...i,onPointerDown:bs(i.onPointerDown,N=>{N.currentTarget.contains(N.target)&&b(!0),d.hasSelectionRef.current=!1,d.isPointerDownOnContentRef.current=!0}),ref:y,style:{...i.style,userSelect:v?"text":void 0,WebkitUserSelect:v?"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)"}})})}),C4t="HoverCardArrow",M4t=E.forwardRef((t,r)=>{const{__scopeHoverCard:s,...n}=t,a=$ae(s);return e.jsx(mP,{...a,...n,ref:r})});M4t.displayName=C4t;function tse(t){return r=>r.pointerType==="touch"?void 0:t()}function T4t(t){const r=[],s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;s.nextNode();)r.push(s.currentNode);return r}var A4t=eBe,E4t=rBe,nBe=sBe;const I4t=A4t,P4t=E4t,aBe=E.forwardRef(({className:t,align:r="center",sideOffset:s=4,...n},a)=>e.jsx(nBe,{ref:a,align:r,sideOffset:s,className:qt("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n}));aBe.displayName=nBe.displayName;const L4t=[{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"}],O4t=t=>t.split(" ").map(r=>r[0]).join("").toUpperCase().slice(0,2),iBe=({reactions:t,children:r})=>{if(t.length===0)return e.jsx(e.Fragment,{children:r});const s={};return t.forEach(n=>{s[n.reaction_type]||(s[n.reaction_type]=[]),s[n.reaction_type].push(n)}),e.jsxs(I4t,{openDelay:200,closeDelay:100,children:[e.jsx(P4t,{asChild:!0,children:e.jsx("div",{className:"cursor-pointer",children:r})}),e.jsx(aBe,{className:"w-64 p-3 bg-popover border shadow-lg z-50",side:"top",align:"start",children:e.jsx("div",{className:"space-y-3",children:Object.entries(s).map(([n,a])=>{const o=L4t.find(l=>l.type===n);return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"text-lg",children:o==null?void 0:o.emoji}),e.jsxs("span",{className:"text-sm font-medium text-foreground",children:[o==null?void 0:o.label," (",a.length,")"]})]}),e.jsxs("div",{className:"space-y-1.5",children:[a.slice(0,10).map(l=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(ln,{className:"h-6 w-6",children:[e.jsx(pa,{src:l.user_avatar||void 0}),e.jsx(cn,{className:"text-[10px]",children:O4t(l.user_name||"U")})]}),e.jsx("span",{className:"text-sm text-foreground truncate",children:l.user_name||"Unknown User"})]},l.id)),a.length>10&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["+",a.length-10," more"]})]})]},n)})})})]})};function D4t({images:t,initialIndex:r=0,open:s,onOpenChange:n}){const[a,o]=E.useState(r),[l,i]=E.useState(!1);E.useEffect(()=>{s&&(o(r),i(!1))},[s,r]);const d=()=>{o(v=>v>0?v-1:t.length-1),i(!1)},m=()=>{o(v=>v{s&&(v.key==="ArrowLeft"&&d(),v.key==="ArrowRight"&&m(),v.key==="Escape"&&n(!1))},[s,t.length]);E.useEffect(()=>(window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)),[g]);const y=t[a];return e.jsx(Dr,{open:s,onOpenChange:n,children:e.jsxs(Lr,{className:"max-w-[95vw] max-h-[95vh] w-auto h-auto p-0 border-none bg-black/95 overflow-hidden",children:[e.jsx(Q,{variant:"ghost",size:"icon",className:"absolute top-2 right-2 z-50 text-white hover:bg-white/20 h-10 w-10",onClick:()=>n(!1),children:e.jsx(rn,{className:"h-6 w-6"})}),t.length>1&&e.jsxs(e.Fragment,{children:[e.jsx(Q,{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:d,children:e.jsx(uc,{className:"h-8 w-8"})}),e.jsx(Q,{variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 z-50 text-white hover:bg-white/20 h-12 w-12",onClick:m,children:e.jsx(Wi,{className:"h-8 w-8"})})]}),t.length>1&&e.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-50 text-white text-sm bg-black/50 px-3 py-1 rounded-full",children:[a+1," / ",t.length]}),(y==null?void 0:y.type)==="image"&&e.jsx(Q,{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?e.jsx(JS,{className:"h-5 w-5"}):e.jsx(QS,{className:"h-5 w-5"})}),e.jsx("div",{className:qt("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"?e.jsx("video",{src:y.url,controls:!0,autoPlay:!0,className:"max-w-full max-h-[85vh] object-contain",onClick:v=>v.stopPropagation()}):e.jsx("img",{src:y==null?void 0:y.url,alt:"",className:qt("object-contain transition-transform duration-200",l?"max-w-none max-h-none scale-150":"max-w-full max-h-[85vh]")})}),t.length>1&&e.jsx("div",{className:"absolute bottom-12 left-1/2 -translate-x-1/2 z-50 flex gap-2 bg-black/50 p-2 rounded-lg max-w-[90vw] overflow-x-auto",children:t.map((v,b)=>e.jsx("button",{onClick:()=>{o(b),i(!1)},className:qt("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:v.type==="video"?e.jsx("video",{src:v.url,className:"w-full h-full object-cover"}):e.jsx("img",{src:v.url,alt:"",className:"w-full h-full object-cover"})},b))})]})})}const F8=[{type:"like",emoji:"👍",label:"Like"},{type:"love",emoji:"❤️",label:"Love"}],R4t=({commentId:t,reactions:r,currentUserId:s})=>{var m,g;const n=qr(),[a,o]=E.useState(!1),l=r.find(y=>y.user_id===s),i=Jt({mutationFn:async y=>{l?l.reaction_type===y?await Z.from("community_comment_reactions").delete().eq("id",l.id):await Z.from("community_comment_reactions").update({reaction_type:y}).eq("id",l.id):await Z.from("community_comment_reactions").insert({comment_id:t,user_id:s,reaction_type:y})},onSuccess:()=>{n.invalidateQueries({queryKey:["community-posts"]}),o(!1)}}),d={};return r.forEach(y=>{d[y.reaction_type]=(d[y.reaction_type]||0)+1}),e.jsxs("div",{className:"flex items-center gap-2",children:[r.length>0&&e.jsx(iBe,{reactions:r,children:e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx("div",{className:"flex -space-x-0.5",children:Object.keys(d).slice(0,2).map(y=>{var v;return e.jsx("span",{className:"text-sm",children:(v=F8.find(b=>b.type===y))==null?void 0:v.emoji},y)})}),e.jsx("span",{children:r.length})]})}),s&&e.jsxs(rd,{open:a,onOpenChange:o,children:[e.jsx(sd,{asChild:!0,children:e.jsx("button",{className:`text-xs hover:text-primary transition-colors ${l?"text-primary font-medium":"text-muted-foreground"}`,children:l?e.jsxs("span",{children:[(m=F8.find(y=>y.type===l.reaction_type))==null?void 0:m.emoji," ",(g=F8.find(y=>y.type===l.reaction_type))==null?void 0:g.label]}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ci,{className:"h-3 w-3"}),"Like"]})})}),e.jsx(Fc,{className:"w-auto p-1.5 bg-popover border shadow-lg z-50",side:"top",children:e.jsx("div",{className:"flex gap-0.5",children:F8.map(y=>e.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 Z0e({content:t,className:r}){const s=/([@#])\[([^\]]+)\]\(([^)]+)\)|(https?:\/\/[^\s<>]+)/g,n=[];let a=0,o,l=0;for(;(o=s.exec(t))!==null;){if(o.index>a&&n.push(t.substring(a,o.index)),o[1]){const i=o[1],d=o[2],m=o[3],g=i==="#";n.push(e.jsx(go,{to:g?`/templates/${m}`:`/profile?user=${m}`,className:qt("font-medium hover:underline",g?"text-white bg-[#2a4c64] px-1.5 py-0.5 rounded":"text-primary"),onClick:y=>y.stopPropagation(),children:g?d:`@${d}`},`mention-${l++}`))}else if(o[4]){const i=o[4],d=i.replace(/[.,;:!?)]+$/,""),m=i.slice(d.length);let g;try{const y=new URL(d);g=y.hostname+(y.pathname!=="/"?y.pathname.slice(0,20)+(y.pathname.length>20?"...":""):"")}catch{g=d.length>40?d.slice(0,40)+"...":d}n.push(e.jsx("a",{href:d,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline break-all",onClick:y=>y.stopPropagation(),children:g},`url-${l++}`)),m&&n.push(m)}a=o.index+o[0].length}return ae.jsx(E.Fragment,{children:i},d))})}function rse({value:t,onChange:r,placeholder:s="What's on your mind? Use @ to mention someone",className:n,minHeight:a="80px",onMentionsChange:o,onTemplatesChange:l,onKeyDown:i,mentionFormat:d="encoded",enableTemplateMentions:m=!1}){const g=E.useRef(null),y=E.useRef(null),[v,b]=E.useState(!1),[N,j]=E.useState("user"),[S,A]=E.useState(""),[M,I]=E.useState(null),[F,O]=E.useState(0),[B,$]=E.useState({top:0,left:0,width:0}),H=E.useRef(new Map),W=E.useRef(new Map),X=we=>{if(d==="plain"){const Le=[];return H.current.forEach((Ye,Ie)=>{we.includes(`@${Ie}`)&&Le.push(Ye)}),[...new Set(Le)]}const ve=/@\[([^\]]+)\]\(([^)]+)\)/g,tt=[];let Ae;for(;(Ae=ve.exec(we))!==null;)tt.push(Ae[2]);return[...new Set(tt)]},se=we=>{if(d==="plain"){const Le=[];return W.current.forEach((Ye,Ie)=>{we.includes(`#${Ie}`)&&Le.push(Ye)}),[...new Set(Le)]}const ve=/#\[([^\]]+)\]\(([^)]+)\)/g,tt=[];let Ae;for(;(Ae=ve.exec(we))!==null;)tt.push(Ae[2]);return[...new Set(tt)]};E.useEffect(()=>{if(o){const we=X(t);o(we)}if(l){const we=se(t);l(we)}},[t,o,l,d]);const{data:ae=[],isLoading:le}=Ht({queryKey:["mention-users",S],queryFn:async()=>{const we=Z.from("profiles").select("id, name").limit(8),ve=S.length>=1?we.ilike("name",`%${S}%`):we.order("name"),{data:tt,error:Ae}=await ve;if(Ae)throw Ae;const Le=tt.map(Ye=>Ye.id),Ue=await _De(Le);return tt.map(Ye=>({id:Ye.id,name:Ye.name||"Unknown",avatar_url:Ue.get(Ye.id)}))},enabled:v&&N==="user",staleTime:3e4}),{data:ne=[],isLoading:fe}=Ht({queryKey:["mention-templates",S],queryFn:async()=>{let we=Z.from("canva_templates").select("id, name, preview_image_url").lte("publish_date",new Date().toISOString()).order("publish_date",{ascending:!1}).limit(8);S.length>=1&&(we=we.ilike("name",`%${S}%`));const{data:ve,error:tt}=await we;if(tt)throw tt;return ve||[]},enabled:v&&N==="template"&&m,staleTime:3e4}),oe=N==="user"?le:fe,de=N==="user"?ae:ne,ue=we=>we.split(" ").map(ve=>ve[0]).join("").toUpperCase().slice(0,2),xe=we=>{const ve=we.target.value,tt=we.target.selectionStart;r(ve);const Ae=ve.substring(0,tt),Le=Ae.lastIndexOf("@"),Ue=m?Ae.lastIndexOf("#"):-1;let Ye=-1,Ie="user";if(Le>Ue?(Ye=Le,Ie="user"):Ue>Le&&m&&(Ye=Ue,Ie="template"),Ye!==-1){const et=Ae.substring(Ye+1),It=et.includes(" "),Pe=et.includes(` `);if(!It&&!Pe&&et.length<=30){I(Ye),A(et),j(Ie),b(!0),O(0);return}}b(!1),I(null)},Te=we=>{if(M===null)return;const ve=t.substring(0,M),tt=t.substring(M+S.length+1),Ae=N==="user"?"@":"#",Le=d==="plain"?`${Ae}${we.name} `:`${Ae}[${we.name}](${we.id}) `;d==="plain"&&(N==="user"?H.current.set(we.name,we.id):W.current.set(we.name,we.id));const Ue=ve+Le+tt;r(Ue),b(!1),I(null),A(""),setTimeout(()=>{if(g.current){const Ye=ve.length+Le.length;g.current.focus(),g.current.setSelectionRange(Ye,Ye)}},0)},be=we=>{if(!(!v||de.length===0))switch(we.key){case"ArrowDown":we.preventDefault(),O(ve=>(ve+1)%de.length);break;case"ArrowUp":we.preventDefault(),O(ve=>(ve-1+de.length)%de.length);break;case"Enter":de[F]&&(we.preventDefault(),Te(de[F]));break;case"Escape":we.preventDefault(),b(!1);break;case"Tab":de[F]&&(we.preventDefault(),Te(de[F]));break}};return E.useEffect(()=>{const we=ve=>{y.current&&!y.current.contains(ve.target)&&g.current&&!g.current.contains(ve.target)&&b(!1)};return document.addEventListener("mousedown",we),()=>document.removeEventListener("mousedown",we)},[]),E.useEffect(()=>{if(!v)return;const we=()=>{const ve=g.current;if(!ve)return;const tt=ve.getBoundingClientRect();$({top:tt.bottom+4,left:tt.left,width:tt.width})};return we(),window.addEventListener("resize",we),window.addEventListener("scroll",we,!0),()=>{window.removeEventListener("resize",we),window.removeEventListener("scroll",we,!0)}},[v,t]),e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Ks,{ref:g,value:t,onChange:xe,onKeyDown:we=>{be(we),we.defaultPrevented||i==null||i(we)},placeholder:s,className:qt("resize-none",n),style:{minHeight:a}}),v&&Ph.createPortal(e.jsxs("div",{ref:y,className:"fixed z-[1000] max-h-[220px] overflow-hidden rounded-lg border bg-popover shadow-lg",style:{top:B.top,left:B.left,width:B.width,maxWidth:"320px"},children:[e.jsx("div",{className:"px-3 py-1.5 text-xs font-medium text-muted-foreground border-b bg-muted/30",children:N==="user"?"👤 Mention a person":"📋 Link a template"}),oe?e.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:"Searching..."}):de.length===0?e.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:S.length<1?`Type to search ${N==="user"?"people":"templates"}...`:`No ${N==="user"?"users":"templates"} found`}):e.jsx("ul",{className:"py-1 max-h-[180px] overflow-y-auto",children:de.map((we,ve)=>e.jsx("li",{className:qt("flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors",ve===F?"bg-accent":"hover:bg-accent/50"),onClick:()=>Te(we),onMouseEnter:()=>O(ve),children:N==="user"?e.jsxs(e.Fragment,{children:[e.jsxs(ln,{className:"h-6 w-6",children:[e.jsx(pa,{src:we.avatar_url}),e.jsx(cn,{className:"text-xs",children:ue(we.name)})]}),e.jsx("span",{className:"text-sm font-medium truncate",children:we.name})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-8 w-8 rounded bg-muted flex items-center justify-center overflow-hidden flex-shrink-0",children:we.preview_image_url?e.jsx("img",{src:we.preview_image_url,alt:"",className:"w-full h-full object-cover"}):e.jsx(ed,{className:"h-4 w-4 text-muted-foreground"})}),e.jsx("span",{className:"text-sm font-medium truncate",children:we.name})]})},we.id))})]}),document.body)]})}function F4t(t){const r=/#\[([^\]]+)\]\(([^)]+)\)/g,s=[];let n;for(;(n=r.exec(t))!==null;)s.push(n[2]);return[...new Set(s)]}const QSe=t=>t.split(" ").map(r=>r[0]).join("").toUpperCase().slice(0,2);function oBe({comment:t,postId:r,currentUserId:s,currentUserAvatar:n,currentUserEmail:a,canModerate:o,depth:l=0}){const i=qr(),[d,m]=E.useState(!1),[g,y]=E.useState(""),[v,b]=E.useState([]),N=Jt({mutationFn:async({content:M,parentCommentId:I})=>{const{data:F,error:O}=await Z.from("community_comments").insert({post_id:r,user_id:s,content:M,parent_comment_id:I}).select("id").single();if(O)throw O;const B=v;if(B.length>0&&F){const $=B.filter(H=>H!==s).map(H=>({comment_id:F.id,mentioned_user_id:H,mentioned_by_user_id:s}));$.length>0&&await Z.from("community_comment_mentions").insert($)}},onSuccess:()=>{i.invalidateQueries({queryKey:["community-posts"]}),y(""),b([]),m(!1)}}),j=Jt({mutationFn:async M=>{const{error:I}=await Z.from("community_comments").delete().eq("id",M);if(I)throw I},onSuccess:()=>i.invalidateQueries({queryKey:["community-posts"]})}),S=()=>{g.trim()&&N.mutate({content:g,parentCommentId:t.id})};return e.jsxs("div",{className:l>0?"ml-8 border-l-2 border-muted pl-3":"",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(ln,{className:"h-8 w-8 shrink-0",children:[e.jsx(pa,{src:t.user_avatar||void 0}),e.jsx(cn,{className:"text-xs",children:QSe(t.user_name||"U")})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"bg-muted rounded-lg px-3 py-2",children:[e.jsx("div",{className:"font-medium text-sm",children:t.user_name}),e.jsx(Z0e,{content:t.content,className:"text-sm break-words"})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 text-xs text-muted-foreground flex-wrap",children:[e.jsx("span",{children:Su(new Date(t.created_at),{addSuffix:!0})}),e.jsx(R4t,{commentId:t.id,reactions:t.reactions,currentUserId:s}),s&&l<2&&e.jsxs("button",{onClick:()=>m(!d),className:"hover:text-primary flex items-center gap-1",children:[e.jsx(DA,{className:"h-3 w-3"}),"Reply"]}),(t.user_id===s||o)&&e.jsx("button",{onClick:()=>j.mutate(t.id),className:"hover:text-destructive",children:t.user_id!==s?"Remove":"Delete"})]}),d&&s&&e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsxs(ln,{className:"h-6 w-6 shrink-0 mt-1",children:[e.jsx(pa,{src:n||void 0}),e.jsx(cn,{className:"text-xs",children:QSe((a==null?void 0:a.split("@")[0])||"U")})]}),e.jsxs("div",{className:"flex-1 flex gap-2 items-start",children:[e.jsx(rse,{placeholder:`Reply to ${t.user_name}...`,value:g,onChange:y,onMentionsChange:b,mentionFormat:"plain",className:"text-sm min-h-0 py-1.5",minHeight:"32px"}),e.jsx(Q,{size:"sm",variant:"ghost",onClick:S,disabled:!g.trim()||N.isPending,className:"h-8 px-2 mt-0.5",children:e.jsx(Mi,{className:"h-3 w-3"})})]})]})]})]}),t.replies&&t.replies.length>0&&e.jsx("div",{className:"mt-2 space-y-2",children:t.replies.map(M=>e.jsx(oBe,{comment:M,postId:r,currentUserId:s,currentUserAvatar:n,currentUserEmail:a,canModerate:o,depth:l+1},M.id))})]})}const z8=[{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"}],z4t=()=>{const{user:t,isBrokerageManager:r,managedBrokerages:s,isAdmin:n}=Gr(),{avatarUrl:a}=vDe(t==null?void 0:t.id),{onlineUsers:o}=PRe(),{toast:l}=fi(),i=qr(),d=E.useRef(null),[m,g]=E.useState("all"),[y,v]=E.useState(""),[b,N]=E.useState(""),[j,S]=E.useState(""),[A,M]=E.useState([]),[I,F]=E.useState([]),[O,B]=E.useState(""),[$,H]=E.useState(!1),[W,X]=E.useState(null),[se,ae]=E.useState(""),[le,ne]=E.useState(new Set),[fe,oe]=E.useState({}),[de,ue]=E.useState({}),[xe,Te]=E.useState([]),[be,we]=E.useState([]),[ve,tt]=E.useState({open:!1,images:[],index:0});E.useEffect(()=>{if(m.startsWith("group:")){const ct=m.replace("group:","");S(ct),N("")}else m!=="all"?(N(m),S("")):(N(""),S(""))},[m]);const{data:Ae=[]}=Ht({queryKey:["community-categories"],queryFn:async()=>{const{data:ct,error:Mt}=await Z.from("community_categories").select("*").order("sort_order");if(Mt)throw Mt;return ct}}),{data:Le=[]}=Ht({queryKey:["community-private-groups"],queryFn:async()=>{const{data:ct,error:Mt}=await Z.from("community_private_groups").select("id, name, description, icon, brokerage_id, sort_order").order("sort_order");if(Mt)throw Mt;return ct}}),Ue=20,{data:Ye,isLoading:Ie,hasNextPage:et,fetchNextPage:It,isFetchingNextPage:Pe}=urt({queryKey:["community-posts",m],initialPageParam:0,queryFn:async({pageParam:ct})=>{var Oe;const Mt=ct*Ue,Ot=Mt+Ue;let rr=Z.from("community_posts").select("*").order("is_pinned",{ascending:!1}).order("pinned_at",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1}).range(Mt,Ot);if(m.startsWith("group:")){const Ke=m.replace("group:","");rr=rr.eq("private_group_id",Ke)}else m==="all"||(rr=rr.eq("category_id",m).is("private_group_id",null));const{data:Ir,error:cr}=await rr;if(cr)throw cr;const Mr=((Ir==null?void 0:Ir.length)||0)>Ue,As=(Ir||[]).slice(0,Ue);if(As.length===0)return{posts:[],hasMore:!1,nextPage:ct+1};const At=As.map(Ke=>Ke.id),Rt=[...new Set(As.filter(Ke=>Ke.category_id).map(Ke=>Ke.category_id))].filter(Boolean),[Cr,fs,Vs,Js,hi]=await Promise.all([Rt.length?Z.from("community_categories").select("*").in("id",Rt):Promise.resolve({data:[]}),Z.from("community_post_media").select("*").in("post_id",At).order("sort_order"),Z.from("community_reactions").select("*").in("post_id",At),Z.from("community_comments").select("*").in("post_id",At).order("created_at",{ascending:!0}),Z.from("community_post_resources").select("*").in("post_id",At)]),Ia=Cr==null?void 0:Cr.data,dn=fs==null?void 0:fs.data,na=Vs==null?void 0:Vs.data,en=Js==null?void 0:Js.data,Un=hi==null?void 0:hi.data,Gn=(en||[]).map(Ke=>Ke.id),[Ai,dr]=await Promise.all([Gn.length?Z.from("community_comment_reactions").select("*").in("comment_id",Gn):Promise.resolve({data:[]}),(()=>{const Ke=(Un||[]).filter(St=>St.resource_type==="template").map(St=>St.resource_id);return Ke.length===0?Promise.resolve({data:[]}):Z.from("canva_templates").select("id, name, preview_image_url").in("id",Ke)})()]),Fa=(Ai==null?void 0:Ai.data)||[],mo=(dr==null?void 0:dr.data)||[],Ti=new Map(mo.map(Ke=>[Ke.id,{name:Ke.name,preview_image_url:Ke.preview_image_url}])),Ys=Array.from(new Set([...As.map(Ke=>Ke.user_id),...(na||[]).map(Ke=>Ke.user_id),...(en||[]).map(Ke=>Ke.user_id),...Fa.map(Ke=>Ke.user_id)])),[ro,gc]=await Promise.all([Ys.length?Z.from("profiles").select("id, name").in("id",Ys):Promise.resolve({data:[]}),_De(Ys)]),jo=new Map(((Oe=ro==null?void 0:ro.data)==null?void 0:Oe.map(Ke=>[Ke.id,Ke.name]))||[]),xc=new Map((Ia||[]).map(Ke=>[Ke.id,Ke])),st=Ke=>{const St=new Map,wt=[];return Ke.forEach(Lt=>{St.set(Lt.id,{...Lt,user_name:jo.get(Lt.user_id)||"Unknown User",user_avatar:gc.get(Lt.user_id),reactions:Fa.filter(Gt=>Gt.comment_id===Lt.id).map(Gt=>({...Gt,user_name:jo.get(Gt.user_id)||"Unknown User",user_avatar:gc.get(Gt.user_id)})),replies:[]})}),Ke.forEach(Lt=>{const Gt=St.get(Lt.id);if(Lt.parent_comment_id&&St.has(Lt.parent_comment_id)){const Ft=St.get(Lt.parent_comment_id);Ft.replies=Ft.replies||[],Ft.replies.push(Gt)}else wt.push(Gt)}),wt};return{posts:As.map(Ke=>{const St=(Un||[]).filter(wt=>wt.post_id===Ke.id).map(wt=>{let Lt="",Gt=null;if(wt.resource_type==="template"){const Ft=Ti.get(wt.resource_id);Lt=(Ft==null?void 0:Ft.name)||"Unknown Template",Gt=(Ft==null?void 0:Ft.preview_image_url)||null}return{id:wt.id,resource_type:wt.resource_type,resource_id:wt.resource_id,resource_name:Lt,resource_preview_url:Gt}});return{...Ke,user_name:jo.get(Ke.user_id)||"Unknown User",user_avatar:gc.get(Ke.user_id),category:Ke.category_id?xc.get(Ke.category_id):null,media:(dn||[]).filter(wt=>wt.post_id===Ke.id),reactions:((na||[]).filter(wt=>wt.post_id===Ke.id)||[]).map(wt=>({...wt,user_name:jo.get(wt.user_id)||"Unknown User",user_avatar:gc.get(wt.user_id)})),comments:st((en||[]).filter(wt=>wt.post_id===Ke.id)),resources:St}}),hasMore:Mr,nextPage:ct+1}},getNextPageParam:ct=>ct.hasMore?ct.nextPage:void 0}),at=E.useMemo(()=>(Ye==null?void 0:Ye.pages.flatMap(ct=>ct.posts))??[],[Ye]),ce=Jt({mutationFn:async()=>{H(!0);const{data:ct,error:Mt}=await Z.from("community_posts").insert({user_id:t.id,category_id:j?null:b||null,private_group_id:j||null,content:y,link_url:O||null}).select().single();if(Mt)throw Mt;for(let rr=0;rr0){const rr=xe.filter(Ir=>Ir!==t.id).map(Ir=>({post_id:ct.id,mentioned_user_id:Ir,mentioned_by_user_id:t.id}));rr.length>0&&await Z.from("community_post_mentions").insert(rr)}const Ot=F4t(y);if(Ot.length>0){const rr=Ot.map(Ir=>({post_id:ct.id,resource_type:"template",resource_id:Ir}));await Z.from("community_post_resources").insert(rr)}return ct},onSuccess:async ct=>{var Mt;i.invalidateQueries({queryKey:["community-posts"]}),v(""),Te([]),we([]),N(""),S(""),M([]),F([]),B(""),l({title:"Post created!"});try{const Ot=((Mt=t==null?void 0:t.user_metadata)==null?void 0:Mt.name)||"Someone",rr=y.length>50?y.substring(0,50)+"...":y;await Z.functions.invoke("send-push-notification",{body:{title:"New Community Post",body:`${Ot}: ${rr}`,url:"/community"}})}catch(Ot){console.error("Failed to send push notification:",Ot)}},onError:ct=>{l({title:"Error creating post",description:ct.message,variant:"destructive"})},onSettled:()=>H(!1)}),$e=Jt({mutationFn:async({postId:ct,content:Mt})=>{const{error:Ot}=await Z.from("community_posts").update({content:Mt}).eq("id",ct);if(Ot)throw Ot},onSuccess:()=>{i.invalidateQueries({queryKey:["community-posts"]}),X(null),ae(""),l({title:"Post updated!"})}}),Ge=Jt({mutationFn:async ct=>{const{error:Mt}=await Z.from("community_posts").delete().eq("id",ct);if(Mt)throw Mt},onSuccess:()=>{i.invalidateQueries({queryKey:["community-posts"]}),l({title:"Post deleted"})}}),rt=Jt({mutationFn:async({postId:ct,isPinned:Mt})=>{const{error:Ot}=await Z.from("community_posts").update({is_pinned:!Mt,pinned_at:Mt?null:new Date().toISOString(),pinned_by:Mt?null:t==null?void 0:t.id}).eq("id",ct);if(Ot)throw Ot},onSuccess:(ct,{isPinned:Mt})=>{i.invalidateQueries({queryKey:["community-posts"]}),l({title:Mt?"Post unpinned":"Post pinned to top"})}}),je=Jt({mutationFn:async({postId:ct,reactionType:Mt})=>{var rr;const Ot=(rr=at.find(Ir=>Ir.id===ct))==null?void 0:rr.reactions.find(Ir=>Ir.user_id===(t==null?void 0:t.id));Ot?Ot.reaction_type===Mt?await Z.from("community_reactions").delete().eq("id",Ot.id):await Z.from("community_reactions").update({reaction_type:Mt}).eq("id",Ot.id):await Z.from("community_reactions").insert({post_id:ct,user_id:t.id,reaction_type:Mt})},onSuccess:()=>i.invalidateQueries({queryKey:["community-posts"]})}),it=Jt({mutationFn:async({postId:ct,content:Mt})=>{const{data:Ot,error:rr}=await Z.from("community_comments").insert({post_id:ct,user_id:t.id,content:Mt}).select("id").single();if(rr)throw rr;const Ir=de[ct]||[];if(Ir.length>0&&Ot){const cr=Ir.filter(Mr=>Mr!==t.id).map(Mr=>({comment_id:Ot.id,mentioned_user_id:Mr,mentioned_by_user_id:t.id}));cr.length>0&&await Z.from("community_comment_mentions").insert(cr)}},onSuccess:(ct,{postId:Mt})=>{i.invalidateQueries({queryKey:["community-posts"]}),oe(Ot=>({...Ot,[Mt]:""})),ue(Ot=>({...Ot,[Mt]:[]}))}});Jt({mutationFn:async ct=>{const{error:Mt}=await Z.from("community_comments").delete().eq("id",ct);if(Mt)throw Mt},onSuccess:()=>i.invalidateQueries({queryKey:["community-posts"]})});const Me=ct=>{const Mt=Array.from(ct.target.files||[]);if(Mt.length+A.length>10){l({title:"Maximum 10 files allowed",variant:"destructive"});return}M(Ot=>[...Ot,...Mt]),Mt.forEach(Ot=>{const rr=new FileReader;rr.onloadend=()=>{F(Ir=>[...Ir,rr.result])},rr.readAsDataURL(Ot)})},Je=ct=>{M(Mt=>Mt.filter((Ot,rr)=>rr!==ct)),F(Mt=>Mt.filter((Ot,rr)=>rr!==ct))},Xe=ct=>ct.split(" ").map(Mt=>Mt[0]).join("").toUpperCase().slice(0,2),Ve=ct=>{const Mt={};return ct.forEach(Ot=>{Mt[Ot.reaction_type]=(Mt[Ot.reaction_type]||0)+1}),Mt},ot=ct=>{var Mt;return(Mt=ct.find(Ot=>Ot.user_id===(t==null?void 0:t.id)))==null?void 0:Mt.reaction_type},mt=ct=>ct.reduce((Mt,Ot)=>Mt+1+(Ot.replies?mt(Ot.replies):0),0),ft=ct=>{if(n)return!0;if(!r||!ct.private_group_id)return!1;const Mt=Le.find(Ot=>Ot.id===ct.private_group_id);return Mt!=null&&Mt.brokerage_id?s.some(Ot=>Ot.id===Mt.brokerage_id):!1};return e.jsx(Fr,{title:"Community",children:e.jsxs("div",{className:"flex gap-6 w-full isolate z-0",children:[e.jsx(b4t,{categories:Ae,privateGroups:Le,selectedFilter:m,onFilterChange:g,onlineUsers:o}),e.jsxs("div",{className:"flex-1 min-w-0 max-w-2xl mx-auto lg:mx-0 space-y-6",children:[e.jsxs("div",{className:"px-1",children:[e.jsx("h1",{className:"text-4xl lg:text-5xl font-bold text-foreground",children:"Community"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Connect and share with fellow agents"})]}),e.jsx(w4t,{categories:Ae,privateGroups:Le,selectedFilter:m,onFilterChange:g,onlineUsers:o}),e.jsx(ze,{children:e.jsx(qe,{className:"pt-6",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsxs(ln,{className:"h-10 w-10",children:[e.jsx(pa,{src:a||void 0}),e.jsx(cn,{children:t!=null&&t.email?Xe(t.email.split("@")[0]):"U"})]}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx(rse,{placeholder:n?"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:v,onMentionsChange:Te,onTemplatesChange:we,mentionFormat:"encoded",minHeight:"80px",enableTemplateMentions:n}),I.length>0&&e.jsx("div",{className:"grid grid-cols-3 gap-2",children:I.map((ct,Mt)=>{var Ot;return e.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[(Ot=A[Mt])!=null&&Ot.type.startsWith("video/")?e.jsx("video",{src:ct,className:"w-full h-full object-cover"}):e.jsx("img",{src:ct,alt:"",className:"w-full h-full object-cover"}),e.jsx(Q,{variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>Je(Mt),children:e.jsx(rn,{className:"h-3 w-3"})})]},Mt)})}),O&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Bo,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{value:O,onChange:ct=>B(ct.target.value),placeholder:"https://...",className:"flex-1"}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>B(""),children:e.jsx(rn,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex gap-1 flex-wrap",children:[e.jsx("input",{type:"file",ref:d,onChange:Me,accept:"image/*,video/*",multiple:!0,className:"hidden"}),e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>{var ct;return(ct=d.current)==null?void 0:ct.click()},children:[e.jsx(El,{className:"h-4 w-4 mr-1"}),"Photo"]}),e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>{var ct;return(ct=d.current)==null?void 0:ct.click()},children:[e.jsx(ya,{className:"h-4 w-4 mr-1"}),"Video"]}),e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>B("https://"),children:[e.jsx(Bo,{className:"h-4 w-4 mr-1"}),"Link"]})]}),e.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto justify-end",children:[Le.length>0?e.jsxs(ds,{value:j||b||"none",onValueChange:ct=>{ct==="none"?(N(""),S("")):ct.startsWith("group:")?(S(ct.replace("group:","")),N("")):(N(ct),S(""))},children:[e.jsx(ls,{className:"w-[130px] sm:w-[160px] h-8 text-xs sm:text-sm",children:e.jsx(us,{placeholder:"Select..."})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"none",children:"No category"}),Ae.map(ct=>e.jsxs(Ut,{value:ct.id,children:[ct.icon," ",ct.name]},ct.id)),Le.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-2 py-1 text-xs font-semibold text-muted-foreground border-t mt-1 pt-1",children:"🔒 Private Groups"}),Le.map(ct=>e.jsxs(Ut,{value:`group:${ct.id}`,children:[ct.icon||"🔒"," ",ct.name]},ct.id))]})]})]}):e.jsxs(ds,{value:b,onValueChange:N,children:[e.jsx(ls,{className:"w-[110px] sm:w-[140px] h-8 text-xs sm:text-sm",children:e.jsx(us,{placeholder:"Category"})}),e.jsx(cs,{children:Ae.map(ct=>e.jsxs(Ut,{value:ct.id,children:[ct.icon," ",ct.name]},ct.id))})]}),e.jsxs(Q,{size:"sm",onClick:()=>ce.mutate(),disabled:!y.trim()||$,children:[e.jsx(Mi,{className:"h-4 w-4 mr-1"}),"Post"]})]})]})]})]})})}),Ie?e.jsx("div",{className:"space-y-4",children:[...Array(3)].map((ct,Mt)=>e.jsx(ze,{children:e.jsx(qe,{className:"pt-6",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(fr,{className:"h-10 w-10 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(fr,{className:"h-4 w-32"}),e.jsx(fr,{className:"h-4 w-full"}),e.jsx(fr,{className:"h-4 w-3/4"})]})]})})},Mt))}):at.length===0?e.jsx(ze,{children:e.jsxs(qe,{className:"py-12 text-center",children:[e.jsx(Pl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("h3",{className:"font-semibold mb-2",children:"No posts yet"}),e.jsx("p",{className:"text-muted-foreground",children:"Be the first to start a conversation!"})]})}):e.jsxs("div",{className:"space-y-4",children:[at.map(ct=>{var Mt,Ot,rr,Ir;return e.jsx(ze,{children:e.jsxs(qe,{className:"pt-6",children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{className:"flex gap-3 min-w-0",children:[e.jsxs(ln,{className:"h-10 w-10",children:[e.jsx(pa,{src:ct.user_avatar||void 0}),e.jsx(cn,{children:Xe(ct.user_name||"U")})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-semibold break-words",children:ct.user_name}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[e.jsx("span",{children:Su(new Date(ct.created_at),{addSuffix:!0})}),ct.category&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsxs(bt,{variant:"secondary",className:"text-xs",children:[ct.category.icon," ",ct.category.name]})]})]})]})]}),(ct.user_id===(t==null?void 0:t.id)||ft(ct))&&e.jsxs(mh,{children:[e.jsx(ph,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(kf,{className:"h-4 w-4"})})}),e.jsxs(Au,{align:"end",children:[ft(ct)&&ct.private_group_id&&e.jsx(Ba,{onClick:()=>rt.mutate({postId:ct.id,isPinned:ct.is_pinned}),children:ct.is_pinned?e.jsxs(e.Fragment,{children:[e.jsx(EA,{className:"h-4 w-4 mr-2"}),"Unpin Post"]}):e.jsxs(e.Fragment,{children:[e.jsx(ev,{className:"h-4 w-4 mr-2"}),"Pin to Top"]})}),ct.user_id===(t==null?void 0:t.id)&&e.jsxs(Ba,{onClick:()=>{X(ct),ae(ct.content)},children:[e.jsx(ei,{className:"h-4 w-4 mr-2"}),"Edit"]}),e.jsxs(Ba,{className:"text-destructive",onClick:()=>Ge.mutate(ct.id),children:[e.jsx(Rs,{className:"h-4 w-4 mr-2"}),ct.user_id!==(t==null?void 0:t.id)?"Remove (Moderate)":"Delete"]})]})]})]}),ct.is_pinned&&e.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm text-primary",children:[e.jsx(ev,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:"Pinned"})]}),e.jsx("div",{className:"mb-3",children:e.jsx(Z0e,{content:ct.content})}),ct.media.length>0&&e.jsx("div",{className:`grid gap-2 mb-3 ${ct.media.length===1?"grid-cols-1":ct.media.length===2?"grid-cols-2":ct.media.length===3?"grid-cols-3":"grid-cols-2"}`,children:ct.media.slice(0,4).map((cr,Mr)=>{const As=Mr===3&&ct.media.length>4,At=ct.media.length-4;return e.jsxs("div",{className:`relative rounded-lg overflow-hidden bg-muted cursor-pointer group ${ct.media.length===1?"max-h-[500px]":ct.media.length===2?"aspect-[4/3]":"aspect-square"}`,onClick:()=>tt({open:!0,images:ct.media.map(Rt=>({url:Rt.media_url,type:Rt.media_type==="video"?"video":"image"})),index:Mr}),children:[cr.media_type==="video"?e.jsx("video",{src:cr.media_url,className:"w-full h-full object-cover transition-transform group-hover:scale-105"}):e.jsx("img",{src:cr.media_url,alt:"",className:"w-full h-full object-cover transition-transform group-hover:scale-105"}),e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors flex items-center justify-center",children:e.jsx("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity text-white",children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.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"})})})}),As&&e.jsx("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center",children:e.jsxs("span",{className:"text-white text-2xl font-bold",children:["+",At]})})]},cr.id)})}),ct.link_url&&e.jsxs("a",{href:ct.link_url,target:"_blank",rel:"noopener noreferrer",className:"block rounded-lg border hover:bg-muted transition-colors mb-3 overflow-hidden",children:[ct.link_image&&e.jsx("div",{className:"aspect-video bg-muted",children:e.jsx("img",{src:ct.link_image,alt:ct.link_title||"Link preview",className:"w-full h-full object-cover",onError:cr=>{cr.currentTarget.style.display="none"}})}),e.jsx("div",{className:"p-3",children:ct.link_title?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"font-medium text-foreground line-clamp-2",children:ct.link_title}),ct.link_description&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:ct.link_description}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2 truncate",children:new URL(ct.link_url).hostname})]}):e.jsxs("div",{className:"flex items-center gap-2 text-sm text-primary",children:[e.jsx(Bo,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:ct.link_url})]})})]}),ct.reactions.length>0&&e.jsx(iBe,{reactions:ct.reactions,children:e.jsxs("div",{className:"flex items-center gap-2 mb-3 text-sm text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:[e.jsx("div",{className:"flex -space-x-1",children:Object.entries(Ve(ct.reactions)).slice(0,3).map(([cr])=>{var Mr;return e.jsx("span",{className:"text-base",children:(Mr=z8.find(As=>As.type===cr))==null?void 0:Mr.emoji},cr)})}),e.jsx("span",{children:ct.reactions.length})]})}),e.jsxs("div",{className:"flex items-center gap-1 border-t border-b py-1 my-2",children:[e.jsxs(rd,{children:[e.jsx(sd,{asChild:!0,children:e.jsxs(Q,{variant:"ghost",size:"sm",className:"flex-1",children:[ot(ct.reactions)?e.jsx("span",{className:"mr-1",children:(Mt=z8.find(cr=>cr.type===ot(ct.reactions)))==null?void 0:Mt.emoji}):e.jsx(_d,{className:"h-4 w-4 mr-1"}),ot(ct.reactions)?(Ot=z8.find(cr=>cr.type===ot(ct.reactions)))==null?void 0:Ot.label:"Like"]})}),e.jsx(Fc,{className:"w-auto p-2",side:"top",children:e.jsx("div",{className:"flex gap-1",children:z8.map(cr=>e.jsx("button",{onClick:()=>je.mutate({postId:ct.id,reactionType:cr.type}),className:"text-2xl hover:scale-125 transition-transform p-1",title:cr.label,children:cr.emoji},cr.type))})})]}),e.jsxs(Q,{variant:"ghost",size:"sm",className:"flex-1",onClick:()=>ne(cr=>{const Mr=new Set(cr);return Mr.has(ct.id)?Mr.delete(ct.id):Mr.add(ct.id),Mr}),children:[e.jsx(Pl,{className:"h-4 w-4 mr-1"}),(()=>{const cr=mt(ct.comments);return cr>0?`Comment (${cr})`:"Comment"})()]})]}),le.has(ct.id)&&e.jsxs("div",{className:"space-y-3 mt-3",children:[ct.comments.map(cr=>e.jsx(oBe,{comment:cr,postId:ct.id,currentUserId:t==null?void 0:t.id,currentUserAvatar:a,currentUserEmail:t==null?void 0:t.email,canModerate:ft(ct)},cr.id)),t&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(ln,{className:"h-8 w-8",children:[e.jsx(pa,{src:a||void 0}),e.jsx(cn,{className:"text-xs",children:Xe(((rr=t.email)==null?void 0:rr.split("@")[0])||"U")})]}),e.jsxs("div",{className:"flex-1 flex gap-2",children:[e.jsx(rse,{placeholder:"Write a comment... (use @ to mention)",value:fe[ct.id]||"",onChange:cr=>oe(Mr=>({...Mr,[ct.id]:cr})),onMentionsChange:cr=>ue(Mr=>({...Mr,[ct.id]:cr})),mentionFormat:"plain",onKeyDown:cr=>{var Mr;cr.defaultPrevented||cr.key==="Enter"&&!cr.shiftKey&&((Mr=fe[ct.id])!=null&&Mr.trim())&&(cr.preventDefault(),it.mutate({postId:ct.id,content:fe[ct.id]}))},className:"text-sm min-h-0 py-1.5",minHeight:"32px"}),e.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>{var cr;(cr=fe[ct.id])!=null&&cr.trim()&&it.mutate({postId:ct.id,content:fe[ct.id]})},disabled:!((Ir=fe[ct.id])!=null&&Ir.trim()),className:"h-8 px-2 mt-0.5",children:e.jsx(Mi,{className:"h-4 w-4"})})]})]})]})]})},ct.id)}),et&&e.jsx("div",{className:"flex justify-center pt-2",children:e.jsx(Q,{variant:"outline",onClick:()=>It(),disabled:Pe,children:Pe?"Loading…":"Load more posts"})})]}),e.jsx(Dr,{open:!!W,onOpenChange:()=>X(null),children:e.jsxs(Lr,{children:[e.jsx(Ur,{children:e.jsx(Br,{children:"Edit Post"})}),e.jsx(Ks,{value:se,onChange:ct=>ae(ct.target.value),className:"min-h-[120px]"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(Q,{variant:"outline",onClick:()=>X(null),children:"Cancel"}),e.jsx(Q,{onClick:()=>{W&&$e.mutate({postId:W.id,content:se})},disabled:!se.trim(),children:"Save Changes"})]})]})}),e.jsx(D4t,{images:ve.images,initialIndex:ve.index,open:ve.open,onOpenChange:ct=>tt(Mt=>({...Mt,open:ct}))})]})]})})},G4={open:{label:"Open",icon:Ea,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:Pl,color:"bg-blue-500"},resolved:{label:"Resolved",icon:ui,color:"bg-green-500"},closed:{label:"Closed",icon:Sc,color:"bg-muted-foreground"}},JSe={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function B4t(){const{user:t}=Gr(),r=qr(),[s,n]=E.useState(null),[a,o]=E.useState(""),{data:l=[],isLoading:i}=Ht({queryKey:["support-tickets"],queryFn:async()=>{const{data:y,error:v}=await Z.from("support_tickets").select("*").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});if(v)throw v;return y},enabled:!!t}),{data:d=[]}=Ht({queryKey:["ticket-replies",s==null?void 0:s.id],queryFn:async()=>{if(!s)return[];const{data:y,error:v}=await Z.from("support_ticket_replies").select("*, profiles(name)").eq("ticket_id",s.id).order("created_at",{ascending:!0});if(v)throw v;return y},enabled:!!s}),m=Jt({mutationFn:async y=>{if(!s||!t)throw new Error("Missing data");const{error:v}=await Z.from("support_ticket_replies").insert({ticket_id:s.id,user_id:t.id,content:y,is_admin_reply:!1});if(v)throw v},onSuccess:()=>{r.invalidateQueries({queryKey:["ticket-replies",s==null?void 0:s.id]}),o(""),Se.success("Reply sent!")},onError:()=>{Se.error("Failed to send reply")}}),g=()=>{a.trim()&&m.mutate(a)};if(s){const y=G4[s.status].icon;return e.jsx(Fr,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>n(null),children:e.jsx(_i,{className:"h-5 w-5"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h1",{className:"text-2xl font-bold",children:s.subject}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(bt,{variant:"secondary",children:JSe[s.category]}),e.jsxs(bt,{className:G4[s.status].color,children:[e.jsx(y,{className:"h-3 w-3 mr-1"}),G4[s.status].label]})]})]})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Ss,{children:["Created on ",Xr(new Date(s.created_at),"MMM d, yyyy 'at' h:mm a")]})}),e.jsx(qe,{children:e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:s.description})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{className:"text-lg",children:"Conversation"})}),e.jsxs(qe,{children:[e.jsx(Eo,{className:"h-[300px] pr-4",children:d.length===0?e.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No replies yet"}):e.jsx("div",{className:"space-y-4",children:d.map(v=>{var b;return e.jsxs("div",{className:`p-4 rounded-lg ${v.is_admin_reply?"bg-primary/10 ml-4":"bg-muted mr-4"}`,children:[e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsx("span",{className:"font-medium text-sm",children:v.is_admin_reply?"Support Team":((b=v.profiles)==null?void 0:b.name)||"You"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Xr(new Date(v.created_at),"MMM d, h:mm a")})]}),e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:v.content})]},v.id)})})}),s.status!=="closed"&&e.jsxs(e.Fragment,{children:[e.jsx(gd,{className:"my-4"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Ks,{placeholder:"Type your reply...",value:a,onChange:v=>o(v.target.value),className:"min-h-[80px]"}),e.jsx(Q,{onClick:g,disabled:!a.trim()||m.isPending,className:"self-end",children:e.jsx(Mi,{className:"h-4 w-4"})})]})]})]})]})]})})}return e.jsx(Fr,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(ze,{className:"bg-gradient-to-br from-primary/10 via-primary/5 to-background border-primary/20",children:e.jsx(qe,{className:"p-6 sm:p-8",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-6",children:[e.jsx("div",{className:"p-4 bg-primary/20 rounded-full",children:e.jsx(ey,{className:"h-8 w-8 text-primary"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Need Help?"}),e.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."}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsx(Pme,{trigger:e.jsxs(Q,{size:"lg",className:"gap-2",children:[e.jsx(gs,{className:"h-5 w-5"}),"Submit a Ticket"]})}),e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-muted rounded-lg",children:[e.jsx(wi,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["Or text us: ",e.jsx("span",{className:"font-semibold text-foreground",children:"1-866-527-8668"})]})]})]})]})]})})}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Your Tickets"}),e.jsx(Pme,{trigger:e.jsxs(Q,{variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(gs,{className:"h-4 w-4"}),"New Ticket"]})})]}),i?e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading tickets..."}):l.length===0?e.jsx(ze,{className:"border-dashed",children:e.jsxs(qe,{className:"text-center py-12",children:[e.jsx(Pl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No tickets yet"}),e.jsx("p",{className:"text-muted-foreground",children:"You haven't submitted any support tickets. Use the button above to get started!"})]})}):e.jsx("div",{className:"space-y-3",children:l.map(y=>{const v=G4[y.status].icon;return e.jsx(ze,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>n(y),children:e.jsx(qe,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-medium truncate",children:y.subject}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(bt,{variant:"outline",className:"text-xs",children:JSe[y.category]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Xr(new Date(y.created_at),"MMM d, yyyy")})]})]}),e.jsxs(bt,{className:G4[y.status].color,children:[e.jsx(v,{className:"h-3 w-3 mr-1"}),G4[y.status].label]})]})})},y.id)})})]})})}function $4t({open:t,onOpenChange:r}){return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[e.jsx(Ur,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:e.jsx(Mn,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx(Br,{children:"Schedule Agent Onboarding"}),e.jsx(Gs,{children:"Book a one-on-one onboarding session with LevelUp"})]})]})}),t&&e.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 U4t({open:t,onOpenChange:r}){const{brokerageId:s}=Gr(),[n,a]=E.useState(""),[o,l]=E.useState([]),[i,d]=E.useState(!1),{data:m,isLoading:g}=Ht({queryKey:["brokerage-agents-for-onboarding",s],queryFn:async()=>{if(!s)return[];const{data:j,error:S}=await Z.from("profiles").select("id, name, email").eq("brokerage_id",s).order("name",{ascending:!0});if(S)throw S;return j},enabled:t&&!!s}),y=m==null?void 0:m.filter(j=>j.name.toLowerCase().includes(n.toLowerCase())||j.email.toLowerCase().includes(n.toLowerCase())),v=j=>{l(S=>S.includes(j)?S.filter(A=>A!==j):[...S,j])},b=async()=>{if(o.length===0){Se.error("Please select at least one agent");return}d(!0);try{const{data:j,error:S}=await Z.functions.invoke("send-onboarding-link",{body:{agentIds:o}});if(S)throw S;Se.success(`Onboarding link sent to ${o.length} agent${o.length>1?"s":""}`),l([]),r(!1)}catch(j){console.error("Error sending onboarding link:",j),Se.error(j.message||"Failed to send onboarding link")}finally{d(!1)}},N=j=>{j||(l([]),a("")),r(j)};return e.jsx(Dr,{open:t,onOpenChange:N,children:e.jsxs(Lr,{className:"max-w-md",children:[e.jsx(Ur,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:e.jsx(Mi,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx(Br,{children:"Send Onboarding Link"}),e.jsx(Gs,{children:"Select agents to receive the onboarding booking link"})]})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search agents...",value:n,onChange:j=>a(j.target.value),className:"pl-10"})]}),g?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Hr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):(y==null?void 0:y.length)===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(ws,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"No agents found"})]}):e.jsx(Eo,{className:"h-[300px] border rounded-lg",children:e.jsx("div",{className:"p-2 space-y-1",children:y==null?void 0:y.map(j=>e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted cursor-pointer",onClick:()=>v(j.id),children:[e.jsx(Yo,{checked:o.includes(j.id),onCheckedChange:()=>v(j.id)}),e.jsx(ln,{className:"h-8 w-8",children:e.jsx(cn,{className:"text-xs",children:j.name.split(" ").map(S=>S[0]).join("").toUpperCase()})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:j.name}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:j.email})]})]},j.id))})}),o.length>0&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:[o.length," agent",o.length>1?"s":""," selected"]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>N(!1),children:"Cancel"}),e.jsx(Q,{onClick:b,disabled:o.length===0||i,children:i?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Mi,{className:"h-4 w-4 mr-2"}),"Send Link"]})})]})]})})}function q4t(){const[t,r]=E.useState(!1),[s,n]=E.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsxs(ze,{className:"mb-8",children:[e.jsx(Wt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:e.jsx(ws,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{children:[e.jsx(Zt,{children:"Agent Onboarding"}),e.jsx(Ss,{children:"Schedule onboarding sessions for yourself or your agents"})]})]})}),e.jsx(qe,{children:e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsxs(Q,{onClick:()=>r(!0),className:"flex items-center gap-2",children:[e.jsx(Mn,{className:"h-4 w-4"}),"Schedule Agent Onboarding"]}),e.jsxs(Q,{variant:"outline",onClick:()=>n(!0),className:"flex items-center gap-2",children:[e.jsx(Mi,{className:"h-4 w-4"}),"Send New Agent Onboarding Link"]})]})})]}),e.jsx($4t,{open:t,onOpenChange:r}),e.jsx(U4t,{open:s,onOpenChange:n})]})}function V4t({open:t,onOpenChange:r}){return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[e.jsx(Ur,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:e.jsx(Kg,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx(Br,{children:"Schedule Launch Meeting"}),e.jsx(Gs,{children:"Book a private LevelUp information session for your brokerage"})]})]})}),t&&e.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 H4t(){const[t,r]=E.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsxs(ze,{className:"mb-8",children:[e.jsx(Wt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:e.jsx(Kg,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{children:[e.jsx(Zt,{children:"Launch or ReLaunch Meeting"}),e.jsx(Ss,{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."})]})]})}),e.jsx(qe,{children:e.jsxs(Q,{onClick:()=>r(!0),className:"flex items-center gap-2",children:[e.jsx(Kg,{className:"h-4 w-4"}),"Schedule Launch Meeting"]})})]}),e.jsx(V4t,{open:t,onOpenChange:r})]})}function W4t(){const t=Ws(),[r,s]=E.useState(""),[n,a]=E.useState(null),{data:o,isLoading:l}=Ht({queryKey:["brokerage-resources-published"],queryFn:async()=>{const{data:j,error:S}=await Z.from("brokerage_resources").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(S)throw S;return j}}),{data:i}=Ht({queryKey:["brokerage-resource-categories"],queryFn:async()=>{const{data:j,error:S}=await Z.from("brokerage_resource_categories").select("*").order("sort_order",{ascending:!0});if(S)throw S;return j}}),{data:d}=Ht({queryKey:["brokerage-resource-pdfs-all"],queryFn:async()=>{const{data:j,error:S}=await Z.from("brokerage_resource_pdfs").select("resource_id");if(S)throw S;return j}}),{data:m}=Ht({queryKey:["brokerage-resource-videos-all"],queryFn:async()=>{const{data:j,error:S}=await Z.from("brokerage_resource_videos").select("resource_id");if(S)throw S;return j}}),{data:g}=Ht({queryKey:["brokerage-resource-links-all"],queryFn:async()=>{const{data:j,error:S}=await Z.from("brokerage_resource_links").select("resource_id");if(S)throw S;return j}}),y=o==null?void 0:o.filter(j=>{var M;const S=j.title.toLowerCase().includes(r.toLowerCase())||((M=j.description)==null?void 0:M.toLowerCase().includes(r.toLowerCase())),A=!n||j.category_id===n;return S&&A}),v=i==null?void 0:i.filter(j=>o==null?void 0:o.some(S=>S.category_id===j.id)),b=j=>{const S=(d==null?void 0:d.filter(I=>I.resource_id===j).length)||0,A=(m==null?void 0:m.filter(I=>I.resource_id===j).length)||0,M=(g==null?void 0:g.filter(I=>I.resource_id===j).length)||0;return{pdfCount:S,videoCount:A,linkCount:M}},N=j=>{t(`/brokerage-resources/${j}`)};return e.jsx(Fr,{title:"Brokerage Resources",description:"Access exclusive resources for brokerage managers",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(q4t,{}),e.jsx(H4t,{}),e.jsxs("div",{className:"relative max-w-md",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search resources...",value:r,onChange:j=>s(j.target.value),className:"pl-10"})]}),v&&v.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(bt,{variant:n===null?"default":"outline",className:"cursor-pointer",onClick:()=>a(null),children:"All"}),v.map(j=>e.jsx(bt,{variant:n===j.id?"default":"outline",className:"cursor-pointer",onClick:()=>a(j.id),children:j.name},j.id))]}),!l&&e.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?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[...Array(6)].map((j,S)=>e.jsxs(ze,{children:[e.jsx(fr,{className:"h-40 w-full"}),e.jsx(Wt,{children:e.jsx(fr,{className:"h-5 w-3/4"})}),e.jsxs(qe,{children:[e.jsx(fr,{className:"h-4 w-full mb-2"}),e.jsx(fr,{className:"h-4 w-2/3"})]})]},S))}):(y==null?void 0:y.length)===0?e.jsxs(ze,{className:"p-12 text-center",children:[e.jsx(wu,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No resources found"}),e.jsx("p",{className:"text-muted-foreground",children:r||n?"Try adjusting your filters":"Check back later for new resources"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:y==null?void 0:y.map(j=>{const{pdfCount:S,videoCount:A,linkCount:M}=b(j.id),I=i==null?void 0:i.find(F=>F.id===j.category_id);return e.jsxs(ze,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>N(j.id),children:[j.preview_image_url?e.jsx("img",{src:j.preview_image_url,alt:j.title,className:"w-full h-40 object-cover"}):e.jsx("div",{className:"w-full h-40 bg-muted flex items-center justify-center",children:e.jsx(wu,{className:"h-16 w-16 text-muted-foreground"})}),e.jsx(Wt,{className:"pb-2",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx(Zt,{className:"text-lg line-clamp-1",children:j.title}),I&&e.jsx(bt,{variant:"secondary",className:"shrink-0 text-xs",children:I.name})]})}),e.jsxs(qe,{children:[j.description&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:j.description}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[S>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(fa,{className:"h-4 w-4"}),S]}),A>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ya,{className:"h-4 w-4"}),A]}),M>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Bo,{className:"h-4 w-4"}),M]})]})]})]},j.id)})})]})})}const G4t=()=>{const{resourceId:t}=Xl(),{data:r,isLoading:s}=Ht({queryKey:["brokerage-resource-detail",t],queryFn:async()=>{const{data:a,error:o}=await Z.from("brokerage_resources").select("*").eq("id",t).eq("is_published",!0).single();if(o)throw o;const{data:l}=await Z.from("brokerage_resource_pdfs").select("*").eq("resource_id",t).order("sort_order"),{data:i}=await Z.from("brokerage_resource_videos").select("*").eq("resource_id",t).order("sort_order"),{data:d}=await Z.from("brokerage_resource_links").select("*").eq("resource_id",t).order("sort_order");return{...a,pdfs:l||[],videos:i||[],links:d||[]}},enabled:!!t}),n=a=>a?a<1024?a+" B":a<1024*1024?(a/1024).toFixed(1)+" KB":(a/(1024*1024)).toFixed(1)+" MB":"";return s?e.jsx(Fr,{title:"Brokerage Resources",children:e.jsx("div",{className:"flex justify-center py-12",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r?e.jsx(Fr,{title:r.title,children:e.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[e.jsx(Q,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:e.jsxs(go,{to:"/brokerage-resources",children:[e.jsx(_i,{className:"h-4 w-4"}),"Back to Resources"]})}),r.preview_image_url&&e.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:e.jsx("img",{src:r.preview_image_url,alt:r.title,className:"w-full max-h-[400px] object-cover"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:r.title}),r.description&&e.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:r.description}})]}),r.videos&&r.videos.length>0&&e.jsx(ze,{children:e.jsxs(qe,{className:"pt-6",children:[e.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[e.jsx(ya,{className:"h-4 w-4"}),"Videos (",r.videos.length,")"]}),e.jsx("div",{className:"space-y-4",children:r.videos.map(a=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:a.title}),e.jsx("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:e.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))})]})}),r.pdfs&&r.pdfs.length>0&&e.jsx(ze,{children:e.jsxs(qe,{className:"pt-6",children:[e.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[e.jsx(fa,{className:"h-4 w-4"}),"Documents (",r.pdfs.length,")"]}),e.jsx("div",{className:"grid gap-2",children:r.pdfs.map(a=>e.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:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-md bg-primary/10",children:e.jsx(fa,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-sm",children:a.name}),a.file_size&&e.jsx("div",{className:"text-xs text-muted-foreground",children:n(a.file_size)})]})]}),e.jsx(Oi,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},a.id))})]})}),r.links&&r.links.length>0&&e.jsx(ze,{children:e.jsxs(qe,{className:"pt-6",children:[e.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[e.jsx(En,{className:"h-4 w-4"}),"Canva Templates (",r.links.length,")"]}),e.jsx("div",{className:"grid gap-2",children:r.links.map(a=>e.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:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-md bg-primary/10",children:e.jsx(En,{className:"h-4 w-4 text-primary"})}),e.jsx("div",{className:"font-medium text-sm",children:a.title})]}),e.jsx(En,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},a.id))})]})})]})}):e.jsx(Fr,{title:"Brokerage Resources",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(wu,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold",children:"Resource not found"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"This resource may have been removed or is not available."}),e.jsx(Q,{asChild:!0,className:"mt-4",children:e.jsx(go,{to:"/brokerage-resources",children:"Back to Resources"})})]})})};function K4t(){const{onlineUsers:t,totalOnline:r}=PRe();return e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Zt,{className:"text-base flex items-center gap-2",children:[e.jsx(ws,{className:"h-4 w-4"}),"Online Now"]}),e.jsxs(bt,{variant:"secondary",className:"bg-green-100 text-green-700",children:[e.jsx(ah,{className:"h-2 w-2 fill-green-500 text-green-500 mr-1"}),r," online"]})]})}),e.jsx(qe,{children:t.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No other users online right now"}):e.jsx(Eo,{className:"h-[300px] pr-4",children:e.jsx("div",{className:"space-y-3",children:t.map(s=>{var n;return e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"relative",children:[e.jsxs(ln,{className:"h-9 w-9",children:[e.jsx(pa,{src:s.avatarUrl,alt:s.name}),e.jsx(cn,{className:"text-xs",children:(n=s.name)==null?void 0:n.split(" ").map(a=>a[0]).join("").slice(0,2).toUpperCase()})]}),e.jsx("span",{className:"absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full bg-green-500 ring-2 ring-background"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:s.name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Online ",Su(new Date(s.onlineSince),{addSuffix:!1})]})]})]},s.id)})})})})]})}const eCe={users:{label:"Users & Access",sections:[{title:"Members",description:"Manage users, roles, and brokerage assignments",icon:ws,path:"/admin/members",color:"bg-blue-500/10 text-blue-600"},{title:"Invite Codes",description:"Create and manage signup invite codes",icon:UA,path:"/admin/invite-codes",color:"bg-amber-500/10 text-amber-600"},{title:"Subscriptions",description:"Track and manage user subscriptions",icon:gp,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:Xg,path:"/admin/discounts",color:"bg-red-500/10 text-red-600"},{title:"Referral Program",description:"Track brokerage referrals and discounts",icon:Oc,path:"/admin/referrals",color:"bg-teal-500/10 text-teal-600"},{title:"Teams",description:"Manage agent teams across all brokerages",icon:ws,path:"/admin/members?tab=teams",color:"bg-violet-500/10 text-violet-600"},{title:"Prospector",description:"Send free trial invites and track conversions",icon:bp,path:"/admin/prospector",color:"bg-gradient-to-br from-orange-500/20 to-amber-500/10 text-orange-600"}]},content:{label:"Content",sections:[{title:"Manage Templates",description:"Upload and organize Canva templates",icon:ed,path:"/admin/templates",color:"bg-pink-500/10 text-pink-600"},{title:"Manage Academy",description:"Upload videos and training content",icon:Y1,path:"/admin/academy",color:"bg-indigo-500/10 text-indigo-600"},{title:"Manage Toolbox",description:"Create and manage resource kits",icon:wy,path:"/admin/toolbox",color:"bg-orange-500/10 text-orange-600"},{title:"Social Swag",description:"Manage social media content and links",icon:An,path:"/admin/social-swag",color:"bg-fuchsia-500/10 text-fuchsia-600"},{title:"Social Swag 2.0",description:"New monthly social media images",icon:An,path:"/admin/social-swag-2",color:"bg-cyan-500/10 text-cyan-600"},{title:"Newsletters",description:"Manage monthly newsletter templates",icon:_y,path:"/admin/newsletters",color:"bg-violet-500/10 text-violet-600"},{title:"Manage Events",description:"Create and publish events with Zoom integration",icon:Ff,path:"/admin/events",color:"bg-green-500/10 text-green-600"},{title:"Additional Services",description:"Manage additional service offerings",icon:wu,path:"/admin/additional-services",color:"bg-lime-500/10 text-lime-600"},{title:"Brokerage Resources",description:"Manage resources for brokerage managers",icon:wu,path:"/admin/brokerage-resources",color:"bg-slate-500/10 text-slate-600"},{title:"Agent Email Templates",description:"Manage curated email templates for agents",icon:mn,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:Vj,path:"/admin/dashboard-management",color:"bg-teal-500/10 text-teal-600"},{title:"Manage Apps",description:"Configure app tiles and access requirements",icon:im,path:"/admin/apps",color:"bg-purple-500/10 text-purple-600"},{title:"Email Templates",description:"Customize system email templates",icon:mn,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:Bf,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:DS,path:"/admin/onboarding-checklist",color:"bg-emerald-500/10 text-emerald-600"},{title:"Marketplace",description:"Manage store categories, products, and orders",icon:Zg,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:uo,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:ho,path:"/admin/agent-points",color:"bg-amber-500/10 text-amber-600"},{title:"Integrations",description:"Connect Canva, Facebook & Instagram for platform-level features",icon:jm,path:"/admin/integrations",color:"bg-blue-500/10 text-blue-600"},{title:"Agent Cards",description:"Manage digital business cards for agents",icon:ws,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:Bf,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:$o,path:"/admin/community",color:"bg-cyan-500/10 text-cyan-600"},{title:"Support Tickets",description:"View and respond to agent support requests",icon:qS,path:"/admin/support-tickets",color:"bg-rose-500/10 text-rose-600"},{title:"Wishlist",description:"Review and manage community feature requests",icon:yy,path:"/admin/wishlist",color:"bg-yellow-500/10 text-yellow-600"},{title:"Membership Reviews",description:"View member feedback and ratings",icon:Ln,path:"/admin/membership-reviews",color:"bg-amber-500/10 text-amber-600"},{title:"Weekly Digest",description:"Configure automated weekly email digests",icon:mn,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:Nc,path:"/admin/analytics",color:"bg-emerald-500/10 text-emerald-600"}]},"agent-os":{label:"Agent OS",sections:[{title:"Agent OS Control Center",description:"Manage InnerCircle feature: relationship types, action types, scripts, plans & feature flags",icon:Ci,path:"/admin/agent-os",color:"bg-gradient-to-br from-rose-500/20 to-pink-500/10 text-rose-600"},{title:"Listing Exchange",description:"Approve, feature, and moderate community listings",icon:Wn,path:"/admin/listing-exchange",color:"bg-gradient-to-br from-blue-500/20 to-sky-500/10 text-blue-600"},{title:"Presentation Analytics",description:"Track agent presentation usage, views, and leads",icon:$f,path:"/admin/presentation-analytics",color:"bg-gradient-to-br from-violet-500/20 to-indigo-500/10 text-violet-600"},{title:"Guest Book Analytics",description:"Track open house sign-in usage, visitors, and lead generation",icon:W1,path:"/admin/guest-book-analytics",color:"bg-gradient-to-br from-emerald-500/20 to-teal-500/10 text-emerald-600"}]}};function Z4t(){const t=Ws();return e.jsx(Fr,{title:"Admin Dashboard",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Admin Dashboard"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage all aspects of your platform"})]}),e.jsx("div",{className:"w-full lg:w-80",children:e.jsx(K4t,{})})]}),e.jsxs(ci,{defaultValue:"users",className:"w-full",children:[e.jsx(ri,{className:"w-full justify-start flex-wrap h-auto gap-1 bg-muted/50 p-1",children:Object.entries(eCe).map(([r,s])=>e.jsx(Kr,{value:r,className:"data-[state=active]:bg-background",children:s.label},r))}),Object.entries(eCe).map(([r,s])=>e.jsx(ms,{value:r,className:"mt-6",children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:s.sections.map(n=>e.jsxs(ze,{className:"cursor-pointer hover:shadow-md transition-all hover:border-primary/50 group",onClick:()=>t(n.path),children:[e.jsxs(Wt,{className:"pb-3",children:[e.jsx("div",{className:`w-10 h-10 rounded-lg flex items-center justify-center ${n.color} mb-2 group-hover:scale-110 transition-transform`,children:e.jsx(n.icon,{className:"h-5 w-5"})}),e.jsx(Zt,{className:"text-base",children:n.title})]}),e.jsx(qe,{className:"pt-0",children:e.jsx(Ss,{className:"text-sm",children:n.description})})]},n.path))})},r))]})]})})}const Rn=E.forwardRef(({className:t,...r},s)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:s,className:qt("w-full caption-bottom text-sm",t),...r})}));Rn.displayName="Table";const Fn=E.forwardRef(({className:t,...r},s)=>e.jsx("thead",{ref:s,className:qt("[&_tr]:border-b",t),...r}));Fn.displayName="TableHeader";const zn=E.forwardRef(({className:t,...r},s)=>e.jsx("tbody",{ref:s,className:qt("[&_tr:last-child]:border-0",t),...r}));zn.displayName="TableBody";const Y4t=E.forwardRef(({className:t,...r},s)=>e.jsx("tfoot",{ref:s,className:qt("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...r}));Y4t.displayName="TableFooter";const Nr=E.forwardRef(({className:t,...r},s)=>e.jsx("tr",{ref:s,className:qt("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",t),...r}));Nr.displayName="TableRow";const Ct=E.forwardRef(({className:t,...r},s)=>e.jsx("th",{ref:s,className:qt("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...r}));Ct.displayName="TableHead";const dt=E.forwardRef(({className:t,...r},s)=>e.jsx("td",{ref:s,className:qt("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...r}));dt.displayName="TableCell";const X4t=E.forwardRef(({className:t,...r},s)=>e.jsx("caption",{ref:s,className:qt("mt-4 text-sm text-muted-foreground",t),...r}));X4t.displayName="TableCaption";const Q4t=()=>{const{isAdmin:t}=Gr(),r=Ws(),[s,n]=E.useState([]),[a,o]=E.useState(!0),[l,i]=E.useState(!1),[d,m]=E.useState(null);E.useEffect(()=>{if(!t){r("/dashboard");return}g()},[t]);const g=async()=>{try{const{data:j,error:S}=await Z.from("app_tiles").select("*").order("name");if(S)throw S;n(j||[])}catch(j){console.error("Error loading apps:",j),Se.error("Failed to load apps")}finally{o(!1)}},y=async j=>{j.preventDefault();const S=new FormData(j.currentTarget),A={name:S.get("name"),description:S.get("description"),icon:S.get("icon"),app_id:S.get("app_id"),target_url:S.get("target_url"),required_tags:S.get("required_tags").split(",").map(M=>M.trim()).filter(Boolean)};try{if(d){const{error:M}=await Z.from("app_tiles").update(A).eq("id",d.id);if(M)throw M;Se.success("App updated successfully")}else{const{error:M}=await Z.from("app_tiles").insert([A]);if(M)throw M;Se.success("App created successfully")}i(!1),m(null),g()}catch(M){console.error("Error saving app:",M),Se.error("Failed to save app")}},v=async j=>{if(confirm("Are you sure you want to delete this app?"))try{const{error:S}=await Z.from("app_tiles").delete().eq("id",j);if(S)throw S;Se.success("App deleted successfully"),g()}catch(S){console.error("Error deleting app:",S),Se.error("Failed to delete app")}},b=j=>{m(j),i(!0)},N=()=>{m(null),i(!0)};return a?e.jsx("div",{className:"flex items-center justify-center min-h-screen",children:"Loading..."}):e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("header",{className:"border-b bg-card",children:e.jsx("div",{className:"container mx-auto px-4 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>r("/dashboard"),children:[e.jsx(_i,{className:"h-4 w-4 mr-2"}),"Back"]}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Manage Apps"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Create and configure application tiles"})]})]}),e.jsxs(Dr,{open:l,onOpenChange:i,children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{onClick:N,children:[e.jsx(gs,{className:"mr-2 h-4 w-4"}),"Add App"]})}),e.jsxs(Lr,{className:"max-w-2xl",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:d?"Edit App":"Create New App"}),e.jsx(Gs,{children:"Configure the application tile settings"})]}),e.jsxs("form",{onSubmit:y,className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"name",children:"App Name"}),e.jsx(Qe,{id:"name",name:"name",defaultValue:d==null?void 0:d.name,required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"app_id",children:"App ID"}),e.jsx(Qe,{id:"app_id",name:"app_id",defaultValue:d==null?void 0:d.app_id,placeholder:"agent_connect",required:!0})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"description",children:"Description"}),e.jsx(Ks,{id:"description",name:"description",defaultValue:d==null?void 0:d.description})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"icon",children:"Icon (emoji)"}),e.jsx(Qe,{id:"icon",name:"icon",defaultValue:d==null?void 0:d.icon,placeholder:"🚀",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"target_url",children:"Target URL"}),e.jsx(Qe,{id:"target_url",name:"target_url",type:"url",defaultValue:d==null?void 0:d.target_url,required:!0})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"required_tags",children:"Required Tags (comma-separated)"}),e.jsx(Qe,{id:"required_tags",name:"required_tags",defaultValue:d==null?void 0:d.required_tags.join(", "),placeholder:"levelup-member, agent-connect"})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(Q,{type:"submit",children:d?"Update":"Create"})]})]})]})]})]})})}),e.jsx("div",{className:"container mx-auto px-4 py-8",children:e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsx(Zt,{children:"Application Tiles"}),e.jsx(Ss,{children:"Manage the apps that appear on the member dashboard"})]}),e.jsx(qe,{children:s.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx("p",{className:"text-muted-foreground mb-4",children:"No apps configured yet"}),e.jsxs(Q,{onClick:N,children:[e.jsx(gs,{className:"mr-2 h-4 w-4"}),"Create First App"]})]}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Icon"}),e.jsx(Ct,{children:"Name"}),e.jsx(Ct,{children:"App ID"}),e.jsx(Ct,{children:"Target URL"}),e.jsx(Ct,{children:"Tags"}),e.jsx(Ct,{className:"text-right",children:"Actions"})]})}),e.jsx(zn,{children:s.map(j=>e.jsxs(Nr,{children:[e.jsx(dt,{className:"text-2xl",children:j.icon}),e.jsx(dt,{className:"font-medium",children:j.name}),e.jsx(dt,{className:"font-mono text-sm",children:j.app_id}),e.jsx(dt,{className:"text-sm text-muted-foreground max-w-xs truncate",children:j.target_url}),e.jsx(dt,{children:e.jsx("div",{className:"flex flex-wrap gap-1",children:j.required_tags.map(S=>e.jsx("span",{className:"text-xs bg-secondary text-secondary-foreground px-2 py-1 rounded",children:S},S))})}),e.jsx(dt,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>b(j),children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>v(j.id),children:e.jsx(Rs,{className:"h-4 w-4"})})]})})]},j.id))})]})})]})})]})};function Lu({title:t,description:r,children:s}){return e.jsxs("div",{className:"space-y-4",children:[e.jsx(go,{to:"/admin",children:e.jsxs(Q,{variant:"ghost",size:"sm",className:"gap-2 text-muted-foreground hover:text-foreground",children:[e.jsx(_i,{className:"h-4 w-4"}),"Back to Admin Dashboard"]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:t}),r&&e.jsx("p",{className:"text-muted-foreground",children:r})]}),s]})]})}const tCe=({expiresAt:t,className:r})=>{const s=new Date().getTime(),n=new Date(t).getTime(),a=Math.ceil((n-s)/(1e3*60*60*24));return a<=0?e.jsxs(bt,{variant:"destructive",className:qt("gap-1",r),children:[e.jsx(Qu,{className:"h-3 w-3"}),"Trial Expired"]}):a<=1?e.jsxs(bt,{variant:"destructive",className:qt("gap-1",r),children:[e.jsx(Ea,{className:"h-3 w-3"}),"Trial: <1 day left"]}):a<=3?e.jsxs(bt,{className:qt("gap-1 bg-amber-500 hover:bg-amber-600",r),children:[e.jsx(Ea,{className:"h-3 w-3"}),"Trial: ",a," days left"]}):e.jsxs(bt,{variant:"secondary",className:qt("gap-1",r),children:[e.jsx(Ea,{className:"h-3 w-3"}),"Trial: ",a," days left"]})},lBe=({open:t,onOpenChange:r,brokerages:s,fixedBrokerageId:n,onSuccess:a})=>{const{toast:o}=fi(),l=E.useRef(null),[i,d]=E.useState([]),[m,g]=E.useState(""),[y,v]=E.useState(!1),[b,N]=E.useState("upload"),[j,S]=E.useState(null),A=()=>{d([]),g(""),N("upload"),S(null),l.current&&(l.current.value="")},M=()=>{A(),r(!1)},I=H=>{const W=H.split(` `).map(ne=>ne.trim()).filter(ne=>ne);if(W.length===0)return[];const X=W[0].toLowerCase(),ae=X.includes("first")||X.includes("last")||X.includes("email")||X.includes("name")||X.includes("phone")||X.includes("sms")||X.includes("consent")?W.slice(1):W,le=[];for(const ne of ae){const oe=(ne.includes(" ")?ne.split(" "):ne.split(",")).map(de=>de.trim().replace(/^["']|["']$/g,""));if(oe.length>=2){let de="",ue="",xe="",Te="",be;if(oe.length===2){const tt=oe[0].split(" ");de=tt[0]||"",ue=tt.slice(1).join(" ")||"",xe=oe[1]}else if(oe.length===3)de=oe[0],ue=oe[1],xe=oe[2];else if(oe.length===4)de=oe[0],ue=oe[1],xe=oe[2],Te=oe[3];else if(oe.length>=5){de=oe[0],ue=oe[1],xe=oe[2],Te=oe[3];const tt=oe[4].toLowerCase();be=tt==="true"||tt==="yes"||tt==="1"||tt==="y"}const ve=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(xe);le.push({firstName:de.trim(),lastName:ue.trim(),email:xe.trim().toLowerCase(),phone:Te.trim()||void 0,smsConsent:be,isValid:ve&&de.trim().length>0,error:ve?de.trim()?void 0:"Missing name":"Invalid email"})}}return le},F=H=>{var se;const W=(se=H.target.files)==null?void 0:se[0];if(!W)return;const X=new FileReader;X.onload=ae=>{var fe;const le=(fe=ae.target)==null?void 0:fe.result,ne=I(le);if(ne.length===0){o({title:"No data found",description:"The CSV file appears to be empty or in an unsupported format.",variant:"destructive"});return}d(ne),N("preview")},X.readAsText(W)},O=async()=>{const H=i.filter(X=>X.isValid);if(H.length===0){o({title:"No valid users",description:"There are no valid users to import.",variant:"destructive"});return}const W=n||m||null;v(!0);try{const{data:{session:X}}=await Z.auth.getSession(),se=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/bulk-create-users",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${X==null?void 0:X.access_token}`},body:JSON.stringify({users:H.map(le=>({firstName:le.firstName,lastName:le.lastName,email:le.email,phone:le.phone,smsConsent:le.smsConsent})),brokerageId:W})}),ae=await se.json();if(!se.ok)throw new Error(ae.error||"Failed to import users");S(ae),N("result"),ae.created>0&&a(),o({title:"Import Complete",description:`${ae.created} user(s) created successfully.${ae.failed>0?` ${ae.failed} failed.`:""}`})}catch(X){console.error("Import error:",X),o({title:"Import Failed",description:X.message||"Failed to import users",variant:"destructive"})}finally{v(!1)}},B=i.filter(H=>H.isValid).length,$=i.filter(H=>!H.isValid).length;return e.jsx(Dr,{open:t,onOpenChange:M,children:e.jsxs(Lr,{className:"max-w-2xl max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{className:"flex items-center gap-2",children:[e.jsx(K1,{className:"h-5 w-5"}),"Import Agents from CSV"]}),e.jsx(Gs,{children:"Upload a CSV file with agent information. Each row should contain First Name, Last Name, and Email."})]}),b==="upload"&&e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"border-2 border-dashed rounded-lg p-8 text-center",children:[e.jsx("input",{type:"file",accept:".csv,.txt",ref:l,onChange:F,className:"hidden"}),e.jsx(to,{className:"h-10 w-10 mx-auto text-muted-foreground mb-4"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Click to upload or drag and drop a CSV file"}),e.jsx(Q,{onClick:()=>{var H;return(H=l.current)==null?void 0:H.click()},children:"Select CSV File"})]}),e.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 text-sm",children:[e.jsx("p",{className:"font-medium mb-2",children:"Expected CSV Format:"}),e.jsxs("code",{className:"text-xs block bg-background p-2 rounded",children:["First Name, Last Name, Email, Phone, SMS Consent",e.jsx("br",{}),"John, Doe, john@example.com, 555-123-4567, yes",e.jsx("br",{}),"Jane, Smith, jane@example.com, 555-987-6543, true"]}),e.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"&&e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[!n&&s&&s.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Assign to Brokerage (optional)"}),e.jsxs(ds,{value:m||"none",onValueChange:H=>g(H==="none"?"":H),children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Select a brokerage..."})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"none",children:"No brokerage"}),s.map(H=>e.jsx(Ut,{value:H.id,children:H.name},H.id))]})]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Li,{className:"h-4 w-4 text-green-500"}),e.jsxs("span",{children:[B," valid"]})]}),$>0&&e.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[e.jsx(_l,{className:"h-4 w-4"}),e.jsxs("span",{children:[$," invalid"]})]})]}),e.jsxs("div",{className:"flex-1 overflow-auto border rounded-lg",children:[e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{className:"bg-muted/30",children:[e.jsx(Ct,{children:"First Name"}),e.jsx(Ct,{children:"Last Name"}),e.jsx(Ct,{children:"Email"}),e.jsx(Ct,{children:"Phone"}),e.jsx(Ct,{children:"SMS"}),e.jsx(Ct,{children:"Status"})]})}),e.jsx(zn,{children:i.slice(0,100).map((H,W)=>e.jsxs(Nr,{children:[e.jsx(dt,{children:H.firstName}),e.jsx(dt,{children:H.lastName}),e.jsx(dt,{children:H.email}),e.jsx(dt,{className:"text-muted-foreground",children:H.phone||"-"}),e.jsx(dt,{className:"text-muted-foreground",children:H.smsConsent===!0?"✓":H.smsConsent===!1?"✗":"-"}),e.jsx(dt,{children:H.isValid?e.jsx(bt,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):e.jsx(bt,{variant:"destructive",children:H.error||"Invalid"})})]},W))})]}),i.length>100&&e.jsxs("p",{className:"text-sm text-muted-foreground text-center py-2",children:["Showing first 100 of ",i.length," users"]})]})]}),b==="result"&&j&&e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsx(Li,{className:"h-12 w-12 mx-auto text-green-500 mb-4"}),e.jsx("h3",{className:"text-lg font-semibold",children:"Import Complete"}),e.jsxs("p",{className:"text-muted-foreground mt-2",children:[j.created," agent(s) created and invited"]}),j.failed>0&&e.jsxs("p",{className:"text-destructive mt-1",children:[j.failed," failed to create"]})]}),j.errors.length>0&&e.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-4 max-h-40 overflow-auto",children:[e.jsx("p",{className:"font-medium text-destructive text-sm mb-2",children:"Errors:"}),e.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1",children:[j.errors.slice(0,10).map((H,W)=>e.jsxs("li",{children:["• ",H]},W)),j.errors.length>10&&e.jsxs("li",{children:["...and ",j.errors.length-10," more"]})]})]})]}),e.jsxs(Dn,{children:[b==="upload"&&e.jsx(Q,{variant:"outline",onClick:M,children:"Cancel"}),b==="preview"&&e.jsxs(e.Fragment,{children:[e.jsx(Q,{variant:"outline",onClick:A,children:"Back"}),e.jsx(Q,{onClick:O,disabled:y||B===0,children:y?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${B} Agent${B!==1?"s":""}`})]}),b==="result"&&e.jsx(Q,{onClick:M,children:"Done"})]})]})})},J4t=[{type:"custom",title:"Great job!",message:"Keep up the amazing work!",icon:Ln},{type:"custom",title:"You're on fire!",message:"Your dedication is inspiring!",icon:ho},{type:"custom",title:"Congratulations!",message:"You earned this celebration!",icon:td}];function cBe({open:t,onOpenChange:r,userId:s,userName:n}){const[a,o]=E.useState("custom"),[l,i]=E.useState(""),[d,m]=E.useState(""),g=rct(),y=b=>{o(b.type),i(b.title),m(b.message)},v=async b=>{if(b.preventDefault(),!l.trim()){Jn({title:"Title required",description:"Please enter a celebration title",variant:"destructive"});return}try{await g.mutateAsync({user_id:s,celebration_type:a,title:l.trim(),message:d.trim()||void 0}),Jn({title:"Celebration sent! 🎉",description:`${n} will see confetti on their next visit!`}),r(!1),i(""),m(""),o("custom")}catch{Jn({title:"Error",description:"Failed to send celebration",variant:"destructive"})}};return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"sm:max-w-md",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{className:"flex items-center gap-2",children:[e.jsx(td,{className:"h-5 w-5 text-primary"}),"Send Celebration to ",n]}),e.jsx(Gs,{children:"They'll see confetti and this message next time they log in!"})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx(Ee,{className:"text-sm text-muted-foreground mb-2 block",children:"Quick presets:"}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:J4t.map((b,N)=>e.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>y(b),className:"text-xs",children:[e.jsx(b.icon,{className:"h-3 w-3 mr-1"}),b.title]},N))})]}),e.jsxs("form",{onSubmit:v,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"type",children:"Celebration Type"}),e.jsxs(ds,{value:a,onValueChange:b=>o(b),children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"custom",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ln,{className:"h-4 w-4"})," Custom"]})}),e.jsx(Ut,{value:"points_earned",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ho,{className:"h-4 w-4"})," Points Earned"]})}),e.jsx(Ut,{value:"listing_created",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Wn,{className:"h-4 w-4"})," Listing Created"]})}),e.jsx(Ut,{value:"deal_closed",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(yd,{className:"h-4 w-4"})," Deal Closed"]})})]})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"title",children:"Title *"}),e.jsx(Qe,{id:"title",value:l,onChange:b=>i(b.target.value),placeholder:"e.g., Congratulations!",maxLength:100})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"message",children:"Message (optional)"}),e.jsx(Ks,{id:"message",value:d,onChange:b=>m(b.target.value),placeholder:"Add a personal message...",rows:3,maxLength:500})]}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsxs(Q,{type:"submit",disabled:g.isPending,children:[e.jsx(td,{className:"h-4 w-4 mr-2"}),g.isPending?"Sending...":"Send Celebration"]})]})]})]})})}const Fde={points_earned:{label:"Points Earned",icon:ho,color:"bg-yellow-500"},listing_created:{label:"Listing Created",icon:Wn,color:"bg-blue-500"},deal_closed:{label:"Deal Closed",icon:yd,color:"bg-green-500"},custom:{label:"Custom",icon:An,color:"bg-purple-500"}};function eSt(){const[t,r]=E.useState(""),[s,n]=E.useState("all"),[a,o]=E.useState("all"),{data:l=[],isLoading:i}=Ht({queryKey:["admin-celebrations"],queryFn:async()=>{const{data:g,error:y}=await Z.from("celebration_queue").select("*").order("created_at",{ascending:!1}).limit(500);if(y)throw y;const v=[...new Set([...g.map(j=>j.user_id),...g.map(j=>j.created_by).filter(Boolean)])],{data:b}=await Z.from("profiles").select("id, name, email").in("id",v),N=new Map((b==null?void 0:b.map(j=>[j.id,j]))||[]);return g.map(j=>{var S,A,M;return{...j,user_name:((S=N.get(j.user_id))==null?void 0:S.name)||"Unknown",user_email:((A=N.get(j.user_id))==null?void 0:A.email)||"",creator_name:j.created_by?((M=N.get(j.created_by))==null?void 0:M.name)||"System":"Auto-triggered"}})}}),d=l.filter(g=>{var N,j;const y=((N=g.user_name)==null?void 0:N.toLowerCase().includes(t.toLowerCase()))||((j=g.user_email)==null?void 0:j.toLowerCase().includes(t.toLowerCase()))||g.title.toLowerCase().includes(t.toLowerCase()),v=s==="all"||g.celebration_type===s,b=a==="all"||a==="seen"&&g.seen_at||a==="unseen"&&!g.seen_at;return y&&v&&b}),m={total:l.length,seen:l.filter(g=>g.seen_at).length,unseen:l.filter(g=>!g.seen_at).length,byType:Object.keys(Fde).reduce((g,y)=>(g[y]=l.filter(v=>v.celebration_type===y).length,g),{})};return i?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Hr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm font-medium",children:"Total Celebrations"})}),e.jsx(qe,{children:e.jsx("div",{className:"text-2xl font-bold",children:m.total})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm font-medium text-green-600",children:"Seen"})}),e.jsx(qe,{children:e.jsx("div",{className:"text-2xl font-bold text-green-600",children:m.seen})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm font-medium text-orange-600",children:"Pending"})}),e.jsx(qe,{children:e.jsx("div",{className:"text-2xl font-bold text-orange-600",children:m.unseen})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm font-medium text-purple-600",children:"Custom Sent"})}),e.jsx(qe,{children:e.jsx("div",{className:"text-2xl font-bold text-purple-600",children:m.byType.custom||0})})]})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(td,{className:"h-5 w-5"}),"Celebration History"]}),e.jsx(Ss,{children:"View all celebrations awarded to agents"})]}),e.jsxs(qe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search by agent name, email, or title...",value:t,onChange:g=>r(g.target.value),className:"pl-9"})]}),e.jsxs(ds,{value:s,onValueChange:n,children:[e.jsx(ls,{className:"w-[180px]",children:e.jsx(us,{placeholder:"Filter by type"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Types"}),Object.entries(Fde).map(([g,y])=>e.jsx(Ut,{value:g,children:y.label},g))]})]}),e.jsxs(ds,{value:a,onValueChange:o,children:[e.jsx(ls,{className:"w-[140px]",children:e.jsx(us,{placeholder:"Status"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Status"}),e.jsx(Ut,{value:"seen",children:"Seen"}),e.jsx(Ut,{value:"unseen",children:"Pending"})]})]})]}),e.jsx("div",{className:"rounded-md border",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Type"}),e.jsx(Ct,{children:"Agent"}),e.jsx(Ct,{children:"Title"}),e.jsx(Ct,{children:"Points"}),e.jsx(Ct,{children:"Created By"}),e.jsx(Ct,{children:"Created"}),e.jsx(Ct,{children:"Status"})]})}),e.jsx(zn,{children:d.length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"No celebrations found"})}):d.map(g=>{const y=Fde[g.celebration_type],v=y.icon;return e.jsxs(Nr,{children:[e.jsx(dt,{children:e.jsxs(bt,{variant:"outline",className:"gap-1",children:[e.jsx(v,{className:"h-3 w-3"}),y.label]})}),e.jsx(dt,{children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:g.user_name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:g.user_email})]})}),e.jsx(dt,{children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:g.title}),g.message&&e.jsx("div",{className:"text-xs text-muted-foreground truncate max-w-[200px]",children:g.message})]})}),e.jsx(dt,{children:g.points_amount?e.jsxs(bt,{variant:"secondary",children:["+",g.points_amount]}):e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(dt,{children:e.jsx("span",{className:"text-sm text-muted-foreground",children:g.creator_name})}),e.jsx(dt,{children:e.jsx("span",{className:"text-sm text-muted-foreground",children:Xr(new Date(g.created_at),"MMM d, yyyy h:mm a")})}),e.jsx(dt,{children:g.seen_at?e.jsx(bt,{variant:"outline",className:"bg-green-50 text-green-700 border-green-200",children:"Seen"}):e.jsx(bt,{variant:"outline",className:"bg-orange-50 text-orange-700 border-orange-200",children:"Pending"})})]},g.id)})})]})}),d.length>0&&e.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["Showing ",d.length," of ",l.length," celebrations"]})]})]})]})}const tSt=()=>{const{user:t}=Gr(),{toast:r}=fi(),[s,n]=E.useState([]),[a,o]=E.useState(!0),[l,i]=E.useState(!1),[d,m]=E.useState("all"),[g,y]=E.useState("all"),[v,b]=E.useState("new"),[N,j]=E.useState(new Set),S=E.useCallback(async()=>{try{o(!0);const{data:le,error:ne}=await Z.from("profiles").select("id, name, email, phone, is_trial, trial_started_at, trial_expires_at, subscription_status, subscription_end_date, converted_from_trial_at, created_at").or("is_trial.eq.true,subscription_status.eq.trialing,converted_from_trial_at.not.is.null");if(ne)throw ne;const{data:fe,error:oe}=await Z.from("trial_email_exports").select("user_id");if(oe)throw oe;const de=new Set((fe||[]).map(xe=>xe.user_id)),ue=(le||[]).map(xe=>({...xe,converted_from_trial_at:xe.converted_from_trial_at??null,already_exported:de.has(xe.id)}));ue.sort((xe,Te)=>new Date(Te.created_at).getTime()-new Date(xe.created_at).getTime()),n(ue)}catch(le){console.error("Error loading trial users:",le),r({title:"Error",description:"Failed to load trial users",variant:"destructive"})}finally{o(!1)}},[r]);E.useEffect(()=>{S()},[S]);const A=le=>le.trial_started_at?"ghl":"stripe",M=le=>le.trial_expires_at?le.trial_expires_at:le.subscription_end_date?le.subscription_end_date:null,I=le=>le.converted_from_trial_at!==null,F=le=>{if(I(le))return!1;const ne=M(le);return ne?new Date(ne).getTime()<=Date.now():!1},O=s.filter(le=>!(d!=="all"&&A(le)!==d||g==="active"&&(F(le)||I(le))||g==="expired"&&!F(le)||g==="converted"&&!I(le)||v==="new"&&le.already_exported||v==="exported"&&!le.already_exported)),B=()=>{N.size===O.length?j(new Set):j(new Set(O.map(le=>le.id)))},$=le=>{const ne=new Set(N);ne.has(le)?ne.delete(le):ne.add(le),j(ne)},H=async()=>{if(N.size===0){r({title:"No users selected",description:"Select users to export",variant:"destructive"});return}i(!0);try{const le=s.filter(be=>N.has(be.id)),ne="First Name,Last Name,Email,Phone,Trial Type,Status,Signup Date,Expiry Date",fe=le.map(be=>{const we=(be.name||"").split(" "),ve=we[0]||"",tt=we.slice(1).join(" ")||"",Ae=A(be)==="stripe"?"Credit Card Trial":"Free Trial (No CC)",Le=I(be)?"Converted":F(be)?"Expired":"Active",Ue=be.created_at?new Date(be.created_at).toLocaleDateString():"",Ye=M(be)?new Date(M(be)).toLocaleDateString():"";return`"${ve}","${tt}","${be.email}","${be.phone||""}","${Ae}","${Le}","${Ue}","${Ye}"`}),oe=[ne,...fe].join(` `),de=new Blob([oe],{type:"text/csv"}),ue=URL.createObjectURL(de),xe=document.createElement("a");xe.href=ue,xe.download=`trial-users-${new Date().toISOString().split("T")[0]}.csv`,xe.click(),URL.revokeObjectURL(ue);const Te=le.filter(be=>!be.already_exported).map(be=>({user_id:be.id,exported_by:t.id}));if(Te.length>0){const{error:be}=await Z.from("trial_email_exports").upsert(Te,{onConflict:"user_id"});be&&console.error("Error marking exports:",be)}r({title:"Export complete",description:`Downloaded ${le.length} trial user(s). ${Te.length} newly marked as exported.`}),j(new Set),S()}catch(le){console.error("Export error:",le),r({title:"Error",description:"Failed to export",variant:"destructive"})}finally{i(!1)}},W=s.filter(le=>!le.already_exported).length,X=s.filter(le=>le.already_exported).length,se=s.filter(le=>I(le)).length,ae=s.filter(le=>!F(le)&&!I(le)).length;return a?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Hr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-5 gap-4",children:[e.jsx(ze,{children:e.jsxs(Wt,{className:"pb-2",children:[e.jsx(Ss,{children:"Total"}),e.jsx(Zt,{className:"text-2xl",children:s.length})]})}),e.jsx(ze,{children:e.jsxs(Wt,{className:"pb-2",children:[e.jsx(Ss,{children:"New (Not Exported)"}),e.jsx(Zt,{className:"text-2xl text-green-600",children:W})]})}),e.jsx(ze,{children:e.jsxs(Wt,{className:"pb-2",children:[e.jsx(Ss,{children:"Active Trials"}),e.jsx(Zt,{className:"text-2xl",children:ae})]})}),e.jsx(ze,{children:e.jsxs(Wt,{className:"pb-2",children:[e.jsx(Ss,{children:"Converted 🎉"}),e.jsx(Zt,{className:"text-2xl text-primary",children:se})]})}),e.jsx(ze,{children:e.jsxs(Wt,{className:"pb-2",children:[e.jsx(Ss,{children:"Already Exported"}),e.jsx(Zt,{className:"text-2xl text-muted-foreground",children:X})]})})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs(ds,{value:v,onValueChange:le=>b(le),children:[e.jsx(ls,{className:"w-[160px]",children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Users"}),e.jsx(Ut,{value:"new",children:"New Only"}),e.jsx(Ut,{value:"exported",children:"Already Exported"})]})]}),e.jsxs(ds,{value:d,onValueChange:le=>m(le),children:[e.jsx(ls,{className:"w-[180px]",children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Trial Types"}),e.jsx(Ut,{value:"stripe",children:"Credit Card Trial"}),e.jsx(Ut,{value:"ghl",children:"Free Trial (No CC)"})]})]}),e.jsxs(ds,{value:g,onValueChange:le=>y(le),children:[e.jsx(ls,{className:"w-[160px]",children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Statuses"}),e.jsx(Ut,{value:"active",children:"Active Trial"}),e.jsx(Ut,{value:"expired",children:"Expired"}),e.jsx(Ut,{value:"converted",children:"Converted ✓"})]})]}),e.jsx("div",{className:"ml-auto",children:e.jsxs(Q,{onClick:H,disabled:l||N.size===0,children:[l?e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(Oi,{className:"h-4 w-4 mr-2"}),"Export Selected (",N.size,")"]})})]}),e.jsx("div",{className:"border rounded-lg",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{className:"bg-muted/30 hover:bg-muted/30",children:[e.jsx(Ct,{className:"w-[40px]",children:e.jsx(Yo,{checked:O.length>0&&N.size===O.length,onCheckedChange:B})}),e.jsx(Ct,{children:"Name"}),e.jsx(Ct,{children:"Email"}),e.jsx(Ct,{children:"Trial Type"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{children:"Signup Date"}),e.jsx(Ct,{children:"Expires / Renews"}),e.jsx(Ct,{children:"Exported"})]})}),e.jsx(zn,{children:O.length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"No trial users match the current filters"})}):O.map(le=>{const ne=A(le),fe=I(le),oe=F(le),de=M(le);return e.jsxs(Nr,{className:`hover:bg-muted/30 ${fe?"bg-primary/5":""}`,children:[e.jsx(dt,{children:e.jsx(Yo,{checked:N.has(le.id),onCheckedChange:()=>$(le.id)})}),e.jsx(dt,{className:"font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[le.name,fe&&e.jsx(ou,{className:"h-3.5 w-3.5 text-primary"})]})}),e.jsx(dt,{className:"text-muted-foreground",children:le.email}),e.jsx(dt,{children:ne==="stripe"?e.jsxs(bt,{variant:"outline",className:"gap-1",children:[e.jsx(gp,{className:"h-3 w-3"}),"Credit Card"]}):e.jsxs(bt,{variant:"secondary",className:"gap-1",children:[e.jsx(mn,{className:"h-3 w-3"}),"Free (No CC)"]})}),e.jsx(dt,{children:fe?e.jsxs(bt,{className:"bg-primary/10 text-primary hover:bg-primary/20 gap-1",children:[e.jsx(ou,{className:"h-3 w-3"}),"Converted"]}):oe?e.jsx(bt,{variant:"destructive",children:"Expired"}):e.jsx(bt,{className:"bg-green-500/10 text-green-600 hover:bg-green-500/20",children:"Active Trial"})}),e.jsx(dt,{className:"text-sm",children:le.created_at?new Date(le.created_at).toLocaleDateString():"—"}),e.jsx(dt,{className:"text-sm",children:fe&&de?e.jsxs("span",{className:"text-muted-foreground",children:["Renews ",new Date(de).toLocaleDateString()]}):de?new Date(de).toLocaleDateString():"—"}),e.jsx(dt,{children:le.already_exported?e.jsx(Li,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(bt,{variant:"outline",className:"text-green-600 border-green-300",children:"New"})})]},le.id)})})]})}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",O.length," of ",s.length," trial users · ",se," converted to paid"]})]})},rSt=()=>{const[t,r]=E.useState([]),[s,n]=E.useState(!0);return E.useEffect(()=>{(async()=>{const{data:o,error:l}=await Z.from("user_deletion_log").select("*").order("created_at",{ascending:!1});!l&&o&&r(o),n(!1)})()},[]),s?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Hr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):t.length===0?e.jsx(ze,{children:e.jsxs(qe,{className:"py-12 text-center text-muted-foreground",children:[e.jsx(Rs,{className:"h-10 w-10 mx-auto mb-3 opacity-40"}),e.jsx("p",{children:"No deletion records yet"})]})}):e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{className:"text-lg",children:"User Deletion History"})}),e.jsx(qe,{children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Date"}),e.jsx(Ct,{children:"User"}),e.jsx(Ct,{children:"Email"}),e.jsx(Ct,{children:"Brokerage"}),e.jsx(Ct,{children:"Type"}),e.jsx(Ct,{children:"Deleted By"})]})}),e.jsx(zn,{children:t.map(a=>e.jsxs(Nr,{children:[e.jsx(dt,{className:"whitespace-nowrap text-sm",children:Xr(new Date(a.created_at),"MMM d, yyyy h:mm a")}),e.jsx(dt,{className:"font-medium",children:a.deleted_user_name||"—"}),e.jsx(dt,{className:"text-sm text-muted-foreground",children:a.deleted_user_email||"—"}),e.jsx(dt,{children:a.brokerage_name||"—"}),e.jsx(dt,{children:e.jsx(bt,{variant:a.deletion_type==="deleted"?"destructive":"secondary",children:a.deletion_type==="deleted"?"Account Deleted":"Removed"})}),e.jsx(dt,{className:"text-sm",children:a.deleted_by_name||a.deleted_by_email||"—"})]},a.id))})]})})]})},Vk=t=>{const{user:r}=Gr(),s=qr(),n=Ht({queryKey:["teams",t],queryFn:async()=>{let y=Z.from("teams").select("*").order("created_at",{ascending:!1});t&&(y=y.eq("brokerage_id",t));const{data:v,error:b}=await y;if(b)throw b;return v||[]},enabled:!!r}),a=y=>Ht({queryKey:["team-members",y],queryFn:async()=>{const{data:v,error:b}=await Z.from("team_members").select("*").eq("team_id",y).order("role",{ascending:!0});if(b)throw b;const N=(v||[]).map(A=>A.user_id),{data:j}=await Z.from("profiles").select("id, name, email, avatar_url").in("id",N),S=new Map((j||[]).map(A=>[A.id,A]));return(v||[]).map(A=>({...A,profile:S.get(A.user_id)||null}))},enabled:!!y}),o=Jt({mutationFn:async y=>{const v={name:y.name,created_by:r.id,description:y.description,contact_visibility:y.contact_visibility,lead_pond_enabled:y.lead_pond_enabled,shared_assets_enabled:y.shared_assets_enabled};y.brokerage_id&&(v.brokerage_id=y.brokerage_id);const{data:b,error:N}=await Z.from("teams").insert(v).select().single();if(N)throw N;return b},onSuccess:()=>{s.invalidateQueries({queryKey:["teams"]}),Se.success("Team created!")},onError:y=>{Se.error("Failed to create team: "+y.message)}}),l=Jt({mutationFn:async({id:y,...v})=>{const{data:b,error:N}=await Z.from("teams").update(v).eq("id",y).select().single();if(N)throw N;return b},onSuccess:()=>{s.invalidateQueries({queryKey:["teams"]}),Se.success("Team updated")},onError:y=>{Se.error("Failed to update team: "+y.message)}}),i=Jt({mutationFn:async y=>{const{error:v}=await Z.from("teams").delete().eq("id",y);if(v)throw v},onSuccess:()=>{s.invalidateQueries({queryKey:["teams"]}),Se.success("Team deleted")},onError:y=>{Se.error("Failed to delete team: "+y.message)}}),d=Jt({mutationFn:async y=>{const{data:v,error:b}=await Z.from("team_members").insert({team_id:y.team_id,user_id:y.user_id,role:y.role||"team_member"}).select().single();if(b)throw b.message.includes("duplicate")||b.message.includes("unique")?new Error("This agent is already on a team. They must be removed from their current team first."):b;return v},onSuccess:(y,v)=>{s.invalidateQueries({queryKey:["team-members",v.team_id]}),Se.success("Member added to team")},onError:y=>{Se.error(y.message)}}),m=Jt({mutationFn:async y=>{const{error:v}=await Z.from("team_members").delete().eq("id",y.member_id);if(v)throw v},onSuccess:(y,v)=>{s.invalidateQueries({queryKey:["team-members",v.team_id]}),Se.success("Member removed from team")},onError:y=>{Se.error("Failed to remove member: "+y.message)}}),g=Jt({mutationFn:async y=>{const{error:v}=await Z.from("team_members").update({role:y.role}).eq("id",y.member_id);if(v)throw v},onSuccess:(y,v)=>{s.invalidateQueries({queryKey:["team-members",v.team_id]}),Se.success("Member role updated")},onError:y=>{Se.error("Failed to update role: "+y.message)}});return{teams:n.data||[],isLoading:n.isLoading,createTeam:o,updateTeam:l,deleteTeam:i,addMember:d,removeMember:m,updateMemberRole:g,useTeamMembers:a}},sSt=()=>{const{user:t}=Gr();return Ht({queryKey:["team-contacts",t==null?void 0:t.id],queryFn:async()=>{const{data:r,error:s}=await Z.rpc("get_team_contacts",{_user_id:t.id});if(s)throw s;return r||[]},enabled:!!t})},dBe=t=>{const{user:r}=Gr(),s=qr(),n=Ht({queryKey:["lead-pond",t],queryFn:async()=>{const{data:i,error:d}=await Z.from("team_lead_pond").select("*").eq("team_id",t).order("created_at",{ascending:!1});if(d)throw d;if(!i||i.length===0)return[];const m=i.map(A=>A.contact_id),g=[...new Set(i.map(A=>A.added_by))],y=i.filter(A=>A.claimed_by).map(A=>A.claimed_by),v=[...new Set([...g,...y])],[b,N]=await Promise.all([Z.from("innercircle_contacts").select("id, first_name, last_name, email, phone").in("id",m),Z.from("profiles").select("id, name, avatar_url").in("id",v)]),j=new Map((b.data||[]).map(A=>[A.id,A])),S=new Map((N.data||[]).map(A=>[A.id,A]));return i.map(A=>({...A,status:A.claimed_by?"claimed":"available",contact:j.get(A.contact_id)||null,contributor:S.get(A.added_by)||null,claimer:A.claimed_by&&S.get(A.claimed_by)||null}))},enabled:!!t&&!!r}),a=Jt({mutationFn:async i=>{const{data:d,error:m}=await Z.rpc("add_to_lead_pond",{_contact_id:i.contact_id,_team_id:i.team_id,_notes:i.notes||null});if(m)throw m;return d},onSuccess:()=>{s.invalidateQueries({queryKey:["lead-pond"]}),Se.success("Contact added to Lead Pond")},onError:i=>{Se.error(i.message)}}),o=Jt({mutationFn:async i=>{const{error:d}=await Z.rpc("claim_lead_pond_contact",{_lead_pond_id:i});if(d)throw d},onSuccess:()=>{s.invalidateQueries({queryKey:["lead-pond"]}),Se.success("Lead claimed!")},onError:i=>{Se.error(i.message)}}),l=Jt({mutationFn:async i=>{const{error:d}=await Z.rpc("return_lead_pond_contact",{_lead_pond_id:i});if(d)throw d},onSuccess:()=>{s.invalidateQueries({queryKey:["lead-pond"]}),Se.success("Lead returned to pond")},onError:i=>{Se.error(i.message)}});return{leadPondItems:n.data||[],isLoading:n.isLoading,addToLeadPond:a,claimLead:o,returnLead:l}},nSt=()=>{const t=qr();return Jt({mutationFn:async r=>{const{data:s,error:n}=await Z.rpc("transfer_contact",{_contact_id:r.contactId,_to_user_id:r.toUserId,_notes:r.notes||null});if(n)throw n;const a=s;if(!a.success)throw new Error(a.error);return a},onSuccess:()=>{t.invalidateQueries({queryKey:["innercircle-contacts"]}),t.invalidateQueries({queryKey:["team-contacts"]}),t.invalidateQueries({queryKey:["innercircle-contact-counts"]}),Se.success("Contact transferred successfully")},onError:r=>{Se.error(r.message||"Failed to transfer contact")}})};function uBe({open:t,onOpenChange:r,contactIds:s,contactNames:n=[],onComplete:a}){var O;const{user:o}=Gr(),{data:l}=Lv(),{useTeamMembers:i}=Vk(),{data:d=[]}=i((l==null?void 0:l.teamId)||""),m=nSt(),[g,y]=E.useState(null),[v,b]=E.useState(""),[N,j]=E.useState(!1),S=d.filter(B=>B.user_id!==(o==null?void 0:o.id)),A=async()=>{if(g){j(!0);try{for(const B of s)await m.mutateAsync({contactId:B,toUserId:g,notes:v||void 0});r(!1),y(null),b(""),a==null||a()}catch{}finally{j(!1)}}},M=S.find(B=>B.user_id===g),I=s.length>1,F=n.length>0?I?`${n.length} contacts`:n[0]:I?`${s.length} contacts`:"this contact";return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"sm:max-w-md",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{className:"flex items-center gap-2",children:[e.jsx(py,{className:"h-5 w-5"}),"Transfer ",F]}),e.jsxs(Gs,{children:["Select a team member to transfer ",I?"these contacts":"this contact"," to. The contact will be removed from the current owner's CRM and added to the selected member's."]})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium mb-2 block",children:"Transfer to:"}),e.jsx("div",{className:"space-y-1 max-h-[240px] overflow-y-auto",children:S.length===0?e.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No other team members available"}):S.map(B=>{var $,H,W;return e.jsxs("button",{onClick:()=>y(B.user_id),className:`w-full flex items-center gap-3 p-3 rounded-lg text-left transition-colors ${g===B.user_id?"bg-primary/10 border border-primary/30":"hover:bg-accent border border-transparent"}`,children:[e.jsxs(ln,{className:"h-8 w-8",children:[e.jsx(pa,{src:(($=B.profile)==null?void 0:$.avatar_url)||""}),e.jsx(cn,{className:"text-xs",children:(((H=B.profile)==null?void 0:H.name)||"?").charAt(0).toUpperCase()})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:((W=B.profile)==null?void 0:W.name)||"Unknown"}),e.jsx("p",{className:"text-xs text-muted-foreground capitalize",children:B.role.replace("_"," ")})]})]},B.user_id)})})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"transfer-notes",className:"text-sm font-medium",children:"Notes (optional)"}),e.jsx(Ks,{id:"transfer-notes",value:v,onChange:B=>b(B.target.value),placeholder:"Reason for transfer...",className:"mt-1",rows:2})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsxs(Q,{onClick:A,disabled:!g||N,children:[N?e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(py,{className:"h-4 w-4 mr-2"}),"Transfer",M?` to ${(O=M.profile)==null?void 0:O.name}`:""]})]})]})})}const Y0e=()=>{const t=Ws(),{data:r,isLoading:s}=sSt(),{data:n}=Lv(),[a,o]=E.useState(""),[l,i]=E.useState("all"),[d,m]=E.useState(null),[g,y]=E.useState(""),v=(n==null?void 0:n.role)==="team_leader",b=E.useMemo(()=>{if(!r)return[];const j=new Map;return r.forEach(S=>{j.has(S.owner_user_id)||j.set(S.owner_user_id,{id:S.owner_user_id,name:S.owner_name||"Unknown",avatar:S.owner_avatar_url})}),Array.from(j.values())},[r]),N=E.useMemo(()=>{if(!r)return[];let j=r;if(l!=="all"&&(j=j.filter(S=>S.owner_user_id===l)),a.trim()){const S=a.toLowerCase();j=j.filter(A=>{var M,I,F;return(A.first_name+" "+(A.last_name||"")).toLowerCase().includes(S)||((M=A.email)==null?void 0:M.toLowerCase().includes(S))||((I=A.phone)==null?void 0:I.includes(S))||((F=A.owner_name)==null?void 0:F.toLowerCase().includes(S))})}return j},[r,a,l]);return s?e.jsxs("div",{className:"space-y-4",children:[e.jsx(fr,{className:"h-10 w-full"}),e.jsx(fr,{className:"h-64 w-full"})]}):!r||r.length===0?e.jsx(ze,{children:e.jsxs(qe,{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(ws,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No Team Contacts"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Team contact sharing is not enabled, or you're not on a team. Ask your manager about contact visibility settings."})]})}):e.jsxs("div",{className:"space-y-4",children:[e.jsx(ze,{children:e.jsx(qe,{className:"p-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search by name, email, phone, or agent...",value:a,onChange:j=>o(j.target.value),className:"pl-9"})]}),e.jsxs(ds,{value:l,onValueChange:i,children:[e.jsx(ls,{className:"w-[200px]",children:e.jsx(us,{placeholder:"Filter by agent"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Team Members"}),b.map(j=>e.jsx(Ut,{value:j.id,children:j.name},j.id))]})]})]})})}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[N.length," contact",N.length!==1?"s":""," from ",b.length," teammate",b.length!==1?"s":""]}),e.jsx(ze,{children:e.jsx(qe,{className:"p-0 overflow-x-auto",children:e.jsxs(Rn,{className:"min-w-[800px]",children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Name"}),e.jsx(Ct,{children:"Agent"}),e.jsx(Ct,{children:"Contact Info"}),e.jsx(Ct,{children:"Address"}),e.jsx(Ct,{children:"Lead Source"}),e.jsx(Ct,{children:"Date Added"}),v&&e.jsx(Ct,{className:"w-[80px]",children:"Actions"})]})}),e.jsx(zn,{children:N.length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:v?7:6,className:"text-center py-8 text-muted-foreground",children:a||l!=="all"?"No contacts match your filters":"No team contacts available"})}):N.map(j=>e.jsxs(Nr,{className:`hover:bg-accent/50 ${v?"cursor-pointer":""}`,onClick:v?()=>t(`/mission-control/contacts/${j.id}`):void 0,children:[e.jsx(dt,{className:"font-medium",children:e.jsxs("span",{className:v?"hover:text-primary hover:underline transition-colors":"",children:[j.first_name," ",j.last_name||""]})}),e.jsx(dt,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(ln,{className:"h-6 w-6",children:[e.jsx(pa,{src:j.owner_avatar_url||""}),e.jsx(cn,{className:"text-[10px]",children:(j.owner_name||"?").charAt(0).toUpperCase()})]}),e.jsx("span",{className:"text-sm text-muted-foreground truncate max-w-[120px]",children:j.owner_name||"Unknown"})]})}),e.jsx(dt,{children:e.jsxs("div",{className:"space-y-1 text-sm",children:[j.email&&e.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[e.jsx(mn,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:j.email})]}),j.phone&&e.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[e.jsx(wi,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:j.phone})]}),!j.email&&!j.phone&&e.jsx("span",{className:"text-xs text-muted-foreground italic",children:"No contact info"})]})}),e.jsx(dt,{children:j.address?e.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[e.jsx(eo,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate max-w-[180px]",children:j.address})]}):e.jsx("span",{className:"text-xs text-muted-foreground italic",children:"—"})}),e.jsx(dt,{children:j.lead_source?e.jsx(bt,{variant:"outline",className:"text-xs border-primary/30 text-primary",children:j.lead_source}):e.jsx("span",{className:"text-xs text-muted-foreground italic",children:"—"})}),e.jsx(dt,{children:e.jsx("span",{className:"text-sm text-muted-foreground",children:Xr(new Date(j.created_at),"MMM d, yyyy")})}),v&&e.jsx(dt,{children:e.jsx(Q,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:S=>{S.stopPropagation(),m(j.id),y(`${j.first_name} ${j.last_name||""}`.trim())},title:"Transfer to team member",children:e.jsx(py,{className:"h-4 w-4"})})})]},j.id))})]})})}),e.jsx(uBe,{open:!!d,onOpenChange:j=>{j||m(null)},contactIds:d?[d]:[],contactNames:g?[g]:[],onComplete:()=>m(null)})]})},X0e=({teamId:t})=>{const{user:r}=Gr(),{leadPondItems:s,isLoading:n,claimLead:a,returnLead:o}=dBe(t);if(console.log("[LeadPondView] render — teamId:",t,"itemCount:",s.length,"loading:",n),n)return e.jsx("div",{className:"space-y-3",children:[1,2,3].map(d=>e.jsx(fr,{className:"h-20 w-full"},d))});if(s.length===0)return e.jsx(ze,{children:e.jsxs(qe,{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(Wg,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Lead Pond is Empty"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Team members can contribute contacts here for others to claim and follow up with."})]})});const l=s.filter(d=>d.status==="available"),i=s.filter(d=>d.status==="claimed");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-muted-foreground mb-3",children:["Available (",l.length,")"]}),l.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No leads available right now."}):e.jsx("div",{className:"space-y-2",children:l.map(d=>{var m,g,y,v,b,N,j;return e.jsx(ze,{children:e.jsxs(qe,{className:"flex items-center justify-between p-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"font-medium text-sm",children:[(m=d.contact)==null?void 0:m.first_name," ",((g=d.contact)==null?void 0:g.last_name)||""]}),e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 mt-1",children:[((y=d.contact)==null?void 0:y.email)&&e.jsxs("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(mn,{className:"h-3 w-3"})," ",d.contact.email]}),((v=d.contact)==null?void 0:v.phone)&&e.jsxs("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(wi,{className:"h-3 w-3"})," ",d.contact.phone]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsxs(ln,{className:"h-4 w-4",children:[e.jsx(pa,{src:((b=d.contributor)==null?void 0:b.avatar_url)||""}),e.jsx(cn,{className:"text-[8px]",children:(((N=d.contributor)==null?void 0:N.name)||"?").charAt(0)})]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["from ",((j=d.contributor)==null?void 0:j.name)||"Unknown"]})]})]}),e.jsxs(Q,{size:"sm",onClick:()=>a.mutate(d.id),disabled:a.isPending,children:[e.jsx(yA,{className:"mr-1 h-3 w-3"}),"Claim"]})]})},d.id)})})]}),i.length>0&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-muted-foreground mb-3",children:["Claimed (",i.length,")"]}),e.jsx("div",{className:"space-y-2",children:i.map(d=>{var m,g,y;return e.jsx(ze,{className:"opacity-75",children:e.jsxs(qe,{className:"flex items-center justify-between p-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"font-medium text-sm",children:[(m=d.contact)==null?void 0:m.first_name," ",((g=d.contact)==null?void 0:g.last_name)||""]}),e.jsx("div",{className:"flex items-center gap-2 mt-1",children:e.jsxs(bt,{variant:"secondary",className:"text-xs",children:["Claimed by ",((y=d.claimer)==null?void 0:y.name)||"Unknown"]})})]}),d.claimed_by===(r==null?void 0:r.id)&&e.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>o.mutate(d.id),disabled:o.isPending,children:[e.jsx(Xj,{className:"mr-1 h-3 w-3"}),"Return"]})]})},d.id)})})]})]})},hBe=({teamId:t})=>{const{useTeamMembers:r}=Vk(),{data:s=[]}=r(t),n=s.map(b=>b.user_id),a=new Map(s.map(b=>[b.user_id,b.profile])),{data:o=[],isLoading:l}=Ht({queryKey:["team-shared-presentations",t,n],queryFn:async()=>{if(n.length===0)return[];const{data:b,error:N}=await Z.from("smart_presentations").select("id, owner_user_id, title, client_name, status, view_count, cta_clicked_count, share_token, created_at, published_at").in("owner_user_id",n).neq("status","archived").order("created_at",{ascending:!1});if(N)throw N;return b||[]},enabled:n.length>0}),{data:i=[],isLoading:d}=Ht({queryKey:["team-shared-open-houses",t,n],queryFn:async()=>{if(n.length===0)return[];const{data:b,error:N}=await Z.from("open_houses").select("id, agent_id, property_address, city, state, event_date, is_active, visitor_count, slug, created_at").in("agent_id",n).order("event_date",{ascending:!1});if(N)throw N;return b||[]},enabled:n.length>0}),{data:m=[],isLoading:g}=Ht({queryKey:["team-shared-videos",t,n],queryFn:async()=>{if(n.length===0)return[];const{data:b,error:N}=await Z.from("agent_videos").select("id, owner_user_id, title, recipient_name, status, view_count, touch_type, share_token, created_at").in("owner_user_id",n).eq("is_deleted",!1).order("created_at",{ascending:!1}).limit(50);if(N)throw N;return b||[]},enabled:n.length>0});if(l||d||g)return e.jsx("div",{className:"space-y-3",children:[1,2,3].map(b=>e.jsx(fr,{className:"h-20 w-full"},b))});const v=b=>{const N=a.get(b);return{name:(N==null?void 0:N.name)||"Unknown",avatar:(N==null?void 0:N.avatar_url)||"",initials:((N==null?void 0:N.name)||"?").charAt(0).toUpperCase()}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-3 grid-cols-3",children:[e.jsx(ze,{children:e.jsxs(qe,{className:"flex items-center gap-3 p-4",children:[e.jsx($f,{className:"h-5 w-5 text-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:o.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Presentations"})]})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"flex items-center gap-3 p-4",children:[e.jsx(Wn,{className:"h-5 w-5 text-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:i.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Guest Books"})]})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"flex items-center gap-3 p-4",children:[e.jsx(ya,{className:"h-5 w-5 text-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:m.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Videos"})]})]})})]}),e.jsxs(ci,{defaultValue:"presentations",className:"space-y-4",children:[e.jsxs(ri,{children:[e.jsxs(Kr,{value:"presentations",children:["Presentations (",o.length,")"]}),e.jsxs(Kr,{value:"guest-books",children:["Guest Books (",i.length,")"]}),e.jsxs(Kr,{value:"videos",children:["Videos (",m.length,")"]})]}),e.jsx(ms,{value:"presentations",className:"space-y-2",children:o.length===0?e.jsx(zde,{icon:e.jsx($f,{className:"h-10 w-10"}),label:"No presentations yet"}):o.map(b=>{const N=v(b.owner_user_id);return e.jsx(ze,{children:e.jsxs(qe,{className:"flex items-center justify-between p-4",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsxs(ln,{className:"h-8 w-8 shrink-0",children:[e.jsx(pa,{src:N.avatar}),e.jsx(cn,{className:"text-xs",children:N.initials})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:b.title||"Untitled"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[N.name," · ",Xr(new Date(b.created_at),"MMM d, yyyy")]})]})]}),e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsx(bt,{variant:b.status==="published"?"default":"secondary",className:"text-xs capitalize",children:b.status}),e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Gi,{className:"h-3 w-3"}),b.view_count||0]})]})]})},b.id)})}),e.jsx(ms,{value:"guest-books",className:"space-y-2",children:i.length===0?e.jsx(zde,{icon:e.jsx(Wn,{className:"h-10 w-10"}),label:"No guest books yet"}):i.map(b=>{const N=v(b.agent_id);return e.jsx(ze,{children:e.jsxs(qe,{className:"flex items-center justify-between p-4",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsxs(ln,{className:"h-8 w-8 shrink-0",children:[e.jsx(pa,{src:N.avatar}),e.jsx(cn,{className:"text-xs",children:N.initials})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:b.property_address}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[N.name," · ",Xr(new Date(b.event_date),"MMM d, yyyy")]})]})]}),e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[b.is_active?e.jsx(bt,{className:"text-xs",children:"Active"}):e.jsx(bt,{variant:"secondary",className:"text-xs",children:"Inactive"}),e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(ws,{className:"h-3 w-3"}),b.visitor_count||0]})]})]})},b.id)})}),e.jsx(ms,{value:"videos",className:"space-y-2",children:m.length===0?e.jsx(zde,{icon:e.jsx(ya,{className:"h-10 w-10"}),label:"No videos yet"}):m.map(b=>{const N=v(b.owner_user_id);return e.jsx(ze,{children:e.jsxs(qe,{className:"flex items-center justify-between p-4",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsxs(ln,{className:"h-8 w-8 shrink-0",children:[e.jsx(pa,{src:N.avatar}),e.jsx(cn,{className:"text-xs",children:N.initials})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:b.title||b.recipient_name||"Untitled Video"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[N.name," · ",Xr(new Date(b.created_at),"MMM d, yyyy")]})]})]}),e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsx(bt,{variant:"secondary",className:"text-xs capitalize",children:b.touch_type}),e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Gi,{className:"h-3 w-3"}),b.view_count||0]})]})]})},b.id)})})]})]})},zde=({icon:t,label:r})=>e.jsx(ze,{children:e.jsxs(qe,{className:"flex flex-col items-center justify-center py-8 text-center text-muted-foreground",children:[t,e.jsx("p",{className:"mt-2 text-sm",children:r})]})}),mBe=({team:t,brokerageAgents:r,onBack:s,onUpdate:n,onAddMember:a,onRemoveMember:o,onUpdateRole:l,onDeleteTeam:i,isUpdating:d,isAddingMember:m})=>{const{useTeamMembers:g}=Vk(),{data:y=[],isLoading:v}=g(t.id),[b,N]=E.useState(!1),[j,S]=E.useState(""),[A,M]=E.useState("team_member"),{data:I}=Ht({queryKey:["agents-on-other-teams",t.id],queryFn:async()=>{const{data:$}=await Z.from("team_members").select("user_id, team_id, teams:team_id(name)").neq("team_id",t.id),H=new Map;return($||[]).forEach(W=>{var X;H.set(W.user_id,((X=W.teams)==null?void 0:X.name)||"another team")}),H}}),F=new Set(y.map($=>$.user_id)),O=r.filter($=>!F.has($.id)),B=async()=>{j&&(await a(j,A),S(""),M("team_member"),N(!1))};return e.jsxs("div",{className:"space-y-6",children:[e.jsx(Q,{variant:"ghost",onClick:s,className:"mb-2",children:"← Back to Teams"}),e.jsxs(ci,{defaultValue:"members",className:"space-y-4",children:[e.jsxs(ri,{children:[e.jsx(Kr,{value:"members",children:"Members"}),e.jsxs(Kr,{value:"contacts",children:[e.jsx(zj,{className:"mr-1 h-3.5 w-3.5"}),"Team Contacts"]}),t.lead_pond_enabled&&e.jsxs(Kr,{value:"lead-pond",children:[e.jsx(Wg,{className:"mr-1 h-3.5 w-3.5"}),"Lead Pond"]}),t.shared_assets_enabled&&e.jsxs(Kr,{value:"shared-assets",children:[e.jsx(bm,{className:"mr-1 h-3.5 w-3.5"}),"Shared Assets"]}),e.jsx(Kr,{value:"settings",children:"Settings"})]}),e.jsxs(ms,{value:"members",className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h3",{className:"text-lg font-semibold",children:[t.name," — Members"]}),e.jsxs(Dr,{open:b,onOpenChange:N,children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{size:"sm",children:[e.jsx($d,{className:"mr-2 h-4 w-4"}),"Add Member"]})}),e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Add Team Member"}),e.jsxs(Gs,{children:["Select an agent from your brokerage to add to ",t.name,"."]})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Agent"}),e.jsxs(ds,{value:j,onValueChange:S,children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Select an agent"})}),e.jsxs(cs,{children:[O.length===0&&e.jsx(Ut,{value:"none",disabled:!0,children:"No available agents"}),O.map($=>{const H=I==null?void 0:I.get($.id);return e.jsx(Ut,{value:$.id,disabled:!!H,children:e.jsxs("span",{className:"flex items-center gap-2",children:[$.name||$.email,H&&e.jsxs("span",{className:"text-xs text-muted-foreground ml-1",children:["(on ",H,")"]})]})},$.id)})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Role"}),e.jsxs(ds,{value:A,onValueChange:M,children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"team_leader",children:"Team Leader"}),e.jsx(Ut,{value:"team_member",children:"Team Member"})]})]})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>N(!1),children:"Cancel"}),e.jsx(Q,{onClick:B,disabled:!j||m,children:m?"Adding...":"Add to Team"})]})]})]})]}),v?e.jsx("div",{className:"space-y-3",children:[1,2,3].map($=>e.jsx(fr,{className:"h-16 w-full"},$))}):y.length===0?e.jsx(ze,{children:e.jsxs(qe,{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(ws,{className:"h-10 w-10 text-muted-foreground mb-3"}),e.jsx("p",{className:"text-muted-foreground",children:"No members yet. Add agents to this team."})]})}):e.jsx("div",{className:"space-y-2",children:y.map($=>{var H,W,X,se,ae;return e.jsx(ze,{children:e.jsxs(qe,{className:"flex items-center justify-between p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(ln,{className:"h-10 w-10",children:[e.jsx(pa,{src:((H=$.profile)==null?void 0:H.avatar_url)||""}),e.jsx(cn,{children:(((W=$.profile)==null?void 0:W.name)||"?").charAt(0).toUpperCase()})]}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:((X=$.profile)==null?void 0:X.name)||"Unknown"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:(se=$.profile)==null?void 0:se.email})]}),$.role==="team_leader"?e.jsxs(bt,{className:"bg-[hsl(var(--chart-4)/0.1)] text-[hsl(var(--chart-4))] border-[hsl(var(--chart-4))]",children:[e.jsx(ih,{className:"mr-1 h-3 w-3"})," Leader"]}):e.jsx(bt,{variant:"secondary",children:"Member"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(ds,{value:$.role,onValueChange:le=>l($.id,le),children:[e.jsx(ls,{className:"w-[140px]",children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"team_leader",children:"Team Leader"}),e.jsx(Ut,{value:"team_member",children:"Team Member"})]})]}),e.jsxs(Xc,{children:[e.jsx(xm,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive",children:e.jsx(WA,{className:"h-4 w-4"})})}),e.jsxs(Tc,{children:[e.jsxs(Ac,{children:[e.jsx(Ic,{children:"Remove Member?"}),e.jsxs(Pc,{children:["Remove ",((ae=$.profile)==null?void 0:ae.name)||"this member"," from ",t.name,"?"]})]}),e.jsxs(Ec,{children:[e.jsx(Lc,{children:"Cancel"}),e.jsx(dc,{onClick:()=>o($.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]})]})]})]})},$.id)})})]}),e.jsx(ms,{value:"contacts",className:"space-y-4",children:e.jsx(Y0e,{})}),t.lead_pond_enabled&&e.jsx(ms,{value:"lead-pond",className:"space-y-4",children:e.jsx(X0e,{teamId:t.id})}),t.shared_assets_enabled&&e.jsx(ms,{value:"shared-assets",className:"space-y-4",children:e.jsx(hBe,{teamId:t.id})}),e.jsxs(ms,{value:"settings",className:"space-y-4",children:[e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsx(Zt,{className:"text-lg",children:"Team Settings"}),e.jsx(Ss,{children:"Configure how this team operates."})]}),e.jsxs(qe,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Team Name"}),e.jsx(Qe,{defaultValue:t.name,onBlur:$=>{$.target.value!==t.name&&n({name:$.target.value})}})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Description"}),e.jsx(Ks,{defaultValue:t.description||"",onBlur:$=>{$.target.value!==(t.description||"")&&n({description:$.target.value||null})},rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Contact Visibility"}),e.jsxs(ds,{defaultValue:t.contact_visibility,onValueChange:$=>n({contact_visibility:$}),children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"private",children:"Private — Members keep their contacts private"}),e.jsx(Ut,{value:"leader_only",children:"Leader Only — Only team leaders can see member contacts"}),e.jsx(Ut,{value:"full_team",children:"Full Team — All team members can see shared contacts"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Controls whether team leaders and members can view each other's contacts."})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Ee,{children:"Lead Pond"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Enable a shared lead pool where leaders can drop leads for members to claim."})]}),e.jsx(xn,{checked:t.lead_pond_enabled,onCheckedChange:$=>n({lead_pond_enabled:$})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Ee,{children:"Shared Assets"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Allow team members to access shared presentations, guest books, and videos."})]}),e.jsx(xn,{checked:t.shared_assets_enabled,onCheckedChange:$=>n({shared_assets_enabled:$})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Ee,{children:"Shared Video Library"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Let team members browse and use each other's videos from the Video Library."})]}),e.jsx(xn,{checked:t.shared_videos_enabled??!1,onCheckedChange:$=>n({shared_videos_enabled:$})})]})]})]}),e.jsxs(Xc,{children:[e.jsx(xm,{asChild:!0,children:e.jsxs(Q,{variant:"destructive",size:"sm",children:[e.jsx(Rs,{className:"mr-2 h-4 w-4"}),"Delete Team"]})}),e.jsxs(Tc,{children:[e.jsxs(Ac,{children:[e.jsx(Ic,{children:"Delete Team?"}),e.jsxs(Pc,{children:['This will permanently delete "',t.name,'" and remove all team members. This cannot be undone.']})]}),e.jsxs(Ec,{children:[e.jsx(Lc,{children:"Cancel"}),e.jsx(dc,{onClick:()=>{i(),s()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Team"})]})]})]})]})]})]})},pBe=({open:t,onOpenChange:r,onCreateTeam:s,isCreating:n,brokerageAgents:a,isAdmin:o,allBrokerages:l,activeBrokerageId:i})=>{const[d,m]=E.useState(1),[g,y]=E.useState(""),[v,b]=E.useState(""),[N,j]=E.useState(""),[S,A]=E.useState(""),[M,I]=E.useState([]),F=()=>{m(1),y(""),b(""),j(""),A(""),I([])},O=W=>{W||F(),r(W)},B=async()=>{const W=N&&N!=="none"?N:i||null;await s({name:g.trim(),description:v.trim()||void 0,brokerage_id:W,leaderId:S||void 0,memberIds:M.length>0?M:void 0}),F()},$=W=>{W!==S&&I(X=>X.includes(W)?X.filter(se=>se!==W):[...X,W])},H=a.filter(W=>W.id!==S);return e.jsx(Dr,{open:t,onOpenChange:O,children:e.jsxs(Lr,{className:"sm:max-w-lg max-h-[90vh] flex flex-col",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:d===1?"Create New Team":"Assign Team Members"}),e.jsx(Gs,{children:d===1?"Name your team and add a description.":"Pick a leader and optionally add initial members."}),e.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[e.jsx("div",{className:qt("h-1.5 flex-1 rounded-full transition-colors","bg-primary")}),e.jsx("div",{className:qt("h-1.5 flex-1 rounded-full transition-colors",d===2?"bg-primary":"bg-muted")})]})]}),e.jsx("div",{className:"overflow-y-auto flex-1 pr-1",children:d===1?e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"team-name",children:"Team Name *"}),e.jsx(Qe,{id:"team-name",value:g,onChange:W=>y(W.target.value),placeholder:"e.g., Downtown Squad",autoFocus:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"team-desc",children:"Description"}),e.jsx(Ks,{id:"team-desc",value:v,onChange:W=>b(W.target.value),placeholder:"What is this team focused on?",rows:3})]}),o&&l&&l.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Brokerage"}),e.jsxs(ds,{value:N,onValueChange:j,children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"No brokerage (independent team)"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"none",children:"No brokerage (independent)"}),l.map(W=>e.jsx(Ut,{value:W.id,children:W.name},W.id))]})]})]})]}):e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ee,{className:"flex items-center gap-1.5",children:[e.jsx(ih,{className:"h-3.5 w-3.5 text-[hsl(var(--chart-4))]"}),"Team Leader"]}),e.jsxs(ds,{value:S,onValueChange:W=>{A(W),I(X=>X.filter(se=>se!==W))},children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Select a team leader (optional)"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"none",children:"No leader for now"}),a.map(W=>e.jsx(Ut,{value:W.id,children:W.name||W.email||"Unknown"},W.id))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ee,{className:"flex items-center gap-1.5",children:[e.jsx($d,{className:"h-3.5 w-3.5"}),"Initial Members",M.length>0&&e.jsxs(bt,{variant:"secondary",className:"ml-1 text-xs",children:[M.length," selected"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Click agents to add them. You can always add more later."}),e.jsx("div",{className:"border rounded-lg max-h-[240px] overflow-y-auto divide-y",children:H.length===0?e.jsxs("div",{className:"p-4 text-center text-sm text-muted-foreground",children:[e.jsx(ws,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),"No agents available"]}):H.map(W=>{const X=M.includes(W.id);return e.jsxs("button",{type:"button",className:qt("w-full flex items-center gap-3 p-3 text-left transition-colors hover:bg-accent/50",X&&"bg-primary/5"),onClick:()=>$(W.id),children:[e.jsxs(ln,{className:"h-8 w-8",children:[e.jsx(pa,{src:W.avatar_url||""}),e.jsx(cn,{className:"text-xs",children:(W.name||"?").charAt(0).toUpperCase()})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:W.name||"Unknown"}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:W.email})]}),e.jsx("div",{className:qt("h-5 w-5 rounded-full border-2 flex items-center justify-center transition-colors shrink-0",X?"bg-primary border-primary text-primary-foreground":"border-muted-foreground/30"),children:X&&e.jsx(li,{className:"h-3 w-3"})})]},W.id)})})]})]})}),e.jsx(Dn,{className:"gap-2 sm:gap-0",children:d===1?e.jsxs(e.Fragment,{children:[e.jsx(Q,{variant:"outline",onClick:()=>O(!1),children:"Cancel"}),e.jsxs(Q,{onClick:()=>m(2),disabled:!g.trim(),children:["Next",e.jsx(Hi,{className:"ml-2 h-4 w-4"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Q,{variant:"outline",onClick:()=>m(1),children:[e.jsx(_i,{className:"mr-2 h-4 w-4"}),"Back"]}),e.jsx(Q,{onClick:B,disabled:n,children:n?"Creating…":"Create Team"})]})})]})})},aSt=()=>{const{teams:t,isLoading:r,createTeam:s,updateTeam:n,deleteTeam:a,addMember:o,removeMember:l,updateMemberRole:i}=Vk(),[d,m]=E.useState(!1),[g,y]=E.useState(null),[v,b]=E.useState(""),{data:N}=Ht({queryKey:["all-brokerages-for-teams"],queryFn:async()=>{const{data:O,error:B}=await Z.from("brokerages").select("id, name").order("name");if(B)throw B;return O||[]}}),{data:j}=Ht({queryKey:["admin-team-member-info",t.map(O=>O.id).join(",")],queryFn:async()=>{var W;if(t.length===0)return{};const{data:O}=await Z.from("team_members").select("team_id, user_id, role").in("team_id",t.map(X=>X.id));if(!O)return{};const B=O.filter(X=>X.role==="team_leader").map(X=>X.user_id);let $={};if(B.length>0){const{data:X}=await Z.from("profiles").select("id, name").in("id",B);X&&($=Object.fromEntries(X.map(se=>[se.id,{name:se.name}])))}const H={};for(const X of t){const se=O.filter(le=>le.team_id===X.id),ae=se.find(le=>le.role==="team_leader");H[X.id]={count:se.length,leaderName:ae&&((W=$[ae.user_id])==null?void 0:W.name)||null}}return H},enabled:t.length>0}),S=(g==null?void 0:g.brokerage_id)||null,{data:A}=Ht({queryKey:["brokerage-agents-for-teams",S],queryFn:async()=>{let O=Z.from("profiles").select("id, name, email, avatar_url").order("name");S&&(O=O.eq("brokerage_id",S));const{data:B,error:$}=await O;if($)throw $;return B||[]},enabled:!!g}),M=Object.fromEntries((N||[]).map(O=>[O.id,O.name])),I=async O=>{const B=await s.mutateAsync({name:O.name,brokerage_id:O.brokerage_id||null,description:O.description});if(O.leaderId&&O.leaderId!=="none"&&await o.mutateAsync({team_id:B.id,user_id:O.leaderId,role:"team_leader"}),O.memberIds)for(const $ of O.memberIds)await o.mutateAsync({team_id:B.id,user_id:$,role:"team_member"});m(!1)};if(g)return e.jsx(mBe,{team:g,brokerageAgents:A||[],onBack:()=>y(null),onUpdate:O=>n.mutateAsync({id:g.id,...O}).then(B=>y(B)),onAddMember:(O,B)=>o.mutateAsync({team_id:g.id,user_id:O,role:B}),onRemoveMember:O=>l.mutateAsync({team_id:g.id,member_id:O}),onUpdateRole:(O,B)=>i.mutateAsync({team_id:g.id,member_id:O,role:B}),onDeleteTeam:()=>{a.mutate(g.id),y(null)},isUpdating:n.isPending,isAddingMember:o.isPending});const F=t.filter(O=>O.name.toLowerCase().includes(v.toLowerCase())||(O.description||"").toLowerCase().includes(v.toLowerCase()));return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search teams...",value:v,onChange:O=>b(O.target.value),className:"pl-10"})]}),e.jsxs("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:[F.length," of ",t.length," teams"]})]}),e.jsxs(Q,{size:"sm",onClick:()=>m(!0),children:[e.jsx(gs,{className:"mr-2 h-4 w-4"}),"Create Team"]})]}),e.jsx(pBe,{open:d,onOpenChange:m,onCreateTeam:I,isCreating:s.isPending,brokerageAgents:[],isAdmin:!0,allBrokerages:N,activeBrokerageId:null}),e.jsx("div",{className:"border rounded-lg bg-card overflow-hidden",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{className:"bg-muted/30 hover:bg-muted/30",children:[e.jsx(Ct,{className:"font-semibold",children:"Team Name"}),e.jsx(Ct,{className:"font-semibold",children:"Brokerage"}),e.jsx(Ct,{className:"font-semibold",children:"Leader"}),e.jsx(Ct,{className:"font-semibold",children:"Members"}),e.jsx(Ct,{className:"font-semibold",children:"Visibility"}),e.jsx(Ct,{className:"w-[100px]"})]})}),e.jsx(zn,{children:r?e.jsx(e.Fragment,{children:[1,2,3].map(O=>e.jsxs(Nr,{children:[e.jsx(dt,{children:e.jsx(fr,{className:"h-4 w-32"})}),e.jsx(dt,{children:e.jsx(fr,{className:"h-4 w-24"})}),e.jsx(dt,{children:e.jsx(fr,{className:"h-4 w-28"})}),e.jsx(dt,{children:e.jsx(fr,{className:"h-4 w-12"})}),e.jsx(dt,{children:e.jsx(fr,{className:"h-4 w-20"})}),e.jsx(dt,{children:e.jsx(fr,{className:"h-4 w-16"})})]},O))}):F.length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:6,className:"text-center py-12 text-muted-foreground",children:v?"No teams match your search":"No teams found. Create one to get started."})}):F.map(O=>{const B=j==null?void 0:j[O.id];return e.jsxs(Nr,{className:"hover:bg-muted/30",children:[e.jsxs(dt,{children:[e.jsx("button",{onClick:()=>y(O),className:"text-primary hover:underline font-medium",children:O.name}),O.description&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:O.description})]}),e.jsx(dt,{children:O.brokerage_id?e.jsx("span",{className:"text-sm",children:M[O.brokerage_id]||"—"}):e.jsx("span",{className:"text-sm text-muted-foreground",children:"Independent"})}),e.jsx(dt,{children:B!=null&&B.leaderName?e.jsxs("span",{className:"text-sm flex items-center gap-1",children:[e.jsx(ih,{className:"h-3 w-3 text-[hsl(var(--chart-4))]"}),B.leaderName]}):e.jsx("span",{className:"text-sm text-muted-foreground",children:"No leader"})}),e.jsx(dt,{children:e.jsxs(bt,{variant:"secondary",className:"text-xs",children:[e.jsx(ws,{className:"h-3 w-3 mr-1"}),(B==null?void 0:B.count)??0]})}),e.jsx(dt,{children:e.jsxs("span",{className:"text-xs text-muted-foreground capitalize flex items-center gap-1",children:[e.jsx(Nu,{className:"h-3 w-3"}),O.contact_visibility.replace("_"," ")]})}),e.jsx(dt,{children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>y(O),title:"Edit team",children:e.jsx(ei,{className:"h-3.5 w-3.5"})}),e.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>{confirm(`Delete team "${O.name}"? This cannot be undone.`)&&a.mutate(O.id)},title:"Delete team",children:e.jsx(Rs,{className:"h-3.5 w-3.5"})})]})})]},O.id)})})]})})]})},iSt=()=>{const t=Ws(),{user:r,isAdmin:s}=Gr(),{startImpersonation:n,isLoading:a}=qxe(),{toast:o}=fi(),[l,i]=E.useState([]),[d,m]=E.useState([]),[g,y]=E.useState([]),[v,b]=E.useState({}),[N,j]=E.useState(!0),[S,A]=E.useState({}),[M,I]=E.useState(!1),[F,O]=E.useState({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),[B,$]=E.useState(!1),[H,W]=E.useState(""),[X,se]=E.useState(1),[ae,le]=E.useState(50),[ne,fe]=E.useState("all"),[oe,de]=E.useState("all"),[ue,xe]=E.useState("all"),[Te,be]=E.useState("all"),[we,ve]=E.useState(!1),[tt,Ae]=E.useState(!1),[Le,Ue]=E.useState(null),[Ye,Ie]=E.useState(null),[et,It]=E.useState(!1),[Pe,at]=E.useState({name:"",email:"",brokerage_id:"",phone:""}),[ce,$e]=E.useState(null),[Ge,rt]=E.useState(!1),[je,it]=E.useState(""),[Me,Je]=E.useState(!1),[Xe,Ve]=E.useState(!1),[ot,mt]=E.useState(null),[ft,ct]=E.useState(""),[Mt,Ot]=E.useState(!1),[rr,Ir]=E.useState(!1),[cr,Mr]=E.useState(null),[As,At]=E.useState(!1),[Rt,Cr]=E.useState(!1),[fs,Vs]=E.useState(null),[Js,hi]=E.useState(""),[Ia,dn]=E.useState(!1),[na,en]=E.useState({email:"",name:"",password:"",phone:""}),[Un,Gn]=E.useState(!1),[Ai,dr]=E.useState(!1),[Fa,mo]=E.useState(""),[Ti,Ys]=E.useState(!1),[ro,gc]=E.useState(!1),[jo,xc]=E.useState(""),[st,ye]=E.useState(new Set),[Oe,Ke]=E.useState(!1),[St,wt]=E.useState(!1),[Lt,Gt]=E.useState(null),[Ft,Yt]=E.useState(!1),[yr,hr]=E.useState(null),[ss,Is]=E.useState([]),[es,yn]=E.useState([]),[vn,un]=E.useState(!1),[ea,Zi]=E.useState({});E.useEffect(()=>{!r||!s||(Sa(),Io())},[r,s]);const Mo=async()=>{try{const{data:Nt,error:vr}=await Z.from("brokerage_manager_assignments").select("user_id, brokerage_id");if(vr)throw vr;const Vr={};for(const pn of Nt??[])Vr[pn.brokerage_id]||(Vr[pn.brokerage_id]=[]),Vr[pn.brokerage_id].push(pn.user_id);b(Vr)}catch(Nt){console.error("Error loading brokerage manager assignments:",Nt)}},Sa=async()=>{try{j(!0);const{data:Nt,error:vr}=await Z.functions.invoke("get-user-details");if(vr)throw vr;const Vr=Nt.users||[];i(Vr),y(Nt.brokerages||[]),await Mo();const pn=Vr.filter(fn=>fn.roles.includes("assistant"));if(pn.length>0){const fn=pn.map(Vn=>Vn.id),{data:ca}=await Z.from("agent_assistant_assignments").select("agent_id, assistant_id").in("assistant_id",fn);if(ca&&ca.length>0){const Vn=[...new Set(ca.map(uu=>uu.agent_id))],{data:Ca}=await Z.from("profiles").select("id, name, email").in("id",Vn),Zh={};for(const uu of ca){const Dl=Ca==null?void 0:Ca.find(Ma=>Ma.id===uu.agent_id);Dl&&(Zh[uu.assistant_id]={agent_name:Dl.name||"",agent_email:Dl.email||""})}Zi(Zh)}}}catch(Nt){console.error("Error loading members:",Nt),o({title:"Error",description:"Failed to load members",variant:"destructive"})}finally{j(!1)}},Io=async()=>{try{const{data:Nt,error:vr}=await Z.from("app_tiles").select("id, name, icon, app_id, required_tags").order("name");if(vr)throw vr;m(Nt||[])}catch(Nt){console.error("Error loading apps:",Nt),o({title:"Error",description:"Failed to load apps",variant:"destructive"})}},Fi=async Nt=>{if(!Pe.name.trim()||!Pe.email.trim()){o({title:"Error",description:"Name and email are required",variant:"destructive"});return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(Pe.email)){o({title:"Error",description:"Please enter a valid email address",variant:"destructive"});return}try{const{error:Vr}=await Z.from("profiles").update({name:Pe.name.trim(),email:Pe.email.trim(),brokerage_id:Pe.brokerage_id||null,phone:Pe.phone.trim()||null}).eq("id",Nt);if(Vr)throw Vr;o({title:"Success",description:"Member details updated successfully"}),Ue(null),Sa()}catch(Vr){console.error("Error updating member:",Vr),o({title:"Error",description:Vr.message||"Failed to update member",variant:"destructive"})}},la=async Nt=>{try{const{data:{session:vr}}=await Z.auth.getSession(),Vr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${vr==null?void 0:vr.access_token}`},body:JSON.stringify({userId:Nt})}),pn=await Vr.json();if(!Vr.ok)throw new Error(pn.error||"Failed to resend welcome email");o({title:"Success",description:"Welcome email sent successfully"})}catch(vr){console.error("Error resending welcome email:",vr),o({title:"Error",description:vr.message||"Failed to resend welcome email",variant:"destructive"})}},zi=async(Nt,vr)=>{try{const{error:Vr}=await Z.functions.invoke("send-password-reset",{body:{email:Nt,redirectTo:window.location.origin}});if(Vr)throw Vr;o({title:"Password Reset Sent",description:`Password reset email sent to ${vr}`})}catch(Vr){console.error("Error sending password reset:",Vr),o({title:"Error",description:Vr.message||"Failed to send password reset email",variant:"destructive"})}},Ya=async(Nt,vr)=>{if(confirm(`Are you sure you want to delete ${vr}? This action cannot be undone.`))try{const{data:{session:Vr}}=await Z.auth.getSession(),pn=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Vr==null?void 0:Vr.access_token}`},body:JSON.stringify({userId:Nt})}),fn=await pn.json();if(!pn.ok)throw new Error(fn.error||"Failed to delete user");o({title:"Success",description:"User deleted successfully"}),Sa()}catch(Vr){console.error("Error deleting user:",Vr),o({title:"Error",description:Vr.message||"Failed to delete user",variant:"destructive"})}},qn=async()=>{if(!F.email||!F.name||!F.password){o({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}if(F.role==="brokerage_manager"&&!F.brokerage_id){o({title:"Error",description:"Please select a brokerage for this manager",variant:"destructive"});return}I(!0);try{const{data:{session:Nt}}=await Z.auth.getSession(),vr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Nt==null?void 0:Nt.access_token}`},body:JSON.stringify(F)}),Vr=await vr.json();if(!vr.ok)throw new Error(Vr.error||"Failed to create user");if(F.role&&F.role!=="user"&&Vr.userId){const pn=F.role==="brokerage_manager"?F.brokerage_id:void 0;await Bi(Vr.userId,F.role,"add",pn)}o({title:"Success",description:`User ${F.email} created successfully`}),O({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),$(!1),Sa()}catch(Nt){console.error("Error creating user:",Nt),o({title:"Error",description:Nt.message||"Failed to create user",variant:"destructive"})}finally{I(!1)}},Bi=async(Nt,vr,Vr,pn)=>{try{const{data:{session:fn}}=await Z.auth.getSession(),ca={userId:Nt,role:vr,action:Vr};if(vr==="brokerage_manager"){if(!pn){o({title:"Error",description:"Please choose a brokerage for this manager assignment",variant:"destructive"});return}ca.brokerageId=pn}const Vn=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${fn==null?void 0:fn.access_token}`},body:JSON.stringify(ca)}),Ca=await Vn.json();if(!Vn.ok)throw new Error(Ca.error||"Failed to manage user role");o({title:"Success",description:`Role ${Vr==="add"?"added":"removed"} successfully`}),Sa()}catch(fn){console.error("Error managing user role:",fn),o({title:"Error",description:fn.message||"Failed to manage user role",variant:"destructive"})}},wl=(Nt,vr)=>vr.length===0?!0:vr.some(Vr=>Nt.includes(Vr)),Ol=async(Nt,vr,Vr)=>{const pn=`${Nt}-${vr.id}`;$e(pn);try{if(Vr){const fn=l.find(Vn=>Vn.id===Nt),ca=vr.required_tags.filter(Vn=>fn==null?void 0:fn.tags.includes(Vn));for(const Vn of ca){const{error:Ca}=await Z.from("user_tags").delete().eq("user_id",Nt).eq("tag",Vn);if(Ca)throw Ca}o({title:"Access Removed",description:`Removed access to ${vr.name}`})}else if(vr.required_tags.length>0){const{error:fn}=await Z.from("user_tags").insert({user_id:Nt,tag:vr.required_tags[0]});if(fn)throw fn;o({title:"Access Granted",description:`Granted access to ${vr.name}`})}await Sa()}catch(fn){console.error("Error toggling access:",fn),o({title:"Error",description:fn.message||"Failed to update access",variant:"destructive"})}finally{$e(null)}},ad=async()=>{const Nt=je.trim();if(!Nt){o({title:"Error",description:"Brokerage name is required",variant:"destructive"});return}if(Nt.length>100){o({title:"Error",description:"Brokerage name must be less than 100 characters",variant:"destructive"});return}if(g.find(Vr=>Vr.name.toLowerCase()===Nt.toLowerCase())){o({title:"Error",description:"A brokerage with this name already exists",variant:"destructive"});return}Je(!0);try{const{error:Vr}=await Z.from("brokerages").insert({name:Nt});if(Vr)throw Vr;o({title:"Success",description:`Brokerage "${Nt}" created successfully`}),it(""),rt(!1),Sa()}catch(Vr){console.error("Error creating brokerage:",Vr),o({title:"Error",description:Vr.message||"Failed to create brokerage",variant:"destructive"})}finally{Je(!1)}},Om=Nt=>{mt(Nt),ct(Nt.name),Ve(!0)},Qo=()=>{mt(null),ct(""),Ve(!1)},Wd=async()=>{if(!ot)return;const Nt=ft.trim();if(!Nt){o({title:"Error",description:"Brokerage name is required",variant:"destructive"});return}if(Nt.length>100){o({title:"Error",description:"Brokerage name must be less than 100 characters",variant:"destructive"});return}Ot(!0);try{const{error:vr}=await Z.from("brokerages").update({name:Nt}).eq("id",ot.id);if(vr)throw vr;o({title:"Success",description:"Brokerage updated successfully"}),Qo(),Sa()}catch(vr){console.error("Error updating brokerage:",vr),o({title:"Error",description:vr.message||"Failed to update brokerage",variant:"destructive"})}finally{Ot(!1)}},yc=async(Nt,vr)=>{var Vr;if(!vr||typeof vr!="string"){o({title:"Error",description:"Please select a brokerage first",variant:"destructive"});return}try{const pn={userId:Nt,role:"brokerage_manager",action:"add",brokerageId:vr};console.debug("[assignManagerToBrokerage] payload",pn);const{data:{session:fn}}=await Z.auth.getSession(),ca=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${fn==null?void 0:fn.access_token}`},body:JSON.stringify(pn)}),Vn=await ca.json();if(!ca.ok&&!((Vr=Vn.error)!=null&&Vr.includes("duplicate")))throw new Error(Vn.error||"Failed to add role");o({title:"Success",description:"Manager assigned to brokerage"}),await Sa()}catch(pn){console.error("Error assigning manager:",pn),o({title:"Error",description:pn.message||"Failed to assign manager",variant:"destructive"})}},fh=Nt=>{Mr(Nt),Ir(!0)},Jo=async()=>{if(cr){At(!0);try{const Nt=l.filter(pn=>pn.brokerage_id===cr.id),{data:{session:vr}}=await Z.auth.getSession();for(const pn of Nt){const fn=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${vr==null?void 0:vr.access_token}`},body:JSON.stringify({userId:pn.id})});if(!fn.ok){const ca=await fn.json();console.error(`Failed to delete user ${pn.email}:`,ca.error)}}const{error:Vr}=await Z.from("brokerages").delete().eq("id",cr.id);if(Vr)throw Vr;o({title:"Success",description:`Brokerage "${cr.name}" and ${Nt.length} member(s) deleted`}),Ir(!1),Mr(null),Sa()}catch(Nt){console.error("Error deleting brokerage:",Nt),o({title:"Error",description:Nt.message||"Failed to delete brokerage",variant:"destructive"})}finally{At(!1)}}},Op=Nt=>{Vs(Nt),hi(""),Cr(!0)},rg=()=>{Vs(null),hi(""),Cr(!1)},Jy=async Nt=>{try{const{error:vr}=await Z.from("profiles").update({brokerage_id:null}).eq("id",Nt);if(vr)throw vr;o({title:"Success",description:"User removed from brokerage"}),Sa()}catch(vr){console.error("Error removing user from brokerage:",vr),o({title:"Error",description:vr.message||"Failed to remove user",variant:"destructive"})}},e0=async(Nt,vr)=>{try{const{error:Vr}=await Z.from("profiles").update({brokerage_id:vr}).eq("id",Nt);if(Vr)throw Vr;o({title:"Success",description:"User added to brokerage"}),Sa()}catch(Vr){console.error("Error adding user to brokerage:",Vr),o({title:"Error",description:Vr.message||"Failed to add user",variant:"destructive"})}},t0=async()=>{if(!fs||!na.email||!na.name||!na.password){o({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}Gn(!0);try{const{data:{session:Nt}}=await Z.auth.getSession(),vr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Nt==null?void 0:Nt.access_token}`},body:JSON.stringify({...na,brokerage_id:fs.id,role:"user"})}),Vr=await vr.json();if(!vr.ok)throw new Error(Vr.error||"Failed to create agent");o({title:"Success",description:`Agent ${na.email} created successfully`}),en({email:"",name:"",password:"",phone:""}),dn(!1),Sa()}catch(Nt){console.error("Error creating agent:",Nt),o({title:"Error",description:Nt.message||"Failed to create agent",variant:"destructive"})}finally{Gn(!1)}},Gh=Nt=>l.filter(vr=>vr.brokerage_id===Nt),Ou=Nt=>{const vr=Gh(Nt);if(!Js)return vr;const Vr=Js.toLowerCase();return vr.filter(pn=>pn.name.toLowerCase().includes(Vr)||pn.email.toLowerCase().includes(Vr))},id=Nt=>l.filter(vr=>vr.brokerage_id!==Nt),du=l.filter(Nt=>{var vr;if(H){const Vr=H.toLowerCase();if(!(Nt.name.toLowerCase().includes(Vr)||Nt.email.toLowerCase().includes(Vr)||((vr=Nt.brokerage_name)==null?void 0:vr.toLowerCase().includes(Vr))))return!1}return!(ne==="claimed"&&!Nt.claimed||ne==="unclaimed"&&Nt.claimed||oe!=="all"&&!Nt.roles.includes(oe)||ue==="trial"&&!Nt.is_trial||ue==="non-trial"&&Nt.is_trial||Te==="none"&&Nt.brokerage_id||Te!=="all"&&Te!=="none"&&Nt.brokerage_id!==Te)}),vc=du.length,od=ae===0,Go=od?1:Math.ceil(vc/ae),Du=od?0:(X-1)*ae,Kh=od?vc:Du+ae,Gd=du.slice(Du,Kh),Dp=Nt=>{W(Nt),se(1)},r0=Nt=>{le(Nt),se(1)},xx=(Nt,vr)=>{Nt(vr),se(1)},Rp=async(Nt,vr)=>{ve(!0);try{const Vr=l.find(Vn=>Vn.id===Nt);if(!Vr)return;const pn=Vr.trial_expires_at?new Date(Vr.trial_expires_at):new Date,fn=new Date(pn.getTime()+vr*24*60*60*1e3),{error:ca}=await Z.from("profiles").update({trial_expires_at:fn.toISOString()}).eq("id",Nt);if(ca)throw ca;o({title:"Trial Extended",description:`Trial extended by ${vr} days`}),Sa()}catch(Vr){console.error("Error extending trial:",Vr),o({title:"Error",description:Vr.message||"Failed to extend trial",variant:"destructive"})}finally{ve(!1)}},kd=async Nt=>{Ae(!0);try{const{error:vr}=await Z.from("profiles").update({is_trial:!1,trial_expires_at:null,trial_started_at:null,trial_claimed_at:null}).eq("id",Nt);if(vr)throw vr;o({title:"Account Converted",description:"User has been converted to a full account"}),Sa(),Ru()}catch(vr){console.error("Error converting trial:",vr),o({title:"Error",description:vr.message||"Failed to convert account",variant:"destructive"})}finally{Ae(!1)}},s0=async Nt=>{un(!0);try{const{data:vr}=await Z.from("agent_assistant_assignments").select("id, assistant_id, permissions").eq("agent_id",Nt);if(vr&&vr.length>0){const pn=vr.map(ca=>ca.assistant_id),{data:fn}=await Z.from("profiles").select("id, name, email").in("id",pn);Is(vr.map(ca=>{const Vn=fn==null?void 0:fn.find(Ca=>Ca.id===ca.assistant_id);return{id:ca.id,assistant_id:ca.assistant_id,assistant_name:(Vn==null?void 0:Vn.name)||"Unknown",assistant_email:(Vn==null?void 0:Vn.email)||"",permissions:ca.permissions||{}}}))}else Is([]);const{data:Vr}=await Z.from("agent_assistant_assignments").select("id, agent_id, permissions").eq("assistant_id",Nt);if(Vr&&Vr.length>0){const pn=Vr.map(ca=>ca.agent_id),{data:fn}=await Z.from("profiles").select("id, name, email").in("id",pn);yn(Vr.map(ca=>{const Vn=fn==null?void 0:fn.find(Ca=>Ca.id===ca.agent_id);return{id:ca.id,agent_id:ca.agent_id,agent_name:(Vn==null?void 0:Vn.name)||"Unknown",agent_email:(Vn==null?void 0:Vn.email)||"",permissions:ca.permissions||{}}}))}else yn([])}catch(vr){console.error("Error loading assistant data:",vr)}finally{un(!1)}},Dm=Nt=>{Ie(Nt),at({name:Nt.name,email:Nt.email,brokerage_id:Nt.brokerage_id||"",phone:Nt.phone||""}),It(!0),s0(Nt.id)},Ru=()=>{Ie(null),It(!1),at({name:"",email:"",brokerage_id:"",phone:""})},p5=async()=>{Ye&&(await Fi(Ye.id),Ru())},Yk=Nt=>{ye(vr=>{const Vr=new Set(vr);return Vr.has(Nt)?Vr.delete(Nt):Vr.add(Nt),Vr})},yx=()=>{if(st.size===Gd.length&&Gd.every(Nt=>st.has(Nt.id))){const Nt=new Set(st);Gd.forEach(vr=>Nt.delete(vr.id)),ye(Nt)}else{const Nt=new Set(st);Gd.forEach(vr=>Nt.add(vr.id)),ye(Nt)}},aa=()=>{ye(new Set)},n0=async()=>{if(st.size===0)return;Ke(!0);let Nt=0,vr=0;try{const{data:{session:Vr}}=await Z.auth.getSession();for(const pn of st)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Vr==null?void 0:Vr.access_token}`},body:JSON.stringify({userId:pn})})).ok?Nt++:vr++}catch{vr++}o({title:"Bulk Email Complete",description:`Sent ${Nt} emails${vr>0?`, ${vr} failed`:""}`}),aa()}catch(Vr){o({title:"Error",description:Vr.message||"Failed to send emails",variant:"destructive"})}finally{Ke(!1)}},qv=async()=>{if(st.size===0)return;Ke(!0);let Nt=0,vr=0;try{const{data:{session:Vr}}=await Z.auth.getSession();for(const pn of st)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/send-password-reset",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Vr==null?void 0:Vr.access_token}`},body:JSON.stringify({userId:pn})})).ok?Nt++:vr++}catch{vr++}o({title:"Bulk Password Reset Complete",description:`Sent ${Nt} reset emails${vr>0?`, ${vr} failed`:""}`}),aa()}catch(Vr){o({title:"Error",description:Vr.message||"Failed to send password reset emails",variant:"destructive"})}finally{Ke(!1)}},Xk=async()=>{if(st.size===0)return;const Nt=l.filter(fn=>st.has(fn.id)).map(fn=>fn.name).slice(0,5).join(", "),vr=st.size>5?` and ${st.size-5} more`:"";if(!confirm(`Are you sure you want to delete ${st.size} users (${Nt}${vr})? This action cannot be undone.`))return;Ke(!0);let Vr=0,pn=0;try{const{data:{session:fn}}=await Z.auth.getSession();for(const ca of st)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${fn==null?void 0:fn.access_token}`},body:JSON.stringify({userId:ca})})).ok?Vr++:pn++}catch{pn++}o({title:"Bulk Delete Complete",description:`Deleted ${Vr} users${pn>0?`, ${pn} failed`:""}`}),aa(),Sa()}catch(fn){o({title:"Error",description:fn.message||"Failed to delete users",variant:"destructive"})}finally{Ke(!1)}},Qk=async()=>{wt(!0);try{const{data:{session:Nt}}=await Z.auth.getSession(),vr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/ghl-phone-sync",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Nt==null?void 0:Nt.access_token}`}});if(!vr.ok){const pn=await vr.json();throw new Error(pn.error||"Failed to sync phones")}const Vr=await vr.json();o({title:"Phone Sync Complete",description:`Pulled ${Vr.summary.pulledFromGHL} from GHL, pushed ${Vr.summary.pushedToGHL} to GHL, ${Vr.summary.alreadySynced} already synced`}),Sa()}catch(Nt){o({title:"Error",description:Nt.message||"Failed to sync phones with GHL",variant:"destructive"})}finally{wt(!1)}},Rm=async(Nt,vr)=>{Gt(Nt);try{const{data:{session:Vr}}=await Z.auth.getSession(),{data:pn}=await Z.from("profiles").select("phone").eq("id",Nt).single(),fn=(pn==null?void 0:pn.phone)||"",ca=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/ghl-tag-sync",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Vr==null?void 0:Vr.access_token}`},body:JSON.stringify({email:vr,action:"update",phone:fn||void 0})});if(!ca.ok){const Ca=await ca.json();throw new Error(Ca.error||"Failed to sync with GHL")}const Vn=await fetch(`https://services.leadconnectorhq.com/contacts/lookup?locationId=&email=${encodeURIComponent(vr)}`,{method:"GET",headers:{"Content-Type":"application/json"}});o({title:"Phone Synced",description:fn?`Phone ${fn} synced to GHL`:"Sync attempted - run bulk sync to pull phone from GHL"}),Sa()}catch(Vr){o({title:"Error",description:Vr.message||"Failed to sync phone",variant:"destructive"})}finally{Gt(null)}},sg=async Nt=>{await n(Nt)},vx=()=>{if(st.size===0){o({title:"No members selected",description:"Please select members to export",variant:"destructive"});return}const Nt=l.filter(Ca=>st.has(Ca.id)),vr=["Name","Email","Phone","Brokerage","Roles","Status","Created At"],Vr=Nt.map(Ca=>[Ca.name,Ca.email,Ca.phone||"",Ca.brokerage_name||"",Ca.roles.join("; "),Ca.claimed?"Claimed":"Unclaimed",new Date(Ca.created_at).toLocaleDateString()]),pn=[vr.join(","),...Vr.map(Ca=>Ca.map(Zh=>`"${(Zh||"").replace(/"/g,'""')}"`).join(","))].join(` `),fn=new Blob([pn],{type:"text/csv"}),ca=URL.createObjectURL(fn),Vn=document.createElement("a");Vn.href=ca,Vn.download=`members-export-${new Date().toISOString().split("T")[0]}.csv`,Vn.click(),URL.revokeObjectURL(ca),o({title:"Export complete",description:`Exported ${Nt.length} member(s)`})};return N?e.jsx(Fr,{title:"Members",children:e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):e.jsxs(Fr,{title:"Members",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsx(Lu,{title:"Member Management",description:"Manage users, roles, and permissions"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(Q,{size:"sm",variant:"outline",onClick:Qk,disabled:St,children:[St?e.jsx(Hr,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(wi,{className:"mr-2 h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:St?"Syncing...":"Sync Phones with GHL"}),e.jsx("span",{className:"sm:hidden",children:St?"Syncing...":"Sync GHL"})]}),e.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>dr(!0),children:[e.jsx(K1,{className:"mr-2 h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Import CSV"}),e.jsx("span",{className:"sm:hidden",children:"Import"})]}),e.jsxs(Dr,{open:B,onOpenChange:$,children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{size:"sm",children:[e.jsx($d,{className:"mr-2 h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Add Member"}),e.jsx("span",{className:"sm:hidden",children:"Add"})]})}),e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Create New User"}),e.jsx(Gs,{children:"Add a new user to the system. They'll be able to sign in immediately."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"name",children:"Name"}),e.jsx(Qe,{id:"name",placeholder:"John Doe",value:F.name,onChange:Nt=>O({...F,name:Nt.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"email",children:"Email"}),e.jsx(Qe,{id:"email",type:"email",placeholder:"john@example.com",value:F.email,onChange:Nt=>O({...F,email:Nt.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"password",children:"Password"}),e.jsx(Qe,{id:"password",type:"password",placeholder:"Min 6 characters",value:F.password,onChange:Nt=>O({...F,password:Nt.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"phone",children:"Phone (optional)"}),e.jsx(Qe,{id:"phone",type:"tel",placeholder:"555-123-4567",value:F.phone,onChange:Nt=>O({...F,phone:Nt.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ee,{htmlFor:"brokerage",children:["Brokerage",F.role==="brokerage_manager"?" (required)":""]}),e.jsxs(ds,{value:F.brokerage_id||"none",onValueChange:Nt=>O({...F,brokerage_id:Nt==="none"?"":Nt}),children:[e.jsx(ls,{id:"brokerage",children:e.jsx(us,{placeholder:F.role==="brokerage_manager"?"Select brokerage":"Select brokerage (optional)"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"none",children:"None"}),g.map(Nt=>e.jsx(Ut,{value:Nt.id,children:Nt.name},Nt.id))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"role",children:"Role"}),e.jsxs(ds,{value:F.role,onValueChange:Nt=>O({...F,role:Nt}),children:[e.jsx(ls,{id:"role",children:e.jsx(us,{placeholder:"Select role"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"user",children:"User"}),e.jsx(Ut,{value:"moderator",children:"Moderator"}),e.jsx(Ut,{value:"brokerage_manager",children:"Brokerage Manager"}),e.jsx(Ut,{value:"admin",children:"Admin"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"trial_days",children:"Trial Period (optional)"}),e.jsxs(ds,{value:F.trial_days||"none",onValueChange:Nt=>O({...F,trial_days:Nt==="none"?"":Nt}),children:[e.jsx(ls,{id:"trial_days",children:e.jsx(us,{placeholder:"No trial (full access)"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"none",children:"No trial (full access)"}),e.jsx(Ut,{value:"7",children:"7-day trial"}),e.jsx(Ut,{value:"30",children:"30-day trial"}),e.jsx(Ut,{value:"60",children:"60-day trial"}),e.jsx(Ut,{value:"90",children:"90-day trial"}),e.jsx(Ut,{value:"365",children:"1-year trial"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Trial accounts don't require a credit card. Access expires after the trial period."})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>$(!1),children:"Cancel"}),e.jsx(Q,{onClick:qn,disabled:M,children:M?"Creating...":"Create User"})]})]})]})]})]}),e.jsxs(ci,{defaultValue:new URLSearchParams(window.location.search).get("tab")||"members",className:"space-y-6",children:[e.jsxs(ri,{children:[e.jsx(Kr,{value:"members",children:"Members"}),e.jsx(Kr,{value:"brokerages",children:"Brokerages"}),e.jsx(Kr,{value:"teams",children:"Teams"}),e.jsx(Kr,{value:"trials",children:"Trial Users"}),e.jsx(Kr,{value:"access",children:"Access Matrix"}),e.jsx(Kr,{value:"celebrations",children:"Celebrations"}),e.jsx(Kr,{value:"deletions",children:"Deletion Log"})]}),e.jsxs(ms,{value:"members",className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{className:"relative flex-1 min-w-[200px] max-w-md",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search members...",value:H,onChange:Nt=>Dp(Nt.target.value),className:"pl-10 h-9"})]}),e.jsxs(ds,{value:ne,onValueChange:Nt=>xx(fe,Nt),children:[e.jsx(ls,{className:"w-[130px] h-9",children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Status"}),e.jsx(Ut,{value:"claimed",children:"Active"}),e.jsx(Ut,{value:"unclaimed",children:"Pending"})]})]}),e.jsxs(ds,{value:oe,onValueChange:Nt=>xx(de,Nt),children:[e.jsx(ls,{className:"w-[130px] h-9",children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Roles"}),e.jsx(Ut,{value:"admin",children:"Admin"}),e.jsx(Ut,{value:"brokerage_manager",children:"Manager"}),e.jsx(Ut,{value:"assistant",children:"Assistant"}),e.jsx(Ut,{value:"user",children:"User"})]})]}),e.jsxs(ds,{value:ue,onValueChange:Nt=>xx(xe,Nt),children:[e.jsx(ls,{className:"w-[130px] h-9",children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Users"}),e.jsx(Ut,{value:"trial",children:"Trial Only"}),e.jsx(Ut,{value:"non-trial",children:"Full Only"})]})]}),e.jsxs(ds,{value:Te,onValueChange:Nt=>xx(be,Nt),children:[e.jsx(ls,{className:"w-[150px] h-9",children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Brokerages"}),e.jsx(Ut,{value:"none",children:"No Brokerage"}),g.map(Nt=>e.jsx(Ut,{value:Nt.id,children:Nt.name},Nt.id))]})]}),(H||ne!=="all"||oe!=="all"||ue!=="all"||Te!=="all")&&e.jsxs(Q,{variant:"ghost",size:"sm",className:"h-9",onClick:()=>{W(""),fe("all"),de("all"),xe("all"),be("all"),se(1)},children:[e.jsx(rn,{className:"h-4 w-4 mr-1"}),"Clear"]}),e.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:od?`Showing all ${vc} members`:`Showing ${Du+1}-${Math.min(Kh,vc)} of ${vc} members`}),e.jsxs(ds,{value:ae.toString(),onValueChange:Nt=>r0(Number(Nt)),children:[e.jsx(ls,{className:"h-9 w-[110px]",children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"50",children:"50 / page"}),e.jsx(Ut,{value:"100",children:"100 / page"}),e.jsx(Ut,{value:"250",children:"250 / page"}),e.jsx(Ut,{value:"0",children:"All"})]})]})]})]}),st.size>0&&e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-primary/10 border border-primary/20 rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(e1,{className:"h-4 w-4 text-primary"}),e.jsxs("span",{className:"text-sm font-medium",children:[st.size," selected"]})]}),e.jsx("div",{className:"flex-1"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(Q,{size:"sm",variant:"outline",onClick:n0,disabled:Oe,children:[Oe?e.jsx(Hr,{className:"h-4 w-4 animate-spin mr-1"}):e.jsx(mn,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"Resend Invite"}),e.jsx("span",{className:"sm:hidden",children:"Invite"})]}),e.jsxs(Q,{size:"sm",variant:"outline",onClick:qv,disabled:Oe,children:[Oe?e.jsx(Hr,{className:"h-4 w-4 animate-spin mr-1"}):e.jsx(wm,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"Password Reset"}),e.jsx("span",{className:"sm:hidden",children:"Reset"})]}),e.jsxs(Q,{size:"sm",variant:"outline",onClick:vx,children:[e.jsx(Oi,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"Export"}),e.jsx("span",{className:"sm:hidden",children:"CSV"})]}),e.jsxs(Q,{size:"sm",variant:"destructive",onClick:Xk,disabled:Oe,children:[Oe?e.jsx(Hr,{className:"h-4 w-4 animate-spin mr-1"}):e.jsx(Rs,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"Delete"}),e.jsx("span",{className:"sm:hidden",children:"Del"})]}),e.jsx(Q,{size:"sm",variant:"ghost",onClick:aa,disabled:Oe,children:e.jsx(rn,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"border rounded-lg bg-card overflow-hidden",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{className:"bg-muted/30 hover:bg-muted/30",children:[e.jsx(Ct,{className:"w-[50px]",children:e.jsx(Yo,{checked:Gd.length>0&&Gd.every(Nt=>st.has(Nt.id)),onCheckedChange:yx,"aria-label":"Select all on page"})}),e.jsx(Ct,{className:"font-semibold",children:"Name"}),e.jsx(Ct,{className:"font-semibold",children:"Brokerage"}),e.jsx(Ct,{className:"font-semibold",children:"Status"}),e.jsx(Ct,{className:"font-semibold",children:"Role"}),e.jsx(Ct,{className:"font-semibold",children:"Last Login"}),e.jsx(Ct,{className:"w-[100px]"})]})}),e.jsx(zn,{children:Gd.length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:7,className:"text-center py-12 text-muted-foreground",children:"No members found"})}):Gd.map(Nt=>e.jsxs(Nr,{className:`hover:bg-muted/30 ${st.has(Nt.id)?"bg-primary/5":""}`,children:[e.jsx(dt,{children:e.jsx(Yo,{checked:st.has(Nt.id),onCheckedChange:()=>Yk(Nt.id),"aria-label":`Select ${Nt.name}`})}),e.jsx(dt,{children:e.jsxs("div",{children:[e.jsx("button",{onClick:()=>Dm(Nt),className:"text-primary hover:underline font-medium text-left",children:Nt.name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:Nt.email})]})}),e.jsx(dt,{className:"text-muted-foreground",children:Nt.brokerage_name||"—"}),e.jsx(dt,{children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(bt,{variant:Nt.claimed?"default":"secondary",className:Nt.claimed?"bg-primary text-primary-foreground w-fit":"w-fit",children:Nt.claimed?"Active":"Pending"}),Nt.is_trial&&Nt.trial_expires_at&&e.jsx(tCe,{expiresAt:Nt.trial_expires_at,className:"w-fit"})]})}),e.jsx(dt,{children:e.jsxs("div",{className:"flex items-center gap-1",children:[Nt.roles.length>0?e.jsx("span",{className:"text-sm capitalize",children:Nt.roles[0]}):e.jsx("span",{className:"text-muted-foreground",children:"—"}),Nt.roles.includes("assistant")&&e.jsxs(bt,{variant:"outline",className:"text-[10px] ml-1",children:["Asst",ea[Nt.id]?` → ${ea[Nt.id].agent_name||ea[Nt.id].agent_email}`:""]})]})}),e.jsx(dt,{className:"text-muted-foreground",children:Nt.last_sign_in_at?new Date(Nt.last_sign_in_at).toLocaleDateString():"—"}),e.jsx(dt,{children:e.jsxs("div",{className:"flex gap-1 justify-end",children:[e.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8 text-yellow-500 hover:text-yellow-600 hover:bg-yellow-50",onClick:()=>{hr(Nt),Yt(!0)},title:"Send celebration",children:e.jsx(td,{className:"h-4 w-4"})}),e.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Dm(Nt),title:"Edit member",children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Rm(Nt.id,Nt.email),disabled:Lt===Nt.id,title:"Sync phone with GHL",children:Lt===Nt.id?e.jsx(Hr,{className:"h-4 w-4 animate-spin"}):e.jsx(wi,{className:"h-4 w-4"})}),e.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>la(Nt.id),title:"Resend welcome email",children:e.jsx(mn,{className:"h-4 w-4"})}),e.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>zi(Nt.email,Nt.name),title:"Send password reset",children:e.jsx(qj,{className:"h-4 w-4"})}),e.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8 text-blue-600 hover:text-blue-700 hover:bg-blue-50",onClick:()=>sg(Nt.id),disabled:a||Nt.id===(r==null?void 0:r.id),title:Nt.id===(r==null?void 0:r.id)?"Cannot impersonate yourself":`Login as ${Nt.name}`,children:a?e.jsx(Hr,{className:"h-4 w-4 animate-spin"}):e.jsx(HS,{className:"h-4 w-4"})}),e.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>Ya(Nt.id,Nt.name),title:"Delete user",children:e.jsx(Rs,{className:"h-4 w-4"})})]})})]},Nt.id))})]})}),Go>1&&e.jsxs("div",{className:"flex items-center justify-between px-2 py-4",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["Page ",X," of ",Go]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Q,{variant:"outline",size:"sm",onClick:()=>se(1),disabled:X===1,children:"First"}),e.jsx(Q,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>se(Nt=>Math.max(1,Nt-1)),disabled:X===1,children:e.jsx(uc,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,Go)},(Nt,vr)=>{let Vr;return Go<=5||X<=3?Vr=vr+1:X>=Go-2?Vr=Go-4+vr:Vr=X-2+vr,e.jsx(Q,{variant:X===Vr?"default":"outline",size:"sm",className:"h-8 w-8 p-0",onClick:()=>se(Vr),children:Vr},Vr)})}),e.jsx(Q,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>se(Nt=>Math.min(Go,Nt+1)),disabled:X===Go,children:e.jsx(Wi,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"outline",size:"sm",onClick:()=>se(Go),disabled:X===Go,children:"Last"})]})]})]}),e.jsx(Dr,{open:et,onOpenChange:It,children:e.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Edit Member"}),e.jsx(Gs,{children:"Update member details, roles, and app access"})]}),Ye&&e.jsxs("div",{className:"space-y-6 py-4",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Basic Information"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"edit-name",children:"Name"}),e.jsx(Qe,{id:"edit-name",value:Pe.name,onChange:Nt=>at({...Pe,name:Nt.target.value}),maxLength:100})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"edit-email",children:"Email"}),e.jsx(Qe,{id:"edit-email",type:"email",value:Pe.email,onChange:Nt=>at({...Pe,email:Nt.target.value}),maxLength:255})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"edit-phone",children:"Phone"}),e.jsx(Qe,{id:"edit-phone",type:"tel",value:Pe.phone,onChange:Nt=>at({...Pe,phone:Nt.target.value}),placeholder:"555-123-4567"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"edit-brokerage",children:"Brokerage"}),e.jsxs(ds,{value:Pe.brokerage_id||"none",onValueChange:Nt=>at({...Pe,brokerage_id:Nt==="none"?"":Nt}),children:[e.jsx(ls,{id:"edit-brokerage",children:e.jsx(us,{placeholder:"Select brokerage"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"none",children:"None"}),g.map(Nt=>e.jsx(Ut,{value:Nt.id,children:Nt.name},Nt.id))]})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Roles"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[Ye.roles.map(Nt=>e.jsxs(bt,{variant:"default",className:"gap-1",children:[e.jsx(Nu,{className:"h-3 w-3"}),Nt,Nt==="brokerage_manager"?e.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(manage in Brokerages tab)"}):e.jsx("button",{onClick:()=>Bi(Ye.id,Nt,"remove"),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove role",children:e.jsx(rn,{className:"h-3 w-3"})})]},Nt)),Ye.roles.length===0&&e.jsx("span",{className:"text-sm text-muted-foreground",children:"No roles assigned"})]}),e.jsxs(ds,{onValueChange:Nt=>Bi(Ye.id,Nt,"add"),children:[e.jsx(ls,{className:"w-[200px]",children:e.jsx(us,{placeholder:"Add role..."})}),e.jsxs(cs,{children:[!Ye.roles.includes("admin")&&e.jsx(Ut,{value:"admin",children:"Admin"}),!Ye.roles.includes("user")&&e.jsx(Ut,{value:"user",children:"User"})]})]}),!Ye.roles.includes("brokerage_manager")&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"To add as brokerage manager, use Brokerages tab → Manage"})]}),(ss.length>0||es.length>0||Ye.roles.includes("assistant"))&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(ws,{className:"h-4 w-4"}),"Assistant Relationships"]}),vn?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Hr,{className:"h-4 w-4 animate-spin"}),"Loading..."]}):e.jsxs("div",{className:"space-y-3",children:[ss.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Has assistants:"}),ss.map(Nt=>e.jsxs("div",{className:"p-3 rounded-lg border bg-muted/30 space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium",children:Nt.assistant_name}),e.jsx(bt,{variant:"outline",className:"text-xs",children:"Assistant"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:Nt.assistant_email}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:Object.entries(Nt.permissions).filter(([,vr])=>vr).map(([vr])=>e.jsx(bt,{variant:"secondary",className:"text-[10px] capitalize",children:vr},vr))})]},Nt.id))]}),es.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Assists agents:"}),es.map(Nt=>e.jsxs("div",{className:"p-3 rounded-lg border bg-muted/30 space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium",children:Nt.agent_name}),e.jsx(bt,{variant:"outline",className:"text-xs",children:"Agent"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:Nt.agent_email}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:Object.entries(Nt.permissions).filter(([,vr])=>vr).map(([vr])=>e.jsx(bt,{variant:"secondary",className:"text-[10px] capitalize",children:vr},vr))})]},Nt.id))]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"App Access"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Toggle which apps this member can access"}),e.jsx("div",{className:"grid gap-3",children:d.map(Nt=>{const vr=wl(Ye.tags,Nt.required_tags),Vr=`${Ye.id}-${Nt.id}`,pn=ce===Vr,fn=Nt.required_tags.length===0;return e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xl",children:Nt.icon}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-sm",children:Nt.name}),fn&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"Available to all members"})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:pn?e.jsx(Hr,{className:"h-4 w-4 animate-spin text-muted-foreground"}):fn?e.jsx(bt,{variant:"secondary",className:"text-xs",children:"Always On"}):e.jsx(xn,{checked:vr,onCheckedChange:()=>Ol(Ye.id,Nt,vr)})})]},Nt.id)})})]}),Ye.is_trial&&e.jsxs("div",{className:"space-y-3 pt-4 border-t",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(Ea,{className:"h-4 w-4"}),"Trial Status"]}),e.jsxs("div",{className:"p-4 rounded-lg border bg-amber-50 dark:bg-amber-950/20 border-amber-200 dark:border-amber-800",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("div",{children:Ye.trial_expires_at&&e.jsx(tCe,{expiresAt:Ye.trial_expires_at})}),Ye.trial_expires_at&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:["Expires: ",new Date(Ye.trial_expires_at).toLocaleDateString()]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>Rp(Ye.id,7),disabled:we,children:[e.jsx(Dj,{className:"h-4 w-4 mr-1"}),"+7 Days"]}),e.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>Rp(Ye.id,14),disabled:we,children:[e.jsx(Dj,{className:"h-4 w-4 mr-1"}),"+14 Days"]}),e.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>Rp(Ye.id,30),disabled:we,children:[e.jsx(Dj,{className:"h-4 w-4 mr-1"}),"+30 Days"]}),e.jsxs(Q,{size:"sm",variant:"default",onClick:()=>kd(Ye.id),disabled:tt,className:"bg-green-600 hover:bg-green-700",children:[e.jsx(Jj,{className:"h-4 w-4 mr-1"}),"Convert to Full Account"]})]}),Ye.trial_started_at&&e.jsxs("div",{className:"mt-3 text-xs text-muted-foreground",children:["Trial started: ",new Date(Ye.trial_started_at).toLocaleDateString(),Ye.trial_claimed_at&&e.jsxs("span",{children:[" • Claimed: ",new Date(Ye.trial_claimed_at).toLocaleDateString()]})]})]})]}),e.jsxs("div",{className:"space-y-2 pt-4 border-t",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Account Information"}),e.jsxs("div",{className:"text-sm space-y-1 text-muted-foreground",children:[Ye.email_confirmed_at&&e.jsxs("div",{children:["Claimed: ",new Date(Ye.email_confirmed_at).toLocaleString()]}),Ye.last_sign_in_at&&e.jsxs("div",{children:["Last login: ",new Date(Ye.last_sign_in_at).toLocaleString()]}),e.jsxs("div",{children:["Created: ",new Date(Ye.created_at).toLocaleString()]})]})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:Ru,children:"Cancel"}),e.jsx(Q,{onClick:p5,children:"Save Changes"})]})]})}),e.jsxs(ms,{value:"access",children:[d.length===0?e.jsx(ze,{children:e.jsxs(qe,{className:"py-12 text-center",children:[e.jsx("p",{className:"text-muted-foreground mb-4",children:"No apps configured yet"}),e.jsx(Q,{onClick:()=>t("/admin/apps"),children:"Configure Apps"})]})}):e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsx(Zt,{children:"Member Access Matrix"}),e.jsx(Ss,{children:"Toggle switches to grant or revoke app access for each member"})]}),e.jsxs(qe,{children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"text-left p-4 font-semibold sticky left-0 bg-card z-10",children:"Member"}),d.map(Nt=>e.jsx("th",{className:"text-center p-4 font-semibold min-w-[120px]",children:e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("span",{className:"text-2xl",children:Nt.icon}),e.jsx("span",{className:"text-sm",children:Nt.name})]})},Nt.id))]})}),e.jsxs("tbody",{children:[Gd.map(Nt=>e.jsxs("tr",{className:"border-b hover:bg-muted/50",children:[e.jsx("td",{className:"p-4 sticky left-0 bg-card z-10",children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:Nt.name}),e.jsx("div",{className:"text-sm text-muted-foreground",children:Nt.email})]})}),d.map(vr=>{const Vr=wl(Nt.tags,vr.required_tags),pn=`${Nt.id}-${vr.id}`,fn=ce===pn;return e.jsx("td",{className:"p-4 text-center",children:e.jsx("div",{className:"flex items-center justify-center",children:fn?e.jsx(Hr,{className:"h-5 w-5 animate-spin text-muted-foreground"}):e.jsx(xn,{checked:Vr,onCheckedChange:()=>Ol(Nt.id,vr,Vr),disabled:vr.required_tags.length===0})})},vr.id)})]},Nt.id)),Gd.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:d.length+1,className:"p-8 text-center text-muted-foreground",children:"No members found"})})]})]})}),Go>1&&e.jsxs("div",{className:"flex items-center justify-between px-2 py-4 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["Showing ",Du+1,"-",Math.min(Kh,vc)," of ",vc," • Page ",X," of ",Go]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Q,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>se(Nt=>Math.max(1,Nt-1)),disabled:X===1,children:e.jsx(uc,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>se(Nt=>Math.min(Go,Nt+1)),disabled:X===Go,children:e.jsx(Wi,{className:"h-4 w-4"})})]})]})]})]}),e.jsx("div",{className:"mt-6",children:e.jsx(Q,{variant:"outline",onClick:()=>t("/admin/apps"),children:"Manage Apps"})})]}),e.jsxs(ms,{value:"brokerages",className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search brokerages...",value:Fa,onChange:Nt=>mo(Nt.target.value),className:"pl-10"})]}),e.jsxs("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:[g.filter(Nt=>Nt.name.toLowerCase().includes(Fa.toLowerCase())).length," of ",g.length," brokerages"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>{const Nt=[];for(const Vn of g){const Ca=v[Vn.id]??[];for(const Zh of Ca){const uu=l.find(Dl=>Dl.id===Zh);if(uu){const Dl=(uu.name||"").trim().split(/\s+/),Ma=Dl[0]||"",Jk=Dl.slice(1).join(" ")||"";Nt.push({firstName:Ma,lastName:Jk,email:uu.email,brokerageName:Vn.name})}}}if(Nt.length===0){o({title:"No managers found to export"});return}const Vr=[["First Name","Last Name","Email","Brokerage Name"].join(","),...Nt.map(Vn=>[Vn.firstName,Vn.lastName,Vn.email,Vn.brokerageName].map(Ca=>`"${(Ca||"").replace(/"/g,'""')}"`).join(","))].join(` `),pn=new Blob([Vr],{type:"text/csv"}),fn=URL.createObjectURL(pn),ca=document.createElement("a");ca.href=fn,ca.download=`brokerage-managers-${new Date().toISOString().slice(0,10)}.csv`,ca.click(),URL.revokeObjectURL(fn),o({title:`Exported ${Nt.length} managers`})},children:[e.jsx(Oi,{className:"mr-2 h-4 w-4"}),"Export Managers"]}),e.jsxs(Dr,{open:Ge,onOpenChange:rt,children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{size:"sm",children:[e.jsx(bi,{className:"mr-2 h-4 w-4"}),"Add Brokerage"]})}),e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Create New Brokerage"}),e.jsx(Gs,{children:"Add a new brokerage to the system."})]}),e.jsx("div",{className:"space-y-4 py-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"brokerage-name",children:"Brokerage Name"}),e.jsx(Qe,{id:"brokerage-name",placeholder:"Enter brokerage name",value:je,onChange:Nt=>it(Nt.target.value),maxLength:100})]})}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>rt(!1),children:"Cancel"}),e.jsx(Q,{onClick:ad,disabled:Me,children:Me?"Creating...":"Create Brokerage"})]})]})]})]})]}),e.jsx("div",{className:"border rounded-lg bg-card overflow-hidden",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{className:"bg-muted/30 hover:bg-muted/30",children:[e.jsx(Ct,{className:"font-semibold",children:"Brokerage Name"}),e.jsx(Ct,{className:"font-semibold",children:"Manager(s)"}),e.jsx(Ct,{className:"font-semibold",children:"Agents"}),e.jsx(Ct,{className:"w-[150px]"})]})}),e.jsx(zn,{children:(()=>{const Nt=g.filter(vr=>vr.name.toLowerCase().includes(Fa.toLowerCase()));return Nt.length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:4,className:"text-center py-12 text-muted-foreground",children:Fa?"No brokerages match your search":"No brokerages found"})}):Nt.map(vr=>{const Vr=l.filter(Vn=>Vn.brokerage_id===vr.id),fn=(v[vr.id]??[]).map(Vn=>l.find(Ca=>Ca.id===Vn)).filter(Boolean),ca=Vr.length;return e.jsxs(Nr,{className:"hover:bg-muted/30",children:[e.jsx(dt,{children:e.jsx("button",{onClick:()=>Om(vr),className:"text-primary hover:underline font-medium",children:vr.name})}),e.jsx(dt,{children:fn.length>0?e.jsx("div",{className:"flex flex-wrap gap-1",children:fn.map(Vn=>e.jsx(bt,{variant:"secondary",className:"text-xs",children:Vn.name},Vn.id))}):e.jsx("span",{className:"text-muted-foreground text-sm",children:"No manager"})}),e.jsxs(dt,{children:[ca," member",ca!==1?"s":""]}),e.jsx(dt,{children:e.jsxs("div",{className:"flex gap-1 justify-end",children:[e.jsxs(Q,{size:"sm",variant:"outline",className:"h-8",onClick:()=>Op(vr),children:[e.jsx(ws,{className:"h-4 w-4 mr-1"}),"Manage"]}),e.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Om(vr),title:"Edit brokerage",children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>fh(vr),title:"Delete brokerage",children:e.jsx(Rs,{className:"h-4 w-4"})})]})})]},vr.id)})})()})]})}),e.jsx(Dr,{open:Xe,onOpenChange:Ve,children:e.jsxs(Lr,{className:"max-w-lg",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Edit Brokerage"}),e.jsx(Gs,{children:"Update brokerage details and manage managers"})]}),ot&&e.jsxs("div",{className:"space-y-6 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"edit-brokerage-name",children:"Brokerage Name"}),e.jsx(Qe,{id:"edit-brokerage-name",value:ft,onChange:Nt=>ct(Nt.target.value),maxLength:100})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(Ee,{children:"Managers"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Click × to remove manager access for this brokerage (keeps them as a member)"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:(()=>{const vr=(v[ot.id]??[]).map(Vr=>l.find(pn=>pn.id===Vr)).filter(Boolean);return vr.length===0?e.jsx("span",{className:"text-sm text-muted-foreground",children:"No managers assigned"}):vr.map(Vr=>e.jsxs(bt,{variant:"default",className:"gap-1",children:[e.jsx(Nu,{className:"h-3 w-3"}),Vr.name,e.jsx("button",{onClick:()=>Bi(Vr.id,"brokerage_manager","remove",ot.id),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove manager from this brokerage",children:e.jsx(rn,{className:"h-3 w-3"})})]},Vr.id))})()}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{className:"text-sm text-muted-foreground",children:"Assign manager from existing members:"}),e.jsxs(rd,{open:Ti,onOpenChange:Ys,children:[e.jsx(sd,{asChild:!0,children:e.jsxs(Q,{variant:"outline",role:"combobox","aria-expanded":Ti,className:"w-full justify-between",children:["Search for a member...",e.jsx(Qn,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Fc,{className:"w-full p-0",align:"start",children:e.jsxs(Ry,{children:[e.jsx(Fy,{placeholder:"Search by name or email..."}),e.jsxs(zy,{className:"max-h-[200px]",children:[e.jsx(By,{children:"No members found."}),e.jsx($y,{children:(()=>{const Nt=new Set(v[ot.id]??[]);return l.filter(vr=>!Nt.has(vr.id)&&(s||vr.brokerage_id===ot.id)).map(vr=>e.jsxs(Uy,{value:`${vr.name} ${vr.email}`,onSelect:()=>{yc(vr.id,ot.id),Ys(!1)},children:[vr.name," (",vr.email,")"]},vr.id))})()})]})]})})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Members in this Brokerage"}),e.jsx("div",{className:"max-h-32 overflow-y-auto border rounded p-2",children:l.filter(Nt=>Nt.brokerage_id===ot.id).length===0?e.jsx("span",{className:"text-sm text-muted-foreground",children:"No members"}):l.filter(Nt=>Nt.brokerage_id===ot.id).map(Nt=>e.jsxs("div",{className:"text-sm py-1 flex items-center justify-between",children:[e.jsx("span",{children:Nt.name}),Nt.roles.includes("brokerage_manager")&&e.jsx(bt,{variant:"outline",className:"text-xs",children:"Manager"})]},Nt.id))})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:Qo,children:"Cancel"}),e.jsx(Q,{onClick:Wd,disabled:Mt,children:Mt?"Saving...":"Save Changes"})]})]})}),e.jsx(Dr,{open:rr,onOpenChange:Ir,children:e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{className:"text-destructive",children:"Delete Brokerage"}),e.jsxs(Gs,{children:['Are you sure you want to delete "',cr==null?void 0:cr.name,'"?']})]}),e.jsx("div",{className:"py-4",children:e.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-4 space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-destructive",children:"Warning: This action cannot be undone!"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"This will permanently delete:"}),e.jsxs("ul",{className:"text-sm text-muted-foreground list-disc list-inside",children:[e.jsxs("li",{children:['The brokerage "',cr==null?void 0:cr.name,'"']}),e.jsxs("li",{children:["All ",l.filter(Nt=>Nt.brokerage_id===(cr==null?void 0:cr.id)).length," member(s) assigned to this brokerage"]}),e.jsx("li",{children:"All their data, roles, and access"})]})]})}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>Ir(!1),children:"Cancel"}),e.jsx(Q,{variant:"destructive",onClick:Jo,disabled:As,children:As?"Deleting...":"Yes, Delete Brokerage"})]})]})}),e.jsx(Dr,{open:Rt,onOpenChange:Cr,children:e.jsxs(Lr,{className:"max-w-4xl max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{className:"flex items-center gap-2",children:[e.jsx(bi,{className:"h-5 w-5"}),"Manage ",fs==null?void 0:fs.name]}),e.jsx(Gs,{children:"Add, remove, or manage users in this brokerage"})]}),fs&&e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search members...",value:Js,onChange:Nt=>hi(Nt.target.value),className:"pl-10 h-9"})]}),e.jsxs(Dr,{open:Ia,onOpenChange:dn,children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{size:"sm",children:[e.jsx($d,{className:"h-4 w-4 mr-1"}),"Add New Agent"]})}),e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Add New Agent"}),e.jsxs(Gs,{children:["Create a new agent for ",fs.name]})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"agent-name",children:"Name"}),e.jsx(Qe,{id:"agent-name",placeholder:"John Doe",value:na.name,onChange:Nt=>en({...na,name:Nt.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"agent-email",children:"Email"}),e.jsx(Qe,{id:"agent-email",type:"email",placeholder:"john@example.com",value:na.email,onChange:Nt=>en({...na,email:Nt.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"agent-password",children:"Password"}),e.jsx(Qe,{id:"agent-password",type:"password",placeholder:"Min 6 characters",value:na.password,onChange:Nt=>en({...na,password:Nt.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"agent-phone",children:"Phone (optional)"}),e.jsx(Qe,{id:"agent-phone",type:"tel",placeholder:"555-123-4567",value:na.phone,onChange:Nt=>en({...na,phone:Nt.target.value})})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>dn(!1),children:"Cancel"}),e.jsx(Q,{onClick:t0,disabled:Un,children:Un?"Creating...":"Create Agent"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ee,{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Add existing user:"}),e.jsxs(rd,{open:ro,onOpenChange:gc,children:[e.jsx(sd,{asChild:!0,children:e.jsxs(Q,{variant:"outline",role:"combobox","aria-expanded":ro,className:"w-[300px] justify-between",children:["Select a user to add...",e.jsx(Qn,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Fc,{className:"w-[300px] p-0",align:"start",children:e.jsxs(Ry,{children:[e.jsx(Fy,{placeholder:"Search users...",value:jo,onValueChange:xc}),e.jsxs(zy,{children:[e.jsx(By,{children:"No users found."}),e.jsx($y,{children:id(fs.id).filter(Nt=>jo===""||Nt.name.toLowerCase().includes(jo.toLowerCase())||Nt.email.toLowerCase().includes(jo.toLowerCase())).map(Nt=>e.jsxs(Uy,{value:`${Nt.name} ${Nt.email}`,onSelect:()=>{e0(Nt.id,fs.id),gc(!1),xc("")},children:[Nt.name," (",Nt.email,")"]},Nt.id))})]})]})})]})]}),e.jsx("div",{className:"flex-1 overflow-auto border rounded-lg",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{className:"bg-muted/30 hover:bg-muted/30",children:[e.jsx(Ct,{className:"font-semibold",children:"Name"}),e.jsx(Ct,{className:"font-semibold",children:"Email"}),e.jsx(Ct,{className:"font-semibold",children:"Status"}),e.jsx(Ct,{className:"font-semibold",children:"Role"}),e.jsx(Ct,{className:"w-[120px]"})]})}),e.jsx(zn,{children:Ou(fs.id).length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:Js?"No matching members found":"No members in this brokerage"})}):Ou(fs.id).map(Nt=>e.jsxs(Nr,{className:"hover:bg-muted/30",children:[e.jsx(dt,{className:"font-medium",children:Nt.name}),e.jsx(dt,{className:"text-muted-foreground",children:Nt.email}),e.jsx(dt,{children:Nt.claimed?e.jsx(bt,{variant:"default",className:"bg-green-500/10 text-green-600 hover:bg-green-500/20",children:"Active"}):e.jsx(bt,{variant:"secondary",children:"Pending"})}),e.jsx(dt,{children:Nt.roles.includes("brokerage_manager")?e.jsxs(bt,{variant:"outline",className:"gap-1",children:[e.jsx(Nu,{className:"h-3 w-3"}),"Manager"]}):e.jsx("span",{className:"text-muted-foreground text-sm",children:"Agent"})}),e.jsx(dt,{children:e.jsxs("div",{className:"flex gap-1 justify-end",children:[!Nt.claimed&&e.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>la(Nt.id),title:"Resend welcome email",children:e.jsx(mn,{className:"h-4 w-4"})}),e.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Jy(Nt.id),title:"Remove from brokerage",children:e.jsx(rn,{className:"h-4 w-4"})}),e.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8 text-blue-600 hover:text-blue-700 hover:bg-blue-50",onClick:()=>sg(Nt.id),disabled:a||Nt.id===(r==null?void 0:r.id),title:Nt.id===(r==null?void 0:r.id)?"Cannot impersonate yourself":`Login as ${Nt.name}`,children:a?e.jsx(Hr,{className:"h-4 w-4 animate-spin"}):e.jsx(HS,{className:"h-4 w-4"})}),e.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>Ya(Nt.id,Nt.name),title:"Delete user",children:e.jsx(Rs,{className:"h-4 w-4"})})]})})]},Nt.id))})]})}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[Gh(fs.id).length," total member",Gh(fs.id).length!==1?"s":""," •",Gh(fs.id).filter(Nt=>Nt.roles.includes("brokerage_manager")).length," manager",Gh(fs.id).filter(Nt=>Nt.roles.includes("brokerage_manager")).length!==1?"s":""]})]}),e.jsx(Dn,{children:e.jsx(Q,{variant:"outline",onClick:rg,children:"Close"})})]})})]}),e.jsx(ms,{value:"teams",children:e.jsx(aSt,{})}),e.jsx(ms,{value:"trials",children:e.jsx(tSt,{})}),e.jsx(ms,{value:"celebrations",children:e.jsx(eSt,{})}),e.jsx(ms,{value:"deletions",children:e.jsx(rSt,{})})]})]}),e.jsx(lBe,{open:Ai,onOpenChange:dr,brokerages:g,onSuccess:Sa}),yr&&e.jsx(cBe,{open:Ft,onOpenChange:Nt=>{Yt(Nt),Nt||hr(null)},userId:yr.id,userName:yr.name})]})},oSt=()=>{const[t,r]=E.useState([]),[s,n]=E.useState(!0),[a,o]=E.useState(!1),[l,i]=E.useState(""),[d,m]=E.useState(""),[g,y]=E.useState(""),[v,b]=E.useState("");E.useEffect(()=>{N()},[]);const N=async()=>{const{data:O,error:B}=await Z.from("invite_codes").select("*").order("created_at",{ascending:!1});B?(Se.error("Failed to load invite codes"),console.error(B)):r(O||[]),n(!1)},j=async O=>{if(O.preventDefault(),!l.trim()){Se.error("Please enter a code");return}o(!0);const{error:B}=await Z.from("invite_codes").insert({code:l.trim().toUpperCase(),description:d.trim()||null,max_uses:g?parseInt(g):null,trial_days:v?parseInt(v):null});B?B.code==="23505"?Se.error("This code already exists"):(Se.error("Failed to create invite code"),console.error(B)):(Se.success("Invite code created"),i(""),m(""),y(""),b(""),N()),o(!1)},S=async(O,B)=>{const{error:$}=await Z.from("invite_codes").update({is_active:!B}).eq("id",O);$?Se.error("Failed to update code"):r(t.map(H=>H.id===O?{...H,is_active:!B}:H))},A=async O=>{const{error:B}=await Z.from("invite_codes").delete().eq("id",O);B?Se.error("Failed to delete code"):(Se.success("Code deleted"),r(t.filter($=>$.id!==O)))},M="https://dashboard.relevelup.com",I=O=>{const B=`${M}/join?code=${O}`;navigator.clipboard.writeText(B),Se.success("Link copied to clipboard")},F=`${M}/join`;return e.jsx(Fr,{title:"Invite Codes",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(Lu,{title:"Invite Codes",description:"Manage signup invite codes"}),e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsx(Zt,{children:"Create New Code"}),e.jsxs(Ss,{children:["Share link: ",e.jsx("code",{className:"bg-muted px-2 py-1 rounded text-sm",children:F})]})]}),e.jsx(qe,{children:e.jsxs("form",{onSubmit:j,className:"flex flex-wrap gap-4 items-end",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"code",children:"Code"}),e.jsx(Qe,{id:"code",placeholder:"WELCOME2024",value:l,onChange:O=>i(O.target.value),className:"w-40"})]}),e.jsxs("div",{className:"space-y-2 flex-1 min-w-[200px]",children:[e.jsx(Ee,{htmlFor:"description",children:"Description (optional)"}),e.jsx(Qe,{id:"description",placeholder:"For marketing campaign",value:d,onChange:O=>m(O.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"maxUses",children:"Max Uses"}),e.jsx(Qe,{id:"maxUses",type:"number",placeholder:"Unlimited",value:g,onChange:O=>y(O.target.value),className:"w-28"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"trialDays",children:"Trial Days"}),e.jsx(Qe,{id:"trialDays",type:"number",placeholder:"None",value:v,onChange:O=>b(O.target.value),className:"w-28"})]}),e.jsxs(Q,{type:"submit",disabled:a,children:[a?e.jsx(Hr,{className:"h-4 w-4 animate-spin"}):e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Create"]})]})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{children:"Active Codes"})}),e.jsx(qe,{children:s?e.jsx("div",{className:"flex justify-center py-8",children:e.jsx(Hr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):t.length===0?e.jsx("p",{className:"text-center py-8 text-muted-foreground",children:"No invite codes yet"}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Code"}),e.jsx(Ct,{children:"Description"}),e.jsx(Ct,{children:"Uses"}),e.jsx(Ct,{children:"Trial"}),e.jsx(Ct,{children:"Created"}),e.jsx(Ct,{children:"Active"}),e.jsx(Ct,{className:"w-24",children:"Actions"})]})}),e.jsx(zn,{children:t.map(O=>e.jsxs(Nr,{children:[e.jsx(dt,{className:"font-mono font-medium",children:O.code}),e.jsx(dt,{className:"text-muted-foreground",children:O.description||"—"}),e.jsxs(dt,{children:[O.uses_count,O.max_uses&&` / ${O.max_uses}`]}),e.jsx(dt,{children:O.trial_days?e.jsxs("span",{className:"text-amber-600 dark:text-amber-400 font-medium",children:[O.trial_days," days"]}):e.jsx("span",{className:"text-muted-foreground",children:"—"})}),e.jsx(dt,{className:"text-muted-foreground",children:Xr(new Date(O.created_at),"MMM d, yyyy")}),e.jsx(dt,{children:e.jsx(xn,{checked:O.is_active,onCheckedChange:()=>S(O.id,O.is_active)})}),e.jsx(dt,{children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>I(O.code),title:"Copy invite link",children:e.jsx(fo,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>A(O.id),className:"text-destructive hover:text-destructive",title:"Delete code",children:e.jsx(Rs,{className:"h-4 w-4"})})]})})]},O.id))})]})})]})]})})},LP=async t=>{try{const{data:r,error:s}=await Z.from("push_notification_settings").select("is_enabled").eq("setting_key",t).maybeSingle();return s?(console.error("Error checking notification setting:",s),!0):(r==null?void 0:r.is_enabled)??!0}catch(r){return console.error("Error checking notification setting:",r),!0}},Z3=async t=>{try{const{data:r,error:s}=await Z.functions.invoke("send-push-notification",{body:t});return s?(console.error("Error sending notification:",s),{success:!1,error:s}):(console.log("Notification sent:",r),{success:!0,data:r})}catch(r){return console.error("Error sending notification:",r),{success:!1,error:r}}},lSt=async(t,r)=>await LP("new_templates")?Z3({title:"New Template Available",body:`Check out the new template: ${t}`,url:`/templates/${r}`}):(console.log("New template notifications are disabled"),{success:!1,skipped:!0}),cSt=async(t,r)=>Z3({title:"New Academy Video",body:`New video added: ${t}`,url:`/academy/${r}`}),dSt=async(t,r)=>await LP("new_events")?Z3({title:"New Event",body:`New event: ${t}`,url:`/events/${r}`}):(console.log("New event notifications are disabled"),{success:!1,skipped:!0}),uSt=async(t,r)=>await LP("new_toolbox")?Z3({title:"New Resource Kit",body:`New resource kit available: ${t}`,url:`/toolbox/${r}`}):(console.log("New toolbox notifications are disabled"),{success:!1,skipped:!0}),kpe=async(t,r)=>await LP("new_social_swag")?Z3({title:"New Social Swag",body:`New social swag available: ${t}`,url:`/social-swag/${r}`}):(console.log("New social swag notifications are disabled"),{success:!1,skipped:!0}),hSt=async(t,r)=>await LP("new_newsletters")?Z3({title:"New Newsletter",body:`New newsletter available: ${t}`,url:`/newsletters/${r}`}):(console.log("New newsletter notifications are disabled"),{success:!1,skipped:!0}),B8={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 mSt(){const t=Ws(),r=qr(),[s,n]=E.useState(!1),[a,o]=E.useState(null),[l,i]=E.useState(B8),[d,m]=E.useState(null),[g,y]=E.useState(null),[v,b]=E.useState(!1),N=E.useRef(null),[j,S]=E.useState(!1),[A,M]=E.useState(null),[I,F]=E.useState(!1),[O,B]=E.useState(null),[$,H]=E.useState(null),[W,X]=E.useState(!0),[se,ae]=E.useState(""),{data:le,isLoading:ne}=Ht({queryKey:["admin-events"],queryFn:async()=>{const{data:je,error:it}=await Z.from("events").select("*").order("event_date",{ascending:!0});if(it)throw it;return je}}),{data:fe}=Ht({queryKey:["event-registrations-count"],queryFn:async()=>{const{data:je,error:it}=await Z.from("event_registrations").select("event_id");if(it)throw it;const Me={};return je.forEach(Je=>{Me[Je.event_id]=(Me[Je.event_id]||0)+1}),Me}}),{data:oe,isLoading:de}=Ht({queryKey:["event-registrations-details",A==null?void 0:A.id],queryFn:async()=>{if(!A)return[];const{data:je,error:it}=await Z.from("event_registrations").select("id, user_id, registered_at, zoom_join_url, zoom_name, zoom_email").eq("event_id",A.id).order("registered_at",{ascending:!1});if(it)throw it;if(!je||je.length===0)return[];const Me=je.map(Ve=>Ve.user_id).filter(Boolean);let Je=[];if(Me.length>0){const{data:Ve,error:ot}=await Z.from("profiles").select("id, name, email").in("id",Me);if(ot)throw ot;Je=Ve||[]}const Xe=new Map((Je==null?void 0:Je.map(Ve=>[Ve.id,Ve]))||[]);return je.map(Ve=>({...Ve,profiles:Ve.user_id&&Xe.get(Ve.user_id)||null}))},enabled:!!A}),{data:ue,isLoading:xe}=Ht({queryKey:["event-attendees-details",A==null?void 0:A.id],queryFn:async()=>{if(!A)return[];const{data:je,error:it}=await Z.from("event_attendees").select("id, user_id, zoom_email, zoom_name, join_time, leave_time, duration_minutes, manually_added, created_at").eq("event_id",A.id).order("created_at",{ascending:!1});if(it)throw it;if(!je||je.length===0)return[];const Me=je.map(mt=>mt.user_id).filter(Boolean);let Je=[];if(Me.length>0){const{data:mt,error:ft}=await Z.from("profiles").select("id, name, email").in("id",Me);if(ft)throw ft;Je=mt||[]}const{data:Xe}=await Z.from("agent_points").select("user_id").eq("event_id",A.id),Ve=new Set((Xe==null?void 0:Xe.map(mt=>mt.user_id))||[]),ot=new Map((Je==null?void 0:Je.map(mt=>[mt.id,mt]))||[]);return je.map(mt=>({...mt,profiles:mt.user_id&&ot.get(mt.user_id)||null,points_awarded:mt.user_id?Ve.has(mt.user_id):!1}))},enabled:!!A}),Te=je=>{M(je),S(!0)},be=Jt({mutationFn:async je=>{const{data:{session:it}}=await Z.auth.getSession();if(!it)throw new Error("Not authenticated");const Me=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/zoom-sync-registrations",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${it.access_token}`},body:JSON.stringify({event_id:je})}),Je=await Me.json();if(!Me.ok)throw new Error(Je.error||"Failed to sync");return Je},onSuccess:je=>{r.invalidateQueries({queryKey:["event-registrations-details",A==null?void 0:A.id]}),r.invalidateQueries({queryKey:["event-registrations-count"]}),Se.success(je.message)},onError:je=>{Se.error("Failed to sync: "+je.message)}}),we=Jt({mutationFn:async je=>{const{data:{session:it}}=await Z.auth.getSession();if(!it)throw new Error("Not authenticated");const Me=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/zoom-sync-attendees",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${it.access_token}`},body:JSON.stringify({event_id:je})}),Je=await Me.json();if(!Me.ok)throw new Error(Je.error||"Failed to sync attendees");return Je},onSuccess:je=>{r.invalidateQueries({queryKey:["event-attendees-details",A==null?void 0:A.id]}),r.invalidateQueries({queryKey:["event-leaderboard"]}),r.invalidateQueries({queryKey:["admin-agent-points"]}),je!=null&&je.message?Se.success(je.message):Se.success(`Synced ${je.synced||0} attendees. ${je.points_awarded||0} points awarded!`)},onError:je=>{Se.error("Failed to sync attendees: "+je.message)}}),ve=Jt({mutationFn:async({eventId:je,testMode:it})=>{const{data:{session:Me}}=await Z.auth.getSession();if(!Me)throw new Error("Not authenticated");const Je=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/send-event-reminder",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Me.access_token}`},body:JSON.stringify({event_id:je,test_mode:it})}),Xe=await Je.json();if(!Je.ok)throw new Error(Xe.error||"Failed to send reminders");return Xe},onSuccess:je=>{je.test?Se.success(je.message||"Test email sent!"):Se.success(je.message||`Reminder emails sent to ${je.sent} registrants!`)},onError:je=>{Se.error("Failed to send reminders: "+je.message)}}),{data:tt}=Ht({queryKey:["all-profiles-for-linking"],queryFn:async()=>{let je=[],it=0;const Me=1e3;for(;;){const{data:Je,error:Xe}=await Z.from("profiles").select("id, name, email").order("name",{ascending:!0}).range(it,it+Me-1);if(Xe)throw Xe;if(!Je||Je.length===0||(je=[...je,...Je],Je.length{const{error:Xe}=await Z.from("event_attendees").update({user_id:it}).eq("id",je);if(Xe)throw Xe;if(Je&&Me){const{error:ot}=await Z.from("zoom_email_aliases").upsert({user_id:it,zoom_email:Me.toLowerCase()},{onConflict:"zoom_email"});ot&&console.error("Failed to save alias:",ot)}const Ve=A==null?void 0:A.id;if(Ve){const{data:ot}=await Z.from("user_roles").select("id").eq("user_id",it).eq("role","admin").single();if(!ot){const{data:mt}=await Z.from("agent_points").select("id").eq("user_id",it).eq("event_id",Ve).single();mt||(await Z.rpc("award_attendance_points",{p_user_id:it,p_event_id:Ve,p_points:10,p_reason:"Event Attendance (Manual Link)"}),await Z.rpc("check_and_award_badges",{p_user_id:it}))}}return{userId:it,zoomEmail:Me,shouldSaveAlias:Je}},onSuccess:je=>{r.invalidateQueries({queryKey:["event-attendees-details",A==null?void 0:A.id]}),r.invalidateQueries({queryKey:["event-leaderboard"]}),r.invalidateQueries({queryKey:["admin-agent-points"]});let it="Attendee linked and points awarded!";je.shouldSaveAlias&&je.zoomEmail&&(it+=` Email "${je.zoomEmail}" will be auto-matched in the future.`),Se.success(it),F(!1),B(null),H(null),ae("")},onError:je=>{Se.error("Failed to link attendee: "+je.message)}}),Le=je=>{B(je),H(null),X(!0),ae(""),F(!0)},Ue=()=>{!O||!$||Ae.mutate({attendeeId:O.id,userId:$,zoomEmail:O.zoom_email,shouldSaveAlias:W})},Ye=(tt==null?void 0:tt.filter(je=>{var Me,Je;if(!se)return!0;const it=se.toLowerCase();return((Me=je.name)==null?void 0:Me.toLowerCase().includes(it))||((Je=je.email)==null?void 0:Je.toLowerCase().includes(it))}))||[],Ie=async je=>{const it=je.name.split(".").pop(),Je=`${`${crypto.randomUUID()}.${it}`}`,{error:Xe}=await Z.storage.from("event-images").upload(Je,je);if(Xe)throw Xe;const{data:{publicUrl:Ve}}=Z.storage.from("event-images").getPublicUrl(Je);return Ve},et=je=>{var Me;const it=(Me=je.target.files)==null?void 0:Me[0];if(it){if(it.size>5*1024*1024){Se.error("Image must be less than 5MB");return}m(it),y(URL.createObjectURL(it))}},It=()=>{m(null),y(null),i({...l,image_url:""}),N.current&&(N.current.value="")},Pe=Jt({mutationFn:async je=>{b(!0);let it=je.image_url;d&&(it=await Ie(d)||"");const Me=new Date(je.event_date),[Je,Xe]=je.event_time.split(":");Me.setHours(parseInt(Je),parseInt(Xe));const Ve=[new Date(Me)];if(je.is_recurring&&je.recurrence_end_date){let ct=new Date(Me);for(;je.recurrence_pattern==="weekly"?ct=hj(ct,1):je.recurrence_pattern==="biweekly"?ct=hj(ct,2):ct=$h(ct,1),!(ct>je.recurrence_end_date);)Ve.push(new Date(ct))}const ot=Ve.map(ct=>({title:je.title,description:je.description||null,image_url:it||null,video_url:je.video_url||null,event_date:ct.toISOString(),zoom_link:je.zoom_link,zoom_meeting_id:je.zoom_meeting_id||null,capacity:je.capacity?parseInt(je.capacity):null,is_published:je.is_published})),{data:mt,error:ft}=await Z.from("events").insert(ot).select();if(ft)throw ft;return mt&&mt.length>0&&dSt(je.title,mt[0].id),Ve.length},onSuccess:je=>{r.invalidateQueries({queryKey:["admin-events"]}),Se.success(je>1?`${je} recurring events created successfully`:"Event created successfully"),n(!1),i(B8),m(null),y(null),b(!1)},onError:je=>{Se.error("Failed to create event: "+je.message),b(!1)}}),at=Jt({mutationFn:async({id:je,data:it})=>{b(!0);let Me=it.image_url;d&&(Me=await Ie(d)||"");const Je=new Date(it.event_date),[Xe,Ve]=it.event_time.split(":");Je.setHours(parseInt(Xe),parseInt(Ve));const{error:ot}=await Z.from("events").update({title:it.title,description:it.description||null,image_url:Me||null,video_url:it.video_url||null,event_date:Je.toISOString(),zoom_link:it.zoom_link,zoom_meeting_id:it.zoom_meeting_id||null,capacity:it.capacity?parseInt(it.capacity):null,is_published:it.is_published}).eq("id",je);if(ot)throw ot},onSuccess:()=>{r.invalidateQueries({queryKey:["admin-events"]}),Se.success("Event updated successfully"),n(!1),o(null),i(B8),m(null),y(null),b(!1)},onError:je=>{Se.error("Failed to update event: "+je.message),b(!1)}}),ce=Jt({mutationFn:async je=>{const{error:it}=await Z.from("events").delete().eq("id",je);if(it)throw it},onSuccess:()=>{r.invalidateQueries({queryKey:["admin-events"]}),Se.success("Event deleted successfully")},onError:je=>{Se.error("Failed to delete event: "+je.message)}}),$e=je=>{var Me;const it=new Date(je.event_date);o(je),i({title:je.title,description:je.description||"",image_url:je.image_url||"",video_url:je.video_url||"",event_date:it,event_time:Xr(it,"HH:mm"),zoom_link:je.zoom_link,zoom_meeting_id:je.zoom_meeting_id||"",capacity:((Me=je.capacity)==null?void 0:Me.toString())||"",is_published:je.is_published,is_recurring:!1,recurrence_pattern:"weekly",recurrence_end_date:void 0}),y(je.image_url||null),m(null),n(!0)},Ge=je=>{if(je.preventDefault(),!l.event_date){Se.error("Please select a date");return}if(l.is_recurring&&!l.recurrence_end_date){Se.error("Please select an end date for recurring events");return}a?at.mutate({id:a.id,data:l}):Pe.mutate(l)},rt=()=>{n(!1),o(null),i(B8),m(null),y(null)};return e.jsx("div",{className:"min-h-screen bg-background p-6",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>t("/dashboard"),children:e.jsx(_i,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Event Management"}),e.jsx("p",{className:"text-muted-foreground",children:"Create and manage upcoming events"})]})]}),e.jsxs(ze,{className:"mb-6",children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[e.jsx(Zt,{children:"All Events"}),e.jsxs(Dr,{open:s,onOpenChange:je=>!je&&rt(),children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{onClick:()=>n(!0),children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Event"]})}),e.jsxs(Lr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[e.jsx(Ur,{children:e.jsx(Br,{children:a?"Edit Event":"Create New Event"})}),e.jsxs("form",{onSubmit:Ge,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"title",children:"Title *"}),e.jsx(Qe,{id:"title",value:l.title,onChange:je=>i({...l,title:je.target.value}),placeholder:"Event title",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Description"}),e.jsx(eg,{content:l.description,onChange:je=>i({...l,description:je}),placeholder:"Event description",minHeight:"120px"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Event Image"}),e.jsx("input",{type:"file",ref:N,accept:"image/*",onChange:et,className:"hidden"}),g?e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:g,alt:"Event preview",className:"w-full h-32 object-cover rounded-lg border"}),e.jsx(Q,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:It,children:e.jsx(rn,{className:"h-4 w-4"})})]}):e.jsxs(Q,{type:"button",variant:"outline",className:"w-full h-32 border-dashed flex flex-col gap-2",onClick:()=>{var je;return(je=N.current)==null?void 0:je.click()},children:[e.jsx(to,{className:"h-6 w-6"}),e.jsx("span",{className:"text-sm",children:"Click to upload image"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Date *"}),e.jsxs(rd,{children:[e.jsx(sd,{asChild:!0,children:e.jsxs(Q,{variant:"outline",className:qt("w-full justify-start text-left font-normal",!l.event_date&&"text-muted-foreground"),children:[e.jsx(Mn,{className:"mr-2 h-4 w-4"}),l.event_date?Xr(l.event_date,"PPP"):"Pick a date"]})}),e.jsx(Fc,{className:"w-auto p-0",align:"start",children:e.jsx(Vf,{mode:"single",selected:l.event_date,onSelect:je=>i({...l,event_date:je}),initialFocus:!0,className:"p-3 pointer-events-auto"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"time",children:"Time *"}),e.jsx(Qe,{id:"time",type:"time",value:l.event_time,onChange:je=>i({...l,event_time:je.target.value}),required:!0})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"zoom_link",children:"Zoom Link *"}),e.jsx(Qe,{id:"zoom_link",value:l.zoom_link,onChange:je=>i({...l,zoom_link:je.target.value}),placeholder:"https://zoom.us/j/...",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"zoom_meeting_id",children:"Zoom Meeting ID (for API registration)"}),e.jsx(Qe,{id:"zoom_meeting_id",value:l.zoom_meeting_id,onChange:je=>i({...l,zoom_meeting_id:je.target.value}),placeholder:"e.g., 1234567890 (find in Zoom dashboard)"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional: Enter the numeric meeting ID for automatic Zoom registration"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"video_url",children:"Promo Video URL (optional)"}),e.jsx(Qe,{id:"video_url",value:l.video_url,onChange:je=>i({...l,video_url:je.target.value}),placeholder:"YouTube, Vimeo, or Bunny.net embed URL"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Add a preview/promo video for this event"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"capacity",children:"Capacity (optional)"}),e.jsx(Qe,{id:"capacity",type:"number",value:l.capacity,onChange:je=>i({...l,capacity:je.target.value}),placeholder:"Leave empty for unlimited",min:"1"})]}),!a&&e.jsxs("div",{className:"space-y-3 rounded-lg border p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(OA,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(Ee,{htmlFor:"is_recurring",children:"Recurring Event"})]}),e.jsx(xn,{id:"is_recurring",checked:l.is_recurring,onCheckedChange:je=>i({...l,is_recurring:je})})]}),l.is_recurring&&e.jsxs("div",{className:"space-y-3 pt-1",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Frequency"}),e.jsxs(ds,{value:l.recurrence_pattern,onValueChange:je=>i({...l,recurrence_pattern:je}),children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"weekly",children:"Weekly"}),e.jsx(Ut,{value:"biweekly",children:"Every 2 Weeks"}),e.jsx(Ut,{value:"monthly",children:"Monthly"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Repeat Until"}),e.jsxs(rd,{children:[e.jsx(sd,{asChild:!0,children:e.jsxs(Q,{variant:"outline",className:qt("w-full justify-start text-left font-normal",!l.recurrence_end_date&&"text-muted-foreground"),children:[e.jsx(Mn,{className:"mr-2 h-4 w-4"}),l.recurrence_end_date?Xr(l.recurrence_end_date,"PPP"):"Pick end date"]})}),e.jsx(Fc,{className:"w-auto p-0",align:"start",children:e.jsx(Vf,{mode:"single",selected:l.recurrence_end_date,onSelect:je=>i({...l,recurrence_end_date:je}),disabled:je=>je<(l.event_date||new Date),initialFocus:!0,className:"p-3 pointer-events-auto"})})]})]}),l.event_date&&l.recurrence_end_date&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["This will create ",(()=>{let je=1,it=new Date(l.event_date);for(;it=l.recurrence_pattern==="weekly"?hj(it,1):l.recurrence_pattern==="biweekly"?hj(it,2):$h(it,1),!(it>l.recurrence_end_date);)je++;return je})()," events with the same Zoom link"]})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ee,{htmlFor:"is_published",children:"Published"}),e.jsx(xn,{id:"is_published",checked:l.is_published,onCheckedChange:je=>i({...l,is_published:je})})]}),e.jsxs("div",{className:"flex gap-2 pt-4",children:[e.jsx(Q,{type:"button",variant:"outline",onClick:rt,className:"flex-1",children:"Cancel"}),e.jsx(Q,{type:"submit",className:"flex-1",disabled:Pe.isPending||at.isPending||v,children:v?"Uploading...":a?"Update Event":l.is_recurring&&l.event_date&&l.recurrence_end_date?"Create Recurring Events":"Create Event"})]})]})]})]})]}),e.jsx(qe,{children:ne?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading events..."}):(le==null?void 0:le.length)===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No events yet. Create your first event!"}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Title"}),e.jsx(Ct,{children:"Date & Time"}),e.jsx(Ct,{children:"Registrations"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{className:"text-right",children:"Actions"})]})}),e.jsx(zn,{children:le==null?void 0:le.map(je=>e.jsxs(Nr,{children:[e.jsx(dt,{className:"font-medium",children:je.title}),e.jsx(dt,{children:Xr(new Date(je.event_date),"PPP p")}),e.jsx(dt,{children:e.jsxs(Q,{variant:"ghost",size:"sm",className:"gap-1",onClick:()=>Te(je),children:[e.jsx(ws,{className:"h-4 w-4"}),(fe==null?void 0:fe[je.id])||0,je.capacity&&` / ${je.capacity}`]})}),e.jsx(dt,{children:e.jsx("span",{className:qt("px-2 py-1 rounded-full text-xs font-medium",je.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:je.is_published?"Published":"Draft"})}),e.jsx(dt,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>window.open(je.zoom_link,"_blank"),title:"Open Zoom Link",children:e.jsx(En,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>$e(je),children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this event?")&&ce.mutate(je.id)},children:e.jsx(Rs,{className:"h-4 w-4 text-destructive"})})]})})]},je.id))})]})})]}),e.jsx(Dr,{open:j,onOpenChange:S,children:e.jsxs(Lr,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{className:"flex items-center gap-2",children:[e.jsx(ws,{className:"h-5 w-5"}),A==null?void 0:A.title]}),e.jsx(Gs,{children:"View registrations and attendees for this event"})]}),e.jsxs("div",{className:"flex items-center justify-end mb-4 gap-2 flex-wrap",children:[e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>ve.mutate({eventId:A.id,testMode:!0}),disabled:ve.isPending,children:[e.jsx(mn,{className:qt("h-4 w-4 mr-2",ve.isPending&&"animate-spin")}),"Send Test to Me"]}),e.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>ve.mutate({eventId:A.id}),disabled:ve.isPending||!(oe!=null&&oe.length),children:[e.jsx(mn,{className:qt("h-4 w-4 mr-2",ve.isPending&&"animate-spin")}),ve.isPending?"Sending...":"Send Reminder to All"]}),(A==null?void 0:A.zoom_meeting_id)&&e.jsxs(e.Fragment,{children:[e.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>be.mutate(A.id),disabled:be.isPending,children:[e.jsx(Ko,{className:qt("h-4 w-4 mr-2",be.isPending&&"animate-spin")}),be.isPending?"Syncing...":"Sync Registrations"]}),e.jsxs(Q,{variant:"default",size:"sm",onClick:()=>we.mutate(A.id),disabled:we.isPending,children:[e.jsx(ho,{className:qt("h-4 w-4 mr-2",we.isPending&&"animate-spin")}),we.isPending?"Syncing...":"Sync Attendees & Award Points"]})]})]}),e.jsxs(ci,{defaultValue:"registrations",className:"w-full",children:[e.jsxs(ri,{className:"grid w-full grid-cols-2",children:[e.jsxs(Kr,{value:"registrations",className:"gap-2",children:[e.jsx(ws,{className:"h-4 w-4"}),"Registrations (",(oe==null?void 0:oe.length)||0,")"]}),e.jsxs(Kr,{value:"attendees",className:"gap-2",children:[e.jsx(Li,{className:"h-4 w-4"}),"Attendees (",(ue==null?void 0:ue.length)||0,")"]})]}),e.jsx(ms,{value:"registrations",className:"mt-4",children:de?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading registrations..."}):(oe==null?void 0:oe.length)===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx("p",{children:"No registrations yet for this event."}),(A==null?void 0:A.zoom_meeting_id)&&e.jsx("p",{className:"text-xs mt-2",children:'Click "Sync Registrations" to import from Zoom.'})]}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Name"}),e.jsx(Ct,{children:"Email"}),e.jsx(Ct,{children:"Registered"}),e.jsx(Ct,{children:"Status"})]})}),e.jsx(zn,{children:oe==null?void 0:oe.map(je=>{var Xe,Ve;const it=((Xe=je.profiles)==null?void 0:Xe.name)||je.zoom_name||"Unknown",Me=((Ve=je.profiles)==null?void 0:Ve.email)||je.zoom_email||null,Je=!je.user_id;return e.jsxs(Nr,{children:[e.jsx(dt,{className:"font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[it,Je&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"External"})]})}),e.jsx(dt,{children:Me?e.jsxs("a",{href:`mailto:${Me}`,className:"flex items-center gap-1 text-primary hover:underline",children:[e.jsx(mn,{className:"h-3 w-3"}),Me]}):e.jsx("span",{className:"text-muted-foreground",children:"No email"})}),e.jsx(dt,{className:"text-muted-foreground text-sm",children:Xr(new Date(je.registered_at),"MMM d, yyyy h:mm a")}),e.jsx(dt,{children:je.zoom_join_url?e.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"}):e.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-muted text-muted-foreground",children:"Pending"})})]},je.id)})})]})}),e.jsx(ms,{value:"attendees",className:"mt-4",children:xe?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading attendees..."}):(ue==null?void 0:ue.length)===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx("p",{children:"No attendees recorded yet."}),(A==null?void 0:A.zoom_meeting_id)&&e.jsx("p",{className:"text-xs mt-2",children:'Click "Sync Attendees & Award Points" after the event ends to import actual participants from Zoom.'})]}):e.jsxs(e.Fragment,{children:[(ue==null?void 0:ue.filter(je=>!je.user_id).length)>0&&e.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:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(_l,{className:"h-4 w-4 text-amber-600 dark:text-amber-400"}),e.jsxs("h4",{className:"font-medium text-amber-800 dark:text-amber-200",children:["Unmatched Attendees (",ue==null?void 0:ue.filter(je=>!je.user_id).length,")"]})]}),e.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."}),e.jsx("div",{className:"space-y-2",children:ue==null?void 0:ue.filter(je=>!je.user_id).map(je=>e.jsxs("div",{className:"flex items-center justify-between p-2 bg-background rounded border",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium text-sm",children:je.zoom_name||"Unknown"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:je.zoom_email||"No email"})]}),e.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>Le(je),className:"gap-1",children:[e.jsx(jm,{className:"h-3 w-3"}),"Link to Profile"]})]},je.id))})]}),e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Name"}),e.jsx(Ct,{children:"Email"}),e.jsx(Ct,{children:"Duration"}),e.jsx(Ct,{children:"Points"})]})}),e.jsx(zn,{children:ue==null?void 0:ue.filter(je=>je.user_id).map(je=>{var Je,Xe;const it=((Je=je.profiles)==null?void 0:Je.name)||je.zoom_name||"Unknown",Me=((Xe=je.profiles)==null?void 0:Xe.email)||je.zoom_email||null;return e.jsxs(Nr,{children:[e.jsx(dt,{className:"font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[it,je.manually_added&&e.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"})]})}),e.jsx(dt,{children:Me?e.jsxs("a",{href:`mailto:${Me}`,className:"flex items-center gap-1 text-primary hover:underline",children:[e.jsx(mn,{className:"h-3 w-3"}),Me]}):e.jsx("span",{className:"text-muted-foreground",children:"No email"})}),e.jsx(dt,{children:je.duration_minutes?e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-sm",children:[e.jsx(Ea,{className:"h-3 w-3"}),je.duration_minutes," min"]}):e.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),e.jsx(dt,{children:je.points_awarded?e.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:[e.jsx(ho,{className:"h-3 w-3"}),"+10 pts"]}):e.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-muted text-muted-foreground",children:"Pending"})})]},je.id)})})]})]})})]})]})}),e.jsx(Dr,{open:I,onOpenChange:F,children:e.jsxs(Lr,{className:"max-w-md",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{className:"flex items-center gap-2",children:[e.jsx(jm,{className:"h-5 w-5"}),"Link Attendee to Profile"]}),e.jsx(Gs,{children:"Link this Zoom attendee to an existing member profile to award them points."})]}),O&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-3 bg-muted rounded-lg",children:[e.jsx("p",{className:"text-sm font-medium",children:O.zoom_name||"Unknown"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:O.zoom_email||"No email"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Search for a profile"}),e.jsxs("div",{className:"relative",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search by name or email...",value:se,onChange:je=>ae(je.target.value),className:"pl-9"})]})]}),e.jsx("div",{className:"max-h-48 overflow-y-auto border rounded-md",children:Ye.length===0?e.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"No profiles found"}):e.jsx("div",{className:"divide-y",children:Ye.slice(0,20).map(je=>e.jsxs("button",{type:"button",onClick:()=>H(je.id),className:qt("w-full p-3 text-left hover:bg-muted/50 transition-colors",$===je.id&&"bg-primary/10 border-l-2 border-primary"),children:[e.jsx("p",{className:"text-sm font-medium",children:je.name||"Unnamed"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:je.email})]},je.id))})}),O.zoom_email&&e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Yo,{id:"save-alias",checked:W,onCheckedChange:je=>X(je)}),e.jsx("label",{htmlFor:"save-alias",className:"text-sm text-muted-foreground cursor-pointer",children:"Remember this email for future auto-matching"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(Q,{variant:"outline",onClick:()=>F(!1),children:"Cancel"}),e.jsx(Q,{onClick:Ue,disabled:!$||Ae.isPending,children:Ae.isPending?"Linking...":"Link & Award Points"})]})]})]})})]})})}const pSt=()=>{const{user:t}=Gr(),{toast:r}=fi(),s=qr(),[n,a]=Bc(),[o,l]=E.useState(!1),[i,d]=E.useState(null),[m,g]=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,v]=E.useState(null),[b,N]=E.useState(0),[j,S]=E.useState(!1),[A,M]=E.useState(null),[I,F]=E.useState(""),[O,B]=E.useState(""),[$,H]=E.useState(""),[W,X]=E.useState(!1),[se,ae]=E.useState(!1),{data:le=[]}=Ht({queryKey:["template-categories"],queryFn:async()=>{const{data:at,error:ce}=await Z.from("template_categories").select("*").order("name");if(ce)throw ce;return at}}),{data:ne=[]}=Ht({queryKey:["template-types"],queryFn:async()=>{const{data:at,error:ce}=await Z.from("template_types").select("*").order("name");if(ce)throw ce;return at}}),{data:fe=[],isLoading:oe}=Ht({queryKey:["canva-templates-admin"],queryFn:async()=>{const{data:at,error:ce}=await Z.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).order("publish_date",{ascending:!1});if(ce)throw ce;const{data:$e,error:Ge}=await Z.from("template_links").select("*").order("sort_order");if(Ge)throw Ge;const{data:rt,error:je}=await Z.from("template_guides").select("*").order("sort_order");if(je)throw je;return at.map(Me=>({...Me,links:($e==null?void 0:$e.filter(Je=>Je.template_id===Me.id))||[],guides:(rt==null?void 0:rt.filter(Je=>Je.template_id===Me.id))||[]}))}});E.useEffect(()=>{const at=n.get("edit");if(at&&fe.length>0){const ce=fe.find($e=>$e.id===at);ce&&(we(ce),a({},{replace:!0}))}},[fe,n]);const de=Jt({mutationFn:async at=>{const{data:ce,error:$e}=await Z.from("template_categories").insert({name:at}).select().single();if($e)throw $e;return ce},onSuccess:at=>{s.invalidateQueries({queryKey:["template-categories"]}),g({...m,category_id:at.id}),B(""),X(!1),r({title:"Category added"})},onError:at=>{r({title:"Error adding category",description:at.message,variant:"destructive"})}}),ue=Jt({mutationFn:async at=>{const{data:ce,error:$e}=await Z.from("template_types").insert({name:at}).select().single();if($e)throw $e;return ce},onSuccess:at=>{s.invalidateQueries({queryKey:["template-types"]}),g({...m,type_id:at.id}),H(""),ae(!1),r({title:"Type added"})},onError:at=>{r({title:"Error adding type",description:at.message,variant:"destructive"})}}),xe=Jt({mutationFn:async at=>{var je;let ce=at.existingImageUrl;if(at.image){const it=at.image.name.split(".").pop(),Me=`${Date.now()}-${Math.random().toString(36).substring(7)}.${it}`,{error:Je}=await Z.storage.from("template-previews").upload(Me,at.image);if(Je)throw Je;const{data:Xe}=Z.storage.from("template-previews").getPublicUrl(Me);ce=Xe.publicUrl}const $e={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:ce,video_url:at.videoUrl||null,publish_date:at.template.publish_date?new Date(at.template.publish_date).toISOString():new Date().toISOString(),created_by:t==null?void 0:t.id};let Ge=at.templateId;if(Ge){const{error:it}=await Z.from("canva_templates").update($e).eq("id",Ge);if(it)throw it;const{error:Me}=await Z.from("template_links").delete().eq("template_id",Ge);if(Me)throw Me;const Je=((je=at.existingGuides)==null?void 0:je.map(ot=>ot.id).filter(Boolean))||[],Xe=at.template.guides.map(ot=>ot.id).filter(Boolean),Ve=Je.filter(ot=>!Xe.includes(ot));Ve.length>0&&await Z.from("template_guides").delete().in("id",Ve)}else{const{data:it,error:Me}=await Z.from("canva_templates").insert($e).select().single();if(Me)throw Me;Ge=it.id,lSt(at.template.name,it.id)}const rt=at.template.links.filter(it=>it.title.trim()&&it.canva_share_link.trim());if(rt.length>0){const it=rt.map((Je,Xe)=>({template_id:Ge,title:Je.title.trim(),canva_share_link:Je.canva_share_link.trim(),sort_order:Xe})),{error:Me}=await Z.from("template_links").insert(it);if(Me)throw Me}for(let it=0;it{s.invalidateQueries({queryKey:["canva-templates-admin"]}),s.invalidateQueries({queryKey:["canva-templates"]}),be(),l(!1),r({title:i?"Template updated":"Template created"})},onError:at=>{r({title:"Error saving template",description:at.message,variant:"destructive"})}}),Te=Jt({mutationFn:async at=>{const{error:ce}=await Z.from("canva_templates").delete().eq("id",at);if(ce)throw ce},onSuccess:()=>{s.invalidateQueries({queryKey:["canva-templates-admin"]}),s.invalidateQueries({queryKey:["canva-templates"]}),r({title:"Template deleted"})},onError:at=>{r({title:"Error deleting template",description:at.message,variant:"destructive"})}}),be=()=>{g({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:""}),M(null),F(""),d(null),X(!1),ae(!1),B(""),H(""),v(null),N(0),S(!1)},we=at=>{var ce;d(at),g({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($e=>({id:$e.id,title:$e.title,canva_share_link:$e.canva_share_link,sort_order:$e.sort_order})):[{title:"",canva_share_link:"",sort_order:0}],guides:((ce=at.guides)==null?void 0:ce.map($e=>({id:$e.id,name:$e.name,file_url:$e.file_url,file_type:$e.file_type,file_size:$e.file_size,sort_order:$e.sort_order})))||[],video_url:at.video_url||""}),F(at.preview_image_url||""),v(null),l(!0)},ve=at=>{var $e;const ce=($e=at.target.files)==null?void 0:$e[0];ce&&(M(ce),F(URL.createObjectURL(ce)))},tt=()=>{g({...m,links:[...m.links,{title:"",canva_share_link:"",sort_order:m.links.length}]})},Ae=at=>{if(m.links.length<=1)return;const ce=m.links.filter(($e,Ge)=>Ge!==at);g({...m,links:ce})},Le=(at,ce,$e)=>{const Ge=[...m.links];Ge[at]={...Ge[at],[ce]:$e},g({...m,links:Ge})},Ue=at=>{const ce=at.target.files;if(!ce)return;const $e=Array.from(ce).map((Ge,rt)=>({name:Ge.name.replace(/\.[^/.]+$/,""),file_url:"",file_type:Ge.type,file_size:Ge.size,sort_order:m.guides.length+rt,file:Ge}));g({...m,guides:[...m.guides,...$e]}),at.target.value=""},Ye=at=>{const ce=m.guides.filter(($e,Ge)=>Ge!==at);g({...m,guides:ce})},Ie=(at,ce)=>{const $e=[...m.guides];$e[at]={...$e[at],name:ce},g({...m,guides:$e})},et=async()=>{if(!y)return null;S(!0),N(0);try{const{data:at,error:ce}=await Z.functions.invoke("bunny-upload",{body:{action:"create",title:m.name||y.name}});if(ce)throw new Error(ce.message);const{videoId:$e,libraryId:Ge}=at,{data:rt,error:je}=await Z.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:$e}});if(je)throw new Error(je.message);const it=new XMLHttpRequest;return await new Promise((Je,Xe)=>{it.upload.addEventListener("progress",Ve=>{if(Ve.lengthComputable){const ot=Math.round(Ve.loaded/Ve.total*100);N(ot)}}),it.addEventListener("load",()=>{it.status>=200&&it.status<300?Je():Xe(new Error(`Upload failed with status ${it.status}`))}),it.addEventListener("error",()=>Xe(new Error("Upload failed"))),it.open("PUT",rt.uploadUrl),it.setRequestHeader("AccessKey",rt.apiKey),it.send(y)}),`https://player.mediadelivery.net/embed/${Ge}/${$e}`}catch(at){return console.error("Bunny upload error:",at),r({title:"Video upload failed",description:at instanceof Error?at.message:"Unknown error",variant:"destructive"}),null}finally{S(!1)}},It=at=>{var $e;const ce=($e=at.target.files)==null?void 0:$e[0];ce&&v(ce),at.target.value=""},Pe=async at=>{if(at.preventDefault(),!m.name.trim()){r({title:"Please enter a template name",variant:"destructive"});return}if(m.links.filter(Ge=>Ge.title.trim()&&Ge.canva_share_link.trim()).length===0){r({title:"Please add at least one Canva link",variant:"destructive"});return}let $e=m.video_url;if(y){const Ge=await et();if(!Ge)return;$e=Ge}xe.mutate({template:m,image:A,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:$e})};return e.jsx(Fr,{title:"Manage Templates",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(Lu,{title:"Manage Templates",description:"Create and manage Canva templates"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Templates"})}),e.jsx(qe,{children:e.jsx("div",{className:"text-2xl font-bold",children:fe.length})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Categories"})}),e.jsx(qe,{children:e.jsx("div",{className:"text-2xl font-bold",children:le.length})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Template Types"})}),e.jsx(qe,{children:e.jsx("div",{className:"text-2xl font-bold",children:ne.length})})]})]}),e.jsxs(Dr,{open:o,onOpenChange:at=>{l(at),at||be()},children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{className:"gap-2",children:[e.jsx(gs,{className:"h-4 w-4"}),"Add Template"]})}),e.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsx(Ur,{children:e.jsx(Br,{children:i?"Edit Template":"Add New Template"})}),e.jsxs("form",{onSubmit:Pe,className:"space-y-6 pt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"name",children:"Name *"}),e.jsx(Qe,{id:"name",value:m.name,onChange:at=>g({...m,name:at.target.value}),placeholder:"Template name",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Description"}),e.jsx(eg,{content:m.description,onChange:at=>g({...m,description:at}),placeholder:"Brief description of the template",minHeight:"120px"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ee,{children:"Canva Links *"}),e.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:tt,className:"gap-1",children:[e.jsx(gs,{className:"h-3 w-3"}),"Add Link"]})]}),e.jsx("div",{className:"space-y-3",children:m.links.map((at,ce)=>e.jsxs("div",{className:"flex gap-2 items-start p-3 border rounded-lg bg-muted/30",children:[e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(Qe,{value:at.title,onChange:$e=>Le(ce,"title",$e.target.value),placeholder:"Link title (e.g., Instagram Post, Story)"}),e.jsx(Qe,{value:at.canva_share_link,onChange:$e=>Le(ce,"canva_share_link",$e.target.value),placeholder:"https://www.canva.com/design/..."})]}),m.links.length>1&&e.jsx(Q,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>Ae(ce),children:e.jsx(rn,{className:"h-4 w-4"})})]},ce))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Category"}),W?e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Qe,{value:O,onChange:at=>B(at.target.value),placeholder:"New category name",className:"flex-1"}),e.jsx(Q,{type:"button",size:"sm",onClick:()=>O.trim()&&de.mutate(O.trim()),disabled:de.isPending,children:"Add"}),e.jsx(Q,{type:"button",size:"sm",variant:"ghost",onClick:()=>{X(!1),B("")},children:e.jsx(rn,{className:"h-4 w-4"})})]}):e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(ds,{value:m.category_id,onValueChange:at=>g({...m,category_id:at}),children:[e.jsx(ls,{className:"flex-1",children:e.jsx(us,{placeholder:"Select category"})}),e.jsx(cs,{children:le.map(at=>e.jsx(Ut,{value:at.id,children:at.name},at.id))})]}),e.jsx(Q,{type:"button",variant:"outline",size:"icon",onClick:()=>X(!0),children:e.jsx(gs,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Template Type"}),se?e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Qe,{value:$,onChange:at=>H(at.target.value),placeholder:"New type name",className:"flex-1"}),e.jsx(Q,{type:"button",size:"sm",onClick:()=>$.trim()&&ue.mutate($.trim()),disabled:ue.isPending,children:"Add"}),e.jsx(Q,{type:"button",size:"sm",variant:"ghost",onClick:()=>{ae(!1),H("")},children:e.jsx(rn,{className:"h-4 w-4"})})]}):e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(ds,{value:m.type_id,onValueChange:at=>g({...m,type_id:at}),children:[e.jsx(ls,{className:"flex-1",children:e.jsx(us,{placeholder:"Select type"})}),e.jsx(cs,{children:ne.map(at=>e.jsx(Ut,{value:at.id,children:at.name},at.id))})]}),e.jsx(Q,{type:"button",variant:"outline",size:"icon",onClick:()=>ae(!0),children:e.jsx(gs,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"publish_date",children:"Publish Date"}),e.jsx(Qe,{id:"publish_date",type:"date",value:m.publish_date,onChange:at=>g({...m,publish_date:at.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Templates are sorted by publish date (newest first) on the member page"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Preview Image"}),e.jsxs("div",{className:"flex items-start gap-4",children:[I?e.jsxs("div",{className:"relative w-32 h-24 rounded-lg overflow-hidden border bg-muted",children:[e.jsx("img",{src:I,alt:"Preview",className:"w-full h-full object-cover"}),e.jsx(Q,{type:"button",size:"icon",variant:"destructive",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>{M(null),F("")},children:e.jsx(rn,{className:"h-3 w-3"})})]}):e.jsx("div",{className:"w-32 h-24 rounded-lg border-2 border-dashed border-muted-foreground/25 flex items-center justify-center",children:e.jsx(El,{className:"h-8 w-8 text-muted-foreground/50"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx(Qe,{type:"file",accept:"image/*",onChange:ve,className:"cursor-pointer"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Upload a preview image for this template"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(Ee,{children:"Video (Optional)"}),m.video_url&&!y?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/30",children:[e.jsx(ya,{className:"h-5 w-5 text-primary shrink-0"}),e.jsx("span",{className:"text-sm flex-1 truncate",children:"Video uploaded"}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>g({...m,video_url:""}),className:"text-destructive hover:text-destructive",children:"Remove"})]}),e.jsx("div",{className:"aspect-video max-w-md rounded-lg overflow-hidden border",children:e.jsx("iframe",{src:m.video_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})]}):j?e.jsxs("div",{className:"space-y-2 p-4 border rounded-lg bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Hr,{className:"h-4 w-4 animate-spin"}),e.jsxs("span",{className:"text-sm",children:["Uploading video... ",b,"%"]})]}),e.jsx(hc,{value:b,className:"h-2"})]}):y?e.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/30",children:[e.jsx(ya,{className:"h-5 w-5 text-muted-foreground shrink-0"}),e.jsx("span",{className:"text-sm flex-1 truncate",children:y.name}),e.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[(y.size/1024/1024).toFixed(1)," MB"]}),e.jsx(Q,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive h-8 w-8",onClick:()=>v(null),children:e.jsx(rn,{className:"h-4 w-4"})})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"cursor-pointer",children:[e.jsx(Qe,{type:"file",accept:"video/*",onChange:It,className:"hidden"}),e.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:[e.jsx(ya,{className:"h-8 w-8 text-muted-foreground/50"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Click to upload a video"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Upload a video to embed on the template page (Bunny.net)"})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ee,{children:"Guide Files (PDFs)"}),e.jsxs("label",{className:"cursor-pointer",children:[e.jsx(Qe,{type:"file",accept:".pdf,.doc,.docx",multiple:!0,onChange:Ue,className:"hidden"}),e.jsx(Q,{type:"button",variant:"outline",size:"sm",className:"gap-1",asChild:!0,children:e.jsxs("span",{children:[e.jsx(to,{className:"h-3 w-3"}),"Add Files"]})})]})]}),m.guides.length>0?e.jsx("div",{className:"space-y-2",children:m.guides.map((at,ce)=>e.jsxs("div",{className:"flex gap-2 items-center p-3 border rounded-lg bg-muted/30",children:[e.jsx(fa,{className:"h-5 w-5 text-muted-foreground shrink-0"}),e.jsx(Qe,{value:at.name,onChange:$e=>Ie(ce,$e.target.value),placeholder:"Guide name",className:"flex-1"}),at.file_size&&e.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[(at.file_size/1024).toFixed(0)," KB"]}),e.jsx(Q,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive h-8 w-8",onClick:()=>Ye(ce),children:e.jsx(rn,{className:"h-4 w-4"})})]},at.id||ce))}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No guide files added. Upload PDFs to help agents understand how to use this template."})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>{l(!1),be()},children:"Cancel"}),e.jsx(Q,{type:"submit",disabled:xe.isPending,children:xe.isPending?"Saving...":i?"Update":"Create"})]})]})]})]})]}),e.jsx(ze,{children:e.jsx(qe,{className:"p-0",children:oe?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading..."}):fe.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No templates yet. Add your first template!"}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Preview"}),e.jsx(Ct,{children:"Name"}),e.jsx(Ct,{children:"Links"}),e.jsx(Ct,{children:"Category"}),e.jsx(Ct,{children:"Type"}),e.jsx(Ct,{children:"Publish Date"}),e.jsx(Ct,{className:"text-right",children:"Actions"})]})}),e.jsx(zn,{children:fe.map(at=>{var ce,$e,Ge,rt,je;return e.jsxs(Nr,{children:[e.jsx(dt,{children:e.jsx("div",{className:"w-16 h-12 rounded overflow-hidden bg-muted",children:at.preview_image_url?e.jsx("img",{src:at.preview_image_url,alt:at.name,className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(El,{className:"h-4 w-4 text-muted-foreground"})})})}),e.jsx(dt,{className:"font-medium",children:at.name}),e.jsx(dt,{children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs(bt,{variant:"secondary",children:[((ce=at.links)==null?void 0:ce.length)||0," link",((($e=at.links)==null?void 0:$e.length)||0)!==1?"s":""]}),(((Ge=at.guides)==null?void 0:Ge.length)||0)>0&&e.jsxs(bt,{variant:"outline",className:"gap-1",children:[e.jsx(fa,{className:"h-3 w-3"}),(rt=at.guides)==null?void 0:rt.length," guide",(((je=at.guides)==null?void 0:je.length)||0)!==1?"s":""]})]})}),e.jsx(dt,{children:at.category?e.jsx(bt,{variant:"secondary",children:at.category.name}):e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(dt,{children:at.type?e.jsx(bt,{variant:"outline",children:at.type.name}):e.jsx("span",{className:"text-muted-foreground",children:"-"})}),e.jsx(dt,{className:"text-muted-foreground",children:new Date(at.publish_date).toLocaleDateString()}),e.jsx(dt,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(Q,{size:"icon",variant:"ghost",onClick:()=>we(at),children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{size:"icon",variant:"ghost",className:"text-destructive hover:text-destructive",onClick:()=>{confirm("Delete this template?")&&Te.mutate(at.id)},children:e.jsx(Rs,{className:"h-4 w-4"})})]})})]},at.id)})})]})})})]})})};function fBe({selectedTemplateIds:t,onChange:r}){const[s,n]=E.useState(""),[a,o]=E.useState(!1),{data:l=[]}=Ht({queryKey:["all-canva-templates-picker"],queryFn:async()=>{const{data:y,error:v}=await Z.from("canva_templates").select("id, name, preview_image_url").order("name");if(v)throw v;return y}}),i=l.filter(y=>t.includes(y.id)),d=l.filter(y=>!t.includes(y.id)&&y.name.toLowerCase().includes(s.toLowerCase())),m=y=>{r([...t,y])},g=y=>{r(t.filter(v=>v!==y))};return e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ee,{className:"flex items-center gap-2",children:[e.jsx(Hj,{className:"h-4 w-4"}),"Linked Templates"]}),i.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.map(y=>e.jsxs(bt,{variant:"secondary",className:"gap-1 pr-1",children:[y.name,e.jsx("button",{type:"button",onClick:()=>g(y.id),className:"ml-1 rounded-full hover:bg-muted-foreground/20 p-0.5",children:e.jsx(rn,{className:"h-3 w-3"})})]},y.id))}),e.jsxs(rd,{open:a,onOpenChange:o,children:[e.jsx(sd,{asChild:!0,children:e.jsxs(Q,{type:"button",variant:"outline",size:"sm",className:"gap-1",children:[e.jsx(Hj,{className:"h-3.5 w-3.5"}),"Add Template"]})}),e.jsxs(Fc,{className:"w-80 p-2",align:"start",children:[e.jsxs("div",{className:"relative mb-2",children:[e.jsx(Qn,{className:"absolute left-2 top-2.5 h-3.5 w-3.5 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search templates...",value:s,onChange:y=>n(y.target.value),className:"pl-7 h-8 text-sm"})]}),e.jsx("div",{className:"max-h-48 overflow-y-auto space-y-0.5",children:d.length===0?e.jsx("p",{className:"text-xs text-muted-foreground text-center py-3",children:s?"No templates found":"All templates selected"}):d.map(y=>e.jsxs("button",{type:"button",onClick:()=>{m(y.id),n("")},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?e.jsx("img",{src:y.preview_image_url,alt:"",className:"w-8 h-8 rounded object-cover flex-shrink-0"}):e.jsx("div",{className:"w-8 h-8 rounded bg-muted flex items-center justify-center flex-shrink-0",children:e.jsx(Hj,{className:"h-3.5 w-3.5 text-muted-foreground"})}),e.jsx("span",{className:"truncate",children:y.name})]},y.id))})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Link templates that agents can use alongside this content."})]})}const fSt=[{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"}],gSt=()=>{const{user:t}=Gr(),[r,s]=Bc(),{toast:n}=fi(),a=qr(),[o,l]=E.useState(!1),[i,d]=E.useState(null),[m,g]=E.useState({title:"",description:"",video_url:"",video_type:"youtube",duration:"",category_id:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[y,v]=E.useState(null),[b,N]=E.useState(""),[j,S]=E.useState([]),[A,M]=E.useState([]),[I,F]=E.useState([]),[O,B]=E.useState([]),[$,H]=E.useState(""),[W,X]=E.useState(!1),[se,ae]=E.useState(null),[le,ne]=E.useState(0),[fe,oe]=E.useState(!1),[de,ue]=E.useState(null),{data:xe=[]}=Ht({queryKey:["academy-categories"],queryFn:async()=>{const{data:ce,error:$e}=await Z.from("academy_categories").select("*").order("sort_order",{ascending:!0});if($e)throw $e;return ce}}),{data:Te=[],isLoading:be}=Ht({queryKey:["academy-videos-admin"],queryFn:async()=>{const{data:ce,error:$e}=await Z.from("academy_videos").select(` *, category:academy_categories(id, name) `).order("publish_date",{ascending:!1});if($e)throw $e;const{data:Ge,error:rt}=await Z.from("academy_resources").select("*").order("sort_order");if(rt)throw rt;return ce.map(it=>({...it,resources:(Ge==null?void 0:Ge.filter(Me=>Me.video_id===it.id))||[]}))}});E.useEffect(()=>{const ce=r.get("edit");if(ce&&Te.length>0){const $e=Te.find(Ge=>Ge.id===ce);$e&&(Ue($e),s({},{replace:!0}))}},[Te,r]);const we=Jt({mutationFn:async ce=>{const{data:$e,error:Ge}=await Z.from("academy_categories").insert({name:ce,sort_order:xe.length}).select().single();if(Ge)throw Ge;return $e},onSuccess:ce=>{a.invalidateQueries({queryKey:["academy-categories"]}),g({...m,category_id:ce.id}),H(""),X(!1),n({title:"Category added"})},onError:ce=>{n({title:"Error adding category",description:ce.message,variant:"destructive"})}}),ve=Jt({mutationFn:async ce=>{let $e=ce.existingThumbnailUrl;if(ce.thumbnail){const je=ce.thumbnail.name.split(".").pop(),it=`thumbnails/${Date.now()}-${Math.random().toString(36).substring(7)}.${je}`,{error:Me}=await Z.storage.from("academy-resources").upload(it,ce.thumbnail);if(Me)throw Me;const{data:Je}=Z.storage.from("academy-resources").getPublicUrl(it);$e=Je.publicUrl}const Ge={title:ce.video.title,description:ce.video.description||null,video_url:ce.video.video_url,video_type:ce.video.video_type,duration:ce.video.duration||null,thumbnail_url:$e,category_id:ce.video.category_id||null,publish_date:ce.video.publish_date?new Date(ce.video.publish_date).toISOString():new Date().toISOString(),is_published:ce.video.is_published,created_by:t==null?void 0:t.id};let rt=ce.videoId;if(rt){const{error:je}=await Z.from("academy_videos").update(Ge).eq("id",rt);if(je)throw je}else{const{data:je,error:it}=await Z.from("academy_videos").insert(Ge).select().single();if(it)throw it;rt=je.id,cSt(ce.video.title,je.id)}if(ce.resourcesToDelete.length>0){const{error:je}=await Z.from("academy_resources").delete().in("id",ce.resourcesToDelete);if(je)throw je}for(let je=0;je0){const{error:je}=await Z.from("academy_video_templates").insert(O.map(it=>({video_id:rt,template_id:it})));if(je)throw je}},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-videos-admin"]}),a.invalidateQueries({queryKey:["academy-videos"]}),Le(),l(!1),n({title:i?"Video updated":"Video created"})},onError:ce=>{n({title:"Error saving video",description:ce.message,variant:"destructive"})}}),tt=Jt({mutationFn:async ce=>{const{error:$e}=await Z.from("academy_videos").delete().eq("id",ce);if($e)throw $e},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-videos-admin"]}),a.invalidateQueries({queryKey:["academy-videos"]}),n({title:"Video deleted"})},onError:ce=>{n({title:"Error deleting video",description:ce.message,variant:"destructive"})}}),Ae=Jt({mutationFn:async({id:ce,is_published:$e})=>{const{error:Ge}=await Z.from("academy_videos").update({is_published:$e}).eq("id",ce);if(Ge)throw Ge},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-videos-admin"]}),a.invalidateQueries({queryKey:["academy-videos"]})},onError:ce=>{n({title:"Error updating video",description:ce.message,variant:"destructive"})}}),Le=()=>{g({title:"",description:"",video_url:"",video_type:"bunny_stream",duration:"",category_id:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),v(null),N(""),S([]),M([]),F([]),d(null),B([]),H(""),ae(null),ne(0),oe(!1),ue(null)},Ue=async ce=>{d(ce),g({title:ce.title,description:ce.description||"",video_url:ce.video_url,video_type:ce.video_type,duration:ce.duration||"",category_id:ce.category_id||"",publish_date:ce.publish_date?new Date(ce.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:ce.is_published}),N(ce.thumbnail_url||""),M(ce.resources||[]),S([]),F([]);const{data:$e}=await Z.from("academy_video_templates").select("template_id").eq("video_id",ce.id);B(($e||[]).map(Ge=>Ge.template_id)),l(!0)},Ye=ce=>{var Ge;const $e=(Ge=ce.target.files)==null?void 0:Ge[0];$e&&(v($e),N(URL.createObjectURL($e)))},Ie=ce=>{const $e=ce.target.files;if($e){const Ge=Array.from($e).map(rt=>({file:rt,title:rt.name.replace(/\.[^/.]+$/,"")}));S([...j,...Ge])}ce.target.value=""},et=ce=>{S(j.filter(($e,Ge)=>Ge!==ce))},It=ce=>{F([...I,ce]),M(A.filter($e=>$e.id!==ce))},Pe=async()=>{if(!se)return null;oe(!0),ne(0);try{const{data:ce,error:$e}=await Z.functions.invoke("bunny-upload",{body:{action:"create",title:m.title||se.name}});if($e)throw new Error($e.message);const{videoId:Ge,libraryId:rt}=ce;ue(Ge);const{data:je,error:it}=await Z.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:Ge}});if(it)throw new Error(it.message);const Me=new XMLHttpRequest;return await new Promise((Xe,Ve)=>{Me.upload.addEventListener("progress",ot=>{if(ot.lengthComputable){const mt=Math.round(ot.loaded/ot.total*100);ne(mt)}}),Me.addEventListener("load",()=>{Me.status>=200&&Me.status<300?Xe():Ve(new Error(`Upload failed with status ${Me.status}`))}),Me.addEventListener("error",()=>Ve(new Error("Upload failed"))),Me.open("PUT",je.uploadUrl),Me.setRequestHeader("AccessKey",je.apiKey),Me.send(se)}),`https://player.mediadelivery.net/embed/${rt}/${Ge}`}catch(ce){return console.error("Bunny upload error:",ce),n({title:"Video upload failed",description:ce instanceof Error?ce.message:"Unknown error",variant:"destructive"}),null}finally{oe(!1)}},at=async ce=>{if(ce.preventDefault(),!m.title.trim()){n({title:"Please enter a video title",variant:"destructive"});return}let $e=m.video_url;if(m.video_type==="bunny_stream"&&se&&!i){const Ge=await Pe();if(!Ge)return;$e=Ge}else if(!m.video_url.trim()&&m.video_type!=="bunny_stream"){n({title:"Please enter a video URL",variant:"destructive"});return}else if(m.video_type==="bunny_stream"&&!se&&!m.video_url&&!i){n({title:"Please select a video file to upload",variant:"destructive"});return}ve.mutate({video:{...m,video_url:$e},thumbnail:y,existingThumbnailUrl:(i==null?void 0:i.thumbnail_url)||null,videoId:i==null?void 0:i.id,newResources:j,resourcesToDelete:I})};return e.jsx(Fr,{title:"Manage Academy",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(Lu,{title:"Manage Academy",description:"Create and manage training videos and resources"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Videos"})}),e.jsx(qe,{children:e.jsx("div",{className:"text-2xl font-bold",children:Te.length})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),e.jsx(qe,{children:e.jsx("div",{className:"text-2xl font-bold",children:Te.filter(ce=>ce.is_published).length})})]})]}),e.jsxs(Dr,{open:o,onOpenChange:ce=>{l(ce),ce||Le()},children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{className:"gap-2",children:[e.jsx(gs,{className:"h-4 w-4"}),"Add Video"]})}),e.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsx(Ur,{children:e.jsx(Br,{children:i?"Edit Video":"Add New Video"})}),e.jsxs("form",{onSubmit:at,className:"space-y-6 pt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"title",children:"Title *"}),e.jsx(Qe,{id:"title",value:m.title,onChange:ce=>g({...m,title:ce.target.value}),placeholder:"Video title",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Description"}),e.jsx(eg,{content:m.description,onChange:ce=>g({...m,description:ce}),placeholder:"Brief description of the video",minHeight:"120px"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Video Type"}),e.jsxs(ds,{value:m.video_type,onValueChange:ce=>{g({...m,video_type:ce,video_url:""}),ae(null)},disabled:fe,children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsx(cs,{children:fSt.map(ce=>e.jsx(Ut,{value:ce.value,children:ce.label},ce.value))})]})]}),m.video_type==="bunny_stream"?e.jsxs("div",{className:"space-y-3",children:[e.jsxs(Ee,{children:["Upload Video File ",!i&&"*"]}),i&&m.video_url&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Current video: ",e.jsx("a",{href:m.video_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"View"})]}),!i&&e.jsxs(e.Fragment,{children:[e.jsx(Qe,{type:"file",accept:"video/*",onChange:ce=>{var Ge;const $e=(Ge=ce.target.files)==null?void 0:Ge[0];$e&&ae($e)},disabled:fe}),se&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(ya,{className:"h-4 w-4"}),se.name," (",(se.size/(1024*1024)).toFixed(1)," MB)"]}),fe&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Hr,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{className:"text-sm",children:"Uploading to Bunny.net..."})]}),e.jsx(hc,{value:le,className:"h-2"}),e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[le,"%"]})]})]})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"video_url",children:"Video URL *"}),e.jsx(Qe,{id:"video_url",value:m.video_url,onChange:ce=>g({...m,video_url:ce.target.value}),placeholder:"https://...",required:!0})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"duration",children:"Duration"}),e.jsx(Qe,{id:"duration",value:m.duration,onChange:ce=>g({...m,duration:ce.target.value}),placeholder:"e.g., 45:30"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"publish_date",children:"Publish Date"}),e.jsx(Qe,{id:"publish_date",type:"date",value:m.publish_date,onChange:ce=>g({...m,publish_date:ce.target.value})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Category"}),W?e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Qe,{value:$,onChange:ce=>H(ce.target.value),placeholder:"New category name",className:"flex-1"}),e.jsx(Q,{type:"button",size:"sm",onClick:()=>$.trim()&&we.mutate($.trim()),disabled:we.isPending,children:"Add"}),e.jsx(Q,{type:"button",size:"sm",variant:"ghost",onClick:()=>{X(!1),H("")},children:e.jsx(rn,{className:"h-4 w-4"})})]}):e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(ds,{value:m.category_id,onValueChange:ce=>g({...m,category_id:ce}),children:[e.jsx(ls,{className:"flex-1",children:e.jsx(us,{placeholder:"Select category"})}),e.jsx(cs,{children:xe.map(ce=>e.jsx(Ut,{value:ce.id,children:ce.name},ce.id))})]}),e.jsx(Q,{type:"button",variant:"outline",size:"sm",onClick:()=>X(!0),children:e.jsx(gs,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Thumbnail Image"}),e.jsxs("div",{className:"flex items-start gap-4",children:[b&&e.jsx("img",{src:b,alt:"Thumbnail preview",className:"w-32 h-20 object-cover rounded-md border"}),e.jsxs("div",{className:"flex-1",children:[e.jsx(Qe,{type:"file",accept:"image/*",onChange:Ye,className:"cursor-pointer"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Recommended: 16:9 aspect ratio"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ee,{children:"Resource Files"}),e.jsx(Q,{type:"button",variant:"outline",size:"sm",asChild:!0,children:e.jsxs("label",{className:"cursor-pointer gap-1",children:[e.jsx(to,{className:"h-3 w-3"}),"Add Files",e.jsx("input",{type:"file",multiple:!0,accept:".pdf,.pptx,.ppt,.xlsx,.xls,.docx,.doc,.zip",onChange:Ie,className:"hidden"})]})})]}),(A.length>0||j.length>0)&&e.jsxs("div",{className:"space-y-2 mt-2",children:[A.map(ce=>e.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:[e.jsx(fa,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"flex-1 text-sm truncate",children:ce.title}),e.jsx(bt,{variant:"outline",className:"text-xs",children:ce.file_type}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>It(ce.id),className:"text-destructive hover:text-destructive",children:e.jsx(rn,{className:"h-4 w-4"})})]},ce.id)),j.map((ce,$e)=>e.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:[e.jsx(fa,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{value:ce.title,onChange:Ge=>{const rt=[...j];rt[$e].title=Ge.target.value,S(rt)},className:"flex-1 h-8",placeholder:"Resource title"}),e.jsx(bt,{variant:"secondary",className:"text-xs",children:"New"}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>et($e),className:"text-destructive hover:text-destructive",children:e.jsx(rn,{className:"h-4 w-4"})})]},$e))]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Supported: PDF, PowerPoint, Excel, Word, ZIP"})]}),e.jsx(fBe,{selectedTemplateIds:O,onChange:B}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xn,{id:"is_published",checked:m.is_published,onCheckedChange:ce=>g({...m,is_published:ce})}),e.jsx(Ee,{htmlFor:"is_published",children:"Published"})]}),e.jsxs(Dn,{children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>l(!1),disabled:fe,children:"Cancel"}),e.jsx(Q,{type:"submit",disabled:ve.isPending||fe,children:fe?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):ve.isPending?"Saving...":i?"Update Video":"Add Video"})]})]})]})]})]}),e.jsx(ze,{children:e.jsx(qe,{className:"p-0",children:be?e.jsx("div",{className:"flex justify-center py-8",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):Te.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(ya,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"No videos yet"}),e.jsx("p",{className:"text-sm",children:"Add your first academy video"})]}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Title"}),e.jsx(Ct,{children:"Category"}),e.jsx(Ct,{children:"Duration"}),e.jsx(Ct,{children:"Resources"}),e.jsx(Ct,{children:"Publish Date"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{className:"w-[120px]",children:"Actions"})]})}),e.jsx(zn,{children:Te.map(ce=>e.jsxs(Nr,{children:[e.jsx(dt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[ce.thumbnail_url?e.jsx("img",{src:ce.thumbnail_url,alt:"",className:"w-16 h-10 object-cover rounded"}):e.jsx("div",{className:"w-16 h-10 bg-muted rounded flex items-center justify-center",children:e.jsx(ya,{className:"h-4 w-4 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:ce.title}),e.jsx("p",{className:"text-xs text-muted-foreground capitalize",children:ce.video_type.replace("_"," ")})]})]})}),e.jsx(dt,{children:ce.category?e.jsx(bt,{variant:"outline",children:ce.category.name}):e.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),e.jsx(dt,{children:ce.duration||"-"}),e.jsx(dt,{children:ce.resources&&ce.resources.length>0?e.jsxs(bt,{variant:"secondary",children:[ce.resources.length," file(s)"]}):e.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),e.jsx(dt,{children:new Date(ce.publish_date).toLocaleDateString()}),e.jsx(dt,{children:e.jsx(xn,{checked:ce.is_published,onCheckedChange:$e=>Ae.mutate({id:ce.id,is_published:$e})})}),e.jsx(dt,{children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>Ue(ce),children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>tt.mutate(ce.id),className:"text-destructive hover:text-destructive",children:e.jsx(Rs,{className:"h-4 w-4"})})]})})]},ce.id))})]})})})]})})};function xSt(){var ve,tt,Ae;const t=qr(),[r,s]=Bc(),[n,a]=E.useState(!1),[o,l]=E.useState(null),[i,d]=E.useState({name:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[m,g]=E.useState(null),[y,v]=E.useState(""),[b,N]=E.useState([]),[j,S]=E.useState([]),[A,M]=E.useState([]),[I,F]=E.useState(null),{data:O,isLoading:B}=Ht({queryKey:["resource-kits"],queryFn:async()=>{const{data:Le,error:Ue}=await Z.from("resource_kits").select("*").order("publish_date",{ascending:!1});if(Ue)throw Ue;return Le}}),{data:$}=Ht({queryKey:["resource-kit-files"],queryFn:async()=>{const{data:Le,error:Ue}=await Z.from("resource_kit_files").select("*").order("sort_order",{ascending:!0});if(Ue)throw Ue;return Le}}),{data:H}=Ht({queryKey:["resource-kit-links"],queryFn:async()=>{const{data:Le,error:Ue}=await Z.from("resource_kit_links").select("*").order("sort_order",{ascending:!0});if(Ue)throw Ue;return Le}});E.useEffect(()=>{const Le=r.get("edit");if(Le&&O&&O.length>0&&$&&H){const Ue=O.find(Ye=>Ye.id===Le);Ue&&(X(Ue),s({},{replace:!0}))}},[O,$,H,r]);const W=()=>{d({name:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),g(null),v(""),N([]),S([]),M([]),l(null)},X=async Le=>{l(Le),d({name:Le.name,description:Le.description||"",publish_date:Le.publish_date.split("T")[0],is_published:Le.is_published}),v(Le.featured_image_url||"");const Ue=($==null?void 0:$.filter(et=>et.kit_id===Le.id))||[];N(Ue.map(et=>({id:et.id,name:et.name,file_url:et.file_url,file_type:et.file_type,file_size:et.file_size,sort_order:et.sort_order})));const Ye=(H==null?void 0:H.filter(et=>et.kit_id===Le.id))||[];S(Ye.map(et=>({id:et.id,title:et.title,canva_share_link:et.canva_share_link,sort_order:et.sort_order})));const{data:Ie}=await Z.from("resource_kit_templates").select("template_id").eq("kit_id",Le.id);M((Ie||[]).map(et=>et.template_id)),a(!0)},se=Le=>{var Ye;const Ue=(Ye=Le.target.files)==null?void 0:Ye[0];Ue&&(g(Ue),v(URL.createObjectURL(Ue)))},ae=()=>{N([...b,{name:"",file_url:"",sort_order:b.length}])},le=Le=>{N(b.filter((Ue,Ye)=>Ye!==Le))},ne=(Le,Ue,Ye)=>{const Ie=[...b];Ie[Le]={...Ie[Le],[Ue]:Ye},N(Ie)},fe=()=>{S([...j,{title:"",canva_share_link:"",sort_order:j.length}])},oe=Le=>{S(j.filter((Ue,Ye)=>Ye!==Le))},de=(Le,Ue,Ye)=>{const Ie=[...j];Ie[Le]={...Ie[Le],[Ue]:Ye},S(Ie)},ue=(Le,Ue)=>{var Ie;const Ye=(Ie=Ue.target.files)==null?void 0:Ie[0];if(Ye){const et=[...b],It=Ye.name.replace(/\.[^/.]+$/,"");et[Le]={...et[Le],file:Ye,file_type:Ye.type,file_size:Ye.size,name:et[Le].name||It},N(et)}},xe=Jt({mutationFn:async()=>{let Le=(o==null?void 0:o.featured_image_url)||null;if(m){const It=m.name.split(".").pop(),Pe=`${Date.now()}.${It}`,{error:at}=await Z.storage.from("resource-kits").upload(`featured/${Pe}`,m);if(at)throw at;const{data:ce}=Z.storage.from("resource-kits").getPublicUrl(`featured/${Pe}`);Le=ce.publicUrl}const Ue={name:i.name,description:i.description||null,featured_image_url:Le,publish_date:i.publish_date,is_published:i.is_published};let Ye;const Ie=!o,et=(o==null?void 0:o.is_published)||!1;if(o){const{error:It}=await Z.from("resource_kits").update(Ue).eq("id",o.id);if(It)throw It;Ye=o.id;const Pe=($==null?void 0:$.filter(je=>je.kit_id===o.id).map(je=>je.id))||[],at=b.filter(je=>je.id).map(je=>je.id),ce=Pe.filter(je=>!at.includes(je));ce.length>0&&await Z.from("resource_kit_files").delete().in("id",ce);const $e=(H==null?void 0:H.filter(je=>je.kit_id===o.id).map(je=>je.id))||[],Ge=j.filter(je=>je.id).map(je=>je.id),rt=$e.filter(je=>!Ge.includes(je));rt.length>0&&await Z.from("resource_kit_links").delete().in("id",rt)}else{const{data:It,error:Pe}=await Z.from("resource_kits").insert(Ue).select().single();if(Pe)throw Pe;Ye=It.id}for(let It=0;It0){const{error:It}=await Z.from("resource_kit_templates").insert(A.map(Pe=>({kit_id:Ye,template_id:Pe})));if(It)throw It}return{kitId:Ye,kitName:i.name,isNewKit:Ie,wasPublished:et,isPublished:i.is_published}},onSuccess:Le=>{t.invalidateQueries({queryKey:["resource-kits"]}),t.invalidateQueries({queryKey:["resource-kit-files"]}),t.invalidateQueries({queryKey:["resource-kit-links"]}),Se.success(o?"Resource kit updated":"Resource kit created"),Le.isPublished&&(Le.isNewKit||!Le.wasPublished)&&uSt(Le.kitName,Le.kitId),a(!1),W()},onError:Le=>{Se.error("Failed to save resource kit: "+Le.message)}}),Te=Jt({mutationFn:async Le=>{const{error:Ue}=await Z.from("resource_kits").delete().eq("id",Le);if(Ue)throw Ue},onSuccess:()=>{t.invalidateQueries({queryKey:["resource-kits"]}),t.invalidateQueries({queryKey:["resource-kit-files"]}),Se.success("Resource kit deleted")},onError:Le=>{Se.error("Failed to delete: "+Le.message)}}),be=Le=>{if(Le.preventDefault(),!i.name){Se.error("Please enter a name");return}xe.mutate()},we=Le=>($==null?void 0:$.filter(Ue=>Ue.kit_id===Le).length)||0;return e.jsx(Fr,{title:"Toolbox Management",description:"Create and manage resource kits for agents",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Kits"})}),e.jsx(qe,{children:e.jsx("div",{className:"text-2xl font-bold",children:(O==null?void 0:O.length)||0})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),e.jsx(qe,{children:e.jsx("div",{className:"text-2xl font-bold",children:(O==null?void 0:O.filter(Le=>Le.is_published).length)||0})})]})]}),e.jsxs(Q,{onClick:()=>{W(),a(!0)},children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Resource Kit"]})]}),e.jsx(ze,{children:e.jsx(qe,{className:"p-0",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Name"}),e.jsx(Ct,{children:"Files"}),e.jsx(Ct,{children:"Publish Date"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{className:"text-right",children:"Actions"})]})}),e.jsx(zn,{children:B?e.jsx(Nr,{children:e.jsx(dt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):(O==null?void 0:O.length)===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No resource kits yet. Create your first one!"})}):O==null?void 0:O.map(Le=>e.jsxs(Nr,{children:[e.jsx(dt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[Le.featured_image_url?e.jsx("img",{src:Le.featured_image_url,alt:Le.name,className:"w-10 h-10 rounded object-cover"}):e.jsx("div",{className:"w-10 h-10 rounded bg-muted flex items-center justify-center",children:e.jsx(Wl,{className:"h-5 w-5 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:Le.name}),Le.description&&e.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:Le.description})]})]})}),e.jsx(dt,{children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(fa,{className:"h-4 w-4 text-muted-foreground"}),we(Le.id)]})}),e.jsx(dt,{children:Xr(new Date(Le.publish_date),"MMM d, yyyy")}),e.jsx(dt,{children:e.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${Le.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:Le.is_published?"Published":"Draft"})}),e.jsx(dt,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{const Ue=($==null?void 0:$.filter(Ie=>Ie.kit_id===Le.id))||[],Ye=(H==null?void 0:H.filter(Ie=>Ie.kit_id===Le.id))||[];F({...Le,files:Ue,links:Ye})},children:e.jsx(Gi,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>X(Le),children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource kit?")&&Te.mutate(Le.id)},children:e.jsx(Rs,{className:"h-4 w-4 text-destructive"})})]})})]},Le.id))})]})})}),e.jsx(Dr,{open:n,onOpenChange:a,children:e.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsx(Ur,{children:e.jsx(Br,{children:o?"Edit Resource Kit":"Add Resource Kit"})}),e.jsxs("form",{onSubmit:be,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Featured Image"}),e.jsxs("div",{className:"flex items-center gap-4",children:[y?e.jsx("img",{src:y,alt:"Preview",className:"w-24 h-24 rounded object-cover"}):e.jsx("div",{className:"w-24 h-24 rounded bg-muted flex items-center justify-center",children:e.jsx(Wl,{className:"h-8 w-8 text-muted-foreground"})}),e.jsx(Qe,{type:"file",accept:"image/*",onChange:se})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"name",children:"Name *"}),e.jsx(Qe,{id:"name",value:i.name,onChange:Le=>d({...i,name:Le.target.value}),placeholder:"Resource Kit Name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Description"}),e.jsx(eg,{content:i.description,onChange:Le=>d({...i,description:Le}),placeholder:"Brief description of this resource kit",minHeight:"120px"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"publish_date",children:"Publish Date"}),e.jsx(Qe,{id:"publish_date",type:"date",value:i.publish_date,onChange:Le=>d({...i,publish_date:Le.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Published"}),e.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[e.jsx(xn,{checked:i.is_published,onCheckedChange:Le=>d({...i,is_published:Le})}),e.jsx("span",{className:"text-sm text-muted-foreground",children:i.is_published?"Visible to agents":"Hidden from agents"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(Ee,{children:"Resource Files"}),e.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:ae,children:[e.jsx(gs,{className:"h-4 w-4 mr-1"}),"Add File"]})]}),b.length===0?e.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.'}):e.jsx("div",{className:"space-y-3",children:b.map((Le,Ue)=>e.jsxs("div",{className:"border rounded-md p-3 space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxs("span",{className:"text-sm font-medium",children:["File ",Ue+1]}),e.jsx(Q,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>le(Ue),children:e.jsx(rn,{className:"h-4 w-4"})})]}),e.jsx(Qe,{placeholder:"File name (e.g., Getting Started Guide)",value:Le.name,onChange:Ye=>ne(Ue,"name",Ye.target.value)}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Qe,{type:"file",onChange:Ye=>ue(Ue,Ye),className:"flex-1"}),Le.file_url&&!Le.file&&e.jsx("a",{href:Le.file_url,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline whitespace-nowrap",children:"Current file"}),Le.file&&e.jsx("span",{className:"text-sm text-green-600 whitespace-nowrap",children:"New file selected"})]})]},Ue))})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(Ee,{children:"Canva Links"}),e.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:fe,children:[e.jsx(gs,{className:"h-4 w-4 mr-1"}),"Add Canva Link"]})]}),j.length===0?e.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.'}):e.jsx("div",{className:"space-y-3",children:j.map((Le,Ue)=>e.jsxs("div",{className:"border rounded-md p-3 space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxs("span",{className:"text-sm font-medium",children:["Canva Link ",Ue+1]}),e.jsx(Q,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>oe(Ue),children:e.jsx(rn,{className:"h-4 w-4"})})]}),e.jsx(Qe,{placeholder:"Link title (e.g., Social Media Post Template)",value:Le.title,onChange:Ye=>de(Ue,"title",Ye.target.value)}),e.jsx(Qe,{placeholder:"Canva share link (e.g., https://www.canva.com/design/...)",value:Le.canva_share_link,onChange:Ye=>de(Ue,"canva_share_link",Ye.target.value)})]},Ue))})]}),e.jsx(fBe,{selectedTemplateIds:A,onChange:M}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsx(Q,{type:"submit",disabled:xe.isPending,children:xe.isPending?"Saving...":o?"Update":"Create"})]})]})]})}),e.jsx(Dr,{open:!!I,onOpenChange:()=>F(null),children:e.jsxs(Lr,{className:"max-w-lg",children:[e.jsx(Ur,{children:e.jsx(Br,{children:I==null?void 0:I.name})}),e.jsxs("div",{className:"space-y-4",children:[(I==null?void 0:I.featured_image_url)&&e.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)&&e.jsx("p",{className:"text-muted-foreground",children:I.description}),e.jsxs("div",{children:[e.jsxs("h4",{className:"font-medium mb-2",children:["Resource Files (",((ve=I==null?void 0:I.files)==null?void 0:ve.length)||0,")"]}),((tt=I==null?void 0:I.files)==null?void 0:tt.length)===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No files in this kit"}):e.jsx("div",{className:"space-y-2",children:(Ae=I==null?void 0:I.files)==null?void 0:Ae.map(Le=>e.jsxs("a",{href:Le.file_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-2 rounded-md hover:bg-muted transition-colors",children:[e.jsx(fa,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"text-sm",children:Le.name})]},Le.id))})]}),(I==null?void 0:I.links)&&I.links.length>0&&e.jsxs("div",{children:[e.jsxs("h4",{className:"font-medium mb-2",children:["Canva Links (",I.links.length,")"]}),e.jsx("div",{className:"space-y-2",children:I.links.map(Le=>e.jsxs("a",{href:Le.canva_share_link,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-2 rounded-md hover:bg-muted transition-colors",children:[e.jsx(Bo,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"text-sm",children:Le.title})]},Le.id))})]})]})]})})]})})}const ySt=()=>{const{user:t}=Gr(),{toast:r}=fi(),s=qr(),[n,a]=E.useState(!1),[o,l]=E.useState(null),[i,d]=E.useState({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,links:[{title:"",canva_share_link:"",sort_order:0}]}),[m,g]=E.useState(null),[y,v]=E.useState(""),{data:b=[],isLoading:N}=Ht({queryKey:["social-swag-admin"],queryFn:async()=>{const{data:H,error:W}=await Z.from("social_swag").select("*").order("publish_date",{ascending:!1});if(W)throw W;const{data:X,error:se}=await Z.from("social_swag_links").select("*").order("sort_order");if(se)throw se;return H.map(le=>({...le,links:(X==null?void 0:X.filter(ne=>ne.swag_id===le.id))||[]}))}}),j=Jt({mutationFn:async H=>{let W=H.existingImageUrl;if(H.image){const fe=H.image.name.split(".").pop(),oe=`${Date.now()}-${Math.random().toString(36).substring(7)}.${fe}`,{error:de}=await Z.storage.from("template-previews").upload(oe,H.image);if(de)throw de;const{data:ue}=Z.storage.from("template-previews").getPublicUrl(oe);W=ue.publicUrl}const X={title:H.item.title,description:H.item.description||null,preview_image_url:W,publish_date:H.item.publish_date?new Date(H.item.publish_date).toISOString():new Date().toISOString(),is_published:H.item.is_published,created_by:t==null?void 0:t.id};let se=H.itemId;const ae=!se,le=(o==null?void 0:o.is_published)||!1;if(se){const{error:fe}=await Z.from("social_swag").update(X).eq("id",se);if(fe)throw fe;await Z.from("social_swag_links").delete().eq("swag_id",se)}else{const{data:fe,error:oe}=await Z.from("social_swag").insert(X).select().single();if(oe)throw oe;se=fe.id}const ne=H.item.links.filter(fe=>fe.title.trim()&&fe.canva_share_link.trim());if(ne.length>0){const fe=ne.map((de,ue)=>({swag_id:se,title:de.title.trim(),canva_share_link:de.canva_share_link.trim(),sort_order:ue})),{error:oe}=await Z.from("social_swag_links").insert(fe);if(oe)throw oe}return{itemId:se,itemTitle:H.item.title,isNewItem:ae,wasPublished:le,isPublished:H.item.is_published}},onSuccess:H=>{s.invalidateQueries({queryKey:["social-swag-admin"]}),s.invalidateQueries({queryKey:["social-swag"]}),r({title:o?"Item updated":"Item created"}),H.isPublished&&(H.isNewItem||!H.wasPublished)&&kpe(H.itemTitle,H.itemId),a(!1),A()},onError:H=>{r({title:"Error saving item",description:H.message,variant:"destructive"})}}),S=Jt({mutationFn:async H=>{const{error:W}=await Z.from("social_swag").delete().eq("id",H);if(W)throw W},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-admin"]}),s.invalidateQueries({queryKey:["social-swag"]}),r({title:"Item deleted"})},onError:H=>{r({title:"Error deleting item",description:H.message,variant:"destructive"})}}),A=()=>{d({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,links:[{title:"",canva_share_link:"",sort_order:0}]}),g(null),v(""),l(null)},M=H=>{l(H),d({title:H.title,description:H.description||"",publish_date:H.publish_date?new Date(H.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:H.is_published,links:H.links&&H.links.length>0?H.links.map(W=>({id:W.id,title:W.title,canva_share_link:W.canva_share_link,sort_order:W.sort_order})):[{title:"",canva_share_link:"",sort_order:0}]}),v(H.preview_image_url||""),a(!0)},I=H=>{var X;const W=(X=H.target.files)==null?void 0:X[0];W&&(g(W),v(URL.createObjectURL(W)))},F=()=>{d({...i,links:[...i.links,{title:"",canva_share_link:"",sort_order:i.links.length}]})},O=H=>{if(i.links.length<=1)return;const W=i.links.filter((X,se)=>se!==H);d({...i,links:W})},B=(H,W,X)=>{const se=[...i.links];se[H]={...se[H],[W]:X},d({...i,links:se})},$=H=>{if(H.preventDefault(),!i.title.trim()){r({title:"Title is required",variant:"destructive"});return}j.mutate({item:i,image:m,existingImageUrl:(o==null?void 0:o.preview_image_url)||null,itemId:o==null?void 0:o.id})};return e.jsx(Fr,{title:"Manage Social Swag",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(Lu,{title:"Manage Social Swag",description:"Create and manage social media content"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Items"})}),e.jsx(qe,{children:e.jsx("div",{className:"text-2xl font-bold",children:b.length})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),e.jsx(qe,{children:e.jsx("div",{className:"text-2xl font-bold",children:b.filter(H=>H.is_published).length})})]})]}),e.jsxs(Dr,{open:n,onOpenChange:H=>{a(H),H||A()},children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{className:"gap-2",children:[e.jsx(gs,{className:"h-4 w-4"}),"Add Item"]})}),e.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsx(Ur,{children:e.jsx(Br,{children:o?"Edit Item":"Add New Item"})}),e.jsxs("form",{onSubmit:$,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"title",children:"Title *"}),e.jsx(Qe,{id:"title",value:i.title,onChange:H=>d({...i,title:H.target.value}),placeholder:"Enter title"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Description"}),e.jsx(eg,{content:i.description,onChange:H=>d({...i,description:H}),placeholder:"Enter description",minHeight:"120px"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"publish_date",children:"Publish Date"}),e.jsx(Qe,{id:"publish_date",type:"date",value:i.publish_date,onChange:H=>d({...i,publish_date:H.target.value})})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(xn,{id:"is_published",checked:i.is_published,onCheckedChange:H=>d({...i,is_published:H})}),e.jsx(Ee,{htmlFor:"is_published",children:"Published"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Preview Image"}),y?e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:y,alt:"Preview",className:"w-full max-h-48 object-contain rounded-lg border"}),e.jsx(Q,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{g(null),v("")},children:e.jsx(rn,{className:"h-3 w-3"})})]}):e.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:[e.jsx(El,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),e.jsx(Qe,{type:"file",accept:"image/*",onChange:I,className:"cursor-pointer"})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ee,{children:"Canva Links"}),e.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:F,children:[e.jsx(gs,{className:"h-3 w-3 mr-1"}),"Add Link"]})]}),i.links.map((H,W)=>e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4 pb-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["Link ",W+1]}),i.links.length>1&&e.jsx(Q,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>O(W),children:e.jsx(rn,{className:"h-3 w-3"})})]}),e.jsx(Qe,{placeholder:"Link title (e.g., Instagram Post)",value:H.title,onChange:X=>B(W,"title",X.target.value)}),e.jsx(Qe,{placeholder:"Canva share link",value:H.canva_share_link,onChange:X=>B(W,"canva_share_link",X.target.value)})]})},W))]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsx(Q,{type:"submit",disabled:j.isPending,children:j.isPending?"Saving...":o?"Update":"Create"})]})]})]})]})]}),e.jsx(ze,{children:e.jsx(qe,{className:"p-0",children:N?e.jsx("div",{className:"flex justify-center py-8",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):b.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'No items yet. Click "Add Item" to create your first one.'}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{className:"w-16",children:"Preview"}),e.jsx(Ct,{children:"Title"}),e.jsx(Ct,{children:"Links"}),e.jsx(Ct,{children:"Publish Date"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{className:"text-right",children:"Actions"})]})}),e.jsx(zn,{children:b.map(H=>{var W;return e.jsxs(Nr,{children:[e.jsx(dt,{children:H.preview_image_url?e.jsx("img",{src:H.preview_image_url,alt:"",className:"w-12 h-12 object-cover rounded"}):e.jsx("div",{className:"w-12 h-12 bg-muted rounded flex items-center justify-center",children:e.jsx(El,{className:"h-4 w-4 text-muted-foreground"})})}),e.jsx(dt,{className:"font-medium",children:H.title}),e.jsxs(dt,{children:[((W=H.links)==null?void 0:W.length)||0," links"]}),e.jsx(dt,{children:new Date(H.publish_date).toLocaleDateString()}),e.jsx(dt,{children:e.jsx(bt,{variant:H.is_published?"default":"secondary",children:H.is_published?"Published":"Draft"})}),e.jsx(dt,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>window.open(`/social-swag/${H.id}`,"_blank"),children:e.jsx(Gi,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>M(H),children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this item?")&&S.mutate(H.id)},children:e.jsx(Rs,{className:"h-4 w-4"})})]})})]},H.id)})})]})})})]})})};function vSt(){for(var t=arguments.length,r=new Array(t),s=0;sn=>{r.forEach(a=>a(n))},r)}const Uae=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Y3(t){const r=Object.prototype.toString.call(t);return r==="[object Window]"||r==="[object global]"}function Q0e(t){return"nodeType"in t}function Hh(t){var r,s;return t?Y3(t)?t:Q0e(t)&&(r=(s=t.ownerDocument)==null?void 0:s.defaultView)!=null?r:window:window}function J0e(t){const{Document:r}=Hh(t);return t instanceof r}function OP(t){return Y3(t)?!1:t instanceof Hh(t).HTMLElement}function gBe(t){return t instanceof Hh(t).SVGElement}function X3(t){return t?Y3(t)?t.document:Q0e(t)?J0e(t)?t:OP(t)||gBe(t)?t.ownerDocument:document:document:document}const lx=Uae?E.useLayoutEffect:E.useEffect;function e1e(t){const r=E.useRef(t);return lx(()=>{r.current=t}),E.useCallback(function(){for(var s=arguments.length,n=new Array(s),a=0;a{t.current=setInterval(n,a)},[]),s=E.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[r,s]}function mI(t,r){r===void 0&&(r=[t]);const s=E.useRef(t);return lx(()=>{s.current!==t&&(s.current=t)},r),s}function DP(t,r){const s=E.useRef();return E.useMemo(()=>{const n=t(s.current);return s.current=n,n},[...r])}function sse(t){const r=e1e(t),s=E.useRef(null),n=E.useCallback(a=>{a!==s.current&&(r==null||r(a,s.current)),s.current=a},[]);return[s,n]}function Npe(t){const r=E.useRef();return E.useEffect(()=>{r.current=t},[t]),r.current}let Bde={};function RP(t,r){return E.useMemo(()=>{if(r)return r;const s=Bde[t]==null?0:Bde[t]+1;return Bde[t]=s,t+"-"+s},[t,r])}function xBe(t){return function(r){for(var s=arguments.length,n=new Array(s>1?s-1:0),a=1;a{const i=Object.entries(l);for(const[d,m]of i){const g=o[d];g!=null&&(o[d]=g+t*m)}return o},{...r})}}const uC=xBe(1),pI=xBe(-1);function bSt(t){return"clientX"in t&&"clientY"in t}function t1e(t){if(!t)return!1;const{KeyboardEvent:r}=Hh(t.target);return r&&t instanceof r}function wSt(t){if(!t)return!1;const{TouchEvent:r}=Hh(t.target);return r&&t instanceof r}function Spe(t){if(wSt(t)){if(t.touches&&t.touches.length){const{clientX:r,clientY:s}=t.touches[0];return{x:r,y:s}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:r,clientY:s}=t.changedTouches[0];return{x:r,y:s}}}return bSt(t)?{x:t.clientX,y:t.clientY}:null}const fI=Object.freeze({Translate:{toString(t){if(!t)return;const{x:r,y:s}=t;return"translate3d("+(r?Math.round(r):0)+"px, "+(s?Math.round(s):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:r,scaleY:s}=t;return"scaleX("+r+") scaleY("+s+")"}},Transform:{toString(t){if(t)return[fI.Translate.toString(t),fI.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:r,duration:s,easing:n}=t;return r+" "+s+"ms "+n}}}),rCe="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function jSt(t){return t.matches(rCe)?t:t.querySelector(rCe)}const kSt={display:"none"};function NSt(t){let{id:r,value:s}=t;return lt.createElement("div",{id:r,style:kSt},s)}function SSt(t){let{id:r,announcement:s,ariaLiveType:n="assertive"}=t;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:r,style:a,role:"status","aria-live":n,"aria-atomic":!0},s)}function CSt(){const[t,r]=E.useState("");return{announce:E.useCallback(n=>{n!=null&&r(n)},[]),announcement:t}}const yBe=E.createContext(null);function MSt(t){const r=E.useContext(yBe);E.useEffect(()=>{if(!r)throw new Error("useDndMonitor must be used within a children of ");return r(t)},[t,r])}function TSt(){const[t]=E.useState(()=>new Set),r=E.useCallback(n=>(t.add(n),()=>t.delete(n)),[t]);return[E.useCallback(n=>{let{type:a,event:o}=n;t.forEach(l=>{var i;return(i=l[a])==null?void 0:i.call(l,o)})},[t]),r]}const ASt={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. `},ESt={onDragStart(t){let{active:r}=t;return"Picked up draggable item "+r.id+"."},onDragOver(t){let{active:r,over:s}=t;return s?"Draggable item "+r.id+" was moved over droppable area "+s.id+".":"Draggable item "+r.id+" is no longer over a droppable area."},onDragEnd(t){let{active:r,over:s}=t;return s?"Draggable item "+r.id+" was dropped over droppable area "+s.id:"Draggable item "+r.id+" was dropped."},onDragCancel(t){let{active:r}=t;return"Dragging was cancelled. Draggable item "+r.id+" was dropped."}};function ISt(t){let{announcements:r=ESt,container:s,hiddenTextDescribedById:n,screenReaderInstructions:a=ASt}=t;const{announce:o,announcement:l}=CSt(),i=RP("DndLiveRegion"),[d,m]=E.useState(!1);if(E.useEffect(()=>{m(!0)},[]),MSt(E.useMemo(()=>({onDragStart(y){let{active:v}=y;o(r.onDragStart({active:v}))},onDragMove(y){let{active:v,over:b}=y;r.onDragMove&&o(r.onDragMove({active:v,over:b}))},onDragOver(y){let{active:v,over:b}=y;o(r.onDragOver({active:v,over:b}))},onDragEnd(y){let{active:v,over:b}=y;o(r.onDragEnd({active:v,over:b}))},onDragCancel(y){let{active:v,over:b}=y;o(r.onDragCancel({active:v,over:b}))}}),[o,r])),!d)return null;const g=lt.createElement(lt.Fragment,null,lt.createElement(NSt,{id:n,value:a.draggable}),lt.createElement(SSt,{id:i,announcement:l}));return s?Ph.createPortal(g,s):g}var md;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(md||(md={}));function nse(){}function sCe(t,r){return E.useMemo(()=>({sensor:t,options:r??{}}),[t,r])}function PSt(){for(var t=arguments.length,r=new Array(t),s=0;s[...r].filter(n=>n!=null),[...r])}const Yf=Object.freeze({x:0,y:0});function vBe(t,r){return Math.sqrt(Math.pow(t.x-r.x,2)+Math.pow(t.y-r.y,2))}function _Be(t,r){let{data:{value:s}}=t,{data:{value:n}}=r;return s-n}function LSt(t,r){let{data:{value:s}}=t,{data:{value:n}}=r;return n-s}function nCe(t){let{left:r,top:s,height:n,width:a}=t;return[{x:r,y:s},{x:r+a,y:s},{x:r,y:s+n},{x:r+a,y:s+n}]}function bBe(t,r){if(!t||t.length===0)return null;const[s]=t;return s[r]}function aCe(t,r,s){return r===void 0&&(r=t.left),s===void 0&&(s=t.top),{x:r+t.width*.5,y:s+t.height*.5}}const OSt=t=>{let{collisionRect:r,droppableRects:s,droppableContainers:n}=t;const a=aCe(r,r.left,r.top),o=[];for(const l of n){const{id:i}=l,d=s.get(i);if(d){const m=vBe(aCe(d),a);o.push({id:i,data:{droppableContainer:l,value:m}})}}return o.sort(_Be)},DSt=t=>{let{collisionRect:r,droppableRects:s,droppableContainers:n}=t;const a=nCe(r),o=[];for(const l of n){const{id:i}=l,d=s.get(i);if(d){const m=nCe(d),g=a.reduce((v,b,N)=>v+vBe(m[N],b),0),y=Number((g/4).toFixed(4));o.push({id:i,data:{droppableContainer:l,value:y}})}}return o.sort(_Be)};function RSt(t,r){const s=Math.max(r.top,t.top),n=Math.max(r.left,t.left),a=Math.min(r.left+r.width,t.left+t.width),o=Math.min(r.top+r.height,t.top+t.height),l=a-n,i=o-s;if(n{let{collisionRect:r,droppableRects:s,droppableContainers:n}=t;const a=[];for(const o of n){const{id:l}=o,i=s.get(l);if(i){const d=RSt(i,r);d>0&&a.push({id:l,data:{droppableContainer:o,value:d}})}}return a.sort(LSt)};function zSt(t,r,s){return{...t,scaleX:r&&s?r.width/s.width:1,scaleY:r&&s?r.height/s.height:1}}function wBe(t,r){return t&&r?{x:t.left-r.left,y:t.top-r.top}:Yf}function BSt(t){return function(s){for(var n=arguments.length,a=new Array(n>1?n-1:0),o=1;o({...l,top:l.top+t*i.y,bottom:l.bottom+t*i.y,left:l.left+t*i.x,right:l.right+t*i.x}),{...s})}}const $St=BSt(1);function USt(t){if(t.startsWith("matrix3d(")){const r=t.slice(9,-1).split(/, /);return{x:+r[12],y:+r[13],scaleX:+r[0],scaleY:+r[5]}}else if(t.startsWith("matrix(")){const r=t.slice(7,-1).split(/, /);return{x:+r[4],y:+r[5],scaleX:+r[0],scaleY:+r[3]}}return null}function qSt(t,r,s){const n=USt(r);if(!n)return t;const{scaleX:a,scaleY:o,x:l,y:i}=n,d=t.left-l-(1-a)*parseFloat(s),m=t.top-i-(1-o)*parseFloat(s.slice(s.indexOf(" ")+1)),g=a?t.width/a:t.width,y=o?t.height/o:t.height;return{width:g,height:y,top:m,right:d+g,bottom:m+y,left:d}}const VSt={ignoreTransform:!1};function Q3(t,r){r===void 0&&(r=VSt);let s=t.getBoundingClientRect();if(r.ignoreTransform){const{transform:m,transformOrigin:g}=Hh(t).getComputedStyle(t);m&&(s=qSt(s,m,g))}const{top:n,left:a,width:o,height:l,bottom:i,right:d}=s;return{top:n,left:a,width:o,height:l,bottom:i,right:d}}function iCe(t){return Q3(t,{ignoreTransform:!0})}function HSt(t){const r=t.innerWidth,s=t.innerHeight;return{top:0,left:0,right:r,bottom:s,width:r,height:s}}function WSt(t,r){return r===void 0&&(r=Hh(t).getComputedStyle(t)),r.position==="fixed"}function GSt(t,r){r===void 0&&(r=Hh(t).getComputedStyle(t));const s=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const o=r[a];return typeof o=="string"?s.test(o):!1})}function qae(t,r){const s=[];function n(a){if(r!=null&&s.length>=r||!a)return s;if(J0e(a)&&a.scrollingElement!=null&&!s.includes(a.scrollingElement))return s.push(a.scrollingElement),s;if(!OP(a)||gBe(a)||s.includes(a))return s;const o=Hh(t).getComputedStyle(a);return a!==t&&GSt(a,o)&&s.push(a),WSt(a,o)?s:n(a.parentNode)}return t?n(t):s}function jBe(t){const[r]=qae(t,1);return r??null}function $de(t){return!Uae||!t?null:Y3(t)?t:Q0e(t)?J0e(t)||t===X3(t).scrollingElement?window:OP(t)?t:null:null}function kBe(t){return Y3(t)?t.scrollX:t.scrollLeft}function NBe(t){return Y3(t)?t.scrollY:t.scrollTop}function Cpe(t){return{x:kBe(t),y:NBe(t)}}var Dd;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Dd||(Dd={}));function SBe(t){return!Uae||!t?!1:t===document.scrollingElement}function CBe(t){const r={x:0,y:0},s=SBe(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},n={x:t.scrollWidth-s.width,y:t.scrollHeight-s.height},a=t.scrollTop<=r.y,o=t.scrollLeft<=r.x,l=t.scrollTop>=n.y,i=t.scrollLeft>=n.x;return{isTop:a,isLeft:o,isBottom:l,isRight:i,maxScroll:n,minScroll:r}}const KSt={x:.2,y:.2};function ZSt(t,r,s,n,a){let{top:o,left:l,right:i,bottom:d}=s;n===void 0&&(n=10),a===void 0&&(a=KSt);const{isTop:m,isBottom:g,isLeft:y,isRight:v}=CBe(t),b={x:0,y:0},N={x:0,y:0},j={height:r.height*a.y,width:r.width*a.x};return!m&&o<=r.top+j.height?(b.y=Dd.Backward,N.y=n*Math.abs((r.top+j.height-o)/j.height)):!g&&d>=r.bottom-j.height&&(b.y=Dd.Forward,N.y=n*Math.abs((r.bottom-j.height-d)/j.height)),!v&&i>=r.right-j.width?(b.x=Dd.Forward,N.x=n*Math.abs((r.right-j.width-i)/j.width)):!y&&l<=r.left+j.width&&(b.x=Dd.Backward,N.x=n*Math.abs((r.left+j.width-l)/j.width)),{direction:b,speed:N}}function YSt(t){if(t===document.scrollingElement){const{innerWidth:o,innerHeight:l}=window;return{top:0,left:0,right:o,bottom:l,width:o,height:l}}const{top:r,left:s,right:n,bottom:a}=t.getBoundingClientRect();return{top:r,left:s,right:n,bottom:a,width:t.clientWidth,height:t.clientHeight}}function MBe(t){return t.reduce((r,s)=>uC(r,Cpe(s)),Yf)}function XSt(t){return t.reduce((r,s)=>r+kBe(s),0)}function QSt(t){return t.reduce((r,s)=>r+NBe(s),0)}function JSt(t,r){if(r===void 0&&(r=Q3),!t)return;const{top:s,left:n,bottom:a,right:o}=r(t);jBe(t)&&(a<=0||o<=0||s>=window.innerHeight||n>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const eCt=[["x",["left","right"],XSt],["y",["top","bottom"],QSt]];class r1e{constructor(r,s){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 n=qae(s),a=MBe(n);this.rect={...r},this.width=r.width,this.height=r.height;for(const[o,l,i]of eCt)for(const d of l)Object.defineProperty(this,d,{get:()=>{const m=i(n),g=a[o]-m;return this.rect[d]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class hE{constructor(r){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(s=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...s)})},this.target=r}add(r,s,n){var a;(a=this.target)==null||a.addEventListener(r,s,n),this.listeners.push([r,s,n])}}function tCt(t){const{EventTarget:r}=Hh(t);return t instanceof r?t:X3(t)}function Ude(t,r){const s=Math.abs(t.x),n=Math.abs(t.y);return typeof r=="number"?Math.sqrt(s**2+n**2)>r:"x"in r&&"y"in r?s>r.x&&n>r.y:"x"in r?s>r.x:"y"in r?n>r.y:!1}var ap;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(ap||(ap={}));function oCe(t){t.preventDefault()}function rCt(t){t.stopPropagation()}var io;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(io||(io={}));const TBe={start:[io.Space,io.Enter],cancel:[io.Esc],end:[io.Space,io.Enter,io.Tab]},sCt=(t,r)=>{let{currentCoordinates:s}=r;switch(t.code){case io.Right:return{...s,x:s.x+25};case io.Left:return{...s,x:s.x-25};case io.Down:return{...s,y:s.y+25};case io.Up:return{...s,y:s.y-25}}};class s1e{constructor(r){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=r;const{event:{target:s}}=r;this.props=r,this.listeners=new hE(X3(s)),this.windowListeners=new hE(Hh(s)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ap.Resize,this.handleCancel),this.windowListeners.add(ap.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ap.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:r,onStart:s}=this.props,n=r.node.current;n&&JSt(n),s(Yf)}handleKeyDown(r){if(t1e(r)){const{active:s,context:n,options:a}=this.props,{keyboardCodes:o=TBe,coordinateGetter:l=sCt,scrollBehavior:i="smooth"}=a,{code:d}=r;if(o.end.includes(d)){this.handleEnd(r);return}if(o.cancel.includes(d)){this.handleCancel(r);return}const{collisionRect:m}=n.current,g=m?{x:m.left,y:m.top}:Yf;this.referenceCoordinates||(this.referenceCoordinates=g);const y=l(r,{active:s,context:n.current,currentCoordinates:g});if(y){const v=pI(y,g),b={x:0,y:0},{scrollableAncestors:N}=n.current;for(const j of N){const S=r.code,{isTop:A,isRight:M,isLeft:I,isBottom:F,maxScroll:O,minScroll:B}=CBe(j),$=YSt(j),H={x:Math.min(S===io.Right?$.right-$.width/2:$.right,Math.max(S===io.Right?$.left:$.left+$.width/2,y.x)),y:Math.min(S===io.Down?$.bottom-$.height/2:$.bottom,Math.max(S===io.Down?$.top:$.top+$.height/2,y.y))},W=S===io.Right&&!M||S===io.Left&&!I,X=S===io.Down&&!F||S===io.Up&&!A;if(W&&H.x!==y.x){const se=j.scrollLeft+v.x,ae=S===io.Right&&se<=O.x||S===io.Left&&se>=B.x;if(ae&&!v.y){j.scrollTo({left:se,behavior:i});return}ae?b.x=j.scrollLeft-se:b.x=S===io.Right?j.scrollLeft-O.x:j.scrollLeft-B.x,b.x&&j.scrollBy({left:-b.x,behavior:i});break}else if(X&&H.y!==y.y){const se=j.scrollTop+v.y,ae=S===io.Down&&se<=O.y||S===io.Up&&se>=B.y;if(ae&&!v.x){j.scrollTo({top:se,behavior:i});return}ae?b.y=j.scrollTop-se:b.y=S===io.Down?j.scrollTop-O.y:j.scrollTop-B.y,b.y&&j.scrollBy({top:-b.y,behavior:i});break}}this.handleMove(r,uC(pI(y,this.referenceCoordinates),b))}}}handleMove(r,s){const{onMove:n}=this.props;r.preventDefault(),n(s)}handleEnd(r){const{onEnd:s}=this.props;r.preventDefault(),this.detach(),s()}handleCancel(r){const{onCancel:s}=this.props;r.preventDefault(),this.detach(),s()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}s1e.activators=[{eventName:"onKeyDown",handler:(t,r,s)=>{let{keyboardCodes:n=TBe,onActivation:a}=r,{active:o}=s;const{code:l}=t.nativeEvent;if(n.start.includes(l)){const i=o.activatorNode.current;return i&&t.target!==i?!1:(t.preventDefault(),a==null||a({event:t.nativeEvent}),!0)}return!1}}];function lCe(t){return!!(t&&"distance"in t)}function cCe(t){return!!(t&&"delay"in t)}class n1e{constructor(r,s,n){var a;n===void 0&&(n=tCt(r.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=r,this.events=s;const{event:o}=r,{target:l}=o;this.props=r,this.events=s,this.document=X3(l),this.documentListeners=new hE(this.document),this.listeners=new hE(n),this.windowListeners=new hE(Hh(l)),this.initialCoordinates=(a=Spe(o))!=null?a:Yf,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:r,props:{options:{activationConstraint:s,bypassActivationConstraint:n}}}=this;if(this.listeners.add(r.move.name,this.handleMove,{passive:!1}),this.listeners.add(r.end.name,this.handleEnd),r.cancel&&this.listeners.add(r.cancel.name,this.handleCancel),this.windowListeners.add(ap.Resize,this.handleCancel),this.windowListeners.add(ap.DragStart,oCe),this.windowListeners.add(ap.VisibilityChange,this.handleCancel),this.windowListeners.add(ap.ContextMenu,oCe),this.documentListeners.add(ap.Keydown,this.handleKeydown),s){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(cCe(s)){this.timeoutId=setTimeout(this.handleStart,s.delay),this.handlePending(s);return}if(lCe(s)){this.handlePending(s);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(r,s){const{active:n,onPending:a}=this.props;a(n,r,this.initialCoordinates,s)}handleStart(){const{initialCoordinates:r}=this,{onStart:s}=this.props;r&&(this.activated=!0,this.documentListeners.add(ap.Click,rCt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ap.SelectionChange,this.removeTextSelection),s(r))}handleMove(r){var s;const{activated:n,initialCoordinates:a,props:o}=this,{onMove:l,options:{activationConstraint:i}}=o;if(!a)return;const d=(s=Spe(r))!=null?s:Yf,m=pI(a,d);if(!n&&i){if(lCe(i)){if(i.tolerance!=null&&Ude(m,i.tolerance))return this.handleCancel();if(Ude(m,i.distance))return this.handleStart()}if(cCe(i)&&Ude(m,i.tolerance))return this.handleCancel();this.handlePending(i,m);return}r.cancelable&&r.preventDefault(),l(d)}handleEnd(){const{onAbort:r,onEnd:s}=this.props;this.detach(),this.activated||r(this.props.active),s()}handleCancel(){const{onAbort:r,onCancel:s}=this.props;this.detach(),this.activated||r(this.props.active),s()}handleKeydown(r){r.code===io.Esc&&this.handleCancel()}removeTextSelection(){var r;(r=this.document.getSelection())==null||r.removeAllRanges()}}const nCt={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class a1e extends n1e{constructor(r){const{event:s}=r,n=X3(s.target);super(r,nCt,n)}}a1e.activators=[{eventName:"onPointerDown",handler:(t,r)=>{let{nativeEvent:s}=t,{onActivation:n}=r;return!s.isPrimary||s.button!==0?!1:(n==null||n({event:s}),!0)}}];const aCt={move:{name:"mousemove"},end:{name:"mouseup"}};var Mpe;(function(t){t[t.RightClick=2]="RightClick"})(Mpe||(Mpe={}));class iCt extends n1e{constructor(r){super(r,aCt,X3(r.event.target))}}iCt.activators=[{eventName:"onMouseDown",handler:(t,r)=>{let{nativeEvent:s}=t,{onActivation:n}=r;return s.button===Mpe.RightClick?!1:(n==null||n({event:s}),!0)}}];const qde={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class oCt extends n1e{constructor(r){super(r,qde)}static setup(){return window.addEventListener(qde.move.name,r,{capture:!1,passive:!1}),function(){window.removeEventListener(qde.move.name,r)};function r(){}}}oCt.activators=[{eventName:"onTouchStart",handler:(t,r)=>{let{nativeEvent:s}=t,{onActivation:n}=r;const{touches:a}=s;return a.length>1?!1:(n==null||n({event:s}),!0)}}];var mE;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(mE||(mE={}));var ase;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(ase||(ase={}));function lCt(t){let{acceleration:r,activator:s=mE.Pointer,canScroll:n,draggingRect:a,enabled:o,interval:l=5,order:i=ase.TreeOrder,pointerCoordinates:d,scrollableAncestors:m,scrollableAncestorRects:g,delta:y,threshold:v}=t;const b=dCt({delta:y,disabled:!o}),[N,j]=_St(),S=E.useRef({x:0,y:0}),A=E.useRef({x:0,y:0}),M=E.useMemo(()=>{switch(s){case mE.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case mE.DraggableRect:return a}},[s,a,d]),I=E.useRef(null),F=E.useCallback(()=>{const B=I.current;if(!B)return;const $=S.current.x*A.current.x,H=S.current.y*A.current.y;B.scrollBy($,H)},[]),O=E.useMemo(()=>i===ase.TreeOrder?[...m].reverse():m,[i,m]);E.useEffect(()=>{if(!o||!m.length||!M){j();return}for(const B of O){if((n==null?void 0:n(B))===!1)continue;const $=m.indexOf(B),H=g[$];if(!H)continue;const{direction:W,speed:X}=ZSt(B,H,M,r,v);for(const se of["x","y"])b[se][W[se]]||(X[se]=0,W[se]=0);if(X.x>0||X.y>0){j(),I.current=B,N(F,l),S.current=X,A.current=W;return}}S.current={x:0,y:0},A.current={x:0,y:0},j()},[r,F,n,j,o,l,JSON.stringify(M),JSON.stringify(b),N,m,O,g,JSON.stringify(v)])}const cCt={x:{[Dd.Backward]:!1,[Dd.Forward]:!1},y:{[Dd.Backward]:!1,[Dd.Forward]:!1}};function dCt(t){let{delta:r,disabled:s}=t;const n=Npe(r);return DP(a=>{if(s||!n||!a)return cCt;const o={x:Math.sign(r.x-n.x),y:Math.sign(r.y-n.y)};return{x:{[Dd.Backward]:a.x[Dd.Backward]||o.x===-1,[Dd.Forward]:a.x[Dd.Forward]||o.x===1},y:{[Dd.Backward]:a.y[Dd.Backward]||o.y===-1,[Dd.Forward]:a.y[Dd.Forward]||o.y===1}}},[s,r,n])}function uCt(t,r){const s=r!=null?t.get(r):void 0,n=s?s.node.current:null;return DP(a=>{var o;return r==null?null:(o=n??a)!=null?o:null},[n,r])}function hCt(t,r){return E.useMemo(()=>t.reduce((s,n)=>{const{sensor:a}=n,o=a.activators.map(l=>({eventName:l.eventName,handler:r(l.handler,n)}));return[...s,...o]},[]),[t,r])}var gI;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(gI||(gI={}));var Tpe;(function(t){t.Optimized="optimized"})(Tpe||(Tpe={}));const dCe=new Map;function mCt(t,r){let{dragging:s,dependencies:n,config:a}=r;const[o,l]=E.useState(null),{frequency:i,measure:d,strategy:m}=a,g=E.useRef(t),y=S(),v=mI(y),b=E.useCallback(function(A){A===void 0&&(A=[]),!v.current&&l(M=>M===null?A:M.concat(A.filter(I=>!M.includes(I))))},[v]),N=E.useRef(null),j=DP(A=>{if(y&&!s)return dCe;if(!A||A===dCe||g.current!==t||o!=null){const M=new Map;for(let I of t){if(!I)continue;if(o&&o.length>0&&!o.includes(I.id)&&I.rect.current){M.set(I.id,I.rect.current);continue}const F=I.node.current,O=F?new r1e(d(F),F):null;I.rect.current=O,O&&M.set(I.id,O)}return M}return A},[t,o,s,y,d]);return E.useEffect(()=>{g.current=t},[t]),E.useEffect(()=>{y||b()},[s,y]),E.useEffect(()=>{o&&o.length>0&&l(null)},[JSON.stringify(o)]),E.useEffect(()=>{y||typeof i!="number"||N.current!==null||(N.current=setTimeout(()=>{b(),N.current=null},i))},[i,y,b,...n]),{droppableRects:j,measureDroppableContainers:b,measuringScheduled:o!=null};function S(){switch(m){case gI.Always:return!1;case gI.BeforeDragging:return s;default:return!s}}}function ABe(t,r){return DP(s=>t?s||(typeof r=="function"?r(t):t):null,[r,t])}function pCt(t,r){return ABe(t,r)}function fCt(t){let{callback:r,disabled:s}=t;const n=e1e(r),a=E.useMemo(()=>{if(s||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(n)},[n,s]);return E.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function Vae(t){let{callback:r,disabled:s}=t;const n=e1e(r),a=E.useMemo(()=>{if(s||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(n)},[s]);return E.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function gCt(t){return new r1e(Q3(t),t)}function uCe(t,r,s){r===void 0&&(r=gCt);const[n,a]=E.useState(null);function o(){a(d=>{if(!t)return null;if(t.isConnected===!1){var m;return(m=d??s)!=null?m:null}const g=r(t);return JSON.stringify(d)===JSON.stringify(g)?d:g})}const l=fCt({callback(d){if(t)for(const m of d){const{type:g,target:y}=m;if(g==="childList"&&y instanceof HTMLElement&&y.contains(t)){o();break}}}}),i=Vae({callback:o});return lx(()=>{o(),t?(i==null||i.observe(t),l==null||l.observe(document.body,{childList:!0,subtree:!0})):(i==null||i.disconnect(),l==null||l.disconnect())},[t]),n}function xCt(t){const r=ABe(t);return wBe(t,r)}const hCe=[];function yCt(t){const r=E.useRef(t),s=DP(n=>t?n&&n!==hCe&&t&&r.current&&t.parentNode===r.current.parentNode?n:qae(t):hCe,[t]);return E.useEffect(()=>{r.current=t},[t]),s}function vCt(t){const[r,s]=E.useState(null),n=E.useRef(t),a=E.useCallback(o=>{const l=$de(o.target);l&&s(i=>i?(i.set(l,Cpe(l)),new Map(i)):null)},[]);return E.useEffect(()=>{const o=n.current;if(t!==o){l(o);const i=t.map(d=>{const m=$de(d);return m?(m.addEventListener("scroll",a,{passive:!0}),[m,Cpe(m)]):null}).filter(d=>d!=null);s(i.length?new Map(i):null),n.current=t}return()=>{l(t),l(o)};function l(i){i.forEach(d=>{const m=$de(d);m==null||m.removeEventListener("scroll",a)})}},[a,t]),E.useMemo(()=>t.length?r?Array.from(r.values()).reduce((o,l)=>uC(o,l),Yf):MBe(t):Yf,[t,r])}function mCe(t,r){r===void 0&&(r=[]);const s=E.useRef(null);return E.useEffect(()=>{s.current=null},r),E.useEffect(()=>{const n=t!==Yf;n&&!s.current&&(s.current=t),!n&&s.current&&(s.current=null)},[t]),s.current?pI(t,s.current):Yf}function _Ct(t){E.useEffect(()=>{if(!Uae)return;const r=t.map(s=>{let{sensor:n}=s;return n.setup==null?void 0:n.setup()});return()=>{for(const s of r)s==null||s()}},t.map(r=>{let{sensor:s}=r;return s}))}function bCt(t,r){return E.useMemo(()=>t.reduce((s,n)=>{let{eventName:a,handler:o}=n;return s[a]=l=>{o(l,r)},s},{}),[t,r])}function EBe(t){return E.useMemo(()=>t?HSt(t):null,[t])}const pCe=[];function wCt(t,r){r===void 0&&(r=Q3);const[s]=t,n=EBe(s?Hh(s):null),[a,o]=E.useState(pCe);function l(){o(()=>t.length?t.map(d=>SBe(d)?n:new r1e(r(d),d)):pCe)}const i=Vae({callback:l});return lx(()=>{i==null||i.disconnect(),l(),t.forEach(d=>i==null?void 0:i.observe(d))},[t]),a}function jCt(t){if(!t)return null;if(t.children.length>1)return t;const r=t.children[0];return OP(r)?r:t}function kCt(t){let{measure:r}=t;const[s,n]=E.useState(null),a=E.useCallback(m=>{for(const{target:g}of m)if(OP(g)){n(y=>{const v=r(g);return y?{...y,width:v.width,height:v.height}:v});break}},[r]),o=Vae({callback:a}),l=E.useCallback(m=>{const g=jCt(m);o==null||o.disconnect(),g&&(o==null||o.observe(g)),n(g?r(g):null)},[r,o]),[i,d]=sse(l);return E.useMemo(()=>({nodeRef:i,rect:s,setRef:d}),[s,i,d])}const NCt=[{sensor:a1e,options:{}},{sensor:s1e,options:{}}],SCt={current:{}},nte={draggable:{measure:iCe},droppable:{measure:iCe,strategy:gI.WhileDragging,frequency:Tpe.Optimized},dragOverlay:{measure:Q3}};class pE extends Map{get(r){var s;return r!=null&&(s=super.get(r))!=null?s:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(r=>{let{disabled:s}=r;return!s})}getNodeFor(r){var s,n;return(s=(n=this.get(r))==null?void 0:n.node.current)!=null?s:void 0}}const CCt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new pE,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:nse},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:nte,measureDroppableContainers:nse,windowRect:null,measuringScheduled:!1},MCt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:nse,draggableNodes:new Map,over:null,measureDroppableContainers:nse},Hae=E.createContext(MCt),IBe=E.createContext(CCt);function TCt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new pE}}}function ACt(t,r){switch(r.type){case md.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:r.initialCoordinates,active:r.active}};case md.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:r.coordinates.x-t.draggable.initialCoordinates.x,y:r.coordinates.y-t.draggable.initialCoordinates.y}}};case md.DragEnd:case md.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case md.RegisterDroppable:{const{element:s}=r,{id:n}=s,a=new pE(t.droppable.containers);return a.set(n,s),{...t,droppable:{...t.droppable,containers:a}}}case md.SetDroppableDisabled:{const{id:s,key:n,disabled:a}=r,o=t.droppable.containers.get(s);if(!o||n!==o.key)return t;const l=new pE(t.droppable.containers);return l.set(s,{...o,disabled:a}),{...t,droppable:{...t.droppable,containers:l}}}case md.UnregisterDroppable:{const{id:s,key:n}=r,a=t.droppable.containers.get(s);if(!a||n!==a.key)return t;const o=new pE(t.droppable.containers);return o.delete(s),{...t,droppable:{...t.droppable,containers:o}}}default:return t}}function ECt(t){let{disabled:r}=t;const{active:s,activatorEvent:n,draggableNodes:a}=E.useContext(Hae),o=Npe(n),l=Npe(s==null?void 0:s.id);return E.useEffect(()=>{if(!r&&!n&&o&&l!=null){if(!t1e(o)||document.activeElement===o.target)return;const i=a.get(l);if(!i)return;const{activatorNode:d,node:m}=i;if(!d.current&&!m.current)return;requestAnimationFrame(()=>{for(const g of[d.current,m.current]){if(!g)continue;const y=jSt(g);if(y){y.focus();break}}})}},[n,r,a,l,o]),null}function ICt(t,r){let{transform:s,...n}=r;return t!=null&&t.length?t.reduce((a,o)=>o({transform:a,...n}),s):s}function PCt(t){return E.useMemo(()=>({draggable:{...nte.draggable,...t==null?void 0:t.draggable},droppable:{...nte.droppable,...t==null?void 0:t.droppable},dragOverlay:{...nte.dragOverlay,...t==null?void 0:t.dragOverlay}}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function LCt(t){let{activeNode:r,measure:s,initialRect:n,config:a=!0}=t;const o=E.useRef(!1),{x:l,y:i}=typeof a=="boolean"?{x:a,y:a}:a;lx(()=>{if(!l&&!i||!r){o.current=!1;return}if(o.current||!n)return;const m=r==null?void 0:r.node.current;if(!m||m.isConnected===!1)return;const g=s(m),y=wBe(g,n);if(l||(y.x=0),i||(y.y=0),o.current=!0,Math.abs(y.x)>0||Math.abs(y.y)>0){const v=jBe(m);v&&v.scrollBy({top:y.y,left:y.x})}},[r,l,i,n,s])}const PBe=E.createContext({...Yf,scaleX:1,scaleY:1});var o1;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(o1||(o1={}));const OCt=E.memo(function(r){var s,n,a,o;let{id:l,accessibility:i,autoScroll:d=!0,children:m,sensors:g=NCt,collisionDetection:y=FSt,measuring:v,modifiers:b,...N}=r;const j=E.useReducer(ACt,void 0,TCt),[S,A]=j,[M,I]=TSt(),[F,O]=E.useState(o1.Uninitialized),B=F===o1.Initialized,{draggable:{active:$,nodes:H,translate:W},droppable:{containers:X}}=S,se=$!=null?H.get($):null,ae=E.useRef({initial:null,translated:null}),le=E.useMemo(()=>{var Ia;return $!=null?{id:$,data:(Ia=se==null?void 0:se.data)!=null?Ia:SCt,rect:ae}:null},[$,se]),ne=E.useRef(null),[fe,oe]=E.useState(null),[de,ue]=E.useState(null),xe=mI(N,Object.values(N)),Te=RP("DndDescribedBy",l),be=E.useMemo(()=>X.getEnabled(),[X]),we=PCt(v),{droppableRects:ve,measureDroppableContainers:tt,measuringScheduled:Ae}=mCt(be,{dragging:B,dependencies:[W.x,W.y],config:we.droppable}),Le=uCt(H,$),Ue=E.useMemo(()=>de?Spe(de):null,[de]),Ye=hi(),Ie=pCt(Le,we.draggable.measure);LCt({activeNode:$!=null?H.get($):null,config:Ye.layoutShiftCompensation,initialRect:Ie,measure:we.draggable.measure});const et=uCe(Le,we.draggable.measure,Ie),It=uCe(Le?Le.parentElement:null),Pe=E.useRef({activatorEvent:null,active:null,activeNode:Le,collisionRect:null,collisions:null,droppableRects:ve,draggableNodes:H,draggingNode:null,draggingNodeRect:null,droppableContainers:X,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),at=X.getNodeFor((s=Pe.current.over)==null?void 0:s.id),ce=kCt({measure:we.dragOverlay.measure}),$e=(n=ce.nodeRef.current)!=null?n:Le,Ge=B?(a=ce.rect)!=null?a:et:null,rt=!!(ce.nodeRef.current&&ce.rect),je=xCt(rt?null:et),it=EBe($e?Hh($e):null),Me=yCt(B?at??Le:null),Je=wCt(Me),Xe=ICt(b,{transform:{x:W.x-je.x,y:W.y-je.y,scaleX:1,scaleY:1},activatorEvent:de,active:le,activeNodeRect:et,containerNodeRect:It,draggingNodeRect:Ge,over:Pe.current.over,overlayNodeRect:ce.rect,scrollableAncestors:Me,scrollableAncestorRects:Je,windowRect:it}),Ve=Ue?uC(Ue,W):null,ot=vCt(Me),mt=mCe(ot),ft=mCe(ot,[et]),ct=uC(Xe,mt),Mt=Ge?$St(Ge,Xe):null,Ot=le&&Mt?y({active:le,collisionRect:Mt,droppableRects:ve,droppableContainers:be,pointerCoordinates:Ve}):null,rr=bBe(Ot,"id"),[Ir,cr]=E.useState(null),Mr=rt?Xe:uC(Xe,ft),As=zSt(Mr,(o=Ir==null?void 0:Ir.rect)!=null?o:null,et),At=E.useRef(null),Rt=E.useCallback((Ia,dn)=>{let{sensor:na,options:en}=dn;if(ne.current==null)return;const Un=H.get(ne.current);if(!Un)return;const Gn=Ia.nativeEvent,Ai=new na({active:ne.current,activeNode:Un,event:Gn,options:en,context:Pe,onAbort(Fa){if(!H.get(Fa))return;const{onDragAbort:Ti}=xe.current,Ys={id:Fa};Ti==null||Ti(Ys),M({type:"onDragAbort",event:Ys})},onPending(Fa,mo,Ti,Ys){if(!H.get(Fa))return;const{onDragPending:gc}=xe.current,jo={id:Fa,constraint:mo,initialCoordinates:Ti,offset:Ys};gc==null||gc(jo),M({type:"onDragPending",event:jo})},onStart(Fa){const mo=ne.current;if(mo==null)return;const Ti=H.get(mo);if(!Ti)return;const{onDragStart:Ys}=xe.current,ro={activatorEvent:Gn,active:{id:mo,data:Ti.data,rect:ae}};Ph.unstable_batchedUpdates(()=>{Ys==null||Ys(ro),O(o1.Initializing),A({type:md.DragStart,initialCoordinates:Fa,active:mo}),M({type:"onDragStart",event:ro}),oe(At.current),ue(Gn)})},onMove(Fa){A({type:md.DragMove,coordinates:Fa})},onEnd:dr(md.DragEnd),onCancel:dr(md.DragCancel)});At.current=Ai;function dr(Fa){return async function(){const{active:Ti,collisions:Ys,over:ro,scrollAdjustedTranslate:gc}=Pe.current;let jo=null;if(Ti&&gc){const{cancelDrop:xc}=xe.current;jo={activatorEvent:Gn,active:Ti,collisions:Ys,delta:gc,over:ro},Fa===md.DragEnd&&typeof xc=="function"&&await Promise.resolve(xc(jo))&&(Fa=md.DragCancel)}ne.current=null,Ph.unstable_batchedUpdates(()=>{A({type:Fa}),O(o1.Uninitialized),cr(null),oe(null),ue(null),At.current=null;const xc=Fa===md.DragEnd?"onDragEnd":"onDragCancel";if(jo){const st=xe.current[xc];st==null||st(jo),M({type:xc,event:jo})}})}}},[H]),Cr=E.useCallback((Ia,dn)=>(na,en)=>{const Un=na.nativeEvent,Gn=H.get(en);if(ne.current!==null||!Gn||Un.dndKit||Un.defaultPrevented)return;const Ai={active:Gn};Ia(na,dn.options,Ai)===!0&&(Un.dndKit={capturedBy:dn.sensor},ne.current=en,Rt(na,dn))},[H,Rt]),fs=hCt(g,Cr);_Ct(g),lx(()=>{et&&F===o1.Initializing&&O(o1.Initialized)},[et,F]),E.useEffect(()=>{const{onDragMove:Ia}=xe.current,{active:dn,activatorEvent:na,collisions:en,over:Un}=Pe.current;if(!dn||!na)return;const Gn={active:dn,activatorEvent:na,collisions:en,delta:{x:ct.x,y:ct.y},over:Un};Ph.unstable_batchedUpdates(()=>{Ia==null||Ia(Gn),M({type:"onDragMove",event:Gn})})},[ct.x,ct.y]),E.useEffect(()=>{const{active:Ia,activatorEvent:dn,collisions:na,droppableContainers:en,scrollAdjustedTranslate:Un}=Pe.current;if(!Ia||ne.current==null||!dn||!Un)return;const{onDragOver:Gn}=xe.current,Ai=en.get(rr),dr=Ai&&Ai.rect.current?{id:Ai.id,rect:Ai.rect.current,data:Ai.data,disabled:Ai.disabled}:null,Fa={active:Ia,activatorEvent:dn,collisions:na,delta:{x:Un.x,y:Un.y},over:dr};Ph.unstable_batchedUpdates(()=>{cr(dr),Gn==null||Gn(Fa),M({type:"onDragOver",event:Fa})})},[rr]),lx(()=>{Pe.current={activatorEvent:de,active:le,activeNode:Le,collisionRect:Mt,collisions:Ot,droppableRects:ve,draggableNodes:H,draggingNode:$e,draggingNodeRect:Ge,droppableContainers:X,over:Ir,scrollableAncestors:Me,scrollAdjustedTranslate:ct},ae.current={initial:Ge,translated:Mt}},[le,Le,Ot,Mt,H,$e,Ge,ve,X,Ir,Me,ct]),lCt({...Ye,delta:W,draggingRect:Mt,pointerCoordinates:Ve,scrollableAncestors:Me,scrollableAncestorRects:Je});const Vs=E.useMemo(()=>({active:le,activeNode:Le,activeNodeRect:et,activatorEvent:de,collisions:Ot,containerNodeRect:It,dragOverlay:ce,draggableNodes:H,droppableContainers:X,droppableRects:ve,over:Ir,measureDroppableContainers:tt,scrollableAncestors:Me,scrollableAncestorRects:Je,measuringConfiguration:we,measuringScheduled:Ae,windowRect:it}),[le,Le,et,de,Ot,It,ce,H,X,ve,Ir,tt,Me,Je,we,Ae,it]),Js=E.useMemo(()=>({activatorEvent:de,activators:fs,active:le,activeNodeRect:et,ariaDescribedById:{draggable:Te},dispatch:A,draggableNodes:H,over:Ir,measureDroppableContainers:tt}),[de,fs,le,et,A,Te,H,Ir,tt]);return lt.createElement(yBe.Provider,{value:I},lt.createElement(Hae.Provider,{value:Js},lt.createElement(IBe.Provider,{value:Vs},lt.createElement(PBe.Provider,{value:As},m)),lt.createElement(ECt,{disabled:(i==null?void 0:i.restoreFocus)===!1})),lt.createElement(ISt,{...i,hiddenTextDescribedById:Te}));function hi(){const Ia=(fe==null?void 0:fe.autoScrollEnabled)===!1,dn=typeof d=="object"?d.enabled===!1:d===!1,na=B&&!Ia&&!dn;return typeof d=="object"?{...d,enabled:na}:{enabled:na}}}),DCt=E.createContext(null),fCe="button",RCt="Draggable";function FCt(t){let{id:r,data:s,disabled:n=!1,attributes:a}=t;const o=RP(RCt),{activators:l,activatorEvent:i,active:d,activeNodeRect:m,ariaDescribedById:g,draggableNodes:y,over:v}=E.useContext(Hae),{role:b=fCe,roleDescription:N="draggable",tabIndex:j=0}=a??{},S=(d==null?void 0:d.id)===r,A=E.useContext(S?PBe:DCt),[M,I]=sse(),[F,O]=sse(),B=bCt(l,r),$=mI(s);lx(()=>(y.set(r,{id:r,key:o,node:M,activatorNode:F,data:$}),()=>{const W=y.get(r);W&&W.key===o&&y.delete(r)}),[y,r]);const H=E.useMemo(()=>({role:b,tabIndex:j,"aria-disabled":n,"aria-pressed":S&&b===fCe?!0:void 0,"aria-roledescription":N,"aria-describedby":g.draggable}),[n,b,j,S,N,g.draggable]);return{active:d,activatorEvent:i,activeNodeRect:m,attributes:H,isDragging:S,listeners:n?void 0:B,node:M,over:v,setNodeRef:I,setActivatorNodeRef:O,transform:A}}function zCt(){return E.useContext(IBe)}const BCt="Droppable",$Ct={timeout:25};function UCt(t){let{data:r,disabled:s=!1,id:n,resizeObserverConfig:a}=t;const o=RP(BCt),{active:l,dispatch:i,over:d,measureDroppableContainers:m}=E.useContext(Hae),g=E.useRef({disabled:s}),y=E.useRef(!1),v=E.useRef(null),b=E.useRef(null),{disabled:N,updateMeasurementsFor:j,timeout:S}={...$Ct,...a},A=mI(j??n),M=E.useCallback(()=>{if(!y.current){y.current=!0;return}b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{m(Array.isArray(A.current)?A.current:[A.current]),b.current=null},S)},[S]),I=Vae({callback:M,disabled:N||!l}),F=E.useCallback((H,W)=>{I&&(W&&(I.unobserve(W),y.current=!1),H&&I.observe(H))},[I]),[O,B]=sse(F),$=mI(r);return E.useEffect(()=>{!I||!O.current||(I.disconnect(),y.current=!1,I.observe(O.current))},[O,I]),E.useEffect(()=>(i({type:md.RegisterDroppable,element:{id:n,key:o,disabled:s,node:O,rect:v,data:$}}),()=>i({type:md.UnregisterDroppable,key:o,id:n})),[n]),E.useEffect(()=>{s!==g.current.disabled&&(i({type:md.SetDroppableDisabled,id:n,key:o,disabled:s}),g.current.disabled=s)},[n,o,s,i]),{active:l,rect:v,isOver:(d==null?void 0:d.id)===n,node:O,over:d,setNodeRef:B}}function i1e(t,r,s){const n=t.slice();return n.splice(s<0?n.length+s:s,0,n.splice(r,1)[0]),n}function qCt(t,r){return t.reduce((s,n,a)=>{const o=r.get(n);return o&&(s[a]=o),s},Array(t.length))}function $8(t){return t!==null&&t>=0}function VCt(t,r){if(t===r)return!0;if(t.length!==r.length)return!1;for(let s=0;s{let{rects:r,activeIndex:s,overIndex:n,index:a}=t;const o=i1e(r,n,s),l=r[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}},LBe="Sortable",OBe=lt.createContext({activeIndex:-1,containerId:LBe,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:o1e,disabled:{draggable:!1,droppable:!1}});function WCt(t){let{children:r,id:s,items:n,strategy:a=o1e,disabled:o=!1}=t;const{active:l,dragOverlay:i,droppableRects:d,over:m,measureDroppableContainers:g}=zCt(),y=RP(LBe,s),v=i.rect!==null,b=E.useMemo(()=>n.map(B=>typeof B=="object"&&"id"in B?B.id:B),[n]),N=l!=null,j=l?b.indexOf(l.id):-1,S=m?b.indexOf(m.id):-1,A=E.useRef(b),M=!VCt(b,A.current),I=S!==-1&&j===-1||M,F=HCt(o);lx(()=>{M&&N&&g(b)},[M,b,N,g]),E.useEffect(()=>{A.current=b},[b]);const O=E.useMemo(()=>({activeIndex:j,containerId:y,disabled:F,disableTransforms:I,items:b,overIndex:S,useDragOverlay:v,sortedRects:qCt(b,d),strategy:a}),[j,y,F.draggable,F.droppable,I,b,S,d,v,a]);return lt.createElement(OBe.Provider,{value:O},r)}const GCt=t=>{let{id:r,items:s,activeIndex:n,overIndex:a}=t;return i1e(s,n,a).indexOf(r)},KCt=t=>{let{containerId:r,isSorting:s,wasDragging:n,index:a,items:o,newIndex:l,previousItems:i,previousContainerId:d,transition:m}=t;return!m||!n||i!==o&&a===l?!1:s?!0:l!==a&&r===d},ZCt={duration:200,easing:"ease"},DBe="transform",YCt=fI.Transition.toString({property:DBe,duration:0,easing:"linear"}),XCt={roleDescription:"sortable"};function QCt(t){let{disabled:r,index:s,node:n,rect:a}=t;const[o,l]=E.useState(null),i=E.useRef(s);return lx(()=>{if(!r&&s!==i.current&&n.current){const d=a.current;if(d){const m=Q3(n.current,{ignoreTransform:!0}),g={x:d.left-m.left,y:d.top-m.top,scaleX:d.width/m.width,scaleY:d.height/m.height};(g.x||g.y)&&l(g)}}s!==i.current&&(i.current=s)},[r,s,n,a]),E.useEffect(()=>{o&&l(null)},[o]),o}function JCt(t){let{animateLayoutChanges:r=KCt,attributes:s,disabled:n,data:a,getNewIndex:o=GCt,id:l,strategy:i,resizeObserverConfig:d,transition:m=ZCt}=t;const{items:g,containerId:y,activeIndex:v,disabled:b,disableTransforms:N,sortedRects:j,overIndex:S,useDragOverlay:A,strategy:M}=E.useContext(OBe),I=e3t(n,b),F=g.indexOf(l),O=E.useMemo(()=>({sortable:{containerId:y,index:F,items:g},...a}),[y,a,F,g]),B=E.useMemo(()=>g.slice(g.indexOf(l)),[g,l]),{rect:$,node:H,isOver:W,setNodeRef:X}=UCt({id:l,data:O,disabled:I.droppable,resizeObserverConfig:{updateMeasurementsFor:B,...d}}),{active:se,activatorEvent:ae,activeNodeRect:le,attributes:ne,setNodeRef:fe,listeners:oe,isDragging:de,over:ue,setActivatorNodeRef:xe,transform:Te}=FCt({id:l,data:O,attributes:{...XCt,...s},disabled:I.draggable}),be=vSt(X,fe),we=!!se,ve=we&&!N&&$8(v)&&$8(S),tt=!A&&de,Ae=tt&&ve?Te:null,Ue=ve?Ae??(i??M)({rects:j,activeNodeRect:le,activeIndex:v,overIndex:S,index:F}):null,Ye=$8(v)&&$8(S)?o({id:l,items:g,activeIndex:v,overIndex:S}):F,Ie=se==null?void 0:se.id,et=E.useRef({activeId:Ie,items:g,newIndex:Ye,containerId:y}),It=g!==et.current.items,Pe=r({active:se,containerId:y,isDragging:de,isSorting:we,id:l,index:F,items:g,newIndex:et.current.newIndex,previousItems:et.current.items,previousContainerId:et.current.containerId,transition:m,wasDragging:et.current.activeId!=null}),at=QCt({disabled:!Pe,index:F,node:H,rect:$});return E.useEffect(()=>{we&&et.current.newIndex!==Ye&&(et.current.newIndex=Ye),y!==et.current.containerId&&(et.current.containerId=y),g!==et.current.items&&(et.current.items=g)},[we,Ye,y,g]),E.useEffect(()=>{if(Ie===et.current.activeId)return;if(Ie!=null&&et.current.activeId==null){et.current.activeId=Ie;return}const $e=setTimeout(()=>{et.current.activeId=Ie},50);return()=>clearTimeout($e)},[Ie]),{active:se,activeIndex:v,attributes:ne,data:O,rect:$,index:F,newIndex:Ye,items:g,isOver:W,isSorting:we,isDragging:de,listeners:oe,node:H,overIndex:S,over:ue,setNodeRef:be,setActivatorNodeRef:xe,setDroppableNodeRef:X,setDraggableNodeRef:fe,transform:at??Ue,transition:ce()};function ce(){if(at||It&&et.current.newIndex===F)return YCt;if(!(tt&&!t1e(ae)||!m)&&(we||Pe))return fI.Transition.toString({...m,property:DBe})}}function e3t(t,r){var s,n;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(s=t==null?void 0:t.draggable)!=null?s:r.draggable,droppable:(n=t==null?void 0:t.droppable)!=null?n:r.droppable}}function ise(t){if(!t)return!1;const r=t.data.current;return!!(r&&"sortable"in r&&typeof r.sortable=="object"&&"containerId"in r.sortable&&"items"in r.sortable&&"index"in r.sortable)}const t3t=[io.Down,io.Right,io.Up,io.Left],r3t=(t,r)=>{let{context:{active:s,collisionRect:n,droppableRects:a,droppableContainers:o,over:l,scrollableAncestors:i}}=r;if(t3t.includes(t.code)){if(t.preventDefault(),!s||!n)return;const d=[];o.getEnabled().forEach(y=>{if(!y||y!=null&&y.disabled)return;const v=a.get(y.id);if(v)switch(t.code){case io.Down:n.topv.top&&d.push(y);break;case io.Left:n.left>v.left&&d.push(y);break;case io.Right:n.left1&&(g=m[1].id),g!=null){const y=o.get(s.id),v=o.get(g),b=v?a.get(v.id):null,N=v==null?void 0:v.node.current;if(N&&b&&y&&v){const S=qae(N).some((B,$)=>i[$]!==B),A=RBe(y,v),M=s3t(y,v),I=S||!A?{x:0,y:0}:{x:M?n.width-b.width:0,y:M?n.height-b.height:0},F={x:b.left,y:b.top};return I.x&&I.y?F:pI(F,I)}}}};function RBe(t,r){return!ise(t)||!ise(r)?!1:t.data.current.sortable.containerId===r.data.current.sortable.containerId}function s3t(t,r){return!ise(t)||!ise(r)||!RBe(t,r)?!1:t.data.current.sortable.indexr(t),children:e.jsx(ei,{className:"h-3.5 w-3.5"})}),e.jsx(Q,{variant:"destructive",size:"icon",className:"h-7 w-7",onClick:()=>s(t),children:e.jsx(Rs,{className:"h-3.5 w-3.5"})})]}),t.post_date&&e.jsx("div",{className:"absolute bottom-2 left-2",children:e.jsxs(bt,{className:"bg-primary/90 text-primary-foreground text-[10px] gap-1 backdrop-blur-sm px-1.5 py-0.5",children:[e.jsx(Mn,{className:"h-2.5 w-2.5"}),Xr(new Date(t.post_date+"T00:00:00"),"MMM d")]})})]}),e.jsxs(qe,{className:"p-3 space-y-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-3",children:t.caption}),e.jsxs(rd,{children:[e.jsx(sd,{asChild:!0,children:e.jsxs(Q,{variant:"outline",size:"sm",className:qt("w-full h-7 text-[11px] gap-1 justify-start font-normal",!t.post_date&&"text-muted-foreground"),children:[e.jsx(Mn,{className:"h-3 w-3"}),t.post_date?Xr(new Date(t.post_date+"T00:00:00"),"MMM d, yyyy"):"Set post date"]})}),e.jsxs(Fc,{className:"w-auto p-0",align:"start",children:[e.jsx(Vf,{mode:"single",selected:t.post_date?new Date(t.post_date+"T00:00:00"):void 0,onSelect:y=>n(t.id,y?Xr(y,"yyyy-MM-dd"):null),className:"p-3 pointer-events-auto"}),t.post_date&&e.jsx("div",{className:"p-2 border-t",children:e.jsx(Q,{variant:"ghost",size:"sm",className:"w-full text-xs text-muted-foreground",onClick:()=>n(t.id,null),children:"Clear date"})})]})]})]})]})})}const a3t=()=>{const t=qr(),[r,s]=E.useState("all"),[n,a]=E.useState(!1),[o,l]=E.useState(Xr(new Date,"yyyy-MM")),[i,d]=E.useState([]),[m,g]=E.useState(!1),[y,v]=E.useState(null),[b,N]=E.useState(null),[j,S]=E.useState(""),[A,M]=E.useState(null),[I,F]=E.useState(!1),[O,B]=E.useState(!1),[$,H]=E.useState(Xr(new Date,"yyyy-MM")),[W,X]=E.useState(null),[se,ae]=E.useState(""),[le,ne]=E.useState(""),[fe,oe]=E.useState(""),[de,ue]=E.useState(!1),xe=PSt(sCe(a1e,{activationConstraint:{distance:5}}),sCe(s1e,{coordinateGetter:r3t})),{data:Te=[],isLoading:be}=Ht({queryKey:["admin-social-swag-2"],queryFn:async()=>{const{data:Ve,error:ot}=await Z.from("social_swag_2").select("*").order("month",{ascending:!1}).order("sort_order");if(ot)throw ot;return Ve}}),{data:we=[]}=Ht({queryKey:["admin-social-swag-2-months"],queryFn:async()=>{const{data:Ve,error:ot}=await Z.from("social_swag_2_months").select("*").order("month",{ascending:!1});if(ot)throw ot;return Ve}}),{data:ve=[]}=Ht({queryKey:["admin-social-swag-2-reels"],queryFn:async()=>{const{data:Ve,error:ot}=await Z.from("social_swag_2_reels").select("*").order("month",{ascending:!1});if(ot)throw ot;return Ve}}),tt=[...new Set(Te.map(Ve=>Ve.month))].sort((Ve,ot)=>ot.localeCompare(Ve)),Ae=r==="all"?Te:Te.filter(Ve=>Ve.month===r),Le=Ve=>{const ot=xye(Ve,"yyyy-MM",new Date);return Xr(ot,"MMMM yyyy")},Ue=Ve=>{N(Ve),S(Ve.caption),M(Ve.post_date)},Ye=async()=>{if(b){F(!0);try{const{error:Ve}=await Z.from("social_swag_2").update({caption:j,post_date:A}).eq("id",b.id);if(Ve)throw Ve;Se.success("Image updated"),N(null),t.invalidateQueries({queryKey:["admin-social-swag-2"]}),t.invalidateQueries({queryKey:["social-swag-2"]})}catch{Se.error("Failed to update image")}finally{F(!1)}}},Ie=async Ve=>{const{active:ot,over:mt}=Ve;if(!mt||ot.id===mt.id)return;const ft=Ae,ct=ft.findIndex(rr=>rr.id===ot.id),Mt=ft.findIndex(rr=>rr.id===mt.id);if(ct===-1||Mt===-1)return;const Ot=i1e(ft,ct,Mt);t.setQueryData(["admin-social-swag-2"],rr=>{if(!rr)return rr;const Ir={};return Ot.forEach((cr,Mr)=>{Ir[cr.id]=Mr}),rr.map(cr=>Ir[cr.id]!==void 0?{...cr,sort_order:Ir[cr.id]}:cr).sort((cr,Mr)=>cr.month!==Mr.month?Mr.month.localeCompare(cr.month):cr.sort_order-Mr.sort_order)});try{await Promise.all(Ot.map((rr,Ir)=>Z.from("social_swag_2").update({sort_order:Ir}).eq("id",rr.id)))}catch{Se.error("Failed to save order"),t.invalidateQueries({queryKey:["admin-social-swag-2"]})}},et=Ve=>{const mt=Array.from(Ve.target.files||[]).slice(0,16-i.length).map(ft=>({file:ft,preview:URL.createObjectURL(ft),caption:""}));d(ft=>[...ft,...mt].slice(0,16))},It=Ve=>{d(ot=>{const mt=[...ot];return URL.revokeObjectURL(mt[Ve].preview),mt.splice(Ve,1),mt})},Pe=(Ve,ot)=>{d(mt=>{const ft=[...mt];return ft[Ve]={...ft[Ve],caption:ot},ft})},at=async()=>{if(i.length===0){Se.error("Please add at least one image");return}if(i.filter(ot=>!ot.caption.trim()).length>0){Se.error("Please add captions to all images");return}g(!0);try{for(let ot=0;ot{const ot=Ve.image_url.split("/social-swag-2/");ot[1]&&await Z.storage.from("social-swag-2").remove([ot[1]]);const{error:mt}=await Z.from("social_swag_2").delete().eq("id",Ve.id);if(mt)throw mt},onSuccess:()=>{Se.success("Image deleted"),t.invalidateQueries({queryKey:["admin-social-swag-2"]})},onError:()=>Se.error("Failed to delete image")}),$e=Jt({mutationFn:async({id:Ve,postDate:ot})=>{const{error:mt}=await Z.from("social_swag_2").update({post_date:ot}).eq("id",Ve);if(mt)throw mt},onSuccess:()=>{Se.success("Post date updated"),t.invalidateQueries({queryKey:["admin-social-swag-2"]}),t.invalidateQueries({queryKey:["social-swag-2"]})},onError:()=>Se.error("Failed to update post date")}),Ge=Jt({mutationFn:async({month:Ve,link:ot})=>{const{error:mt}=await Z.from("social_swag_2_months").upsert({month:Ve,canva_link:ot||null},{onConflict:"month"});if(mt)throw mt},onSuccess:()=>{Se.success("Canva link updated"),v(null),t.invalidateQueries({queryKey:["admin-social-swag-2-months"]})},onError:()=>Se.error("Failed to update Canva link")}),rt=Ve=>{var ot;return((ot=we.find(mt=>mt.month===Ve))==null?void 0:ot.canva_link)||""},je=Ve=>ve.find(ot=>ot.month===Ve)||null,it=Ve=>{var mt;const ot=(mt=Ve.target.files)==null?void 0:mt[0];ot&&(X(ot),ae(URL.createObjectURL(ot)))},Me=()=>{se&&URL.revokeObjectURL(se),X(null),ae(""),ne(""),oe("")},Je=async()=>{if(!W){Se.error("Please select an image");return}ue(!0);try{const Ve=W.name.split(".").pop(),ot=`reels/${$}-${Date.now()}.${Ve}`,{error:mt}=await Z.storage.from("social-swag-2").upload(ot,W);if(mt)throw mt;const{data:{publicUrl:ft}}=Z.storage.from("social-swag-2").getPublicUrl(ot),{error:ct}=await Z.from("social_swag_2_reels").upsert({month:$,image_url:ft,canva_link:fe||null,caption:le||null},{onConflict:"month"});if(ct)throw ct;Se.success("Reel uploaded successfully!"),kpe(`${Le($)} Reel`,"social-swag-2"),Me(),B(!1),t.invalidateQueries({queryKey:["admin-social-swag-2-reels"]})}catch(Ve){console.error("Reel upload error:",Ve),Se.error("Failed to upload reel")}finally{ue(!1)}},Xe=Jt({mutationFn:async Ve=>{const ot=Ve.image_url.split("/social-swag-2/");ot[1]&&await Z.storage.from("social-swag-2").remove([ot[1]]);const{error:mt}=await Z.from("social_swag_2_reels").delete().eq("id",Ve.id);if(mt)throw mt},onSuccess:()=>{Se.success("Reel deleted"),t.invalidateQueries({queryKey:["admin-social-swag-2-reels"]})},onError:()=>Se.error("Failed to delete reel")});return e.jsxs(Fr,{title:"Admin - Social Swag 2.0",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Social Swag 2.0"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage monthly social media images and captions"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Dr,{open:n,onOpenChange:a,children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{className:"gap-2",children:[e.jsx(gs,{className:"h-4 w-4"}),"Upload Images"]})}),e.jsxs(Lr,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[e.jsx(Ur,{children:e.jsx(Br,{children:"Upload Social Swag Images"})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Month"}),e.jsx(Qe,{type:"month",value:o,onChange:Ve=>l(Ve.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ee,{children:["Images (",i.length,"/16)"]}),e.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 text-center",children:[e.jsx("input",{type:"file",accept:"image/*",multiple:!0,onChange:et,className:"hidden",id:"swag-upload",disabled:i.length>=16}),e.jsxs("label",{htmlFor:"swag-upload",className:"cursor-pointer",children:[e.jsx(to,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to select images (max 16)"})]})]})]}),i.length>0&&e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:i.map((Ve,ot)=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"relative aspect-[4/5] rounded-lg overflow-hidden bg-muted",children:[e.jsx("img",{src:Ve.preview,alt:`Upload ${ot+1}`,className:"w-full h-full object-cover"}),e.jsx(Q,{variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>It(ot),children:e.jsx(rn,{className:"h-3 w-3"})})]}),e.jsx(Ks,{placeholder:"Caption...",value:Ve.caption,onChange:mt=>Pe(ot,mt.target.value),className:"text-xs h-20"})]},ot))}),e.jsx(Q,{onClick:at,disabled:m||i.length===0,className:"w-full gap-2",children:m?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):e.jsxs(e.Fragment,{children:[e.jsx(to,{className:"h-4 w-4"}),"Upload ",i.length," Images"]})})]})]})]}),e.jsxs(Dr,{open:O,onOpenChange:Ve=>{B(Ve),Ve||Me()},children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{variant:"outline",className:"gap-2",children:[e.jsx(Od,{className:"h-4 w-4"}),"Upload Reel"]})}),e.jsxs(Lr,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[e.jsx(Ur,{children:e.jsx(Br,{children:"Upload Monthly Reel"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Month"}),e.jsx(Qe,{type:"month",value:$,onChange:Ve=>H(Ve.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Reel Preview Image"}),se?e.jsxs("div",{className:"relative aspect-[9/16] max-w-[120px] mx-auto rounded-lg overflow-hidden bg-muted",children:[e.jsx("img",{src:se,alt:"Reel preview",className:"w-full h-full object-cover"}),e.jsx(Q,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{URL.revokeObjectURL(se),X(null),ae("")},children:e.jsx(rn,{className:"h-3 w-3"})})]}):e.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 text-center",children:[e.jsx("input",{type:"file",accept:"image/*",onChange:it,className:"hidden",id:"reel-upload"}),e.jsxs("label",{htmlFor:"reel-upload",className:"cursor-pointer",children:[e.jsx(Od,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to select reel preview image"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Canva Download Link"}),e.jsx(Qe,{value:fe,onChange:Ve=>oe(Ve.target.value),placeholder:"https://www.canva.com/..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Caption"}),e.jsx(Ks,{value:le,onChange:Ve=>ne(Ve.target.value),placeholder:"Enter caption for this reel...",className:"h-24"})]}),e.jsx(Q,{onClick:Je,disabled:de||!W,className:"w-full gap-2",children:de?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):e.jsxs(e.Fragment,{children:[e.jsx(to,{className:"h-4 w-4"}),"Upload Reel"]})})]})]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsx(ze,{children:e.jsxs(qe,{className:"p-4",children:[e.jsx("div",{className:"text-2xl font-bold",children:Te.length}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Total Images"})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"p-4",children:[e.jsx("div",{className:"text-2xl font-bold",children:tt.length}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Months"})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(ci,{value:r,onValueChange:s,children:e.jsxs(ri,{children:[e.jsx(Kr,{value:"all",children:"All"}),tt.map(Ve=>e.jsx(Kr,{value:Ve,children:Le(Ve)},Ve))]})}),r!=="all"&&e.jsx(ze,{children:e.jsx(qe,{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(Bo,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs(Ee,{className:"text-sm text-muted-foreground",children:["Canva Edit Link for ",Le(r)]}),(y==null?void 0:y.month)===r?e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(Qe,{value:y.link,onChange:Ve=>v({...y,link:Ve.target.value}),placeholder:"https://www.canva.com/..."}),e.jsx(Q,{size:"sm",onClick:()=>Ge.mutate(y),children:"Save"}),e.jsx(Q,{size:"sm",variant:"outline",onClick:()=>v(null),children:"Cancel"})]}):e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx("span",{className:"text-sm",children:rt(r)||"No link set"}),e.jsx(Q,{size:"sm",variant:"outline",onClick:()=>v({month:r,link:rt(r)}),children:"Edit"})]})]})]})})}),r!=="all"&&e.jsx(ze,{children:e.jsx(qe,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(Od,{className:"h-4 w-4 text-muted-foreground mt-1"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs(Ee,{className:"text-sm text-muted-foreground",children:["Reel for ",Le(r)]}),(()=>{const Ve=je(r);return Ve?e.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[e.jsx("img",{src:Ve.image_url,alt:"Reel preview",className:"w-16 h-28 object-cover rounded"}),e.jsxs("div",{className:"flex-1 text-sm",children:[e.jsx("p",{className:"line-clamp-2",children:Ve.caption||"No caption"}),Ve.canva_link&&e.jsx("a",{href:Ve.canva_link,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-xs",children:"View Canva Link"})]}),e.jsx(Q,{variant:"destructive",size:"sm",onClick:()=>Xe.mutate(Ve),children:e.jsx(Rs,{className:"h-4 w-4"})})]}):e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"No reel uploaded for this month"})})()]})]})})})]}),be?e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}):Ae.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(El,{className:"h-12 w-12 mx-auto text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"No images yet. Upload some!"})]}):e.jsx(OCt,{sensors:xe,collisionDetection:OSt,onDragEnd:Ie,children:e.jsx(WCt,{items:Ae.map(Ve=>Ve.id),strategy:o1e,children:e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:Ae.map(Ve=>e.jsx(n3t,{item:Ve,onEdit:Ue,onDelete:ot=>ce.mutate(ot),onDateChange:(ot,mt)=>$e.mutate({id:ot,postDate:mt})},Ve.id))})})})]}),e.jsx(Dr,{open:!!b,onOpenChange:Ve=>{Ve||N(null)},children:e.jsxs(Lr,{className:"max-w-md",children:[e.jsx(Ur,{children:e.jsx(Br,{children:"Edit Image"})}),b&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"aspect-[4/5] max-h-48 w-full rounded-lg overflow-hidden bg-muted",children:e.jsx("img",{src:b.image_url,alt:"Preview",className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Caption"}),e.jsx(Ks,{value:j,onChange:Ve=>S(Ve.target.value),placeholder:"Enter caption...",className:"h-28"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Post Date"}),e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsxs(rd,{children:[e.jsx(sd,{asChild:!0,children:e.jsxs(Q,{variant:"outline",className:qt("flex-1 justify-start gap-2 font-normal",!A&&"text-muted-foreground"),children:[e.jsx(Mn,{className:"h-4 w-4"}),A?Xr(new Date(A+"T00:00:00"),"MMM d, yyyy"):"Pick a date"]})}),e.jsx(Fc,{className:"w-auto p-0",align:"start",children:e.jsx(Vf,{mode:"single",selected:A?new Date(A+"T00:00:00"):void 0,onSelect:Ve=>M(Ve?Xr(Ve,"yyyy-MM-dd"):null),className:"p-3 pointer-events-auto"})})]}),A&&e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>M(null),children:e.jsx(rn,{className:"h-4 w-4"})})]})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>N(null),children:"Cancel"}),e.jsx(Q,{onClick:Ye,disabled:I,className:"gap-2",children:I?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})})]})},i3t=()=>{const{toast:t}=fi(),r=qr(),[s,n]=E.useState("categories"),[a,o]=E.useState(!1),[l,i]=E.useState(null),[d,m]=E.useState({name:"",description:"",icon:""}),[g,y]=E.useState(!1),[v,b]=E.useState(null),[N,j]=E.useState({name:"",description:"",icon:""}),[S,A]=E.useState(!1),[M,I]=E.useState(null),[F,O]=E.useState(""),{data:B=[],isLoading:$}=Ht({queryKey:["admin-community-categories"],queryFn:async()=>{const{data:Ie,error:et}=await Z.from("community_categories").select("*").order("sort_order");if(et)throw et;return Ie}}),{data:H=[],isLoading:W}=Ht({queryKey:["admin-private-groups"],queryFn:async()=>{const{data:Ie,error:et}=await Z.from("community_private_groups").select("*").order("sort_order");if(et)throw et;return Ie}}),{data:X=[]}=Ht({queryKey:["admin-group-members",M==null?void 0:M.id],queryFn:async()=>{if(!M)return[];const{data:Ie,error:et}=await Z.from("community_private_group_members").select("*").eq("group_id",M.id);if(et)throw et;return Ie},enabled:!!M}),{data:se=[]}=Ht({queryKey:["admin-all-profiles"],queryFn:async()=>{let et=[],It=0,Pe=!0;for(;Pe;){const{data:at,error:ce}=await Z.from("profiles").select("id, name, email, brokerage_id").order("name").range(It,It+1e3-1);if(ce)throw ce;at&&at.length>0?(et=[...et,...at],It+=1e3,Pe=at.length===1e3):Pe=!1}return et}}),{data:ae=[]}=Ht({queryKey:["admin-all-brokerages"],queryFn:async()=>{const{data:Ie,error:et}=await Z.from("brokerages").select("*").order("name");if(et)throw et;return Ie}}),le=Jt({mutationFn:async Ie=>{if(Ie.id){const{error:et}=await Z.from("community_categories").update({name:Ie.name,description:Ie.description||null,icon:Ie.icon||null}).eq("id",Ie.id);if(et)throw et}else{const et=Math.max(...B.map(Pe=>Pe.sort_order),0),{error:It}=await Z.from("community_categories").insert({name:Ie.name,description:Ie.description||null,icon:Ie.icon||null,sort_order:et+1});if(It)throw It}},onSuccess:()=>{r.invalidateQueries({queryKey:["admin-community-categories"]}),o(!1),i(null),m({name:"",description:"",icon:""}),t({title:l?"Category updated!":"Category created!"})},onError:Ie=>{t({title:"Error",description:Ie.message,variant:"destructive"})}}),ne=Jt({mutationFn:async Ie=>{const{error:et}=await Z.from("community_categories").delete().eq("id",Ie);if(et)throw et},onSuccess:()=>{r.invalidateQueries({queryKey:["admin-community-categories"]}),t({title:"Category deleted"})}}),fe=Jt({mutationFn:async({id:Ie,direction:et})=>{const It=B.findIndex(Pe=>Pe.id===Ie);if(et==="up"&&It>0){const Pe=B[It-1],at=B[It];await Z.from("community_categories").update({sort_order:at.sort_order}).eq("id",Pe.id),await Z.from("community_categories").update({sort_order:Pe.sort_order}).eq("id",at.id)}else if(et==="down"&&Itr.invalidateQueries({queryKey:["admin-community-categories"]})}),oe=Jt({mutationFn:async Ie=>{if(Ie.id){const{error:et}=await Z.from("community_private_groups").update({name:Ie.name,description:Ie.description||null,icon:Ie.icon||null}).eq("id",Ie.id);if(et)throw et}else{const et=Math.max(...H.map(Pe=>Pe.sort_order),0),{error:It}=await Z.from("community_private_groups").insert({name:Ie.name,description:Ie.description||null,icon:Ie.icon||null,sort_order:et+1});if(It)throw It}},onSuccess:()=>{r.invalidateQueries({queryKey:["admin-private-groups"]}),y(!1),b(null),j({name:"",description:"",icon:""}),t({title:v?"Private group updated!":"Private group created!"})},onError:Ie=>{t({title:"Error",description:Ie.message,variant:"destructive"})}}),de=Jt({mutationFn:async Ie=>{const{error:et}=await Z.from("community_private_groups").delete().eq("id",Ie);if(et)throw et},onSuccess:()=>{r.invalidateQueries({queryKey:["admin-private-groups"]}),t({title:"Private group deleted"})}}),ue=Jt({mutationFn:async({id:Ie,direction:et})=>{const It=H.findIndex(Pe=>Pe.id===Ie);if(et==="up"&&It>0){const Pe=H[It-1],at=H[It];await Z.from("community_private_groups").update({sort_order:at.sort_order}).eq("id",Pe.id),await Z.from("community_private_groups").update({sort_order:Pe.sort_order}).eq("id",at.id)}else if(et==="down"&&Itr.invalidateQueries({queryKey:["admin-private-groups"]})}),xe=Jt({mutationFn:async({groupId:Ie,userId:et,isMember:It})=>{if(It){const{error:Pe}=await Z.from("community_private_group_members").delete().eq("group_id",Ie).eq("user_id",et);if(Pe)throw Pe}else{const{error:Pe}=await Z.from("community_private_group_members").insert({group_id:Ie,user_id:et});if(Pe)throw Pe}},onSuccess:()=>{r.invalidateQueries({queryKey:["admin-group-members",M==null?void 0:M.id]})}}),Te=Jt({mutationFn:async({groupId:Ie,brokerageId:et,isMember:It})=>{if(It){const{error:Pe}=await Z.from("community_private_group_members").delete().eq("group_id",Ie).eq("brokerage_id",et);if(Pe)throw Pe}else{const{error:Pe}=await Z.from("community_private_group_members").insert({group_id:Ie,brokerage_id:et});if(Pe)throw Pe}},onSuccess:()=>{r.invalidateQueries({queryKey:["admin-group-members",M==null?void 0:M.id]})}}),be=Ie=>{i(Ie),m({name:Ie.name,description:Ie.description||"",icon:Ie.icon||""}),o(!0)},we=()=>{i(null),m({name:"",description:"",icon:""}),o(!0)},ve=Ie=>{b(Ie),j({name:Ie.name,description:Ie.description||"",icon:Ie.icon||""}),y(!0)},tt=()=>{b(null),j({name:"",description:"",icon:""}),y(!0)},Ae=Ie=>{I(Ie),O(""),A(!0)},Le=Ie=>X.some(et=>et.user_id===Ie),Ue=Ie=>X.some(et=>et.brokerage_id===Ie),Ye=se.filter(Ie=>Ie.name.toLowerCase().includes(F.toLowerCase())||Ie.email.toLowerCase().includes(F.toLowerCase()));return e.jsx(Fr,{title:"Community Management",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(Lu,{title:"Community Management",description:"Manage categories and private groups for community discussions"}),e.jsxs(ci,{value:s,onValueChange:n,children:[e.jsxs(ri,{children:[e.jsx(Kr,{value:"categories",children:"Public Categories"}),e.jsxs(Kr,{value:"private-groups",children:[e.jsx(ku,{className:"h-4 w-4 mr-1"}),"Private Groups"]})]}),e.jsxs(ms,{value:"categories",className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Categories visible to all community members"}),e.jsxs(Q,{onClick:we,children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),e.jsx(ze,{children:e.jsx(qe,{className:"pt-6",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{className:"w-[50px]",children:"Order"}),e.jsx(Ct,{className:"w-[80px]",children:"Icon"}),e.jsx(Ct,{children:"Name"}),e.jsx(Ct,{children:"Description"}),e.jsx(Ct,{className:"w-[100px]",children:"Actions"})]})}),e.jsx(zn,{children:$?e.jsx(Nr,{children:e.jsx(dt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):B.length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No categories yet. Create your first one!"})}):B.map((Ie,et)=>e.jsxs(Nr,{children:[e.jsx(dt,{children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(Q,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:et===0,onClick:()=>fe.mutate({id:Ie.id,direction:"up"}),children:"↑"}),e.jsx(Q,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:et===B.length-1,onClick:()=>fe.mutate({id:Ie.id,direction:"down"}),children:"↓"})]})}),e.jsx(dt,{className:"text-2xl",children:Ie.icon||"📁"}),e.jsx(dt,{className:"font-medium",children:Ie.name}),e.jsx(dt,{className:"text-muted-foreground",children:Ie.description||"—"}),e.jsx(dt,{children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>be(Ie),children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{confirm("Delete this category? Posts will be uncategorized.")&&ne.mutate(Ie.id)},children:e.jsx(Rs,{className:"h-4 w-4"})})]})})]},Ie.id))})]})})})]}),e.jsxs(ms,{value:"private-groups",className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Private groups visible only to assigned members or brokerages"}),e.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(bi,{className:"h-3 w-3"}),"Brokerage groups are created automatically and sync with brokerage names"]})]}),e.jsxs(Q,{onClick:tt,children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Private Group"]})]}),e.jsx(ze,{children:e.jsx(qe,{className:"pt-6",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{className:"w-[50px]",children:"Order"}),e.jsx(Ct,{className:"w-[80px]",children:"Icon"}),e.jsx(Ct,{children:"Name"}),e.jsx(Ct,{children:"Description"}),e.jsx(Ct,{className:"w-[120px]",children:"Members"}),e.jsx(Ct,{className:"w-[140px]",children:"Actions"})]})}),e.jsx(zn,{children:W?e.jsx(Nr,{children:e.jsx(dt,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):H.length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No private groups yet. Create your first one!"})}):H.map((Ie,et)=>e.jsxs(Nr,{children:[e.jsx(dt,{children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(Q,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:et===0,onClick:()=>ue.mutate({id:Ie.id,direction:"up"}),children:"↑"}),e.jsx(Q,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:et===H.length-1,onClick:()=>ue.mutate({id:Ie.id,direction:"down"}),children:"↓"})]})}),e.jsx(dt,{className:"text-2xl",children:Ie.icon||"🔒"}),e.jsx(dt,{className:"font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[Ie.name,Ie.brokerage_id?e.jsxs(bt,{variant:"outline",className:"text-xs bg-blue-50 text-blue-700 border-blue-200",children:[e.jsx(bi,{className:"h-3 w-3 mr-1"}),"Auto-managed"]}):e.jsxs(bt,{variant:"secondary",className:"text-xs",children:[e.jsx(ku,{className:"h-3 w-3 mr-1"}),"Private"]})]})}),e.jsx(dt,{className:"text-muted-foreground",children:Ie.description||"—"}),e.jsx(dt,{children:e.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>Ae(Ie),children:[e.jsx(ws,{className:"h-4 w-4 mr-1"}),"Manage"]})}),e.jsx(dt,{children:e.jsxs("div",{className:"flex gap-1",children:[!Ie.brokerage_id&&e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>ve(Ie),children:e.jsx(ei,{className:"h-4 w-4"})}),!Ie.brokerage_id&&e.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{confirm("Delete this private group? All posts in this group will be deleted.")&&de.mutate(Ie.id)},children:e.jsx(Rs,{className:"h-4 w-4"})}),Ie.brokerage_id&&e.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Managed via brokerage"})]})})]},Ie.id))})]})})})]})]}),e.jsx(Dr,{open:a,onOpenChange:o,children:e.jsxs(Lr,{children:[e.jsx(Ur,{children:e.jsx(Br,{children:l?"Edit Category":"Create Category"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Icon (emoji)"}),e.jsx(Qe,{value:d.icon,onChange:Ie=>m(et=>({...et,icon:Ie.target.value})),placeholder:"💬",className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Name *"}),e.jsx(Qe,{value:d.name,onChange:Ie=>m(et=>({...et,name:Ie.target.value})),placeholder:"Category name",className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Description"}),e.jsx(Ks,{value:d.description,onChange:Ie=>m(et=>({...et,description:Ie.target.value})),placeholder:"Brief description of this category",className:"mt-1"})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(Q,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),e.jsx(Q,{onClick:()=>le.mutate({...d,id:l==null?void 0:l.id}),disabled:!d.name.trim(),children:l?"Save Changes":"Create Category"})]})]})]})}),e.jsx(Dr,{open:g,onOpenChange:y,children:e.jsxs(Lr,{children:[e.jsx(Ur,{children:e.jsx(Br,{children:v?"Edit Private Group":"Create Private Group"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Icon (emoji)"}),e.jsx(Qe,{value:N.icon,onChange:Ie=>j(et=>({...et,icon:Ie.target.value})),placeholder:"🔒",className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Name *"}),e.jsx(Qe,{value:N.name,onChange:Ie=>j(et=>({...et,name:Ie.target.value})),placeholder:"e.g., Pioneers",className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium",children:"Description"}),e.jsx(Ks,{value:N.description,onChange:Ie=>j(et=>({...et,description:Ie.target.value})),placeholder:"Brief description of this private group",className:"mt-1"})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(Q,{variant:"outline",onClick:()=>y(!1),children:"Cancel"}),e.jsx(Q,{onClick:()=>oe.mutate({...N,id:v==null?void 0:v.id}),disabled:!N.name.trim(),children:v?"Save Changes":"Create Private Group"})]})]})]})}),e.jsx(Dr,{open:S,onOpenChange:A,children:e.jsxs(Lr,{className:"max-w-2xl",children:[e.jsx(Ur,{children:e.jsxs(Br,{children:["Manage Members: ",M==null?void 0:M.name]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ci,{defaultValue:"brokerages",children:[e.jsxs(ri,{className:"w-full",children:[e.jsx(Kr,{value:"brokerages",className:"flex-1",children:"By Brokerage"}),e.jsx(Kr,{value:"users",className:"flex-1",children:"Individual Users"})]}),e.jsxs(ms,{value:"brokerages",className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Select brokerages to grant all their agents access to this private group."}),e.jsx(Eo,{className:"h-[300px] border rounded-md p-4",children:e.jsxs("div",{className:"space-y-2",children:[ae.map(Ie=>e.jsxs("div",{className:"flex items-center justify-between p-2 hover:bg-muted rounded-md",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Yo,{checked:Ue(Ie.id),onCheckedChange:()=>{M&&Te.mutate({groupId:M.id,brokerageId:Ie.id,isMember:Ue(Ie.id)})}}),e.jsx("span",{className:"font-medium",children:Ie.name})]}),e.jsxs(bt,{variant:"secondary",children:[se.filter(et=>et.brokerage_id===Ie.id).length," agents"]})]},Ie.id)),ae.length===0&&e.jsx("p",{className:"text-center text-muted-foreground py-4",children:"No brokerages found"})]})})]}),e.jsxs(ms,{value:"users",className:"space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search users...",value:F,onChange:Ie=>O(Ie.target.value),className:"pl-9"})]}),e.jsx(Eo,{className:"h-[300px] border rounded-md p-4",children:e.jsxs("div",{className:"space-y-2",children:[Ye.map(Ie=>e.jsx("div",{className:"flex items-center justify-between p-2 hover:bg-muted rounded-md",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Yo,{checked:Le(Ie.id),onCheckedChange:()=>{M&&xe.mutate({groupId:M.id,userId:Ie.id,isMember:Le(Ie.id)})}}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:Ie.name}),e.jsx("div",{className:"text-sm text-muted-foreground",children:Ie.email})]})]})},Ie.id)),Ye.length===0&&e.jsx("p",{className:"text-center text-muted-foreground py-4",children:"No users found"})]})})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(Q,{onClick:()=>A(!1),children:"Done"})})]})]})})]})})},gCe=t=>{switch(t){case"academy_video":return e.jsx(Gl,{className:"h-3 w-3"});case"template":return e.jsx(fa,{className:"h-3 w-3"});case"toolbox":return e.jsx(Wl,{className:"h-3 w-3"});case"newsletter":return e.jsx(_y,{className:"h-3 w-3"});case"social_swag":return e.jsx(An,{className:"h-3 w-3"});default:return e.jsx(En,{className:"h-3 w-3"})}},o3t=t=>{switch(t){case"academy_video":return"Academy";case"template":return"Template";case"toolbox":return"Toolbox";case"newsletter":return"Newsletter";case"social_swag":return"Social Swag";default:return t}},l3t=t=>{switch(t){case"view":return"Viewed";case"click_canva":return"Clicked Canva";case"click_pdf":return"Downloaded PDF";case"click_video":return"Watched Video";case"click_link":return"Clicked Link";case"click_drive":return"Clicked Drive";default:return t}},c3t=()=>{const{toast:t}=fi(),[r,s]=E.useState([]),[n,a]=E.useState([]),[o,l]=E.useState([]),[i,d]=E.useState(!0),[m,g]=E.useState(""),[y,v]=E.useState(null),[b,N]=E.useState([]),[j,S]=E.useState([]);E.useEffect(()=>{A()},[]);const A=async()=>{try{d(!0);const{data:O,error:B}=await Z.from("activity_logs").select(` id, user_id, app_name, launched_at, profiles ( name, email, brokerages ( name ) ) `).order("launched_at",{ascending:!1}).limit(5e3);if(B)throw B;const{data:$,error:H}=await Z.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(H)throw H;const W=[...new Set(($==null?void 0:$.map(oe=>oe.user_id))||[])],{data:X}=await Z.from("profiles").select(` id, name, email, brokerages ( name ) `).in("id",W),se=new Map((X==null?void 0:X.map(oe=>[oe.id,oe]))||[]),ae=(O==null?void 0:O.map(oe=>{var de,ue,xe,Te;return{id:oe.id,user_id:oe.user_id,app_name:oe.app_name,launched_at:oe.launched_at,user_name:((de=oe.profiles)==null?void 0:de.name)||"Unknown",user_email:((ue=oe.profiles)==null?void 0:ue.email)||"Unknown",brokerage_name:((Te=(xe=oe.profiles)==null?void 0:xe.brokerages)==null?void 0:Te.name)||null}}))||[],le=($==null?void 0:$.map(oe=>{var ue;const de=se.get(oe.user_id);return{id:oe.id,user_id:oe.user_id,resource_type:oe.resource_type,resource_id:oe.resource_id,resource_title:oe.resource_title,action_type:oe.action_type,created_at:oe.created_at,user_name:(de==null?void 0:de.name)||"Unknown",user_email:(de==null?void 0:de.email)||"Unknown",brokerage_name:((ue=de==null?void 0:de.brokerages)==null?void 0:ue.name)||null}}))||[];s(ae),a(le);const ne=new Map;ae.forEach(oe=>{if(!ne.has(oe.user_id))ne.set(oe.user_id,{user_id:oe.user_id,user_name:oe.user_name,user_email:oe.user_email,brokerage_name:oe.brokerage_name,last_activity_type:"app",last_activity_name:oe.app_name,last_activity_at:oe.launched_at,total_app_launches:1,total_content_views:0});else{const de=ne.get(oe.user_id);de.total_app_launches++,new Date(oe.launched_at)>new Date(de.last_activity_at)&&(de.last_activity_type="app",de.last_activity_name=oe.app_name,de.last_activity_at=oe.launched_at)}}),le.forEach(oe=>{if(!ne.has(oe.user_id))ne.set(oe.user_id,{user_id:oe.user_id,user_name:oe.user_name,user_email:oe.user_email,brokerage_name:oe.brokerage_name,last_activity_type:oe.resource_type,last_activity_name:oe.resource_title,last_activity_at:oe.created_at,total_app_launches:0,total_content_views:1});else{const de=ne.get(oe.user_id);de.total_content_views++,new Date(oe.created_at)>new Date(de.last_activity_at)&&(de.last_activity_type=oe.resource_type,de.last_activity_name=oe.resource_title,de.last_activity_at=oe.created_at)}});const fe=Array.from(ne.values()).sort((oe,de)=>new Date(de.last_activity_at).getTime()-new Date(oe.last_activity_at).getTime());l(fe)}catch(O){console.error("Error loading activity:",O),t({title:"Error",description:"Failed to load activity logs",variant:"destructive"})}finally{d(!1)}},M=O=>{v({id:O.user_id,name:O.user_name,email:O.user_email});const B=r.filter(H=>H.user_id===O.user_id),$=n.filter(H=>H.user_id===O.user_id);N(B),S($)},I=()=>{v(null),N([]),S([])},F=o.filter(O=>{var $;if(!m)return!0;const B=m.toLowerCase();return O.user_name.toLowerCase().includes(B)||O.user_email.toLowerCase().includes(B)||(($=O.brokerage_name)==null?void 0:$.toLowerCase().includes(B))});return i?e.jsx(ze,{children:e.jsx(qe,{className:"flex items-center justify-center py-8",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):e.jsxs(e.Fragment,{children:[e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsx(Zt,{children:"User Activity"}),e.jsx(Ss,{children:"App launches and content engagement - click to see full history"})]}),e.jsxs(qe,{children:[e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"relative",children:[e.jsx(Qn,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search by name, email, or brokerage...",value:m,onChange:O=>g(O.target.value),className:"pl-9"})]})}),e.jsx("div",{className:"rounded-md border",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"User"}),e.jsx(Ct,{children:"Brokerage"}),e.jsx(Ct,{children:"Last Activity"}),e.jsx(Ct,{children:"Last Active"}),e.jsx(Ct,{className:"text-right",children:"Apps"}),e.jsx(Ct,{className:"text-right",children:"Content"})]})}),e.jsx(zn,{children:F.length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:6,className:"text-center text-muted-foreground",children:"No activity found"})}):F.map(O=>e.jsxs(Nr,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>M(O),children:[e.jsx(dt,{children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:O.user_name}),e.jsx("div",{className:"text-sm text-muted-foreground",children:O.user_email})]})}),e.jsx(dt,{children:O.brokerage_name?e.jsx(bt,{variant:"outline",children:O.brokerage_name}):e.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),e.jsx(dt,{children:e.jsx("div",{className:"flex items-center gap-2",children:O.last_activity_type==="app"?e.jsxs(bt,{variant:"secondary",children:[e.jsx(En,{className:"h-3 w-3 mr-1"}),O.last_activity_name]}):e.jsxs(bt,{variant:"outline",className:"flex items-center gap-1",children:[gCe(O.last_activity_type),e.jsx("span",{className:"max-w-32 truncate",children:O.last_activity_name})]})})}),e.jsx(dt,{className:"text-sm text-muted-foreground",children:Su(new Date(O.last_activity_at),{addSuffix:!0})}),e.jsx(dt,{className:"text-right",children:e.jsx(bt,{variant:"outline",children:O.total_app_launches})}),e.jsx(dt,{className:"text-right",children:e.jsx(bt,{variant:"outline",children:O.total_content_views})})]},O.user_id))})]})})]})]}),e.jsx(Dr,{open:!!y,onOpenChange:O=>!O&&I(),children:e.jsxs(Lr,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{children:[y==null?void 0:y.name,"'s Activity"]}),e.jsx(Gs,{children:y==null?void 0:y.email})]}),e.jsxs(ci,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[e.jsxs(ri,{className:"grid w-full grid-cols-2",children:[e.jsxs(Kr,{value:"content",children:["Content (",j.length,")"]}),e.jsxs(Kr,{value:"apps",children:["App Launches (",b.length,")"]})]}),e.jsx(ms,{value:"content",className:"flex-1 overflow-auto mt-4",children:e.jsx("div",{className:"rounded-md border",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Type"}),e.jsx(Ct,{children:"Resource"}),e.jsx(Ct,{children:"Action"}),e.jsx(Ct,{children:"Time"})]})}),e.jsx(zn,{children:j.length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement"})}):j.map(O=>e.jsxs(Nr,{children:[e.jsx(dt,{children:e.jsxs(bt,{variant:"outline",className:"flex items-center gap-1 w-fit",children:[gCe(O.resource_type),o3t(O.resource_type)]})}),e.jsx(dt,{className:"max-w-48",children:e.jsx("span",{className:"truncate block",children:O.resource_title})}),e.jsx(dt,{children:e.jsx(bt,{variant:"secondary",children:l3t(O.action_type)})}),e.jsx(dt,{className:"text-sm text-muted-foreground",children:Su(new Date(O.created_at),{addSuffix:!0})})]},O.id))})]})})}),e.jsx(ms,{value:"apps",className:"flex-1 overflow-auto mt-4",children:e.jsx("div",{className:"rounded-md border",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"App"}),e.jsx(Ct,{children:"Time"})]})}),e.jsx(zn,{children:b.length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches"})}):b.map(O=>e.jsxs(Nr,{children:[e.jsx(dt,{children:e.jsx(bt,{variant:"secondary",children:O.app_name})}),e.jsx(dt,{className:"text-sm text-muted-foreground",children:Su(new Date(O.launched_at),{addSuffix:!0})})]},O.id))})]})})})]})]})})]})},d3t=()=>{const{toast:t}=fi(),[r,s]=E.useState({totalUsers:0,activeUsers:0,pendingUsers:0,totalBrokerages:0,totalLaunches:0,launchesThisWeek:0,launchesThisMonth:0,uniqueActiveThisWeek:0}),[n,a]=E.useState(!0);E.useEffect(()=>{o()},[]);const o=async()=>{try{a(!0);const{count:l}=await Z.from("profiles").select("*",{count:"exact",head:!0}),{count:i}=await Z.from("profiles").select("*",{count:"exact",head:!0}).not("last_login","is",null),d=(l||0)-(i||0),{count:m}=await Z.from("brokerages").select("*",{count:"exact",head:!0}),{count:g}=await Z.from("activity_logs").select("*",{count:"exact",head:!0}),y=new Date;y.setDate(y.getDate()-7);const{count:v}=await Z.from("activity_logs").select("*",{count:"exact",head:!0}).gte("launched_at",y.toISOString()),b=new Date;b.setMonth(b.getMonth()-1);const{count:N}=await Z.from("activity_logs").select("*",{count:"exact",head:!0}).gte("launched_at",b.toISOString()),{data:j}=await Z.from("activity_logs").select("user_id").gte("launched_at",y.toISOString()),S=new Set(j==null?void 0:j.map(A=>A.user_id)).size;s({totalUsers:l||0,activeUsers:i||0,pendingUsers:d,totalBrokerages:m||0,totalLaunches:g||0,launchesThisWeek:v||0,launchesThisMonth:N||0,uniqueActiveThisWeek:S})}catch(l){console.error("Error loading analytics:",l),t({title:"Error",description:"Failed to load analytics",variant:"destructive"})}finally{a(!1)}};return n?e.jsx(ze,{children:e.jsx(qe,{className:"flex items-center justify-center py-8",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Zt,{className:"text-sm font-medium",children:"Total Users"}),e.jsx(ws,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(qe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:r.totalUsers}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[r.activeUsers," active, ",r.pendingUsers," pending"]})]})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Zt,{className:"text-sm font-medium",children:"Active Users"}),e.jsx(ui,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(qe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:r.activeUsers}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r.totalUsers>0?`${Math.round(r.activeUsers/r.totalUsers*100)}% of total`:"0% of total"})]})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Zt,{className:"text-sm font-medium",children:"Pending Invites"}),e.jsx(Ea,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(qe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:r.pendingUsers}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Awaiting setup"})]})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Zt,{className:"text-sm font-medium",children:"Brokerages"}),e.jsx(bi,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(qe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:r.totalBrokerages}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Total brokerages"})]})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Zt,{className:"text-sm font-medium",children:"Total App Launches"}),e.jsx(qg,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(qe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:r.totalLaunches}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"All time"})]})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Zt,{className:"text-sm font-medium",children:"Launches This Week"}),e.jsx(qg,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(qe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:r.launchesThisWeek}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 7 days"})]})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Zt,{className:"text-sm font-medium",children:"Launches This Month"}),e.jsx(qg,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(qe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:r.launchesThisMonth}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 30 days"})]})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Zt,{className:"text-sm font-medium",children:"Active This Week"}),e.jsx(ou,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(qe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:r.uniqueActiveThisWeek}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Unique users"})]})]})]})},xCe={event:"Event",template:"Template",academy_video:"Academy Video",resource_kit:"Resource Kit",newsletter:"Newsletter",social_swag:"Social Swag"},yCe={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 FBe({brokerageOnly:t=!1,brokerageId:r}){const[s,n]=E.useState([]),[a,o]=E.useState(!0),[l,i]=E.useState(""),[d,m]=E.useState("all");E.useEffect(()=>{g()},[r]);const g=async()=>{o(!0);try{let A=[];if(t&&r){const{data:W}=await Z.from("profiles").select("id").eq("brokerage_id",r);if(A=(W==null?void 0:W.map(X=>X.id))||[],A.length===0){n([]),o(!1);return}}let M=Z.from("resource_shares").select("*").order("created_at",{ascending:!1});t&&A.length>0&&(M=M.or(`sender_id.in.(${A.join(",")}),recipient_id.in.(${A.join(",")})`));const{data:I,error:F}=await M;if(F)throw F;const O=new Set;I==null||I.forEach(W=>{O.add(W.sender_id),O.add(W.recipient_id)});const{data:B}=await Z.from("profiles").select("id, name, email").in("id",Array.from(O)),$=new Map((B==null?void 0:B.map(W=>[W.id,W]))||[]),H=(I==null?void 0:I.map(W=>({...W,sender:$.get(W.sender_id),recipient:$.get(W.recipient_id)})))||[];n(H)}catch(A){console.error("Error loading shares:",A)}finally{o(!1)}},y=s.filter(A=>{var F,O;const M=l===""||A.resource_title.toLowerCase().includes(l.toLowerCase())||((F=A.sender)==null?void 0:F.name.toLowerCase().includes(l.toLowerCase()))||((O=A.recipient)==null?void 0:O.name.toLowerCase().includes(l.toLowerCase())),I=d==="all"||A.resource_type===d;return M&&I}),v=s.length,b=new Set(s.map(A=>A.sender_id)).size,N=new Set(s.map(A=>A.recipient_id)).size,j=s.length>0?Math.round(s.filter(A=>A.is_read).length/s.length*100):0,S=s.reduce((A,M)=>(A[M.resource_type]=(A[M.resource_type]||0)+1,A),{});return a?e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"grid gap-4 md:grid-cols-4",children:[...Array(4)].map((A,M)=>e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(fr,{className:"h-4 w-20"})}),e.jsx(qe,{children:e.jsx(fr,{className:"h-8 w-16"})})]},M))}),e.jsx(ze,{children:e.jsx(qe,{className:"p-6",children:e.jsx(fr,{className:"h-[300px]"})})})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Zt,{className:"text-sm font-medium",children:"Total Shares"}),e.jsx(Oc,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(qe,{children:e.jsx("div",{className:"text-2xl font-bold",children:v})})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Zt,{className:"text-sm font-medium",children:"Active Sharers"}),e.jsx(ws,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(qe,{children:e.jsx("div",{className:"text-2xl font-bold",children:b})})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Zt,{className:"text-sm font-medium",children:"Recipients Reached"}),e.jsx(ou,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(qe,{children:e.jsx("div",{className:"text-2xl font-bold",children:N})})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Zt,{className:"text-sm font-medium",children:"Read Rate"}),e.jsx(fa,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(qe,{children:e.jsxs("div",{className:"text-2xl font-bold",children:[j,"%"]})})]})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{className:"text-sm font-medium",children:"Shares by Resource Type"})}),e.jsx(qe,{children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[Object.entries(S).map(([A,M])=>e.jsxs(bt,{variant:"secondary",className:yCe[A],children:[xCe[A],": ",M]},A)),Object.keys(S).length===0&&e.jsx("span",{className:"text-muted-foreground text-sm",children:"No shares yet"})]})})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsx(Zt,{children:"Share History"}),e.jsxs(Ss,{children:["All resource shares ",t?"in your brokerage":"across the platform"]})]}),e.jsxs(qe,{children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-4",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search by resource, sender, or recipient...",value:l,onChange:A=>i(A.target.value),className:"pl-9"})]}),e.jsxs(ds,{value:d,onValueChange:m,children:[e.jsx(ls,{className:"w-[180px]",children:e.jsx(us,{placeholder:"Resource type"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Types"}),e.jsx(Ut,{value:"event",children:"Events"}),e.jsx(Ut,{value:"template",children:"Templates"}),e.jsx(Ut,{value:"academy_video",children:"Academy Videos"}),e.jsx(Ut,{value:"resource_kit",children:"Resource Kits"}),e.jsx(Ut,{value:"newsletter",children:"Newsletters"}),e.jsx(Ut,{value:"social_swag",children:"Social Swag"})]})]})]}),e.jsx(Eo,{className:"h-[400px]",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Resource"}),e.jsx(Ct,{children:"Type"}),e.jsx(Ct,{children:"Sender"}),e.jsx(Ct,{children:"Recipient"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{children:"Date"})]})}),e.jsx(zn,{children:y.length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No shares found"})}):y.map(A=>{var M,I;return e.jsxs(Nr,{children:[e.jsx(dt,{className:"font-medium max-w-[200px] truncate",children:A.resource_title}),e.jsx(dt,{children:e.jsx(bt,{variant:"secondary",className:yCe[A.resource_type],children:xCe[A.resource_type]})}),e.jsx(dt,{children:((M=A.sender)==null?void 0:M.name)||"Unknown"}),e.jsx(dt,{children:((I=A.recipient)==null?void 0:I.name)||"Unknown"}),e.jsx(dt,{children:e.jsx(bt,{variant:A.is_read?"default":"outline",children:A.is_read?"Read":"Unread"})}),e.jsx(dt,{className:"text-muted-foreground",children:Xr(new Date(A.created_at),"MMM d, yyyy")})]},A.id)})})]})})]})]})]})}const u3t=()=>e.jsx(Fr,{title:"Analytics",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Analytics & Activity"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Platform-wide usage statistics and user activity"})]}),e.jsxs(ci,{defaultValue:"analytics",className:"space-y-4",children:[e.jsxs(ri,{children:[e.jsx(Kr,{value:"analytics",children:"Analytics"}),e.jsx(Kr,{value:"activity",children:"Activity"}),e.jsx(Kr,{value:"shares",children:"Shares"})]}),e.jsx(ms,{value:"analytics",className:"space-y-4",children:e.jsx(d3t,{})}),e.jsx(ms,{value:"activity",className:"space-y-4",children:e.jsx(c3t,{})}),e.jsx(ms,{value:"shares",className:"space-y-4",children:e.jsx(FBe,{})})]})]})});function h3t(){const t=qr(),[r,s]=E.useState(!1),[n,a]=E.useState(null),[o,l]=E.useState({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,category_id:""}),[i,d]=E.useState(null),[m,g]=E.useState(""),[y,v]=E.useState([]),[b,N]=E.useState([]),[j,S]=E.useState([]),[A,M]=E.useState(!1),[I,F]=E.useState(null),[O,B]=E.useState(""),{data:$,isLoading:H}=Ht({queryKey:["brokerage-resources"],queryFn:async()=>{const{data:Pe,error:at}=await Z.from("brokerage_resources").select("*").order("publish_date",{ascending:!1});if(at)throw at;return Pe}}),{data:W}=Ht({queryKey:["brokerage-resource-pdfs"],queryFn:async()=>{const{data:Pe,error:at}=await Z.from("brokerage_resource_pdfs").select("*").order("sort_order",{ascending:!0});if(at)throw at;return Pe}}),{data:X}=Ht({queryKey:["brokerage-resource-videos"],queryFn:async()=>{const{data:Pe,error:at}=await Z.from("brokerage_resource_videos").select("*").order("sort_order",{ascending:!0});if(at)throw at;return Pe}}),{data:se}=Ht({queryKey:["brokerage-resource-links"],queryFn:async()=>{const{data:Pe,error:at}=await Z.from("brokerage_resource_links").select("*").order("sort_order",{ascending:!0});if(at)throw at;return Pe}}),{data:ae,isLoading:le}=Ht({queryKey:["brokerage-resource-categories"],queryFn:async()=>{const{data:Pe,error:at}=await Z.from("brokerage_resource_categories").select("*").order("sort_order",{ascending:!0});if(at)throw at;return Pe}}),ne=()=>{l({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,category_id:""}),d(null),g(""),v([]),N([]),S([]),a(null),B("")},fe=Pe=>{a(Pe),l({title:Pe.title,description:Pe.description||"",publish_date:Pe.publish_date.split("T")[0],is_published:Pe.is_published,category_id:Pe.category_id||""}),g(Pe.preview_image_url||""),B("");const at=(W==null?void 0:W.filter(Ge=>Ge.resource_id===Pe.id))||[];v(at.map(Ge=>({id:Ge.id,name:Ge.name,file_url:Ge.file_url,file_size:Ge.file_size,sort_order:Ge.sort_order})));const ce=(X==null?void 0:X.filter(Ge=>Ge.resource_id===Pe.id))||[];N(ce.map(Ge=>({id:Ge.id,title:Ge.title,video_url:Ge.video_url,sort_order:Ge.sort_order})));const $e=(se==null?void 0:se.filter(Ge=>Ge.resource_id===Pe.id))||[];S($e.map(Ge=>({id:Ge.id,title:Ge.title,canva_share_link:Ge.canva_share_link,sort_order:Ge.sort_order}))),s(!0)},oe=Pe=>{var ce;const at=(ce=Pe.target.files)==null?void 0:ce[0];at&&(d(at),g(URL.createObjectURL(at)))},de=()=>{v([...y,{name:"",file_url:"",sort_order:y.length}])},ue=Pe=>{v(y.filter((at,ce)=>ce!==Pe))},xe=(Pe,at,ce)=>{const $e=[...y];if(at==="file"&&ce instanceof File){const Ge=ce.name.replace(/\.[^/.]+$/,"");$e[Pe]={...$e[Pe],file:ce,file_size:ce.size,name:$e[Pe].name||Ge}}else $e[Pe]={...$e[Pe],[at]:ce};v($e)},Te=()=>{N([...b,{title:"",video_url:"",sort_order:b.length}])},be=Pe=>{N(b.filter((at,ce)=>ce!==Pe))},we=(Pe,at,ce)=>{const $e=[...b];at==="file"&&ce instanceof File?$e[Pe]={...$e[Pe],file:ce}:$e[Pe]={...$e[Pe],[at]:ce},N($e)},ve=()=>{S([...j,{title:"",canva_share_link:"",sort_order:j.length}])},tt=Pe=>{S(j.filter((at,ce)=>ce!==Pe))},Ae=(Pe,at,ce)=>{const $e=[...j];$e[Pe]={...$e[Pe],[at]:ce},S($e)},Le=async(Pe,at)=>{try{const ce=await Z.functions.invoke("bunny-upload",{body:{action:"create",title:Pe.name}});if(ce.error)throw ce.error;const{videoId:$e,uploadUrl:Ge,libraryId:rt}=ce.data,je=await Z.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:$e,libraryId:rt}});if(je.error)throw je.error;const{uploadUrl:it,apiKey:Me}=je.data,Je=new XMLHttpRequest;return Je.open("PUT",it,!0),Je.setRequestHeader("AccessKey",Me),Je.upload.onprogress=Xe=>{if(Xe.lengthComputable){const Ve=Math.round(Xe.loaded/Xe.total*100),ot=[...b];ot[at]={...ot[at],uploadProgress:Ve},N(ot)}},await new Promise((Xe,Ve)=>{Je.onload=()=>Je.status>=200&&Je.status<300?Xe():Ve(new Error("Upload failed")),Je.onerror=()=>Ve(new Error("Upload failed")),Je.send(Pe)}),`https://iframe.mediadelivery.net/embed/${rt}/${$e}`}catch(ce){throw console.error("Bunny upload error:",ce),ce}},Ue=Jt({mutationFn:async Pe=>{const{data:at,error:ce}=await Z.from("brokerage_resource_categories").insert({name:Pe,sort_order:(ae==null?void 0:ae.length)||0}).select().single();if(ce)throw ce;return at},onSuccess:Pe=>{t.invalidateQueries({queryKey:["brokerage-resource-categories"]}),l({...o,category_id:Pe.id}),B(""),Se.success("Category created")},onError:Pe=>{Se.error("Failed to create category: "+Pe.message)}}),Ye=Jt({mutationFn:async()=>{M(!0);let Pe=(n==null?void 0:n.preview_image_url)||null;if(i){const $e=i.name.split(".").pop(),Ge=`${Date.now()}.${$e}`,{error:rt}=await Z.storage.from("brokerage-resources").upload(`previews/${Ge}`,i);if(rt)throw rt;const{data:je}=Z.storage.from("brokerage-resources").getPublicUrl(`previews/${Ge}`);Pe=je.publicUrl}const at={title:o.title,description:o.description||null,preview_image_url:Pe,publish_date:o.publish_date,is_published:o.is_published,category_id:o.category_id||null};let ce;if(n){const{error:$e}=await Z.from("brokerage_resources").update(at).eq("id",n.id);if($e)throw $e;ce=n.id;const Ge=(W==null?void 0:W.filter(mt=>mt.resource_id===n.id).map(mt=>mt.id))||[],rt=y.filter(mt=>mt.id).map(mt=>mt.id),je=Ge.filter(mt=>!rt.includes(mt));je.length>0&&await Z.from("brokerage_resource_pdfs").delete().in("id",je);const it=(X==null?void 0:X.filter(mt=>mt.resource_id===n.id).map(mt=>mt.id))||[],Me=b.filter(mt=>mt.id).map(mt=>mt.id),Je=it.filter(mt=>!Me.includes(mt));Je.length>0&&await Z.from("brokerage_resource_videos").delete().in("id",Je);const Xe=(se==null?void 0:se.filter(mt=>mt.resource_id===n.id).map(mt=>mt.id))||[],Ve=j.filter(mt=>mt.id).map(mt=>mt.id),ot=Xe.filter(mt=>!Ve.includes(mt));ot.length>0&&await Z.from("brokerage_resource_links").delete().in("id",ot)}else{const{data:$e,error:Ge}=await Z.from("brokerage_resources").insert(at).select().single();if(Ge)throw Ge;ce=$e.id}for(let $e=0;$e{t.invalidateQueries({queryKey:["brokerage-resources"]}),t.invalidateQueries({queryKey:["brokerage-resource-pdfs"]}),t.invalidateQueries({queryKey:["brokerage-resource-videos"]}),t.invalidateQueries({queryKey:["brokerage-resource-links"]}),Se.success(n?"Resource updated":"Resource created"),s(!1),ne(),M(!1)},onError:Pe=>{Se.error("Failed to save resource: "+Pe.message),M(!1)}}),Ie=Jt({mutationFn:async Pe=>{const{error:at}=await Z.from("brokerage_resources").delete().eq("id",Pe);if(at)throw at},onSuccess:()=>{t.invalidateQueries({queryKey:["brokerage-resources"]}),t.invalidateQueries({queryKey:["brokerage-resource-pdfs"]}),t.invalidateQueries({queryKey:["brokerage-resource-videos"]}),t.invalidateQueries({queryKey:["brokerage-resource-links"]}),Se.success("Resource deleted")},onError:Pe=>{Se.error("Failed to delete: "+Pe.message)}}),et=Pe=>{if(Pe.preventDefault(),!o.title){Se.error("Please enter a title");return}Ye.mutate()},It=Pe=>{const at=(W==null?void 0:W.filter(Ge=>Ge.resource_id===Pe).length)||0,ce=(X==null?void 0:X.filter(Ge=>Ge.resource_id===Pe).length)||0,$e=(se==null?void 0:se.filter(Ge=>Ge.resource_id===Pe).length)||0;return{pdfCount:at,videoCount:ce,linkCount:$e}};return e.jsx(Fr,{title:"Brokerage Resources Management",description:"Create and manage resources for brokerage managers",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Resources"})}),e.jsx(qe,{children:e.jsx("div",{className:"text-2xl font-bold",children:($==null?void 0:$.length)||0})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),e.jsx(qe,{children:e.jsx("div",{className:"text-2xl font-bold",children:($==null?void 0:$.filter(Pe=>Pe.is_published).length)||0})})]})]}),e.jsxs(Q,{onClick:()=>{ne(),s(!0)},children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Resource"]})]}),e.jsx(ze,{children:e.jsx(qe,{className:"p-0",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Title"}),e.jsx(Ct,{children:"Category"}),e.jsx(Ct,{children:"Content"}),e.jsx(Ct,{children:"Publish Date"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{className:"text-right",children:"Actions"})]})}),e.jsx(zn,{children:H?e.jsx(Nr,{children:e.jsx(dt,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):($==null?void 0:$.length)===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No brokerage resources yet. Create your first one!"})}):$==null?void 0:$.map(Pe=>{const{pdfCount:at,videoCount:ce,linkCount:$e}=It(Pe.id),Ge=ae==null?void 0:ae.find(rt=>rt.id===Pe.category_id);return e.jsxs(Nr,{children:[e.jsx(dt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[Pe.preview_image_url?e.jsx("img",{src:Pe.preview_image_url,alt:Pe.title,className:"w-10 h-10 rounded object-cover"}):e.jsx("div",{className:"w-10 h-10 rounded bg-muted flex items-center justify-center",children:e.jsx(wu,{className:"h-5 w-5 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:Pe.title}),Pe.description&&e.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:Pe.description})]})]})}),e.jsx(dt,{children:Ge?e.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-muted",children:Ge.name}):e.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),e.jsx(dt,{children:e.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(fa,{className:"h-3.5 w-3.5"}),at]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ya,{className:"h-3.5 w-3.5"}),ce]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Bo,{className:"h-3.5 w-3.5"}),$e]})]})}),e.jsx(dt,{children:Xr(new Date(Pe.publish_date),"MMM d, yyyy")}),e.jsx(dt,{children:e.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${Pe.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:Pe.is_published?"Published":"Draft"})}),e.jsx(dt,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{const rt=(W==null?void 0:W.filter(Me=>Me.resource_id===Pe.id))||[],je=(X==null?void 0:X.filter(Me=>Me.resource_id===Pe.id))||[],it=(se==null?void 0:se.filter(Me=>Me.resource_id===Pe.id))||[];F({...Pe,pdfs:rt,videos:je,links:it})},children:e.jsx(Gi,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>fe(Pe),children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource?")&&Ie.mutate(Pe.id)},children:e.jsx(Rs,{className:"h-4 w-4 text-destructive"})})]})})]},Pe.id)})})]})})}),e.jsx(Dr,{open:r,onOpenChange:s,children:e.jsxs(Lr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[e.jsx(Ur,{children:e.jsx(Br,{children:n?"Edit Brokerage Resource":"Add Brokerage Resource"})}),e.jsxs("form",{onSubmit:et,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Preview Image"}),e.jsxs("div",{className:"flex items-center gap-4",children:[m?e.jsx("img",{src:m,alt:"Preview",className:"w-24 h-24 rounded object-cover"}):e.jsx("div",{className:"w-24 h-24 rounded bg-muted flex items-center justify-center",children:e.jsx(wu,{className:"h-8 w-8 text-muted-foreground"})}),e.jsx(Qe,{type:"file",accept:"image/*",onChange:oe})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"title",children:"Title *"}),e.jsx(Qe,{id:"title",value:o.title,onChange:Pe=>l({...o,title:Pe.target.value}),placeholder:"Resource Title"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ee,{className:"flex items-center gap-2",children:[e.jsx(Xg,{className:"h-4 w-4"}),"Category"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(ds,{value:o.category_id,onValueChange:Pe=>l({...o,category_id:Pe}),children:[e.jsx(ls,{className:"flex-1",children:e.jsx(us,{placeholder:"Select a category"})}),e.jsx(cs,{children:ae==null?void 0:ae.map(Pe=>e.jsx(Ut,{value:Pe.id,children:Pe.name},Pe.id))})]}),o.category_id&&e.jsx(Q,{type:"button",variant:"ghost",size:"icon",onClick:()=>l({...o,category_id:""}),children:e.jsx(rn,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Qe,{placeholder:"Or create new category...",value:O,onChange:Pe=>B(Pe.target.value),className:"flex-1"}),e.jsxs(Q,{type:"button",variant:"outline",size:"sm",disabled:!O.trim()||Ue.isPending,onClick:()=>Ue.mutate(O.trim()),children:[e.jsx(gs,{className:"h-4 w-4 mr-1"}),"Add"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Description"}),e.jsx(eg,{content:o.description,onChange:Pe=>l({...o,description:Pe}),placeholder:"Brief description of this resource",minHeight:"120px"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"publish_date",children:"Publish Date"}),e.jsx(Qe,{id:"publish_date",type:"date",value:o.publish_date,onChange:Pe=>l({...o,publish_date:Pe.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Published"}),e.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[e.jsx(xn,{checked:o.is_published,onCheckedChange:Pe=>l({...o,is_published:Pe})}),e.jsx("span",{className:"text-sm text-muted-foreground",children:o.is_published?"Visible to brokerage managers":"Hidden from brokerage managers"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Ee,{className:"flex items-center gap-2",children:[e.jsx(fa,{className:"h-4 w-4"}),"PDF Documents (",y.length,")"]}),e.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:de,children:[e.jsx(gs,{className:"h-4 w-4 mr-1"}),"Add PDF"]})]}),y.map((Pe,at)=>e.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/50",children:[e.jsx(Qe,{placeholder:"PDF Name",value:Pe.name,onChange:ce=>xe(at,"name",ce.target.value),className:"flex-1"}),e.jsx(Qe,{type:"file",accept:".pdf",onChange:ce=>{var Ge;const $e=(Ge=ce.target.files)==null?void 0:Ge[0];$e&&xe(at,"file",$e)},className:"flex-1"}),Pe.file_url&&!Pe.file&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"Uploaded"}),e.jsx(Q,{type:"button",variant:"ghost",size:"icon",onClick:()=>ue(at),children:e.jsx(rn,{className:"h-4 w-4"})})]},at))]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Ee,{className:"flex items-center gap-2",children:[e.jsx(ya,{className:"h-4 w-4"}),"Videos (",b.length,")"]}),e.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:Te,children:[e.jsx(gs,{className:"h-4 w-4 mr-1"}),"Add Video"]})]}),b.map((Pe,at)=>e.jsxs("div",{className:"space-y-2 p-3 border rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Qe,{placeholder:"Video Title",value:Pe.title,onChange:ce=>we(at,"title",ce.target.value),className:"flex-1"}),e.jsx(Q,{type:"button",variant:"ghost",size:"icon",onClick:()=>be(at),children:e.jsx(rn,{className:"h-4 w-4"})})]}),e.jsx(Qe,{type:"file",accept:"video/*",onChange:ce=>{var Ge;const $e=(Ge=ce.target.files)==null?void 0:Ge[0];$e&&we(at,"file",$e)}}),Pe.uploadProgress!==void 0&&Pe.uploadProgress>0&&e.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:e.jsx("div",{className:"bg-primary h-2 rounded-full transition-all",style:{width:`${Pe.uploadProgress}%`}})}),Pe.video_url&&!Pe.file&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"Video uploaded"})]},at))]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Ee,{className:"flex items-center gap-2",children:[e.jsx(Bo,{className:"h-4 w-4"}),"Canva Links (",j.length,")"]}),e.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:ve,children:[e.jsx(gs,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),j.map((Pe,at)=>e.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/50",children:[e.jsx(Qe,{placeholder:"Link Title",value:Pe.title,onChange:ce=>Ae(at,"title",ce.target.value),className:"flex-1"}),e.jsx(Qe,{placeholder:"Canva Share Link",value:Pe.canva_share_link,onChange:ce=>Ae(at,"canva_share_link",ce.target.value),className:"flex-1"}),e.jsx(Q,{type:"button",variant:"ghost",size:"icon",onClick:()=>tt(at),children:e.jsx(rn,{className:"h-4 w-4"})})]},at))]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(Q,{type:"submit",disabled:Ye.isPending||A,children:Ye.isPending||A?"Saving...":n?"Update":"Create"})]})]})]})}),e.jsx(Dr,{open:!!I,onOpenChange:()=>F(null),children:e.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsx(Ur,{children:e.jsx(Br,{children:I==null?void 0:I.title})}),I&&e.jsxs("div",{className:"space-y-4",children:[I.preview_image_url&&e.jsx("img",{src:I.preview_image_url,alt:I.title,className:"w-full h-48 object-cover rounded-lg"}),I.description&&e.jsx("p",{className:"text-muted-foreground",children:I.description}),I.pdfs&&I.pdfs.length>0&&e.jsxs("div",{children:[e.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[e.jsx(fa,{className:"h-4 w-4"}),"PDF Documents (",I.pdfs.length,")"]}),e.jsx("div",{className:"space-y-1",children:I.pdfs.map(Pe=>e.jsx("a",{href:Pe.file_url,target:"_blank",rel:"noopener noreferrer",className:"block p-2 border rounded hover:bg-muted",children:Pe.name},Pe.id))})]}),I.videos&&I.videos.length>0&&e.jsxs("div",{children:[e.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[e.jsx(ya,{className:"h-4 w-4"}),"Videos (",I.videos.length,")"]}),e.jsx("div",{className:"space-y-2",children:I.videos.map(Pe=>e.jsx("div",{className:"p-2 border rounded",children:e.jsx("p",{className:"font-medium text-sm",children:Pe.title})},Pe.id))})]}),I.links&&I.links.length>0&&e.jsxs("div",{children:[e.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[e.jsx(Bo,{className:"h-4 w-4"}),"Canva Links (",I.links.length,")"]}),e.jsx("div",{className:"space-y-1",children:I.links.map(Pe=>e.jsx("a",{href:Pe.canva_share_link,target:"_blank",rel:"noopener noreferrer",className:"block p-2 border rounded hover:bg-muted",children:Pe.title},Pe.id))})]})]})]})})]})})}const zBe=[{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 m3t(){const[t,r]=E.useState([]),[s,n]=E.useState(!0),[a,o]=E.useState(!1),[l,i]=E.useState(!1),[d,m]=E.useState(null),[g,y]=E.useState(!1),[v,b]=E.useState(!1),[N,j]=E.useState(""),[S,A]=E.useState(""),[M,I]=E.useState(""),[F,O]=E.useState(""),[B,$]=E.useState("Learn More"),[H,W]=E.useState("top"),[X,se]=E.useState(""),[ae,le]=E.useState(!0),[ne,fe]=E.useState(""),[oe,de]=E.useState("");E.useEffect(()=>{ue()},[]);const ue=async()=>{try{const{data:Ue,error:Ye}=await Z.from("dashboard_banners").select("*").order("placement").order("sort_order");if(Ye)throw Ye;r(Ue||[])}catch(Ue){Se.error("Failed to load banners: "+Ue.message)}finally{n(!1)}},xe=()=>{j(""),A(""),I(""),O(""),$("Learn More"),W("top"),se(""),le(!0),fe(""),de(""),m(null)},Te=Ue=>{m(Ue),j(Ue.title),A(Ue.description||""),I(Ue.image_url),O(Ue.link_url||""),$(Ue.link_text||"Learn More"),W(Ue.placement),se(Ue.section_after||""),le(Ue.is_active),fe(Ue.start_date?Xr(new Date(Ue.start_date),"yyyy-MM-dd'T'HH:mm"):""),de(Ue.end_date?Xr(new Date(Ue.end_date),"yyyy-MM-dd'T'HH:mm"):""),o(!0)},be=async Ue=>{var Ie;const Ye=(Ie=Ue.target.files)==null?void 0:Ie[0];if(Ye){y(!0);try{const et=Ye.name.split(".").pop(),It=`${Date.now()}.${et}`,{error:Pe}=await Z.storage.from("banner-images").upload(It,Ye);if(Pe)throw Pe;const{data:{publicUrl:at}}=Z.storage.from("banner-images").getPublicUrl(It);I(at),Se.success("Image uploaded successfully")}catch(et){Se.error("Failed to upload image: "+et.message)}finally{y(!1)}}},we=async()=>{if(!N.trim()||!M){Se.error("Please fill in required fields (title and image)");return}b(!0);try{const Ue={title:N.trim(),description:S.trim()||null,image_url:M,link_url:F.trim()||null,link_text:B.trim()||"Learn More",placement:H,section_after:H==="between"?X:null,is_active:ae,start_date:ne?new Date(ne).toISOString():null,end_date:oe?new Date(oe).toISOString():null};if(d){const{error:Ye}=await Z.from("dashboard_banners").update(Ue).eq("id",d.id);if(Ye)throw Ye;Se.success("Banner updated successfully")}else{const Ye=t.filter(et=>et.placement===H).length,{error:Ie}=await Z.from("dashboard_banners").insert({...Ue,sort_order:Ye});if(Ie)throw Ie;Se.success("Banner created successfully")}o(!1),xe(),ue()}catch(Ue){Se.error("Failed to save banner: "+Ue.message)}finally{b(!1)}},ve=async()=>{if(d)try{const{error:Ue}=await Z.from("dashboard_banners").delete().eq("id",d.id);if(Ue)throw Ue;Se.success("Banner deleted successfully"),i(!1),m(null),ue()}catch(Ue){Se.error("Failed to delete banner: "+Ue.message)}},tt=async Ue=>{try{const{error:Ye}=await Z.from("dashboard_banners").update({is_active:!Ue.is_active}).eq("id",Ue.id);if(Ye)throw Ye;Se.success(Ue.is_active?"Banner deactivated":"Banner activated"),ue()}catch(Ye){Se.error("Failed to update banner: "+Ye.message)}},Ae=t.filter(Ue=>Ue.placement==="top"),Le=t.filter(Ue=>Ue.placement==="between");return s?e.jsx(Fr,{title:"Dashboard Management",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})}):e.jsxs(Fr,{title:"Dashboard Management",description:"Configure dashboard modules and banners",children:[e.jsxs("div",{className:"space-y-8",children:[e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(El,{className:"h-5 w-5"}),"Hero Banners (Top of Dashboard)"]}),e.jsx(Ss,{children:"These banners appear in a rotating carousel at the top of the dashboard"})]}),e.jsxs(Dr,{open:a&&H==="top",onOpenChange:Ue=>{Ue||xe(),o(Ue),Ue&&W("top")},children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{onClick:()=>{xe(),W("top")},children:[e.jsx(gs,{className:"mr-2 h-4 w-4"}),"Add Hero Banner"]})}),e.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{children:[d?"Edit":"Create"," Banner"]}),e.jsx(Gs,{children:"Configure the banner's content and display settings"})]}),e.jsx(vCe,{title:N,setTitle:j,description:S,setDescription:A,imageUrl:M,linkUrl:F,setLinkUrl:O,linkText:B,setLinkText:$,placement:H,setPlacement:W,sectionAfter:X,setSectionAfter:se,isActive:ae,setIsActive:le,startDate:ne,setStartDate:fe,endDate:oe,setEndDate:de,handleImageUpload:be,uploading:g,showPlacementOptions:!1}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>{o(!1),xe()},children:"Cancel"}),e.jsx(Q,{onClick:we,disabled:v,children:v?"Saving...":d?"Update Banner":"Create Banner"})]})]})]})]}),e.jsx(qe,{children:Ae.length===0?e.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No hero banners yet. Add your first banner above."}):e.jsx("div",{className:"space-y-3",children:Ae.map(Ue=>e.jsx(_Ce,{banner:Ue,onEdit:()=>Te(Ue),onDelete:()=>{m(Ue),i(!0)},onToggleActive:()=>tt(Ue)},Ue.id))})})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(El,{className:"h-5 w-5"}),"Section Banners"]}),e.jsx(Ss,{children:"These banners appear between dashboard content sections"})]}),e.jsxs(Dr,{open:a&&H==="between",onOpenChange:Ue=>{Ue||xe(),o(Ue),Ue&&W("between")},children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{onClick:()=>{xe(),W("between")},children:[e.jsx(gs,{className:"mr-2 h-4 w-4"}),"Add Section Banner"]})}),e.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{children:[d?"Edit":"Create"," Section Banner"]}),e.jsx(Gs,{children:"Configure where this banner appears between sections"})]}),e.jsx(vCe,{title:N,setTitle:j,description:S,setDescription:A,imageUrl:M,linkUrl:F,setLinkUrl:O,linkText:B,setLinkText:$,placement:H,setPlacement:W,sectionAfter:X,setSectionAfter:se,isActive:ae,setIsActive:le,startDate:ne,setStartDate:fe,endDate:oe,setEndDate:de,handleImageUpload:be,uploading:g,showPlacementOptions:!0}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>{o(!1),xe()},children:"Cancel"}),e.jsx(Q,{onClick:we,disabled:v,children:v?"Saving...":d?"Update Banner":"Create Banner"})]})]})]})]}),e.jsx(qe,{children:Le.length===0?e.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No section banners yet. Add your first banner above."}):e.jsx("div",{className:"space-y-3",children:Le.map(Ue=>e.jsx(_Ce,{banner:Ue,onEdit:()=>Te(Ue),onDelete:()=>{m(Ue),i(!0)},onToggleActive:()=>tt(Ue),showSection:!0},Ue.id))})})]})]}),e.jsx(Dr,{open:l,onOpenChange:i,children:e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Delete Banner"}),e.jsxs(Gs,{children:['Are you sure you want to delete "',d==null?void 0:d.title,'"? This action cannot be undone.']})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(Q,{variant:"destructive",onClick:ve,children:"Delete"})]})]})})]})}function vCe({title:t,setTitle:r,description:s,setDescription:n,imageUrl:a,linkUrl:o,setLinkUrl:l,linkText:i,setLinkText:d,placement:m,setPlacement:g,sectionAfter:y,setSectionAfter:v,isActive:b,setIsActive:N,startDate:j,setStartDate:S,endDate:A,setEndDate:M,handleImageUpload:I,uploading:F,showPlacementOptions:O}){return e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"title",children:"Title *"}),e.jsx(Qe,{id:"title",placeholder:"Banner headline...",value:t,onChange:B=>r(B.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"description",children:"Description"}),e.jsx(Ks,{id:"description",placeholder:"Optional banner description...",value:s,onChange:B=>n(B.target.value),rows:2})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Banner Image *"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(Qe,{type:"file",accept:"image/*",onChange:I,disabled:F,className:"flex-1"}),F&&e.jsx("span",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),a&&e.jsx("div",{className:"mt-2 relative rounded-lg overflow-hidden border",children:e.jsx("img",{src:a,alt:"Preview",className:"w-full h-40 object-cover"})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"linkUrl",children:"Link URL (optional)"}),e.jsx(Qe,{id:"linkUrl",placeholder:"https://...",value:o,onChange:B=>l(B.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"linkText",children:"Button Text"}),e.jsx(Qe,{id:"linkText",placeholder:"Learn More",value:i,onChange:B=>d(B.target.value)})]})]}),O&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Placement"}),e.jsxs(ds,{value:y,onValueChange:v,children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Select section placement..."})}),e.jsx(cs,{children:zBe.map(B=>e.jsx(Ut,{value:B.value,children:B.label},B.value))})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ee,{htmlFor:"startDate",className:"flex items-center gap-2",children:[e.jsx(Mn,{className:"h-4 w-4"}),"Start Date (optional)"]}),e.jsx(Qe,{id:"startDate",type:"datetime-local",value:j,onChange:B=>S(B.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ee,{htmlFor:"endDate",className:"flex items-center gap-2",children:[e.jsx(Mn,{className:"h-4 w-4"}),"End Date (optional)"]}),e.jsx(Qe,{id:"endDate",type:"datetime-local",value:A,onChange:B=>M(B.target.value)})]})]}),e.jsx("div",{className:"flex items-center justify-between pt-2",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xn,{id:"isActive",checked:b,onCheckedChange:N}),e.jsx(Ee,{htmlFor:"isActive",children:"Active"})]})})]})}function _Ce({banner:t,onEdit:r,onDelete:s,onToggleActive:n,showSection:a=!1}){var l;const o=(l=zBe.find(i=>i.value===t.section_after))==null?void 0:l.label;return e.jsxs("div",{className:"flex items-center gap-4 p-3 border rounded-lg bg-card hover:bg-accent/50 transition-colors",children:[e.jsx(xp,{className:"h-5 w-5 text-muted-foreground cursor-grab"}),e.jsx("img",{src:t.image_url,alt:t.title,className:"w-24 h-14 object-cover rounded"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"font-medium truncate",children:t.title}),!t.is_active&&e.jsx(bt,{variant:"secondary",children:"Inactive"}),t.start_date&&new Date(t.start_date)>new Date&&e.jsx(bt,{variant:"outline",children:"Scheduled"})]}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:t.description}),a&&o&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:o})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[t.link_url&&e.jsx("a",{href:t.link_url,target:"_blank",rel:"noopener noreferrer",children:e.jsx(Q,{variant:"ghost",size:"icon",children:e.jsx(En,{className:"h-4 w-4"})})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:n,children:t.is_active?e.jsx(Gi,{className:"h-4 w-4"}):e.jsx(zf,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:r,children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:s,children:e.jsx(Rs,{className:"h-4 w-4 text-destructive"})})]})]})}const U8={open:{label:"Open",icon:Ea,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:Pl,color:"bg-blue-500"},resolved:{label:"Resolved",icon:ui,color:"bg-green-500"},closed:{label:"Closed",icon:Sc,color:"bg-muted-foreground"}},bCe={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function p3t(){var B,$;const{user:t}=Gr(),r=qr(),[s,n]=E.useState(null),[a,o]=E.useState(""),[l,i]=E.useState("all"),[d,m]=E.useState("all"),[g,y]=E.useState(!1),{data:v=[],isLoading:b}=Ht({queryKey:["admin-support-tickets",l,d],queryFn:async()=>{let H=Z.from("support_tickets").select("*, profiles!support_tickets_user_id_fkey(name, email)").order("created_at",{ascending:!1});l!=="all"&&(H=H.eq("status",l)),d!=="all"&&(H=H.eq("category",d));const{data:W,error:X}=await H;if(X)throw X;return W}}),{data:N=[]}=Ht({queryKey:["admin-users-notifications"],queryFn:async()=>{const{data:H,error:W}=await Z.from("user_roles").select("user_id").eq("role","admin");if(W)throw W;const X=H.map(oe=>oe.user_id),{data:se,error:ae}=await Z.from("profiles").select("id, name, email").in("id",X);if(ae)throw ae;const{data:le,error:ne}=await Z.from("support_notification_settings").select("user_id, receive_notifications");if(ne)throw ne;const fe=new Map((le==null?void 0:le.map(oe=>[oe.user_id,oe.receive_notifications]))||[]);return se.map(oe=>({...oe,receives_notifications:fe.get(oe.id)||!1}))}}),{data:j=[]}=Ht({queryKey:["admin-ticket-replies",s==null?void 0:s.id],queryFn:async()=>{if(!s)return[];const{data:H,error:W}=await Z.from("support_ticket_replies").select("*, profiles(name)").eq("ticket_id",s.id).order("created_at",{ascending:!0});if(W)throw W;return H},enabled:!!s}),S=Jt({mutationFn:async({userId:H,enabled:W})=>{const{data:X}=await Z.from("support_notification_settings").select("id").eq("user_id",H).maybeSingle();if(X){const{error:se}=await Z.from("support_notification_settings").update({receive_notifications:W}).eq("user_id",H);if(se)throw se}else{const{error:se}=await Z.from("support_notification_settings").insert({user_id:H,receive_notifications:W});if(se)throw se}},onSuccess:()=>{r.invalidateQueries({queryKey:["admin-users-notifications"]}),Se.success("Notification settings updated")},onError:()=>{Se.error("Failed to update settings")}}),A=Jt({mutationFn:async({ticketId:H,status:W})=>{const{error:X}=await Z.from("support_tickets").update({status:W}).eq("id",H);if(X)throw X},onSuccess:()=>{r.invalidateQueries({queryKey:["admin-support-tickets"]}),s&&n({...s,status:s.status}),Se.success("Status updated")},onError:()=>{Se.error("Failed to update status")}}),M=Jt({mutationFn:async({ticketId:H,assignedTo:W})=>{const{error:X}=await Z.from("support_tickets").update({assigned_to:W}).eq("id",H);if(X)throw X},onSuccess:()=>{r.invalidateQueries({queryKey:["admin-support-tickets"]}),Se.success("Ticket assigned")},onError:()=>{Se.error("Failed to assign ticket")}}),I=Jt({mutationFn:async H=>{var X,se;if(!s||!t)throw new Error("Missing data");const{error:W}=await Z.from("support_ticket_replies").insert({ticket_id:s.id,user_id:t.id,content:H,is_admin_reply:!0});if(W)throw W;try{await Z.functions.invoke("support-reply-notify",{body:{ticketId:s.id,ticketSubject:s.subject,replyContent:H,userEmail:(X=s.profiles)==null?void 0:X.email,userName:(se=s.profiles)==null?void 0:se.name}})}catch(ae){console.error("Failed to send reply notification:",ae)}},onSuccess:()=>{r.invalidateQueries({queryKey:["admin-ticket-replies",s==null?void 0:s.id]}),o(""),Se.success("Reply sent!")},onError:()=>{Se.error("Failed to send reply")}}),F=()=>{a.trim()&&I.mutate(a)};E.useEffect(()=>{const H=Z.channel("admin-tickets").on("postgres_changes",{event:"*",schema:"public",table:"support_tickets"},()=>{r.invalidateQueries({queryKey:["admin-support-tickets"]})}).subscribe();return()=>{Z.removeChannel(H)}},[r]);const O=v.filter(H=>H.status==="open").length;return s?(U8[s.status].icon,e.jsx(Fr,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>n(null),children:e.jsx(_i,{className:"h-5 w-5"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h1",{className:"text-2xl font-bold",children:s.subject}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(bt,{variant:"secondary",children:bCe[s.category]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["from ",((B=s.profiles)==null?void 0:B.name)||"Unknown"," (",($=s.profiles)==null?void 0:$.email,")"]})]})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm",children:"Status"})}),e.jsx(qe,{children:e.jsxs(ds,{value:s.status,onValueChange:H=>{A.mutate({ticketId:s.id,status:H}),n({...s,status:H})},children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"open",children:"Open"}),e.jsx(Ut,{value:"in_progress",children:"In Progress"}),e.jsx(Ut,{value:"resolved",children:"Resolved"}),e.jsx(Ut,{value:"closed",children:"Closed"})]})]})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm",children:"Assigned To"})}),e.jsx(qe,{children:e.jsxs(ds,{value:s.assigned_to||"unassigned",onValueChange:H=>{const W=H==="unassigned"?null:H;M.mutate({ticketId:s.id,assignedTo:W}),n({...s,assigned_to:W})},children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Unassigned"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"unassigned",children:"Unassigned"}),N.map(H=>e.jsx(Ut,{value:H.id,children:H.name},H.id))]})]})})]})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Ss,{children:["Created on ",Xr(new Date(s.created_at),"MMM d, yyyy 'at' h:mm a")]})}),e.jsx(qe,{children:e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:s.description})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{className:"text-lg",children:"Conversation"})}),e.jsxs(qe,{children:[e.jsx(Eo,{className:"h-[300px] pr-4",children:j.length===0?e.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No replies yet"}):e.jsx("div",{className:"space-y-4",children:j.map(H=>{var W,X;return e.jsxs("div",{className:`p-4 rounded-lg ${H.is_admin_reply?"bg-primary/10 ml-4":"bg-muted mr-4"}`,children:[e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsx("span",{className:"font-medium text-sm",children:H.is_admin_reply?`${((W=H.profiles)==null?void 0:W.name)||"Admin"} (Support)`:((X=H.profiles)==null?void 0:X.name)||"User"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Xr(new Date(H.created_at),"MMM d, h:mm a")})]}),e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:H.content})]},H.id)})})}),e.jsx(gd,{className:"my-4"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Ks,{placeholder:"Type your reply...",value:a,onChange:H=>o(H.target.value),className:"min-h-[80px]"}),e.jsx(Q,{onClick:F,disabled:!a.trim()||I.isPending,className:"self-end",children:e.jsx(Mi,{className:"h-4 w-4"})})]})]})]})]})})):e.jsx(Fr,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Support Tickets"}),e.jsxs("p",{className:"text-muted-foreground",children:["Manage support requests from agents",O>0&&e.jsxs(bt,{variant:"destructive",className:"ml-2",children:[O," open"]})]})]}),e.jsxs(Dr,{open:g,onOpenChange:y,children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{variant:"outline",children:[e.jsx(vd,{className:"h-4 w-4 mr-2"}),"Notification Settings"]})}),e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Email Notification Settings"}),e.jsx(Gs,{children:"Choose which admins receive email notifications for new support tickets."})]}),e.jsx("div",{className:"space-y-4 mt-4",children:N.map(H=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Kl,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:H.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:H.email})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[H.receives_notifications?e.jsx(Df,{className:"h-4 w-4 text-primary"}):e.jsx(Lj,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(xn,{checked:H.receives_notifications,onCheckedChange:W=>S.mutate({userId:H.id,enabled:W})})]})]},H.id))})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[e.jsx(ci,{value:l,onValueChange:i,className:"w-auto",children:e.jsxs(ri,{children:[e.jsx(Kr,{value:"all",children:"All"}),e.jsx(Kr,{value:"open",children:"Open"}),e.jsx(Kr,{value:"in_progress",children:"In Progress"}),e.jsx(Kr,{value:"resolved",children:"Resolved"}),e.jsx(Kr,{value:"closed",children:"Closed"})]})}),e.jsxs(ds,{value:d,onValueChange:m,children:[e.jsx(ls,{className:"w-[180px]",children:e.jsx(us,{placeholder:"All Categories"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Categories"}),e.jsx(Ut,{value:"general",children:"General Support"}),e.jsx(Ut,{value:"technology",children:"Technology Support"}),e.jsx(Ut,{value:"crm",children:"CRM Support"}),e.jsx(Ut,{value:"marketing",children:"Marketing Support"})]})]})]}),e.jsx("div",{className:"mt-4",children:b?e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading tickets..."}):v.length===0?e.jsx(ze,{children:e.jsxs(qe,{className:"text-center py-12",children:[e.jsx(Pl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No tickets found"}),e.jsx("p",{className:"text-muted-foreground",children:"No support tickets match the current filters."})]})}):e.jsx("div",{className:"space-y-3",children:v.map(H=>{var X,se;const W=U8[H.status].icon;return e.jsx(ze,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>n(H),children:e.jsx(qe,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-medium truncate",children:H.subject}),e.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[e.jsx(bt,{variant:"outline",className:"text-xs",children:bCe[H.category]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[(X=H.profiles)==null?void 0:X.name," • ",Xr(new Date(H.created_at),"MMM d, yyyy")]}),H.assigned_to&&e.jsxs(bt,{variant:"secondary",className:"text-xs gap-1",children:[e.jsx(Kl,{className:"h-3 w-3"}),((se=N.find(ae=>ae.id===H.assigned_to))==null?void 0:se.name)||"Assigned"]})]})]}),e.jsxs(bt,{className:U8[H.status].color,children:[e.jsx(W,{className:"h-3 w-3 mr-1"}),U8[H.status].label]})]})})},H.id)})})})]})]})})}const f3t=cu.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var r;return(r=t.style.color)===null||r===void 0?void 0:r.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:r})=>r().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}});function g3t({content:t,onChange:r,variables:s}){const n=k7e({extensions:[A7e,B7e.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),$7e.configure({types:["heading","paragraph"]}),U7e,f3t],content:t,onUpdate:({editor:l})=>{r(l.getHTML())}});E.useEffect(()=>{n&&t!==n.getHTML()&&n.commands.setContent(t)},[t,n]);const a=l=>{n&&n.chain().focus().insertContent(`{{${l.key}}}`).run()},o=()=>{if(!n)return;const l=n.getAttributes("link").href,i=window.prompt("URL",l);if(i!==null){if(i===""){n.chain().focus().extendMarkRange("link").unsetLink().run();return}n.chain().focus().extendMarkRange("link").setLink({href:i}).run()}};return n?e.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1 p-2 border-b bg-muted/30",children:[e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>n.chain().focus().toggleBold().run(),className:n.isActive("bold")?"bg-muted":"",children:e.jsx(LS,{className:"h-4 w-4"})}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>n.chain().focus().toggleItalic().run(),className:n.isActive("italic")?"bg-muted":"",children:e.jsx($S,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-6 bg-border mx-1"}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>n.chain().focus().toggleBulletList().run(),className:n.isActive("bulletList")?"bg-muted":"",children:e.jsx(vp,{className:"h-4 w-4"})}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>n.chain().focus().toggleOrderedList().run(),className:n.isActive("orderedList")?"bg-muted":"",children:e.jsx(VS,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-6 bg-border mx-1"}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>n.chain().focus().setTextAlign("left").run(),className:n.isActive({textAlign:"left"})?"bg-muted":"",children:e.jsx(IS,{className:"h-4 w-4"})}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>n.chain().focus().setTextAlign("center").run(),className:n.isActive({textAlign:"center"})?"bg-muted":"",children:e.jsx(ES,{className:"h-4 w-4"})}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>n.chain().focus().setTextAlign("right").run(),className:n.isActive({textAlign:"right"})?"bg-muted":"",children:e.jsx(PS,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-6 bg-border mx-1"}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:o,className:n.isActive("link")?"bg-muted":"",children:e.jsx(Bo,{className:"h-4 w-4"})}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>n.chain().focus().toggleCodeBlock().run(),className:n.isActive("codeBlock")?"bg-muted":"",children:e.jsx(Rj,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-6 bg-border mx-1"}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>n.chain().focus().undo().run(),disabled:!n.can().undo(),children:e.jsx(XS,{className:"h-4 w-4"})}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>n.chain().focus().redo().run(),disabled:!n.can().redo(),children:e.jsx(ZS,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex-1"}),s.length>0&&e.jsxs(mh,{children:[e.jsx(ph,{asChild:!0,children:e.jsxs(Q,{type:"button",variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(GA,{className:"h-4 w-4"}),"Insert Variable"]})}),e.jsx(Au,{align:"end",className:"w-64",children:s.map(l=>e.jsxs(Ba,{onClick:()=>a(l),className:"flex flex-col items-start",children:[e.jsx("span",{className:"font-medium",children:l.label}),e.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:`{{${l.key}}}`}),l.description&&e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:l.description})]},l.key))})]})]}),e.jsx(w7e,{editor:n,className:"prose prose-sm max-w-none p-4 min-h-[300px] focus:outline-none [&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[280px]"}),s.length>0&&e.jsxs("div",{className:"border-t p-3 bg-muted/20",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Available variables (click to copy):"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.map(l=>e.jsx(bt,{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 x3t(){const t=qr(),[r,s]=E.useState(null),[n,a]=E.useState(null),[o,l]=E.useState(""),[i,d]=E.useState(""),[m,g]=E.useState(""),[y,v]=E.useState(!0),[b,N]=E.useState("visual"),{data:j,isLoading:S}=Ht({queryKey:["email-templates"],queryFn:async()=>{const{data:O,error:B}=await Z.from("email_templates").select("*").order("name");if(B)throw B;return O.map($=>({...$,available_variables:$.available_variables||[]}))}}),A=Jt({mutationFn:async O=>{const{error:B}=await Z.from("email_templates").update({subject:O.subject,body_html:O.body_html,description:O.description,is_active:O.is_active}).eq("id",O.id);if(B)throw B},onSuccess:()=>{t.invalidateQueries({queryKey:["email-templates"]}),Se.success("Email template updated successfully"),s(null)},onError:O=>{Se.error("Failed to update template: "+O.message)}}),M=O=>{s(O),l(O.subject),d(O.body_html),g(O.description||""),v(O.is_active),N("visual")},I=()=>{r&&A.mutate({id:r.id,subject:o,body_html:i,description:m,is_active:y})},F=(O,B)=>{let $=O;return B.forEach(H=>{const W=`{{${H.key}}}`,X=`[${H.label}]`;$=$.replace(new RegExp(W.replace(/[{}]/g,"\\$&"),"g"),X)}),$};return r?e.jsxs(Fr,{title:"Edit Email Template",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(Q,{variant:"ghost",onClick:()=>s(null),children:[e.jsx(_i,{className:"h-4 w-4 mr-2"}),"Back to Templates"]}),e.jsx("div",{className:"flex-1"}),e.jsxs(Q,{variant:"outline",onClick:()=>a(r),children:[e.jsx(Gi,{className:"h-4 w-4 mr-2"}),"Preview"]}),e.jsxs(Q,{onClick:I,disabled:A.isPending,children:[e.jsx(_p,{className:"h-4 w-4 mr-2"}),A.isPending?"Saving...":"Save Changes"]})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(mn,{className:"h-5 w-5"}),r.name]}),e.jsxs(Ss,{className:"mt-1",children:["Template slug: ",e.jsx("code",{className:"bg-muted px-1 rounded",children:r.slug})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ee,{htmlFor:"active-toggle",children:"Active"}),e.jsx(xn,{id:"active-toggle",checked:y,onCheckedChange:v})]})]})}),e.jsxs(qe,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"description",children:"Description"}),e.jsx(Ks,{id:"description",value:m,onChange:O=>g(O.target.value),placeholder:"Brief description of when this email is sent",rows:2})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"subject",children:"Email Subject"}),e.jsx(Qe,{id:"subject",value:o,onChange:O=>l(O.target.value),placeholder:"Email subject line"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["You can use variables like ","{{name}}"," in the subject"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ee,{children:"Email Body"}),e.jsx(ci,{value:b,onValueChange:O=>N(O),children:e.jsxs(ri,{className:"h-8",children:[e.jsxs(Kr,{value:"visual",className:"text-xs px-3 h-6",children:[e.jsx(Wj,{className:"h-3 w-3 mr-1"}),"Visual"]}),e.jsxs(Kr,{value:"html",className:"text-xs px-3 h-6",children:[e.jsx(Rj,{className:"h-3 w-3 mr-1"}),"HTML"]})]})})]}),b==="visual"?e.jsx(g3t,{content:i,onChange:d,variables:r.available_variables}):e.jsx(Ks,{value:i,onChange:O=>d(O.target.value),className:"font-mono text-sm min-h-[400px]",placeholder:"HTML email body"})]})]})]})]}),e.jsx(Dr,{open:!!n,onOpenChange:()=>a(null),children:e.jsxs(Lr,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Email Preview"}),e.jsxs(Gs,{children:["Subject: ",o.replace(/\{\{(\w+)\}\}/g,"[$1]")]})]}),e.jsx("div",{className:"border rounded-lg p-4 bg-white",children:e.jsx("div",{dangerouslySetInnerHTML:{__html:F(i,r.available_variables)}})})]})})]}):e.jsx(Fr,{title:"Email Templates",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Email Templates"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Manage and customize system email templates"})]}),S?e.jsx("div",{className:"grid gap-4",children:[...Array(4)].map((O,B)=>e.jsx(ze,{children:e.jsxs(Wt,{children:[e.jsx(fr,{className:"h-5 w-48"}),e.jsx(fr,{className:"h-4 w-96"})]})},B))}):e.jsx("div",{className:"grid gap-4",children:j==null?void 0:j.map(O=>e.jsxs(ze,{className:"hover:shadow-md transition-shadow",children:[e.jsx(Wt,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(Zt,{className:"flex items-center gap-2 text-lg",children:[e.jsx(mn,{className:"h-5 w-5 text-muted-foreground"}),O.name,!O.is_active&&e.jsx(bt,{variant:"secondary",children:"Inactive"})]}),e.jsx(Ss,{children:O.description})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>a(O),children:[e.jsx(Gi,{className:"h-4 w-4 mr-2"}),"Preview"]}),e.jsxs(Q,{size:"sm",onClick:()=>M(O),children:[e.jsx(wc,{className:"h-4 w-4 mr-2"}),"Edit"]})]})]})}),e.jsx(qe,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Subject:"}),e.jsx("code",{className:"bg-muted px-2 py-0.5 rounded text-sm",children:O.subject})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Variables:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:O.available_variables.map(B=>e.jsx(bt,{variant:"outline",className:"font-mono text-xs",children:`{{${B.key}}}`},B.key))})]})]})})]},O.id))}),e.jsx(Dr,{open:!!n&&!r,onOpenChange:()=>a(null),children:e.jsxs(Lr,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{children:["Email Preview: ",n==null?void 0:n.name]}),e.jsxs(Gs,{children:["Subject: ",n==null?void 0:n.subject.replace(/\{\{(\w+)\}\}/g,"[$1]")]})]}),n&&e.jsx("div",{className:"border rounded-lg p-4 bg-white",children:e.jsx("div",{dangerouslySetInnerHTML:{__html:F(n.body_html,n.available_variables)}})})]})})]})})}function y3t(){const t=qr(),[r,s]=E.useState("templates"),[n,a]=E.useState(null),[o,l]=E.useState(null),[i,d]=E.useState(!1),[m,g]=E.useState(!1),[y,v]=E.useState({title:"",subject:"",body:"",description:"",tone:"",category_id:"",is_active:!0}),[b,N]=E.useState({name:"",description:"",icon:"📧"}),{data:j=[]}=Ht({queryKey:["agent-email-template-categories"],queryFn:async()=>{const{data:X,error:se}=await Z.from("email_template_categories").select("*").order("sort_order");if(se)throw se;return X}}),{data:S=[],isLoading:A}=Ht({queryKey:["agent-email-templates-admin"],queryFn:async()=>{const{data:X,error:se}=await Z.from("agent_email_templates").select("*, category:email_template_categories(*)").order("sort_order");if(se)throw se;return X}}),M=Jt({mutationFn:async X=>{const se={title:X.title,subject:X.subject,body:X.body,description:X.description||null,tone:X.tone||null,category_id:X.category_id||null,is_active:X.is_active};if(X.id){const{error:ae}=await Z.from("agent_email_templates").update(se).eq("id",X.id);if(ae)throw ae}else{const{error:ae}=await Z.from("agent_email_templates").insert(se);if(ae)throw ae}},onSuccess:()=>{t.invalidateQueries({queryKey:["agent-email-templates-admin"]}),d(!1),Se.success(n?"Template updated":"Template created")},onError:()=>Se.error("Failed to save template")}),I=Jt({mutationFn:async X=>{const{error:se}=await Z.from("agent_email_templates").delete().eq("id",X);if(se)throw se},onSuccess:()=>{t.invalidateQueries({queryKey:["agent-email-templates-admin"]}),Se.success("Template deleted")}}),F=Jt({mutationFn:async X=>{const se={name:X.name,description:X.description||null,icon:X.icon};if(X.id){const{error:ae}=await Z.from("email_template_categories").update(se).eq("id",X.id);if(ae)throw ae}else{const ae=j.length>0?Math.max(...j.map(ne=>ne.sort_order))+1:0,{error:le}=await Z.from("email_template_categories").insert({...se,sort_order:ae});if(le)throw le}},onSuccess:()=>{t.invalidateQueries({queryKey:["agent-email-template-categories"]}),g(!1),Se.success(o?"Category updated":"Category created")},onError:()=>Se.error("Failed to save category")}),O=Jt({mutationFn:async X=>{const{error:se}=await Z.from("email_template_categories").delete().eq("id",X);if(se)throw se},onSuccess:()=>{t.invalidateQueries({queryKey:["agent-email-template-categories"]}),Se.success("Category deleted")}}),B=()=>{a(null),v({title:"",subject:"",body:"",description:"",tone:"",category_id:"",is_active:!0}),d(!0)},$=X=>{a(X),v({title:X.title,subject:X.subject,body:X.body,description:X.description||"",tone:X.tone||"",category_id:X.category_id||"",is_active:X.is_active}),d(!0)},H=()=>{l(null),N({name:"",description:"",icon:"📧"}),g(!0)},W=X=>{l(X),N({name:X.name,description:X.description||"",icon:X.icon}),g(!0)};return e.jsx(Fr,{children:e.jsxs("div",{className:"space-y-6 animate-fade-in",children:[e.jsx(Lu,{title:"Agent Email Templates",description:"Manage email templates that agents use when composing emails from Mission Control."}),e.jsxs(ci,{value:r,onValueChange:s,children:[e.jsxs(ri,{children:[e.jsxs(Kr,{value:"templates",className:"gap-2",children:[e.jsx(mn,{className:"h-4 w-4"})," Templates"]}),e.jsxs(Kr,{value:"categories",className:"gap-2",children:[e.jsx(bm,{className:"h-4 w-4"})," Categories"]})]}),e.jsxs(ms,{value:"templates",className:"space-y-4",children:[e.jsx("div",{className:"flex justify-end",children:e.jsxs(Q,{onClick:B,className:"gap-2",children:[e.jsx(gs,{className:"h-4 w-4"})," Add Template"]})}),e.jsx(ze,{children:e.jsx(qe,{className:"p-0",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Template"}),e.jsx(Ct,{className:"hidden md:table-cell",children:"Category"}),e.jsx(Ct,{className:"hidden md:table-cell",children:"Tone"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{className:"text-right",children:"Actions"})]})}),e.jsx(zn,{children:A?e.jsx(Nr,{children:e.jsx(dt,{colSpan:5,className:"text-center py-8",children:e.jsx(Hr,{className:"h-6 w-6 animate-spin mx-auto"})})}):S.length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No templates yet. Create your first one!"})}):S.map(X=>e.jsxs(Nr,{children:[e.jsx(dt,{children:e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:X.title}),e.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[300px]",children:X.subject})]})}),e.jsx(dt,{className:"hidden md:table-cell",children:X.category?e.jsxs(bt,{variant:"outline",className:"gap-1",children:[X.category.icon," ",X.category.name]}):e.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),e.jsx(dt,{className:"hidden md:table-cell",children:X.tone?e.jsx(bt,{variant:"secondary",children:X.tone}):"—"}),e.jsx(dt,{children:e.jsx(bt,{variant:X.is_active?"default":"secondary",children:X.is_active?"Active":"Inactive"})}),e.jsx(dt,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-1",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>$(X),children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",onClick:()=>{confirm("Delete this template?")&&I.mutate(X.id)},children:e.jsx(Rs,{className:"h-4 w-4"})})]})})]},X.id))})]})})})]}),e.jsxs(ms,{value:"categories",className:"space-y-4",children:[e.jsx("div",{className:"flex justify-end",children:e.jsxs(Q,{onClick:H,className:"gap-2",children:[e.jsx(gs,{className:"h-4 w-4"})," Add Category"]})}),e.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:j.map(X=>e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Zt,{className:"text-base flex items-center gap-2",children:[e.jsx("span",{className:"text-lg",children:X.icon})," ",X.name]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>W(X),children:e.jsx(ei,{className:"h-3.5 w-3.5"})}),e.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive",onClick:()=>{confirm("Delete this category?")&&O.mutate(X.id)},children:e.jsx(Rs,{className:"h-3.5 w-3.5"})})]})]})}),e.jsxs(qe,{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:X.description||"No description"}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:[S.filter(se=>se.category_id===X.id).length," templates"]})]})]},X.id))})]})]}),e.jsx(Dr,{open:i,onOpenChange:d,children:e.jsxs(Lr,{className:"sm:max-w-[700px] max-h-[90vh] overflow-y-auto",children:[e.jsx(Ur,{children:e.jsx(Br,{children:n?"Edit Template":"New Template"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{children:"Title"}),e.jsx(Qe,{value:y.title,onChange:X=>v(se=>({...se,title:X.target.value})),placeholder:"e.g. Quick Check-in"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{children:"Category"}),e.jsxs(ds,{value:y.category_id,onValueChange:X=>v(se=>({...se,category_id:X})),children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Select category"})}),e.jsx(cs,{children:j.map(X=>e.jsxs(Ut,{value:X.id,children:[X.icon," ",X.name]},X.id))})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{children:"Subject Line"}),e.jsx(Qe,{value:y.subject,onChange:X=>v(se=>({...se,subject:X.target.value})),placeholder:"e.g. Hey {{first_name}}, just checking in!"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Use ","{{first_name}}",", ","{{last_name}}",", ","{{full_name}}"," for merge variables"]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{children:"Email Body"}),e.jsx(Ks,{value:y.body,onChange:X=>v(se=>({...se,body:X.target.value})),rows:12,placeholder:"Write your email template...",className:"resize-y"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{children:"Description (internal)"}),e.jsx(Qe,{value:y.description,onChange:X=>v(se=>({...se,description:X.target.value})),placeholder:"Short description for admin reference"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{children:"Tone"}),e.jsx(Qe,{value:y.tone,onChange:X=>v(se=>({...se,tone:X.target.value})),placeholder:"e.g. Warm & Casual"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xn,{checked:y.is_active,onCheckedChange:X=>v(se=>({...se,is_active:X}))}),e.jsx(Ee,{children:"Active"})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>d(!1),children:"Cancel"}),e.jsxs(Q,{onClick:()=>M.mutate({...y,id:n==null?void 0:n.id}),disabled:M.isPending||!y.title||!y.subject||!y.body,children:[M.isPending&&e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),n?"Save Changes":"Create Template"]})]})]})}),e.jsx(Dr,{open:m,onOpenChange:g,children:e.jsxs(Lr,{className:"sm:max-w-[450px]",children:[e.jsx(Ur,{children:e.jsx(Br,{children:o?"Edit Category":"New Category"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-[60px_1fr] gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{children:"Icon"}),e.jsx(Qe,{value:b.icon,onChange:X=>N(se=>({...se,icon:X.target.value})),className:"text-center text-lg"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{children:"Name"}),e.jsx(Qe,{value:b.name,onChange:X=>N(se=>({...se,name:X.target.value})),placeholder:"e.g. Check-in & Stay in Touch"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{children:"Description"}),e.jsx(Qe,{value:b.description,onChange:X=>N(se=>({...se,description:X.target.value})),placeholder:"Brief description of this category"})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>g(!1),children:"Cancel"}),e.jsxs(Q,{onClick:()=>F.mutate({...b,id:o==null?void 0:o.id}),disabled:F.isPending||!b.name,children:[F.isPending&&e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),o?"Save Changes":"Create Category"]})]})]})})]})})}const v3t=({brokerageId:t})=>{var jo,xc;const{toast:r}=fi(),[s,n]=E.useState([]),[a,o]=E.useState(!0),[l,i]=E.useState(""),[d,m]=E.useState("all"),[g,y]=E.useState(new Set),[v,b]=E.useState(!1),[N,j]=E.useState({}),[S,A]=E.useState(!1),[M,I]=E.useState(!1),[F,O]=E.useState({email:"",name:"",password:"",phone:""}),[B,$]=E.useState(!1),[H,W]=E.useState(null),[X,se]=E.useState(!1),[ae,le]=E.useState(!1),[ne,fe]=E.useState(!1),[oe,de]=E.useState(""),[ue,xe]=E.useState(!1),[Te,be]=E.useState([]),[we,ve]=E.useState(!1),[tt,Ae]=E.useState(!1),[Le,Ue]=E.useState(null),[Ye,Ie]=E.useState({name:"",phone:"",email:""}),[et,It]=E.useState(!1),[Pe,at]=E.useState(!1),[ce,$e]=E.useState(null),[Ge,rt]=E.useState("asc"),[je,it]=E.useState(!1),[Me,Je]=E.useState(null),[Xe,Ve]=E.useState(!1),[ot,mt]=E.useState(null),[ft,ct]=E.useState(""),[Mt,Ot]=E.useState(!1),[rr,Ir]=E.useState(null);E.useEffect(()=>{Mr(),cr()},[t]);const cr=async()=>{try{const{data:st,error:ye}=await Z.from("brokerage_manager_assignments").select("user_id").eq("brokerage_id",t);if(ye)throw ye;be((st==null?void 0:st.map(Oe=>Oe.user_id))||[])}catch(st){console.error("Error loading brokerage managers:",st)}},Mr=async()=>{try{o(!0);const{data:st,error:ye}=await Z.functions.invoke("get-brokerage-agents",{body:{brokerageId:t}});if(ye)throw ye;const Oe=st.agents||[];if(n(Oe),Oe.length>0){const Ke=Oe.map(wt=>wt.id),{data:St}=await Z.from("agent_assistant_assignments").select("agent_id, assistant_id").in("agent_id",Ke);if(St&&St.length>0){const wt=St.map(Ft=>Ft.assistant_id),{data:Lt}=await Z.from("profiles").select("id, name, email").in("id",wt),Gt={};for(const Ft of St){const Yt=Lt==null?void 0:Lt.find(yr=>yr.id===Ft.assistant_id);Yt&&(Gt[Ft.agent_id]={name:Yt.name||"",email:Yt.email||""})}j(Gt)}else j({})}}catch(st){console.error("Error loading agents:",st),r({title:"Error",description:"Failed to load agents",variant:"destructive"})}finally{o(!1)}},As=async()=>{if(!F.email||!F.name||!F.password){r({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}I(!0);try{const{data:{session:st}}=await Z.auth.getSession(),ye=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${st==null?void 0:st.access_token}`},body:JSON.stringify({...F,brokerageId:t})}),Oe=await ye.json();if(!ye.ok)throw new Error(Oe.error||"Failed to create agent");r({title:"Success",description:`Agent ${F.email} created successfully`}),O({email:"",name:"",password:"",phone:""}),A(!1),Mr()}catch(st){console.error("Error creating agent:",st),r({title:"Error",description:st.message||"Failed to create agent",variant:"destructive"})}finally{I(!1)}},At=async st=>{try{const{data:{session:ye}}=await Z.auth.getSession(),Oe=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:st})}),Ke=await Oe.json();if(!Oe.ok)throw new Error(Ke.error||"Failed to resend welcome email");r({title:"Success",description:"Welcome email sent successfully"})}catch(ye){console.error("Error resending welcome email:",ye),r({title:"Error",description:ye.message||"Failed to resend welcome email",variant:"destructive"})}},Rt=async(st,ye)=>{try{const{error:Oe}=await Z.functions.invoke("send-password-reset",{body:{email:st,redirectTo:window.location.origin}});if(Oe)throw Oe;r({title:"Password Reset Sent",description:`Password reset email sent to ${ye}`})}catch(Oe){console.error("Error sending password reset:",Oe),r({title:"Error",description:Oe.message||"Failed to send password reset email",variant:"destructive"})}},Cr=st=>{W(st),$(!0)},fs=st=>{Ue(st),Ie({name:st.name,phone:st.phone||"",email:st.email}),Ae(!0)},Vs=async()=>{if(!Le)return;if(!Ye.name.trim()){r({title:"Error",description:"Name is required",variant:"destructive"});return}const st=Ye.email.trim().toLowerCase()!==Le.email.toLowerCase();It(!0);try{if(st){if(!Ye.email.trim())throw new Error("Email is required");at(!0);const{data:{session:Oe}}=await Z.auth.getSession(),Ke=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Oe==null?void 0:Oe.access_token}`},body:JSON.stringify({agentId:Le.id,newEmail:Ye.email.trim(),brokerageId:t})}),St=await Ke.json();if(at(!1),!Ke.ok)throw new Error(St.error||"Failed to update email")}const{error:ye}=await Z.from("profiles").update({name:Ye.name.trim(),phone:Ye.phone.trim()||null}).eq("id",Le.id);if(ye)throw ye;r({title:"Success",description:"Agent profile updated successfully"}),Ae(!1),Ue(null),Mr()}catch(ye){console.error("Error updating agent:",ye),r({title:"Error",description:ye.message||"Failed to update agent",variant:"destructive"})}finally{It(!1),at(!1)}},Js=async()=>{if(!oe){r({title:"Error",description:"Please select an agent to promote",variant:"destructive"});return}xe(!0);try{const{data:{session:st}}=await Z.auth.getSession(),ye=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${st==null?void 0:st.access_token}`},body:JSON.stringify({userId:oe,role:"brokerage_manager",action:"add",brokerageId:t})}),Oe=await ye.json();if(!ye.ok)throw new Error(Oe.error||"Failed to add brokerage manager");r({title:"Success",description:"Brokerage manager added successfully"}),fe(!1),de(""),cr()}catch(st){console.error("Error adding brokerage manager:",st),r({title:"Error",description:st.message||"Failed to add brokerage manager",variant:"destructive"})}finally{xe(!1)}},hi=async st=>{try{const{data:{session:ye}}=await Z.auth.getSession(),Oe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ye==null?void 0:ye.access_token}`},body:JSON.stringify({userId:st,role:"brokerage_manager",action:"remove",brokerageId:t})}),Ke=await Oe.json();if(!Oe.ok)throw new Error(Ke.error||"Failed to remove brokerage manager");r({title:"Success",description:"Brokerage manager role removed"}),cr()}catch(ye){console.error("Error removing brokerage manager:",ye),r({title:"Error",description:ye.message||"Failed to remove brokerage manager",variant:"destructive"})}},Ia=st=>Te.includes(st),dn=st=>{mt(st),ct(""),Ve(!0)},na=async()=>{if(!(!ot||!ft)){if(ft.length<6){r({title:"Error",description:"Password must be at least 6 characters",variant:"destructive"});return}Ot(!0);try{const{data:{session:st}}=await Z.auth.getSession(),ye=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${st==null?void 0:st.access_token}`},body:JSON.stringify({agentId:ot.id,brokerageId:t,action:"set_password",newPassword:ft})}),Oe=await ye.json();if(!ye.ok)throw new Error(Oe.error||"Failed to set password");r({title:"Success",description:`Password set for ${ot.name}`}),Ve(!1),mt(null),ct("")}catch(st){console.error("Error setting password:",st),r({title:"Error",description:st.message||"Failed to set password",variant:"destructive"})}finally{Ot(!1)}}},en=async st=>{Ir(st.id);try{const{data:{session:ye}}=await Z.auth.getSession(),Oe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ye==null?void 0:ye.access_token}`},body:JSON.stringify({agentId:st.id,brokerageId:t,action:"claim_account"})}),Ke=await Oe.json();if(!Oe.ok)throw new Error(Ke.error||"Failed to claim account");r({title:"Success",description:`Account claimed for ${st.name}`}),Mr()}catch(ye){console.error("Error claiming account:",ye),r({title:"Error",description:ye.message||"Failed to claim account",variant:"destructive"})}finally{Ir(null)}},Un=async()=>{if(H){se(!0);try{const{data:{session:st}}=await Z.auth.getSession(),ye=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/remove-agent",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${st==null?void 0:st.access_token}`},body:JSON.stringify({userId:H.id,brokerageId:t})}),Oe=await ye.json();if(!ye.ok)throw new Error(Oe.error||"Failed to remove agent");r({title:"Success",description:`${H.name} has been removed from your brokerage`}),$(!1),W(null),Mr()}catch(st){console.error("Error removing agent:",st),r({title:"Error",description:st.message||"Failed to remove agent",variant:"destructive"})}finally{se(!1)}}},Gn=st=>{const ye=st.trim().split(" ");return ye.length>1?ye[ye.length-1].toLowerCase():st.toLowerCase()},Ai=st=>{ce===st?rt(Ge==="asc"?"desc":"asc"):($e(st),rt("asc"))},dr=st=>ce!==st?e.jsx(Of,{className:"ml-1 h-4 w-4"}):Ge==="asc"?e.jsx(fp,{className:"ml-1 h-4 w-4"}):e.jsx(my,{className:"ml-1 h-4 w-4"}),Fa=s.filter(st=>{if(d==="active"&&!st.claimed||d==="pending"&&st.claimed)return!1;if(!l)return!0;const ye=l.toLowerCase();return st.name.toLowerCase().includes(ye)||st.email.toLowerCase().includes(ye)}),mo=[...Fa].sort((st,ye)=>{if(!ce)return 0;let Oe=0;return ce==="name"?Oe=Gn(st.name).localeCompare(Gn(ye.name)):ce==="status"&&(Oe=st.claimed===ye.claimed?0:st.claimed?-1:1),Ge==="asc"?Oe:-Oe});Fa.filter(st=>st.claimed&&!Ia(st.id));const Ti=st=>{y(ye=>{const Oe=new Set(ye);return Oe.has(st)?Oe.delete(st):Oe.add(st),Oe})},Ys=()=>{g.size===mo.length?y(new Set):y(new Set(mo.map(st=>st.id)))},ro=()=>{y(new Set)},gc=async()=>{const st=Array.from(g);if(st.length===0)return;b(!0);let ye=0,Oe=0;try{const{data:{session:Ke}}=await Z.auth.getSession();for(const St of st)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ke==null?void 0:Ke.access_token}`},body:JSON.stringify({userId:St})})).ok?ye++:Oe++}catch{Oe++}ye>0?r({title:"Success",description:`Welcome emails sent to ${ye} agent${ye>1?"s":""}${Oe>0?` (${Oe} failed)`:""}`}):r({title:"Error",description:"Failed to send welcome emails",variant:"destructive"}),ro()}catch(Ke){console.error("Error bulk sending welcome emails:",Ke),r({title:"Error",description:Ke.message||"Failed to send welcome emails",variant:"destructive"})}finally{b(!1)}};return a?e.jsx(ze,{children:e.jsx(qe,{className:"flex items-center justify-center py-8",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):e.jsxs(e.Fragment,{children:[e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Zt,{children:"Agents"}),e.jsx(Ss,{children:"Manage your brokerage's agents"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Q,{variant:"outline",onClick:()=>fe(!0),children:[e.jsx(Nu,{className:"mr-2 h-4 w-4"}),"Add Brokerage Manager"]}),e.jsxs(Q,{variant:"outline",onClick:()=>le(!0),children:[e.jsx(K1,{className:"mr-2 h-4 w-4"}),"Import CSV"]}),e.jsxs(Q,{onClick:()=>A(!0),children:[e.jsx($d,{className:"mr-2 h-4 w-4"}),"Add Agent"]})]})]})}),e.jsxs(qe,{children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-4 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Qn,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search agents...",value:l,onChange:st=>i(st.target.value),className:"pl-9"})]}),e.jsxs(ds,{value:d,onValueChange:st=>m(st),children:[e.jsx(ls,{className:"w-[160px]",children:e.jsx(us,{placeholder:"Filter by status"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Agents"}),e.jsx(Ut,{value:"active",children:"Active"}),e.jsx(Ut,{value:"pending",children:"Pending"})]})]})]}),g.size>0&&e.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-lg border bg-muted/50 p-3",children:[e.jsxs("span",{className:"text-sm font-medium",children:[g.size," agent",g.size>1?"s":""," selected"]}),e.jsx("div",{className:"flex-1"}),e.jsxs(Q,{size:"sm",variant:"outline",onClick:gc,disabled:v,children:[e.jsx(mn,{className:"mr-2 h-4 w-4"}),v?"Sending...":"Resend Welcome Email"]}),e.jsx(Q,{size:"sm",variant:"ghost",onClick:ro,children:"Clear"})]}),e.jsx("div",{className:"rounded-md border",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{className:"w-[40px]",children:e.jsx(Yo,{checked:mo.length>0&&g.size===mo.length,onCheckedChange:Ys,"aria-label":"Select all"})}),e.jsx(Ct,{children:e.jsxs(Q,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-transparent",onClick:()=>Ai("name"),children:["Name (Last)",dr("name")]})}),e.jsx(Ct,{children:"Email"}),e.jsx(Ct,{children:e.jsxs(Q,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-transparent",onClick:()=>Ai("status"),children:["Status",dr("status")]})}),e.jsx(Ct,{children:"Actions"})]})}),e.jsx(zn,{children:mo.length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:5,className:"text-center text-muted-foreground",children:"No agents found"})}):mo.map(st=>e.jsxs(Nr,{children:[e.jsx(dt,{children:e.jsx(Yo,{checked:g.has(st.id),onCheckedChange:()=>Ti(st.id),"aria-label":`Select ${st.name}`})}),e.jsx(dt,{className:"font-medium",children:st.name}),e.jsx(dt,{children:st.email}),e.jsx(dt,{children:e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[st.claimed?e.jsx(bt,{variant:"default",children:"Active"}):e.jsx(bt,{variant:"secondary",children:"Pending"}),Ia(st.id)&&e.jsxs(bt,{variant:"outline",className:"border-primary text-primary",children:[e.jsx(zA,{className:"mr-1 h-3 w-3"}),"Manager"]}),N[st.id]&&e.jsxs(bt,{variant:"outline",className:"text-xs",children:[e.jsx(ws,{className:"mr-1 h-3 w-3"}),"Asst: ",N[st.id].name||N[st.id].email]})]})}),e.jsx(dt,{children:e.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[e.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>{Je(st),it(!0)},title:"Send celebration",className:"text-yellow-500 hover:text-yellow-600 hover:bg-yellow-50",children:e.jsx(td,{className:"h-4 w-4"})}),e.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>fs(st),title:"Edit agent",children:e.jsx(ei,{className:"h-4 w-4"})}),!st.claimed&&e.jsxs(e.Fragment,{children:[e.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>At(st.id),title:"Resend welcome email",children:e.jsx(mn,{className:"h-4 w-4"})}),e.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>en(st),title:"Claim account for agent",disabled:rr===st.id,className:"text-green-600 hover:text-green-700 hover:bg-green-50",children:e.jsx(Jj,{className:"h-4 w-4"})})]}),e.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>dn(st),title:"Set password",className:"text-blue-600 hover:text-blue-700 hover:bg-blue-50",children:e.jsx(ku,{className:"h-4 w-4"})}),e.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>Rt(st.email,st.name),title:"Send password reset email",children:e.jsx(qj,{className:"h-4 w-4"})}),Ia(st.id)&&e.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>hi(st.id),title:"Remove manager role",className:"text-orange-500 hover:text-orange-600",children:e.jsx(Nu,{className:"h-4 w-4"})}),e.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>Cr(st),className:"text-destructive hover:text-destructive",title:"Remove agent",children:e.jsx(Rs,{className:"h-4 w-4"})})]})})]},st.id))})]})})]})]}),e.jsx(Dr,{open:S,onOpenChange:A,children:e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Add New Agent"}),e.jsx(Gs,{children:"Create a new agent account. They'll receive an email to set up their account."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"name",children:"Name"}),e.jsx(Qe,{id:"name",value:F.name,onChange:st=>O({...F,name:st.target.value}),placeholder:"John Doe"})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"email",children:"Email"}),e.jsx(Qe,{id:"email",type:"email",value:F.email,onChange:st=>O({...F,email:st.target.value}),placeholder:"john@example.com"})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"phone",children:"Phone (optional)"}),e.jsx(Qe,{id:"phone",type:"tel",value:F.phone,onChange:st=>O({...F,phone:st.target.value}),placeholder:"555-123-4567"})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"password",children:"Temporary Password"}),e.jsx(Qe,{id:"password",type:"password",value:F.password,onChange:st=>O({...F,password:st.target.value}),placeholder:"Temporary password"})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>A(!1),children:"Cancel"}),e.jsx(Q,{onClick:As,disabled:M,children:M?"Creating...":"Create Agent"})]})]})}),e.jsx(Dr,{open:B,onOpenChange:$,children:e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Remove Agent"}),e.jsxs(Gs,{children:["Are you sure you want to remove ",e.jsx("strong",{children:H==null?void 0:H.name})," from your brokerage? This will revoke their access to the dashboard."]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>$(!1),children:"Cancel"}),e.jsx(Q,{variant:"destructive",onClick:Un,disabled:X,children:X?"Removing...":"Remove Agent"})]})]})}),e.jsx(lBe,{open:ae,onOpenChange:le,fixedBrokerageId:t,onSuccess:Mr}),e.jsx(Dr,{open:ne,onOpenChange:fe,children:e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Add Brokerage Manager"}),e.jsx(Gs,{children:"Promote an existing active agent to brokerage manager. They will be able to manage agents and view analytics."})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(Ee,{children:"Select Agent"}),e.jsxs(rd,{open:we,onOpenChange:ve,children:[e.jsx(sd,{asChild:!0,children:e.jsxs(Q,{variant:"outline",role:"combobox","aria-expanded":we,className:"w-full justify-between",children:[oe?((jo=s.find(st=>st.id===oe))==null?void 0:jo.name)+" ("+((xc=s.find(st=>st.id===oe))==null?void 0:xc.email)+")":"Select an agent to promote...",e.jsx(fy,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Fc,{className:"w-full p-0",align:"start",children:e.jsxs(Ry,{children:[e.jsx(Fy,{placeholder:"Search by name or email..."}),e.jsxs(zy,{className:"max-h-[200px]",children:[e.jsx(By,{children:"No eligible agents found."}),e.jsx($y,{children:s.filter(st=>!Ia(st.id)).map(st=>e.jsxs(Uy,{value:`${st.name} ${st.email}`,onSelect:()=>{de(st.id),ve(!1)},children:[e.jsx(li,{className:`mr-2 h-4 w-4 ${oe===st.id?"opacity-100":"opacity-0"}`}),st.name," (",st.email,")"]},st.id))})]})]})})]}),s.filter(st=>!Ia(st.id)).length===0&&e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"All agents are already brokerage managers."})]})}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>fe(!1),children:"Cancel"}),e.jsx(Q,{onClick:Js,disabled:ue||!oe,children:ue?"Adding...":"Add as Manager"})]})]})}),e.jsx(Dr,{open:tt,onOpenChange:Ae,children:e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Edit Agent"}),e.jsxs(Gs,{children:["Update profile information for ",Le==null?void 0:Le.name]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"edit-name",children:"Name"}),e.jsx(Qe,{id:"edit-name",value:Ye.name,onChange:st=>Ie({...Ye,name:st.target.value}),placeholder:"Agent name"})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"edit-email",children:"Email"}),e.jsx(Qe,{id:"edit-email",type:"email",value:Ye.email,onChange:st=>Ie({...Ye,email:st.target.value}),placeholder:"agent@example.com"}),Ye.email.trim().toLowerCase()!==(Le==null?void 0:Le.email.toLowerCase())&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Changing email will update their login credentials"})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"edit-phone",children:"Phone"}),e.jsx(Qe,{id:"edit-phone",type:"tel",value:Ye.phone,onChange:st=>Ie({...Ye,phone:st.target.value}),placeholder:"555-123-4567"})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>Ae(!1),children:"Cancel"}),e.jsx(Q,{onClick:Vs,disabled:et||Pe,children:Pe?"Updating email...":et?"Saving...":"Save Changes"})]})]})}),Me&&e.jsx(cBe,{open:je,onOpenChange:st=>{it(st),st||Je(null)},userId:Me.id,userName:Me.name}),e.jsx(Dr,{open:Xe,onOpenChange:Ve,children:e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Set Password"}),e.jsxs(Gs,{children:["Set a new password for ",ot==null?void 0:ot.name,". They will be able to log in with this password immediately."]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"new-password",children:"New Password"}),e.jsx(Qe,{id:"new-password",type:"password",value:ft,onChange:st=>ct(st.target.value),placeholder:"Enter new password (min 6 characters)"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Make sure to communicate this password to the agent through a secure channel."})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>Ve(!1),children:"Cancel"}),e.jsx(Q,{onClick:na,disabled:Mt||!ft||ft.length<6,children:Mt?"Setting...":"Set Password"})]})]})})]})},_3t={academy_video:"Academy Video",template:"Template",toolbox:"Toolbox Resource",newsletter:"Newsletter",social_swag:"Social Swag",event:"Event"},b3t={view:"Viewed",click_canva:"Opened Canva",click_pdf:"Downloaded PDF",click_video:"Watched Video",click_link:"Clicked Link",register:"Registered"},w3t=t=>{switch(t){case"academy_video":return e.jsx(ya,{className:"h-4 w-4"});case"template":return e.jsx(fa,{className:"h-4 w-4"});case"toolbox":return e.jsx(fa,{className:"h-4 w-4"});case"newsletter":return e.jsx(_y,{className:"h-4 w-4"});case"social_swag":return e.jsx(An,{className:"h-4 w-4"});case"event":return e.jsx(Mn,{className:"h-4 w-4"});default:return e.jsx(En,{className:"h-4 w-4"})}},j3t=({brokerageId:t})=>{const{toast:r}=fi(),[s,n]=E.useState([]),[a,o]=E.useState([]),[l,i]=E.useState([]),[d,m]=E.useState(!0),[g,y]=E.useState(null);E.useEffect(()=>{v()},[t]);const v=async()=>{try{m(!0);const{data:j,error:S}=await Z.from("profiles").select("id, name, email").eq("brokerage_id",t);if(S)throw S;const A=j.map(se=>se.id),M=new Map(j.map(se=>[se.id,se]));if(A.length===0){n([]),o([]),i([]);return}const{data:I,error:F}=await Z.from("activity_logs").select("*").in("user_id",A).order("launched_at",{ascending:!1});if(F)throw F;const O=I.map(se=>{var ae,le;return{id:se.id,user_id:se.user_id,app_name:se.app_name,launched_at:se.launched_at,user_name:((ae=M.get(se.user_id))==null?void 0:ae.name)||"Unknown",user_email:((le=M.get(se.user_id))==null?void 0:le.email)||"Unknown"}});n(O);const{data:B,error:$}=await Z.from("content_engagement_logs").select("*").in("user_id",A).order("created_at",{ascending:!1});if($)throw $;const H=(B||[]).map(se=>{var ae,le;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:((ae=M.get(se.user_id))==null?void 0:ae.name)||"Unknown",user_email:((le=M.get(se.user_id))==null?void 0:le.email)||"Unknown"}});o(H);const W=new Map;j.forEach(se=>{W.set(se.id,{user_id:se.id,user_name:se.name,user_email:se.email,app_launches:0,content_views:0,last_activity:""})}),O.forEach(se=>{const ae=W.get(se.user_id);ae&&(ae.app_launches++,(!ae.last_activity||new Date(se.launched_at)>new Date(ae.last_activity))&&(ae.last_activity=se.launched_at))}),H.forEach(se=>{const ae=W.get(se.user_id);ae&&(ae.content_views++,(!ae.last_activity||new Date(se.created_at)>new Date(ae.last_activity))&&(ae.last_activity=se.created_at))});const X=Array.from(W.values()).filter(se=>se.app_launches>0||se.content_views>0).sort((se,ae)=>new Date(ae.last_activity).getTime()-new Date(se.last_activity).getTime());i(X)}catch(j){console.error("Error loading activity:",j),r({title:"Error",description:"Failed to load activity logs",variant:"destructive"})}finally{m(!1)}},b=j=>s.filter(S=>S.user_id===j),N=j=>a.filter(S=>S.user_id===j);return d?e.jsx(ze,{children:e.jsx(qe,{className:"flex items-center justify-center py-8",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):e.jsxs(e.Fragment,{children:[e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsx(Zt,{children:"Agent Activity"}),e.jsx(Ss,{children:"Track app usage and content engagement - click an agent for details"})]}),e.jsx(qe,{children:e.jsx("div",{className:"rounded-md border",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Agent"}),e.jsx(Ct,{className:"text-center",children:"App Launches"}),e.jsx(Ct,{className:"text-center",children:"Content Views"}),e.jsx(Ct,{children:"Last Active"})]})}),e.jsx(zn,{children:l.length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:4,className:"text-center text-muted-foreground",children:"No activity yet"})}):l.map(j=>e.jsxs(Nr,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>y({id:j.user_id,name:j.user_name,email:j.user_email}),children:[e.jsx(dt,{children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:j.user_name}),e.jsx("div",{className:"text-sm text-muted-foreground",children:j.user_email})]})}),e.jsx(dt,{className:"text-center",children:e.jsxs(bt,{variant:"outline",className:"gap-1",children:[e.jsx(Gl,{className:"h-3 w-3"}),j.app_launches]})}),e.jsx(dt,{className:"text-center",children:e.jsxs(bt,{variant:"secondary",className:"gap-1",children:[e.jsx(fa,{className:"h-3 w-3"}),j.content_views]})}),e.jsx(dt,{className:"text-sm text-muted-foreground",children:j.last_activity&&Su(new Date(j.last_activity),{addSuffix:!0})})]},j.user_id))})]})})})]}),e.jsx(Dr,{open:!!g,onOpenChange:j=>!j&&y(null),children:e.jsxs(Lr,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{children:[g==null?void 0:g.name,"'s Activity"]}),e.jsx(Gs,{children:g==null?void 0:g.email})]}),e.jsxs(ci,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[e.jsxs(ri,{className:"grid w-full grid-cols-2",children:[e.jsx(Kr,{value:"content",children:"Content Engagement"}),e.jsx(Kr,{value:"apps",children:"App Launches"})]}),e.jsx(ms,{value:"content",className:"flex-1 overflow-auto",children:e.jsx("div",{className:"rounded-md border",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Resource"}),e.jsx(Ct,{children:"Type"}),e.jsx(Ct,{children:"Action"}),e.jsx(Ct,{children:"Time"})]})}),e.jsx(zn,{children:g&&N(g.id).length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement yet"})}):g&&N(g.id).map(j=>e.jsxs(Nr,{children:[e.jsx(dt,{className:"max-w-[200px] truncate font-medium",children:j.resource_title}),e.jsx(dt,{children:e.jsxs(bt,{variant:"outline",className:"gap-1",children:[w3t(j.resource_type),_3t[j.resource_type]||j.resource_type]})}),e.jsx(dt,{children:e.jsx("span",{className:"text-sm text-muted-foreground",children:b3t[j.action_type]||j.action_type})}),e.jsx(dt,{className:"text-sm text-muted-foreground",children:Su(new Date(j.created_at),{addSuffix:!0})})]},j.id))})]})})}),e.jsx(ms,{value:"apps",className:"flex-1 overflow-auto",children:e.jsx("div",{className:"rounded-md border",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"App"}),e.jsx(Ct,{children:"Time"})]})}),e.jsx(zn,{children:g&&b(g.id).length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches yet"})}):g&&b(g.id).map(j=>e.jsxs(Nr,{children:[e.jsx(dt,{children:e.jsx(bt,{variant:"outline",children:j.app_name})}),e.jsx(dt,{className:"text-sm text-muted-foreground",children:Su(new Date(j.launched_at),{addSuffix:!0})})]},j.id))})]})})})]})]})})]})},k3t=({brokerageId:t})=>{const{toast:r}=fi(),[s,n]=E.useState({totalAgents:0,activeAgents:0,pendingAgents:0,totalLaunches:0,launchesThisWeek:0,launchesThisMonth:0}),[a,o]=E.useState(!0);E.useEffect(()=>{l()},[t]);const l=async()=>{try{o(!0);const{data:i,error:d}=await Z.from("profiles").select("id").eq("brokerage_id",t);if(d)throw d;const m=i.map(O=>O.id),g=m.length;if(m.length===0){o(!1);return}const{data:y,error:v}=await Z.from("profiles").select("id, email").in("id",m);if(v)throw v;const{count:b}=await Z.from("profiles").select("*",{count:"exact",head:!0}).eq("brokerage_id",t).not("last_login","is",null),N=b||0,j=g-N,{count:S}=await Z.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",m),A=new Date;A.setDate(A.getDate()-7);const{count:M}=await Z.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",m).gte("launched_at",A.toISOString()),I=new Date;I.setMonth(I.getMonth()-1);const{count:F}=await Z.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",m).gte("launched_at",I.toISOString());n({totalAgents:g,activeAgents:N,pendingAgents:j,totalLaunches:S||0,launchesThisWeek:M||0,launchesThisMonth:F||0})}catch(i){console.error("Error loading analytics:",i),r({title:"Error",description:"Failed to load analytics",variant:"destructive"})}finally{o(!1)}};return a?e.jsx(ze,{children:e.jsx(qe,{className:"flex items-center justify-center py-8",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Zt,{className:"text-sm font-medium",children:"Total Agents"}),e.jsx(ws,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(qe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:s.totalAgents}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.activeAgents," active, ",s.pendingAgents," pending"]})]})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Zt,{className:"text-sm font-medium",children:"Active Agents"}),e.jsx(ui,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(qe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:s.activeAgents}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.totalAgents>0?`${Math.round(s.activeAgents/s.totalAgents*100)}% of total`:"0% of total"})]})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Zt,{className:"text-sm font-medium",children:"Pending Invites"}),e.jsx(Ea,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(qe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:s.pendingAgents}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Awaiting setup"})]})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Zt,{className:"text-sm font-medium",children:"Total App Launches"}),e.jsx(qg,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(qe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:s.totalLaunches}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"All time"})]})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Zt,{className:"text-sm font-medium",children:"This Week"}),e.jsx(qg,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(qe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:s.launchesThisWeek}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 7 days"})]})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Zt,{className:"text-sm font-medium",children:"This Month"}),e.jsx(qg,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(qe,{children:[e.jsx("div",{className:"text-2xl font-bold",children:s.launchesThisMonth}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 30 days"})]})]})]})},N3t=({brokerageId:t})=>{const[r,s]=E.useState([]),[n,a]=E.useState(!0),[o,l]=E.useState(!1),[i,d]=E.useState(!1),[m,g]=E.useState({description:"",maxUses:""});E.useEffect(()=>{y()},[t]);const y=async()=>{try{const{data:A,error:M}=await Z.from("invite_codes").select("*").eq("brokerage_id",t).order("created_at",{ascending:!1});if(M)throw M;s(A||[])}catch(A){console.error("Error loading invite codes:",A),Se.error("Failed to load invite links")}finally{a(!1)}},v=()=>Math.random().toString(36).substring(2,8).toUpperCase(),b=async()=>{l(!0);try{const A=v(),{error:M}=await Z.from("invite_codes").insert({code:A,description:m.description||null,max_uses:m.maxUses?parseInt(m.maxUses):null,brokerage_id:t,is_active:!0});if(M)throw M;Se.success("Invite link created!"),d(!1),g({description:"",maxUses:""}),y()}catch(A){console.error("Error creating invite code:",A),Se.error("Failed to create invite link")}finally{l(!1)}},N=async A=>{try{const{error:M}=await Z.from("invite_codes").delete().eq("id",A);if(M)throw M;Se.success("Invite link deleted"),s(r.filter(I=>I.id!==A))}catch(M){console.error("Error deleting invite code:",M),Se.error("Failed to delete invite link")}},j=async(A,M)=>{try{const{error:I}=await Z.from("invite_codes").update({is_active:!M}).eq("id",A);if(I)throw I;s(r.map(F=>F.id===A?{...F,is_active:!M}:F)),Se.success(`Invite link ${M?"deactivated":"activated"}`)}catch(I){console.error("Error toggling invite code:",I),Se.error("Failed to update invite link")}},S=A=>{const M=`${window.location.origin}/join?code=${A}`;navigator.clipboard.writeText(M),Se.success("Link copied to clipboard!")};return n?e.jsx(ze,{children:e.jsx(qe,{className:"flex items-center justify-center py-8",children:e.jsx(Hr,{className:"h-6 w-6 animate-spin text-muted-foreground"})})}):e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(Bo,{className:"h-5 w-5"}),"Agent Invite Links"]}),e.jsx(Ss,{children:"Create shareable links for agents to join your brokerage"})]}),e.jsxs(Dr,{open:i,onOpenChange:d,children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{size:"sm",children:[e.jsx(gs,{className:"mr-2 h-4 w-4"}),"Create Link"]})}),e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Create Invite Link"}),e.jsx(Gs,{children:"Create a new invite link for agents to join your brokerage"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"description",children:"Description (optional)"}),e.jsx(Qe,{id:"description",placeholder:"e.g., New agent recruiting campaign",value:m.description,onChange:A=>g({...m,description:A.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"maxUses",children:"Max Uses (optional)"}),e.jsx(Qe,{id:"maxUses",type:"number",placeholder:"Leave empty for unlimited",value:m.maxUses,onChange:A=>g({...m,maxUses:A.target.value})})]}),e.jsx(Q,{onClick:b,disabled:o,className:"w-full",children:o?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Invite Link"})]})]})]})]}),e.jsx(qe,{children:r.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(Bo,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"No invite links yet"}),e.jsx("p",{className:"text-sm",children:"Create one to start inviting agents"})]}):e.jsx("div",{className:"space-y-3",children:r.map(A=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-card",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"text-sm font-mono bg-muted px-2 py-0.5 rounded",children:A.code}),e.jsx(bt,{variant:A.is_active?"default":"secondary",children:A.is_active?"Active":"Inactive"})]}),A.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:A.description}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[A.uses_count," uses",A.max_uses&&` / ${A.max_uses} max`]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>S(A.code),title:"Copy link",children:e.jsx(fo,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>j(A.id,A.is_active),title:A.is_active?"Deactivate":"Activate",children:A.is_active?"Disable":"Enable"}),e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>N(A.id),className:"text-destructive hover:text-destructive",title:"Delete",children:e.jsx(Rs,{className:"h-4 w-4"})})]})]},A.id))})})]})},S3t=({open:t,onOpenChange:r,referralCode:s,brokerageId:n,senderName:a,brokerageName:o,onInvitesSent:l})=>{const[i,d]=E.useState(""),[m,g]=E.useState([]),[y,v]=E.useState(""),[b,N]=E.useState(!1),j=F=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(F),S=()=>{const F=i.trim().toLowerCase();if(F&&j(F)&&!m.includes(F)){if(m.length>=10){Se.error("Maximum 10 emails per invite");return}g([...m,F]),d("")}else F&&!j(F)?Se.error("Please enter a valid email address"):m.includes(F)&&Se.error("Email already added")},A=F=>{g(m.filter(O=>O!==F))},M=F=>{(F.key==="Enter"||F.key===",")&&(F.preventDefault(),S())},I=async()=>{if(m.length===0){Se.error("Please add at least one email address");return}N(!0);try{const{data:F,error:O}=await Z.functions.invoke("send-referral-invite",{body:{emails:m,personalMessage:y.trim()||void 0,referralCode:s,brokerageId:n,senderName:a,brokerageName:o}});if(O)throw O;F.successCount===F.totalCount?Se.success(`${F.successCount} invite${F.successCount>1?"s":""} sent successfully!`):Se.warning(`${F.successCount} of ${F.totalCount} invites sent. Some failed.`),g([]),v(""),r(!1),l==null||l()}catch(F){console.error("Error sending invites:",F),Se.error("Failed to send invites. Please try again.")}finally{N(!1)}};return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"sm:max-w-[550px]",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{className:"flex items-center gap-2",children:[e.jsx(mn,{className:"h-5 w-5 text-primary"}),"Invite Broker Friends"]}),e.jsx(Gs,{children:"Send a personalized email invitation to broker owners you know. They'll receive a beautiful email highlighting LevelUp's features."})]}),e.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:[e.jsx("div",{className:"bg-primary/20 rounded-full p-2",children:e.jsx(uo,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-sm",children:"Earn $25/month for each referral!"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"When they sign up and stay for 30 days, you save on your membership forever."})]})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"email",children:"Email Addresses (up to 10)"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Qe,{id:"email",type:"email",placeholder:"Enter email and press Enter",value:i,onChange:F=>d(F.target.value),onKeyDown:M,onBlur:S}),e.jsx(Q,{type:"button",variant:"secondary",onClick:S,children:"Add"})]}),m.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:m.map(F=>e.jsxs(bt,{variant:"secondary",className:"flex items-center gap-1 pr-1",children:[F,e.jsx("button",{type:"button",onClick:()=>A(F),className:"ml-1 rounded-full p-0.5 hover:bg-muted",children:e.jsx(rn,{className:"h-3 w-3"})})]},F))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"message",children:"Personal Message (optional)"}),e.jsx(Ks,{id:"message",placeholder:"Add a personal note that will appear at the top of the email...",value:y,onChange:F=>v(F.target.value),rows:3,maxLength:500}),e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[y.length,"/500 characters"]})]}),e.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[e.jsx(An,{className:"h-4 w-4 text-primary"}),"What they'll receive:"]}),e.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1",children:[e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Beautiful branded email from you"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Your personal message (if added)"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Key LevelUp features for brokerages"]}),e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Direct signup link with your referral code"]})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(Q,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsx(Q,{onClick:I,disabled:m.length===0||b,children:b?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent mr-2"}),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Mi,{className:"h-4 w-4 mr-2"}),"Send ",m.length>0&&`(${m.length})`," Invite",m.length!==1?"s":""]})})]})]})})},C3t=({brokerageId:t,refreshTrigger:r})=>{const[s,n]=E.useState([]),[a,o]=E.useState(!0);E.useEffect(()=>{l()},[t,r]);const l=async()=>{try{const{data:d,error:m}=await Z.from("referral_invites").select("*").eq("referrer_brokerage_id",t).order("sent_at",{ascending:!1}).limit(20);if(m)throw m;n(d||[])}catch(d){console.error("Error fetching invites:",d)}finally{o(!1)}},i=d=>{switch(d){case"signed_up":return e.jsxs(bt,{className:"bg-green-100 text-green-800 gap-1",children:[e.jsx(ui,{className:"h-3 w-3"}),"Signed Up"]});case"expired":return e.jsxs(bt,{variant:"outline",className:"text-muted-foreground gap-1",children:[e.jsx(Sc,{className:"h-3 w-3"}),"Expired"]});default:return e.jsxs(bt,{variant:"secondary",className:"gap-1",children:[e.jsx(Ea,{className:"h-3 w-3"}),"Pending"]})}};return a?e.jsx("div",{className:"flex justify-center py-4",children:e.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):s.length===0?e.jsxs("div",{className:"text-center py-6 text-muted-foreground",children:[e.jsx(mn,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:"No invites sent yet"}),e.jsx("p",{className:"text-xs",children:"Start inviting broker friends to earn rewards!"})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium mb-3",children:"Recent Invites"}),s.map(d=>e.jsxs("div",{className:"flex items-center justify-between p-2.5 bg-muted/30 rounded-lg",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:d.recipient_email}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sent ",Xr(new Date(d.sent_at),"MMM d, yyyy")]})]}),i(d.status)]},d.id))]})},M3t=()=>{const{brokerageId:t,user:r}=Gr(),[s,n]=E.useState(null),[a,o]=E.useState(""),[l,i]=E.useState(""),[d,m]=E.useState([]),[g,y]=E.useState(!0),[v,b]=E.useState(!1),[N,j]=E.useState(0);E.useEffect(()=>{t&&S()},[t]);const S=async()=>{try{const[B,$]=await Promise.all([Z.from("brokerages").select("name").eq("id",t).single(),r?Z.from("profiles").select("name").eq("id",r.id).single():Promise.resolve({data:null})]);B.data&&o(B.data.name),$.data&&i($.data.name||"A LevelUp Member");const{data:H}=await Z.from("referral_codes").select("code").eq("brokerage_id",t).single();if(H)n(H.code);else{const X=`REF${t==null?void 0:t.slice(0,8).toUpperCase()}`;await Z.from("referral_codes").insert({brokerage_id:t,code:X}),n(X)}const{data:W}=await Z.from("referrals").select(` *, referred_user:profiles!referred_user_id(name, email), referred_brokerage:brokerages!referred_brokerage_id(name) `).eq("referrer_brokerage_id",t).order("created_at",{ascending:!1});m(W||[])}catch(B){console.error("Error fetching referral data:",B)}finally{y(!1)}},A=()=>{const B=`https://dashboard.relevelup.com/?ref=${s}`;navigator.clipboard.writeText(B),Se.success("Referral link copied to clipboard!")},M=d.filter(B=>B.status==="qualified").length,I=d.filter(B=>B.status==="pending").length,F=M*25,O=Math.max(0,Math.ceil((299-F)/25));return g?null:e.jsxs(e.Fragment,{children:[e.jsxs(ze,{className:"overflow-hidden",children:[e.jsx("div",{className:"bg-gradient-to-r from-primary/10 via-primary/5 to-background border-b",children:e.jsxs("div",{className:"px-6 py-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"bg-primary/20 rounded-full p-2",children:e.jsx(uo,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-bold",children:"Referral Rewards Program"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Earn $25/month off your membership for every broker you refer"})]})]}),e.jsx("div",{className:"mt-4 bg-background/80 rounded-lg p-4 border",children:e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-3xl font-bold text-primary",children:["$",F]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Monthly Savings"})]}),F>0&&e.jsxs("div",{className:"flex items-center gap-1 text-green-600",children:[e.jsx(ui,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm font-medium",children:"Active"})]})]}),O>0&&F<299&&e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Refer ",O," more = ",e.jsx("span",{className:"text-primary",children:"FREE membership!"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Your membership could cost $0/month"})]}),F>=299&&e.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[e.jsx(An,{className:"h-5 w-5"}),e.jsx("span",{className:"font-bold",children:"FREE Membership Unlocked!"})]})]})})]})}),e.jsxs(qe,{className:"pt-6 space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs(Q,{onClick:()=>b(!0),className:"w-full",size:"lg",children:[e.jsx(mn,{className:"h-4 w-4 mr-2"}),"Invite Broker Friends"]}),e.jsxs(Q,{onClick:A,variant:"outline",className:"w-full",size:"lg",children:[e.jsx(fo,{className:"h-4 w-4 mr-2"}),"Copy Referral Link"]})]}),e.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Your Referral Link"}),e.jsxs("code",{className:"block px-3 py-2 bg-background rounded border text-sm break-all",children:["https://dashboard.relevelup.com/?ref=",s]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.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:[e.jsx(yd,{className:"h-5 w-5 mx-auto text-green-600 mb-1"}),e.jsxs("p",{className:"text-2xl font-bold text-green-700 dark:text-green-400",children:["$",F]}),e.jsx("p",{className:"text-xs text-green-600 dark:text-green-500",children:"Monthly Savings"})]}),e.jsxs("div",{className:"text-center p-4 bg-primary/5 rounded-lg border border-primary/20",children:[e.jsx(ws,{className:"h-5 w-5 mx-auto text-primary mb-1"}),e.jsx("p",{className:"text-2xl font-bold",children:M}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Qualified Referrals"})]}),e.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:[e.jsx(Ea,{className:"h-5 w-5 mx-auto text-amber-600 mb-1"}),e.jsx("p",{className:"text-2xl font-bold text-amber-700 dark:text-amber-400",children:I}),e.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-500",children:"Pending (30 days)"})]})]}),e.jsxs("div",{className:"bg-muted/30 rounded-lg p-4",children:[e.jsx("h4",{className:"font-semibold text-sm mb-3",children:"How It Works"}),e.jsxs("div",{className:"space-y-2 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.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"}),e.jsx("p",{children:"Share your referral link or send an invite email to broker friends"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.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"}),e.jsx("p",{children:"They sign up and subscribe to LevelUp"})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.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"}),e.jsx("p",{children:"After 30 days, you get $25/month off your membership - forever!"})]})]})]}),e.jsx(C3t,{brokerageId:t,refreshTrigger:N}),d.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Your Referrals"}),d.slice(0,5).map(B=>{var $,H;return e.jsxs("div",{className:"flex items-center justify-between p-2.5 bg-muted/30 rounded-lg",children:[e.jsx("span",{className:"text-sm truncate",children:(($=B.referred_brokerage)==null?void 0:$.name)||((H=B.referred_user)==null?void 0:H.email)||"Pending setup"}),e.jsxs(bt,{variant:B.status==="qualified"?"default":B.status==="pending"?"secondary":"destructive",className:B.status==="qualified"?"bg-green-600":"",children:[B.status==="qualified"&&e.jsx(ui,{className:"h-3 w-3 mr-1"}),B.status]})]},B.id)})]})]})]}),e.jsx(S3t,{open:v,onOpenChange:b,referralCode:s||"",brokerageId:t||"",senderName:l||"A LevelUp Member",brokerageName:a,onInvitesSent:()=>j(B=>B+1)})]})},T3t=({brokerageId:t})=>{const r=Ws(),{teams:s,isLoading:n}=Vk(t),{data:a,isLoading:o}=Ht({queryKey:["team-aggregate-stats",t,s.map(g=>g.id)],queryFn:async()=>{if(s.length===0)return[];const g=s.map(B=>B.id),{data:y}=await Z.from("team_members").select("team_id, user_id, role").in("team_id",g);if(!y||y.length===0)return s.map(B=>({team_id:B.id,team_name:B.name,member_count:0,leader_name:null,leader_avatar:null,total_contacts:0,total_deals:0,total_videos:0}));const v=y.map(B=>B.user_id),b=y.filter(B=>B.role==="team_leader").map(B=>B.user_id),{data:N}=await Z.from("profiles").select("id, name, avatar_url").in("id",b),j=new Map((N||[]).map(B=>[B.id,B])),{data:S}=await Z.from("innercircle_contacts").select("owner_user_id").in("owner_user_id",v),{data:A}=await Z.from("deal_pipeline").select("owner_user_id").in("owner_user_id",v),{data:M}=await Z.from("agent_videos").select("owner_user_id").in("owner_user_id",v).eq("is_deleted",!1),I=new Map;(S||[]).forEach(B=>{I.set(B.owner_user_id,(I.get(B.owner_user_id)||0)+1)});const F=new Map;(A||[]).forEach(B=>{F.set(B.owner_user_id,(F.get(B.owner_user_id)||0)+1)});const O=new Map;return(M||[]).forEach(B=>{O.set(B.owner_user_id,(O.get(B.owner_user_id)||0)+1)}),s.map(B=>{const $=y.filter(ne=>ne.team_id===B.id),H=$.find(ne=>ne.role==="team_leader"),W=H?j.get(H.user_id):null,X=$.map(ne=>ne.user_id),se=X.reduce((ne,fe)=>ne+(I.get(fe)||0),0),ae=X.reduce((ne,fe)=>ne+(F.get(fe)||0),0),le=X.reduce((ne,fe)=>ne+(O.get(fe)||0),0);return{team_id:B.id,team_name:B.name,member_count:$.length,leader_name:(W==null?void 0:W.name)||null,leader_avatar:(W==null?void 0:W.avatar_url)||null,total_contacts:se,total_deals:ae,total_videos:le}})},enabled:s.length>0});if(n||o)return e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(g=>e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(fr,{className:"h-5 w-32"})}),e.jsx(qe,{children:e.jsx(fr,{className:"h-24 w-full"})})]},g))});if(s.length===0)return e.jsx(ze,{children:e.jsxs(qe,{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(ws,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No Teams Yet"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Create teams to organize your agents and track their performance."}),e.jsx(Q,{onClick:()=>r("/brokerage/teams"),children:"Manage Teams"})]})});const i=(a||[]).reduce((g,y)=>g+y.member_count,0),d=(a||[]).reduce((g,y)=>g+y.total_contacts,0),m=(a||[]).reduce((g,y)=>g+y.total_deals,0);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid gap-4 grid-cols-2 md:grid-cols-4",children:[e.jsx(ze,{children:e.jsxs(qe,{className:"pt-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-1",children:[e.jsx(ws,{className:"h-4 w-4"})," Teams"]}),e.jsx("p",{className:"text-2xl font-bold",children:s.length})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"pt-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-1",children:[e.jsx(ws,{className:"h-4 w-4"})," Total Members"]}),e.jsx("p",{className:"text-2xl font-bold",children:i})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"pt-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-1",children:[e.jsx(zj,{className:"h-4 w-4"})," Total Contacts"]}),e.jsx("p",{className:"text-2xl font-bold",children:d.toLocaleString()})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"pt-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-1",children:[e.jsx(wu,{className:"h-4 w-4"})," Total Deals"]}),e.jsx("p",{className:"text-2xl font-bold",children:m.toLocaleString()})]})})]}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:(a||[]).map(g=>e.jsxs(ze,{className:"hover:shadow-md transition-shadow",children:[e.jsxs(Wt,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Zt,{className:"text-lg",children:g.team_name}),e.jsxs(bt,{variant:"secondary",children:[g.member_count," members"]})]}),g.leader_name&&e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsxs(ln,{className:"h-6 w-6",children:[e.jsx(pa,{src:g.leader_avatar||""}),e.jsx(cn,{className:"text-xs",children:g.leader_name.charAt(0).toUpperCase()})]}),e.jsxs("span",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(ih,{className:"h-3 w-3 text-amber-500"}),g.leader_name]})]})]}),e.jsx(qe,{children:e.jsxs("div",{className:"grid grid-cols-3 gap-3 text-center",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-lg font-semibold",children:g.total_contacts.toLocaleString()}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Contacts"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-lg font-semibold",children:g.total_deals.toLocaleString()}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Deals"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-lg font-semibold",children:g.total_videos.toLocaleString()}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Videos"})]})]})})]},g.team_id))}),e.jsx("div",{className:"flex justify-end",children:e.jsx(Q,{variant:"outline",onClick:()=>r("/brokerage/teams"),children:"Manage Teams →"})})]})},A3t=()=>{const{user:t,isBrokerageManager:r,brokerageId:s,isAdmin:n,managedBrokerages:a,selectedBrokerageId:o,setSelectedBrokerageId:l}=Gr(),i=Ws(),{toast:d}=fi(),[m,g]=E.useState(""),[y,v]=E.useState(!0),b=o||(a.length>0?a[0].id:s);E.useEffect(()=>{if(!t||!r&&!n){i("/dashboard");return}!o&&a.length>0&&l(a[0].id),b?N():a.length===0&&!s&&v(!1)},[t,r,n,b,i,a,o]);const N=async()=>{if(!b){v(!1);return}try{const{data:j,error:S}=await Z.from("brokerages").select("name").eq("id",b).single();if(S)throw S;g(j.name)}catch(j){console.error("Error loading brokerage info:",j),d({title:"Error",description:"Failed to load brokerage information",variant:"destructive"})}finally{v(!1)}};return y?e.jsx(Fr,{title:"Manage Brokerages",description:"Loading brokerage information...",children:e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):b?e.jsx(Fr,{title:m||"Manage Brokerages",description:"Brokerage Management Dashboard",children:e.jsxs("div",{className:"space-y-6",children:[a.length>1&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Managing:"}),e.jsxs(ds,{value:o||"",onValueChange:l,children:[e.jsxs(ls,{className:"w-[280px]",children:[e.jsx(bi,{className:"mr-2 h-4 w-4"}),e.jsx(us,{placeholder:"Select brokerage"})]}),e.jsx(cs,{children:a.map(j=>e.jsx(Ut,{value:j.id,children:j.name},j.id))})]})]}),e.jsxs(ci,{defaultValue:"agents",className:"space-y-4",children:[e.jsxs(ri,{className:"grid w-full grid-cols-4 md:grid-cols-8",children:[e.jsx(Kr,{value:"agents",children:"Agents"}),e.jsx(Kr,{value:"teams",children:"Teams"}),e.jsx(Kr,{value:"invite",children:"Invite Links"}),e.jsx(Kr,{value:"referrals",children:"Referrals"}),e.jsx(Kr,{value:"leaderboard",children:"Leaderboard"}),e.jsx(Kr,{value:"activity",children:"Activity"}),e.jsx(Kr,{value:"analytics",children:"Analytics"}),e.jsx(Kr,{value:"shares",children:"Shares"})]}),e.jsx(ms,{value:"agents",className:"space-y-4",children:e.jsx(v3t,{brokerageId:b})}),e.jsx(ms,{value:"teams",className:"space-y-4",children:e.jsx(T3t,{brokerageId:b})}),e.jsx(ms,{value:"invite",className:"space-y-4",children:e.jsx(N3t,{brokerageId:b})}),e.jsx(ms,{value:"referrals",className:"space-y-4",children:e.jsx(M3t,{})}),e.jsx(ms,{value:"leaderboard",className:"space-y-4",children:e.jsx(C9e,{brokerageId:b,title:`${m} Event Leaderboard`,showUserStats:!1})}),e.jsx(ms,{value:"activity",className:"space-y-4",children:e.jsx(j3t,{brokerageId:b})}),e.jsx(ms,{value:"analytics",className:"space-y-4",children:e.jsx(k3t,{brokerageId:b})}),e.jsx(ms,{value:"shares",className:"space-y-4",children:e.jsx(FBe,{brokerageOnly:!0,brokerageId:b})})]})]})}):e.jsx(Fr,{title:"Manage Brokerages",description:"Brokerage Management",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(bi,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"No Brokerage Assigned"}),e.jsx("p",{className:"text-muted-foreground",children:"You don't have any brokerages to manage."})]})})};function E3t({brokerageId:t,canManage:r}){const{user:s}=Gr(),[n,a]=E.useState([]),[o,l]=E.useState(!0),[i,d]=E.useState(!1),[m,g]=E.useState(null),[y,v]=E.useState(null),[b,N]=E.useState(!1),[j,S]=E.useState(""),[A,M]=E.useState(""),[I,F]=E.useState(!1),O=async()=>{try{const{data:X,error:se}=await Z.from("brokerage_announcements").select("*").eq("brokerage_id",t).order("is_pinned",{ascending:!1}).order("pinned_at",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1});if(se)throw se;const ae=X;if(ae&&ae.length>0){const le=[...new Set(ae.map(de=>de.created_by))],{data:ne}=await Z.from("profiles").select("id, name, avatar_url").in("id",le),fe=new Map((ne==null?void 0:ne.map(de=>[de.id,de]))||[]),oe=ae.map(de=>({...de,author:fe.get(de.created_by)||{name:"Unknown",avatar_url:null}}));a(oe)}else a([])}catch(X){console.error("Error fetching announcements:",X)}finally{l(!1)}};E.useEffect(()=>{O()},[t]);const B=()=>{S(""),M(""),F(!1),g(null)},$=X=>{X?(g(X),S(X.title),M(X.content),F(X.is_pinned)):B(),d(!0)},H=async()=>{if(!j.trim()||!A.trim()){Se.error("Please fill in all fields");return}N(!0);try{if(m){const{error:X}=await Z.from("brokerage_announcements").update({title:j.trim(),content:A.trim(),is_pinned:I,pinned_at:I?new Date().toISOString():null}).eq("id",m.id);if(X)throw X;Se.success("Announcement updated")}else{const{error:X}=await Z.from("brokerage_announcements").insert({brokerage_id:t,created_by:s==null?void 0:s.id,title:j.trim(),content:A.trim(),is_pinned:I,pinned_at:I?new Date().toISOString():null});if(X)throw X;Se.success("Announcement created")}d(!1),B(),O()}catch(X){console.error("Error saving announcement:",X),Se.error("Failed to save announcement")}finally{N(!1)}},W=async()=>{if(y)try{const{error:X}=await Z.from("brokerage_announcements").delete().eq("id",y);if(X)throw X;Se.success("Announcement deleted"),O()}catch(X){console.error("Error deleting announcement:",X),Se.error("Failed to delete announcement")}finally{v(null)}};return o?e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(Bf,{className:"h-5 w-5"}),"Announcements"]})}),e.jsx(qe,{children:e.jsx("div",{className:"animate-pulse space-y-3",children:e.jsx("div",{className:"h-20 bg-muted rounded"})})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(Bf,{className:"h-5 w-5 text-primary"}),"Announcements"]}),r&&e.jsxs(Q,{size:"sm",onClick:()=>$(),className:"gap-1",children:[e.jsx(gs,{className:"h-4 w-4"}),"New"]})]}),e.jsx(qe,{children:n.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No announcements yet"}):e.jsx("div",{className:"space-y-4",children:n.map(X=>{var se,ae,le,ne;return e.jsx("div",{className:`p-4 rounded-lg border ${X.is_pinned?"bg-primary/5 border-primary/20":"bg-muted/30"}`,children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[X.is_pinned&&e.jsx(ev,{className:"h-3.5 w-3.5 text-primary shrink-0"}),e.jsx("h4",{className:"font-semibold truncate",children:X.title})]}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:X.content}),e.jsxs("div",{className:"flex items-center gap-2 mt-3 text-xs text-muted-foreground",children:[e.jsxs(ln,{className:"h-5 w-5",children:[e.jsx(pa,{src:((se=X.author)==null?void 0:se.avatar_url)||void 0}),e.jsx(cn,{className:"text-[10px]",children:((le=(ae=X.author)==null?void 0:ae.name)==null?void 0:le.charAt(0))||"?"})]}),e.jsx("span",{children:(ne=X.author)==null?void 0:ne.name}),e.jsx("span",{children:"•"}),e.jsx("span",{children:Xr(new Date(X.created_at),"MMM d, yyyy")})]})]}),r&&e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>$(X),children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>v(X.id),children:e.jsx(Rs,{className:"h-4 w-4"})})]})]})},X.id)})})})]}),e.jsx(Dr,{open:i,onOpenChange:d,children:e.jsxs(Lr,{children:[e.jsx(Ur,{children:e.jsx(Br,{children:m?"Edit Announcement":"New Announcement"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"title",children:"Title"}),e.jsx(Qe,{id:"title",value:j,onChange:X=>S(X.target.value),placeholder:"Announcement title..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"content",children:"Content"}),e.jsx(Ks,{id:"content",value:A,onChange:X=>M(X.target.value),placeholder:"Write your announcement...",rows:4})]}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xn,{id:"pinned",checked:I,onCheckedChange:F}),e.jsxs(Ee,{htmlFor:"pinned",className:"flex items-center gap-1 cursor-pointer",children:[e.jsx(ev,{className:"h-4 w-4"}),"Pin to top"]})]})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(Q,{variant:"outline",onClick:()=>d(!1),children:"Cancel"}),e.jsx(Q,{onClick:H,disabled:b,children:b?"Saving...":m?"Update":"Create"})]})]})]})}),e.jsx(Xc,{open:!!y,onOpenChange:()=>v(null),children:e.jsxs(Tc,{children:[e.jsxs(Ac,{children:[e.jsx(Ic,{children:"Delete Announcement"}),e.jsx(Pc,{children:"Are you sure you want to delete this announcement? This action cannot be undone."})]}),e.jsxs(Ec,{children:[e.jsx(Lc,{children:"Cancel"}),e.jsx(dc,{onClick:W,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function I3t({brokerageId:t}){const[r,s]=E.useState([]),[n,a]=E.useState(!0),[o,l]=E.useState(""),[i,d]=E.useState(new Set);E.useEffect(()=>{(async()=>{try{const{data:y,error:v}=await Z.from("profiles").select("id, name, email, phone, avatar_url, title, bio, areas_served, years_experience, instagram_url, facebook_url, linkedin_url").eq("brokerage_id",t).order("name");if(v)throw v;if(s(y||[]),y&&y.length>0){const b=y.map(j=>j.id),{data:N}=await Z.from("agent_assistant_assignments").select("agent_id").in("agent_id",b);N&&d(new Set(N.map(j=>j.agent_id)))}}catch(y){console.error("Error fetching agents:",y)}finally{a(!1)}})()},[t]);const m=r.filter(g=>{var y,v;return g.name.toLowerCase().includes(o.toLowerCase())||g.email.toLowerCase().includes(o.toLowerCase())||((y=g.title)==null?void 0:y.toLowerCase().includes(o.toLowerCase()))||((v=g.areas_served)==null?void 0:v.toLowerCase().includes(o.toLowerCase()))});return n?e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(ws,{className:"h-5 w-5"}),"Agent Roster"]})}),e.jsx(qe,{children:e.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(g=>e.jsx("div",{className:"animate-pulse",children:e.jsx("div",{className:"h-48 bg-muted rounded-lg"})},g))})})]}):e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 space-y-0",children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(ws,{className:"h-5 w-5 text-primary"}),"Agent Roster",e.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["(",r.length,")"]})]}),e.jsxs("div",{className:"relative w-full sm:w-64",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search agents...",value:o,onChange:g=>l(g.target.value),className:"pl-9"})]})]}),e.jsx(qe,{children:m.length===0?e.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"}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:m.map(g=>e.jsx(P3t,{agent:g,hasAssistant:i.has(g.id)},g.id))})})]})}function P3t({agent:t,hasAssistant:r}){const s=t.name.split(" ").map(n=>n[0]).join("").toUpperCase().slice(0,2);return e.jsxs("div",{className:"group relative bg-card border rounded-xl p-4 hover:shadow-md transition-shadow",children:[e.jsxs("div",{className:"flex flex-col items-center text-center mb-3",children:[e.jsxs(ln,{className:"h-20 w-20 mb-3 ring-2 ring-background shadow-md",children:[e.jsx(pa,{src:t.avatar_url||void 0,alt:t.name}),e.jsx(cn,{className:"text-lg bg-primary/10 text-primary",children:s})]}),e.jsx("h3",{className:"font-semibold text-sm leading-tight",children:t.name}),t.title&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t.title}),r&&e.jsx(bt,{variant:"outline",className:"text-[10px] mt-1",children:"Has Assistant"})]}),t.bio&&e.jsx("p",{className:"text-xs text-muted-foreground text-center line-clamp-2 mb-3",children:t.bio}),e.jsxs("div",{className:"space-y-1.5 mb-3",children:[t.areas_served&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(eo,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:t.areas_served})]}),t.years_experience&&e.jsxs("p",{className:"text-xs text-muted-foreground text-center",children:[t.years_experience," ",t.years_experience===1?"year":"years"," experience"]})]}),e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[t.phone&&e.jsx(Q,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:e.jsx("a",{href:`tel:${t.phone}`,title:`Call ${t.name}`,children:e.jsx(wi,{className:"h-4 w-4"})})}),e.jsx(Q,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:e.jsx("a",{href:`mailto:${t.email}`,title:`Email ${t.name}`,children:e.jsx(mn,{className:"h-4 w-4"})})}),t.linkedin_url&&e.jsx(Q,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:e.jsx("a",{href:t.linkedin_url,target:"_blank",rel:"noopener noreferrer",title:"LinkedIn",children:e.jsx(km,{className:"h-4 w-4"})})}),t.instagram_url&&e.jsx(Q,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:e.jsx("a",{href:t.instagram_url,target:"_blank",rel:"noopener noreferrer",title:"Instagram",children:e.jsx(ju,{className:"h-4 w-4"})})})]})]})}function L3t({brokerageId:t}){const[r,s]=E.useState([]),[n,a]=E.useState(!0);if(E.useEffect(()=>{(async()=>{try{const{data:d,error:m}=await Z.from("profiles").select("id, name, avatar_url").eq("brokerage_id",t);if(m)throw m;if(!d||d.length===0){s([]),a(!1);return}const g=d.map(j=>j.id),{data:y,error:v}=await Z.from("agent_attendance_stats").select("user_id, total_points").in("user_id",g).order("total_points",{ascending:!1});if(v)throw v;const b=new Map(d.map(j=>[j.id,j])),N=(y||[]).filter(j=>j.total_points>0).map(j=>{const S=b.get(j.user_id);return{user_id:j.user_id,total_points:j.total_points,name:(S==null?void 0:S.name)||"Unknown",avatar_url:(S==null?void 0:S.avatar_url)||null}});s(N)}catch(d){console.error("Error fetching leaderboard:",d)}finally{a(!1)}})()},[t]),n)return e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(ho,{className:"h-5 w-5"}),"Team Leaderboard"]})}),e.jsx(qe,{children:e.jsx("div",{className:"animate-pulse space-y-3",children:[1,2,3].map(i=>e.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?e.jsx(vy,{className:qt("h-5 w-5",o(i))}):e.jsx("span",{className:"w-5 text-center text-sm text-muted-foreground",children:i});return e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(ho,{className:"h-5 w-5 text-primary"}),"Team Leaderboard"]})}),e.jsx(qe,{children:r.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No points earned yet. Attend events to earn points!"}):e.jsx("div",{className:"space-y-2",children:r.slice(0,10).map((i,d)=>{const m=i.name.split(" ").map(y=>y[0]).join("").toUpperCase().slice(0,2),g=d+1;return e.jsxs("div",{className:qt("flex items-center gap-3 p-2 rounded-lg",g<=3&&"bg-muted/50"),children:[e.jsx("div",{className:"w-6 flex justify-center",children:l(g)}),e.jsxs(ln,{className:"h-8 w-8",children:[e.jsx(pa,{src:i.avatar_url||void 0}),e.jsx(cn,{className:"text-xs",children:m})]}),e.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:i.name}),e.jsxs("span",{className:"text-sm font-semibold text-primary",children:[i.total_points.toLocaleString()," pts"]})]},i.user_id)})})})]})}function O3t({brokerageId:t}){const r=Ws(),[s,n]=E.useState([]),[a,o]=E.useState(!0);E.useEffect(()=>{(async()=>{try{const{data:d,error:m}=await Z.from("profiles").select("id, name, avatar_url").eq("brokerage_id",t);if(m)throw m;if(!d||d.length===0){n([]),o(!1);return}const g=d.map(j=>j.id),y=new Map(d.map(j=>[j.id,j])),{data:v,error:b}=await Z.from("listings").select(` id, slug, property_address, city, price, property_type, agent_id, listing_photos(photo_url) `).in("agent_id",g).eq("status","active").order("created_at",{ascending:!1}).limit(6);if(b)throw b;const N=(v||[]).map(j=>({id:j.id,slug:j.slug,property_address:j.property_address,city:j.city,price:j.price,property_type:j.property_type,agent_id:j.agent_id,agent:y.get(j.agent_id)||null,photos:j.listing_photos||[]}));n(N)}catch(d){console.error("Error fetching listings:",d)}finally{o(!1)}})()},[t]);const l=i=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(i);return a?e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(Wn,{className:"h-5 w-5"}),"Brokerage Listings"]})}),e.jsx(qe,{children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[1,2].map(i=>e.jsx("div",{className:"animate-pulse",children:e.jsx("div",{className:"h-32 bg-muted rounded-lg"})},i))})})]}):e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(Wn,{className:"h-5 w-5 text-primary"}),"Brokerage Listings"]}),e.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>r("/mission-control/listings"),className:"gap-1",children:[e.jsx(gs,{className:"h-4 w-4"}),"Add Listing"]})]}),e.jsxs(qe,{children:[s.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(Wn,{className:"h-10 w-10 text-muted-foreground mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"No active listings from your brokerage yet"}),e.jsxs(Q,{size:"sm",onClick:()=>r("/mission-control/listings/new"),className:"gap-1",children:[e.jsx(gs,{className:"h-4 w-4"}),"Add Your First Listing"]})]}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:s.map(i=>e.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:[e.jsxs("div",{className:"relative h-24 bg-muted",children:[i.photos&&i.photos.length>0?e.jsx("img",{src:i.photos[0].photo_url,alt:i.property_address||"Listing",className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(Wn,{className:"h-8 w-8 text-muted-foreground"})}),e.jsx("div",{className:"absolute top-2 left-2",children:e.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("_"," ")})})]}),e.jsxs("div",{className:"p-2.5",children:[e.jsx("p",{className:"font-semibold text-sm text-primary",children:l(i.price)}),e.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:i.property_address||"Address not available"}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:i.city}),i.agent&&e.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1.5 truncate",children:["Listed by ",i.agent.name]})]})]},i.id))}),s.length>0&&e.jsxs(Q,{variant:"ghost",size:"sm",className:"w-full mt-3",onClick:()=>r("/mission-control/listings"),children:["View All Listings",e.jsx(En,{className:"h-3 w-3 ml-1"})]})]})]})}function D3t(){const{user:t,isAdmin:r,isBrokerageManager:s}=Gr(),n=Ws(),[a,o]=E.useState(!0),[l,i]=E.useState(null),[d,m]=E.useState(""),[g,y]=E.useState(0),[v,b]=E.useState(!1),[N,j]=E.useState(!1);return E.useEffect(()=>{(async()=>{if(t)try{const{data:A}=await Z.from("profiles").select("brokerage_id").eq("id",t.id).maybeSingle();if(!(A!=null&&A.brokerage_id)){o(!1);return}i(A.brokerage_id);const{data:M}=await Z.from("brokerages").select("name").eq("id",A.brokerage_id).maybeSingle();M&&m(M.name);const{count:I}=await Z.from("profiles").select("id",{count:"exact",head:!0}).eq("brokerage_id",A.brokerage_id);if(y(I||0),r)b(!0),j(!0);else if(s){const{data:F}=await Z.from("brokerage_manager_assignments").select("id").eq("user_id",t.id).eq("brokerage_id",A.brokerage_id).maybeSingle();b(!!F),j(!!F)}}catch(A){console.error("Error fetching brokerage info:",A)}finally{o(!1)}})()},[t,r,s]),a?e.jsx(Fr,{title:"My Brokerage",description:"Loading...",children:e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):l?e.jsx(Fr,{title:d||"My Brokerage",description:"Team Hub",children:e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2 bg-muted/50 rounded-lg px-4 py-2",children:[e.jsx(ws,{className:"h-5 w-5 text-primary"}),e.jsxs("span",{className:"font-medium",children:[g," ",g===1?"Agent":"Agents"]})]}),N&&e.jsxs(Q,{onClick:()=>n(`/mission-control/listings/new?brokerage=${l}`),children:[e.jsx(Wn,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]}),e.jsx(E3t,{brokerageId:l,canManage:v}),e.jsx(I3t,{brokerageId:l}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[e.jsx(L3t,{brokerageId:l}),e.jsx(O3t,{brokerageId:l})]})]})}):e.jsx(Fr,{title:"My Brokerage",description:"Team Hub",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(bi,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"No Brokerage Assigned"}),e.jsx("p",{className:"text-muted-foreground",children:"You're not currently part of a brokerage team."})]})})}function R3t(){const t=Ws(),[r,s]=E.useState(""),[n,a]=E.useState("grid"),{data:o,isLoading:l}=Ht({queryKey:["newsletters"],queryFn:async()=>{const{data:I,error:F}=await Z.from("newsletter_content").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(F)throw F;return I}}),{data:i}=Ht({queryKey:["newsletter-likes-all"],queryFn:async()=>{const{data:I}=await Z.from("newsletter_likes").select("newsletter_id");return I||[]}}),{data:d}=Ht({queryKey:["newsletter-comments-all"],queryFn:async()=>{const{data:I}=await Z.from("newsletter_comments").select("newsletter_id");return I||[]}}),{data:m}=Ht({queryKey:["newsletter-resource-counts"],queryFn:async()=>{const[I,F,O,B]=await Promise.all([Z.from("newsletter_canva_links").select("newsletter_id"),Z.from("newsletter_pdfs").select("newsletter_id"),Z.from("newsletter_videos").select("newsletter_id"),Z.from("newsletter_drive_links").select("newsletter_id")]);return{canva:I.data||[],pdfs:F.data||[],videos:O.data||[],drives:B.data||[]}}}),g=I=>(i==null?void 0:i.filter(F=>F.newsletter_id===I).length)||0,y=I=>(d==null?void 0:d.filter(F=>F.newsletter_id===I).length)||0,v=I=>{var F;return((F=m==null?void 0:m.canva)==null?void 0:F.filter(O=>O.newsletter_id===I).length)||0},b=I=>{var F;return((F=m==null?void 0:m.pdfs)==null?void 0:F.filter(O=>O.newsletter_id===I).length)||0},N=I=>{var F;return((F=m==null?void 0:m.videos)==null?void 0:F.filter(O=>O.newsletter_id===I).length)||0},j=I=>{var F;return((F=m==null?void 0:m.drives)==null?void 0:F.filter(O=>O.newsletter_id===I).length)||0},S=I=>v(I)+b(I)+N(I)+j(I),A=o==null?void 0:o.filter(I=>{var F;return I.title.toLowerCase().includes(r.toLowerCase())||((F=I.description)==null?void 0:F.toLowerCase().includes(r.toLowerCase()))}),M=I=>{t(`/newsletters/${I}`)};return e.jsx(Fr,{title:"Newsletter Content",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-bold text-foreground text-5xl",children:"Newsletter Content"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Monthly newsletter templates and resources"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search newsletters...",value:r,onChange:I=>s(I.target.value),className:"pl-9"})]}),e.jsxs("div",{className:"flex gap-2",children:[r&&e.jsx(Q,{variant:"outline",size:"sm",onClick:()=>s(""),children:"Clear"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(Q,{variant:n==="grid"?"secondary":"outline",size:"icon",onClick:()=>a("grid"),className:"rounded-full",children:e.jsx(yp,{className:"h-4 w-4"})}),e.jsx(Q,{variant:n==="list"?"secondary":"outline",size:"icon",onClick:()=>a("list"),className:"rounded-full",children:e.jsx(vp,{className:"h-4 w-4"})})]})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[(A==null?void 0:A.length)||0," item",(A==null?void 0:A.length)!==1?"s":""," found"]}),l&&e.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,F)=>e.jsx(ze,{children:e.jsxs(qe,{className:"p-0",children:[e.jsx(fr,{className:"aspect-[3/2] w-full"}),e.jsxs("div",{className:"p-4 space-y-2",children:[e.jsx(fr,{className:"h-5 w-3/4"}),e.jsx(fr,{className:"h-4 w-full"})]})]})},F))}),!l&&(A==null?void 0:A.length)===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(fa,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("div",{className:"text-muted-foreground mb-4",children:r?"No newsletters match your search":"No newsletters available yet"}),r&&e.jsx(Q,{variant:"outline",onClick:()=>s(""),children:"Clear Search"})]}),!l&&A&&A.length>0&&e.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-3",children:A.map(I=>{const F=S(I.id),O=v(I.id),B=b(I.id),$=N(I.id);return n==="grid"?e.jsxs(ze,{className:"group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer border-border/50",onClick:()=>M(I.id),children:[e.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:I.preview_image_url?e.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"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:e.jsx(fa,{className:"h-16 w-16"})})}),e.jsxs(qe,{className:"p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-foreground line-clamp-1",children:I.title}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-1 text-xs text-muted-foreground",children:[e.jsx(Mn,{className:"h-3 w-3"}),Xr(new Date(I.publish_date),"MMM d, yyyy")]})]}),I.description&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:I.description.replace(/<[^>]*>/g,"")}),F>0&&e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[O>0&&e.jsxs(bt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[e.jsx(ed,{className:"h-3 w-3"})," ",O," Template",O>1?"s":""]}),B>0&&e.jsxs(bt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[e.jsx(Oi,{className:"h-3 w-3"})," ",B," PDF",B>1?"s":""]}),$>0&&e.jsxs(bt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[e.jsx(Gl,{className:"h-3 w-3"})," ",$," Video",$>1?"s":""]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground pt-1 border-t border-border/50",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(_d,{className:"h-3 w-3"})," ",g(I.id)]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Pl,{className:"h-3 w-3"})," ",y(I.id)]})]})]})]},I.id):e.jsx(ze,{className:"group overflow-hidden hover:shadow-md transition-all duration-200 cursor-pointer border-border/50",onClick:()=>M(I.id),children:e.jsxs("div",{className:"flex flex-row",children:[e.jsx("div",{className:"relative overflow-hidden bg-muted w-40 sm:w-48 shrink-0",children:I.preview_image_url?e.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"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground min-h-[100px]",children:e.jsx(fa,{className:"h-10 w-10"})})}),e.jsxs(qe,{className:"p-4 flex-1 flex flex-col justify-center gap-2",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-foreground line-clamp-1",children:I.title}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5 text-xs text-muted-foreground",children:[e.jsx(Mn,{className:"h-3 w-3"}),Xr(new Date(I.publish_date),"MMM d, yyyy")]})]}),I.description&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:I.description.replace(/<[^>]*>/g,"")}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[F>0&&e.jsxs("span",{children:[F," resource",F>1?"s":""]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(_d,{className:"h-3 w-3"})," ",g(I.id)]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Pl,{className:"h-3 w-3"})," ",y(I.id)]})]})]})]})},I.id)})})]})})}function F3t({rows:t}){if(!t||t.length===0)return null;const r=t.filter(s=>s.columns.some(n=>n.title||n.description||n.image_url));return r.length===0?null:e.jsx("div",{className:"space-y-6",children:r.map((s,n)=>{const a=s.columns.filter(o=>o.title||o.description||o.image_url);return a.length===0?null:e.jsx("div",{className:"grid gap-4",style:{gridTemplateColumns:`repeat(${a.length}, minmax(0, 1fr))`},children:a.map((o,l)=>e.jsxs(ze,{className:"overflow-hidden border-border/50",children:[o.image_url&&e.jsx("img",{src:o.image_url,alt:o.title||"",className:"w-full h-40 object-cover"}),e.jsxs(qe,{className:"p-4 space-y-2",children:[o.title&&e.jsx("h4",{className:"font-semibold text-foreground",children:o.title}),o.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:o.description})]})]},l))},n)})})}function z3t(){const{id:t}=Xl(),r=Ws(),{user:s}=Gr(),{toast:n}=fi(),a=qr(),{trackEngagement:o}=TP(),[l,i]=E.useState(""),{data:d,isLoading:m}=Ht({queryKey:["newsletter",t],queryFn:async()=>{const{data:O,error:B}=await Z.from("newsletter_content").select("*").eq("id",t).single();if(B)throw B;return O},enabled:!!t});E.useEffect(()=>{d&&o("newsletter",d.id,d.title,"view")},[d==null?void 0:d.id]);const{data:g}=Ht({queryKey:["newsletter-drives",t],queryFn:async()=>{const{data:O}=await Z.from("newsletter_drive_links").select("*").eq("newsletter_id",t).order("sort_order");return O||[]},enabled:!!t}),{data:y}=Ht({queryKey:["newsletter-pdfs",t],queryFn:async()=>{const{data:O}=await Z.from("newsletter_pdfs").select("*").eq("newsletter_id",t).order("sort_order");return O||[]},enabled:!!t}),{data:v}=Ht({queryKey:["newsletter-videos",t],queryFn:async()=>{const{data:O}=await Z.from("newsletter_videos").select("*").eq("newsletter_id",t).order("sort_order");return O||[]},enabled:!!t}),{data:b}=Ht({queryKey:["newsletter-canva-links",t],queryFn:async()=>{const{data:O}=await Z.from("newsletter_canva_links").select("*").eq("newsletter_id",t).order("sort_order");return O||[]},enabled:!!t}),{data:N}=Ht({queryKey:["newsletter-likes",t],queryFn:async()=>{const{data:O}=await Z.from("newsletter_likes").select("*").eq("newsletter_id",t);return O||[]},enabled:!!t}),{data:j}=Ht({queryKey:["newsletter-comments",t],queryFn:async()=>{const{data:O}=await Z.from("newsletter_comments").select("*, profiles:user_id(name)").eq("newsletter_id",t).order("created_at",{ascending:!1});return O||[]},enabled:!!t}),S=N==null?void 0:N.some(O=>O.user_id===(s==null?void 0:s.id)),A=Jt({mutationFn:async()=>{S?await Z.from("newsletter_likes").delete().eq("newsletter_id",t).eq("user_id",s==null?void 0:s.id):await Z.from("newsletter_likes").insert({newsletter_id:t,user_id:s==null?void 0:s.id})},onSuccess:()=>{a.invalidateQueries({queryKey:["newsletter-likes",t]})}}),M=Jt({mutationFn:async O=>{const{error:B}=await Z.from("newsletter_comments").insert({newsletter_id:t,user_id:s==null?void 0:s.id,content:O});if(B)throw B},onSuccess:()=>{a.invalidateQueries({queryKey:["newsletter-comments",t]}),i(""),n({title:"Comment added"})}}),I=Jt({mutationFn:async O=>{const{error:B}=await Z.from("newsletter_comments").delete().eq("id",O);if(B)throw B},onSuccess:()=>{a.invalidateQueries({queryKey:["newsletter-comments",t]}),n({title:"Comment deleted"})}}),F=O=>{if(O.includes("player.mediadelivery.net")||O.includes("iframe.mediadelivery.net")){const B=O.match(/embed\/(\d+)\/([a-f0-9-]+)/);if(B)return e.jsx("div",{className:"relative w-full pt-[56.25%]",children:e.jsx("iframe",{src:`https://iframe.mediadelivery.net/embed/${B[1]}/${B[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(O.includes("youtube.com")||O.includes("youtu.be")){const B=O.match(/(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([^&\s]+)/);if(B)return e.jsx("div",{className:"relative w-full pt-[56.25%]",children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${B[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 e.jsxs("a",{href:O,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-primary hover:underline",children:[e.jsx(Gl,{className:"h-4 w-4"})," Watch Video"]})};return m?e.jsx(Fr,{title:"",description:"",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(fr,{className:"h-8 w-32"}),e.jsx(fr,{className:"h-64 w-full"}),e.jsx(fr,{className:"h-32 w-full"})]})}):d?e.jsx(Fr,{title:"",description:"",children:e.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[e.jsxs(Q,{variant:"ghost",onClick:()=>r("/newsletters"),className:"mb-4",children:[e.jsx(_i,{className:"mr-2 h-4 w-4"})," Back to Newsletters"]}),d.preview_image_url&&e.jsx("img",{src:d.preview_image_url,alt:d.title,className:"w-full h-64 md:h-80 object-cover rounded-lg"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:d.title}),e.jsx("p",{className:"text-muted-foreground mt-1",children:Xr(new Date(d.publish_date),"MMMM d, yyyy")})]}),d.description&&e.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:d.description}}),e.jsx(F3t,{rows:d.content_blocks||[]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(K3,{resourceType:"newsletter",resourceId:d.id,resourceTitle:d.title}),e.jsxs(Q,{variant:S?"default":"outline",size:"sm",onClick:()=>A.mutate(),children:[e.jsx(Ci,{className:`h-4 w-4 mr-1 ${S?"fill-current":""}`}),(N==null?void 0:N.length)||0," ",(N==null?void 0:N.length)===1?"Like":"Likes"]})]}),b&&b.length>0&&e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{className:"text-lg",children:"Canva Templates"})}),e.jsx(qe,{className:"space-y-2",children:b.map(O=>e.jsxs("a",{href:O.canva_share_link,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",d.id,d.title,"click_canva"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[e.jsx(ed,{className:"h-5 w-5 text-purple-500"}),e.jsx("span",{className:"font-medium",children:O.title}),e.jsx(En,{className:"h-4 w-4 text-muted-foreground ml-auto"})]},O.id))})]}),g&&g.length>0&&e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{className:"text-lg",children:"Google Drive Files"})}),e.jsx(qe,{className:"space-y-2",children:g.map(O=>e.jsxs("a",{href:O.drive_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",d.id,d.title,"click_link"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[e.jsx(En,{className:"h-5 w-5 text-primary"}),e.jsx("span",{className:"font-medium",children:O.title})]},O.id))})]}),y&&y.length>0&&e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{className:"text-lg",children:"PDF Downloads"})}),e.jsx(qe,{className:"space-y-2",children:y.map(O=>e.jsxs("a",{href:O.file_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",d.id,d.title,"click_pdf"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[e.jsx(fa,{className:"h-5 w-5 text-red-500"}),e.jsx("span",{className:"font-medium flex-1",children:O.name}),e.jsx(Oi,{className:"h-4 w-4 text-muted-foreground"})]},O.id))})]}),v&&v.length>0&&e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{className:"text-lg",children:"Videos"})}),e.jsx(qe,{className:"space-y-6",children:v.map(O=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:O.title}),F(O.video_url)]},O.id))})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"text-lg",children:["Comments (",(j==null?void 0:j.length)||0,")"]})}),e.jsxs(qe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsx(Ks,{placeholder:"Write a comment...",value:l,onChange:O=>i(O.target.value),className:"flex-1"}),e.jsx(Q,{onClick:()=>l.trim()&&M.mutate(l),disabled:!l.trim()||M.isPending,children:e.jsx(Mi,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"space-y-4",children:j==null?void 0:j.map(O=>{var B,$,H;return e.jsxs("div",{className:"flex gap-3",children:[e.jsx(ln,{className:"h-8 w-8",children:e.jsx(cn,{children:(($=(B=O.profiles)==null?void 0:B.name)==null?void 0:$[0])||"U"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium text-sm",children:((H=O.profiles)==null?void 0:H.name)||"User"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:Xr(new Date(O.created_at),"MMM d, yyyy")}),O.user_id===(s==null?void 0:s.id)&&e.jsx(Q,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>I.mutate(O.id),children:e.jsx(Rs,{className:"h-3 w-3"})})]})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:O.content})]})]},O.id)})})]})]})]})}):e.jsx(Fr,{title:"Not Found",description:"",children:e.jsxs("div",{className:"text-center py-12",children:[e.jsx("p",{className:"text-muted-foreground",children:"Newsletter not found"}),e.jsx(Q,{variant:"link",onClick:()=>r("/newsletters"),children:"Back to Newsletters"})]})})}function B3t({rows:t,onChange:r}){const[s,n]=E.useState(null),a=()=>{r([...t,{columns:[{title:"",description:""},{title:"",description:""},{title:"",description:""}]}])},o=m=>{r(t.filter((g,y)=>y!==m))},l=(m,g,y,v)=>{const b=[...t];b[m]={...b[m],columns:b[m].columns.map((N,j)=>j===g?{...N,[y]:v}:N)},r(b)},i=async(m,g,y)=>{var N;const v=(N=y.target.files)==null?void 0:N[0];if(!v)return;const b=`${m}-${g}`;n(b);try{const j=`content-blocks/${Date.now()}-${v.name}`,{error:S}=await Z.storage.from("newsletter-content").upload(j,v);if(!S){const{data:A}=Z.storage.from("newsletter-content").getPublicUrl(j);l(m,g,"image_url",A.publicUrl)}}finally{n(null)}},d=(m,g)=>{l(m,g,"image_url","")};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ee,{className:"text-base font-medium",children:"Content Blocks (3-Column Rows)"}),e.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:a,children:[e.jsx(gs,{className:"mr-1 h-3 w-3"})," Add Row"]})]}),t.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"No content block rows yet. Add a row to create a 3-column layout."}),t.map((m,g)=>e.jsxs(ze,{className:"relative",children:[e.jsx(Q,{type:"button",variant:"ghost",size:"icon",className:"absolute top-2 right-2 h-6 w-6 text-muted-foreground hover:text-destructive",onClick:()=>o(g),children:e.jsx(rn,{className:"h-4 w-4"})}),e.jsxs(qe,{className:"p-4 pt-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(xp,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:["Row ",g+1]})]}),e.jsx("div",{className:"grid grid-cols-3 gap-3",children:m.columns.map((y,v)=>{const b=`${g}-${v}`;return e.jsxs("div",{className:"space-y-2 border border-border/50 rounded-md p-3 bg-muted/20",children:[e.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:["Column ",v+1]}),y.image_url?e.jsxs("div",{className:"relative group",children:[e.jsx("img",{src:y.image_url,alt:"",className:"w-full h-20 object-cover rounded"}),e.jsx(Q,{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:()=>d(g,v),children:e.jsx(rn,{className:"h-3 w-3"})})]}):e.jsxs("div",{children:[e.jsx(Qe,{type:"file",accept:"image/*",className:"hidden",id:`block-img-${b}`,onChange:N=>i(g,v,N)}),e.jsx(Q,{type:"button",variant:"outline",size:"sm",className:"w-full text-xs h-8",disabled:s===b,asChild:!0,children:e.jsx("label",{htmlFor:`block-img-${b}`,className:"cursor-pointer",children:s===b?"Uploading...":e.jsxs(e.Fragment,{children:[e.jsx(El,{className:"h-3 w-3 mr-1"})," Image"]})})})]}),e.jsx(Qe,{placeholder:"Title",value:y.title,onChange:N=>l(g,v,"title",N.target.value),className:"h-8 text-sm"}),e.jsx(Ks,{placeholder:"Description",value:y.description,onChange:N=>l(g,v,"description",N.target.value),className:"text-sm min-h-[60px] resize-none"})]},v)})})]})]},g))]})}function $3t(){const{toast:t}=fi(),r=qr(),[s,n]=E.useState(!1),[a,o]=E.useState(null),[l,i]=E.useState({title:"",description:"",publish_date:Xr(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),[d,m]=E.useState(null),[g,y]=E.useState(null),[v,b]=E.useState([]),[N,j]=E.useState([]),[S,A]=E.useState([]),[M,I]=E.useState([]),[F,O]=E.useState([]),[B,$]=E.useState([]),[H,W]=E.useState(!1),{data:X,isLoading:se}=Ht({queryKey:["admin-newsletters"],queryFn:async()=>{const{data:Ae,error:Le}=await Z.from("newsletter_content").select("*").order("publish_date",{ascending:!1});if(Le)throw Le;return Ae}}),ae=Jt({mutationFn:async Ae=>{const{data:Le,error:Ue}=await Z.from("newsletter_content").insert({title:Ae.title,description:Ae.description||null,preview_image_url:Ae.preview_image_url,publish_date:Ae.publish_date,is_published:Ae.is_published,content_blocks:Ae.content_blocks}).select().single();if(Ue)throw Ue;return Le},onSuccess:async Ae=>{await fe(Ae.id),r.invalidateQueries({queryKey:["admin-newsletters"]}),t({title:"Newsletter created successfully"}),Ae.is_published&&hSt(Ae.title,Ae.id),ue()},onError:Ae=>{t({title:"Error creating newsletter",description:Ae.message,variant:"destructive"})}}),le=Jt({mutationFn:async Ae=>{const{error:Le}=await Z.from("newsletter_content").update({title:Ae.title,description:Ae.description||null,preview_image_url:Ae.preview_image_url,publish_date:Ae.publish_date,is_published:Ae.is_published,content_blocks:Ae.content_blocks}).eq("id",Ae.id);if(Le)throw Le;return Ae.id},onSuccess:async Ae=>{await fe(Ae),r.invalidateQueries({queryKey:["admin-newsletters"]}),t({title:"Newsletter updated successfully"}),ue()},onError:Ae=>{t({title:"Error updating newsletter",description:Ae.message,variant:"destructive"})}}),ne=Jt({mutationFn:async Ae=>{const{error:Le}=await Z.from("newsletter_content").delete().eq("id",Ae);if(Le)throw Le},onSuccess:()=>{r.invalidateQueries({queryKey:["admin-newsletters"]}),t({title:"Newsletter deleted successfully"})},onError:Ae=>{t({title:"Error deleting newsletter",description:Ae.message,variant:"destructive"})}}),fe=async Ae=>{await Z.from("newsletter_drive_links").delete().eq("newsletter_id",Ae),await Z.from("newsletter_pdfs").delete().eq("newsletter_id",Ae),await Z.from("newsletter_videos").delete().eq("newsletter_id",Ae),await Z.from("newsletter_canva_links").delete().eq("newsletter_id",Ae);for(const Le of B){const Ue=`${Ae}/${Date.now()}-${Le.file.name}`,{error:Ye}=await Z.storage.from("newsletter-content").upload(Ue,Le.file);if(!Ye){const{data:Ie}=Z.storage.from("newsletter-content").getPublicUrl(Ue);N.push({name:Le.name,file_url:Ie.publicUrl,file_size:Le.file.size,sort_order:N.length})}}v.length>0&&await Z.from("newsletter_drive_links").insert(v.map((Le,Ue)=>({newsletter_id:Ae,title:Le.title,drive_url:Le.drive_url,sort_order:Ue}))),N.length>0&&await Z.from("newsletter_pdfs").insert(N.map((Le,Ue)=>({newsletter_id:Ae,name:Le.name,file_url:Le.file_url,file_size:Le.file_size||null,sort_order:Ue}))),S.length>0&&await Z.from("newsletter_videos").insert(S.map((Le,Ue)=>({newsletter_id:Ae,title:Le.title,video_url:Le.video_url,sort_order:Ue}))),M.length>0&&await Z.from("newsletter_canva_links").insert(M.map((Le,Ue)=>({newsletter_id:Ae,title:Le.title,canva_share_link:Le.canva_share_link,sort_order:Ue})))},oe=async Ae=>{o(Ae),i({title:Ae.title,description:Ae.description||"",publish_date:Xr(new Date(Ae.publish_date),"yyyy-MM-dd'T'HH:mm"),is_published:Ae.is_published}),y(Ae.preview_image_url),O(Ae.content_blocks||[]);const[Le,Ue,Ye,Ie]=await Promise.all([Z.from("newsletter_drive_links").select("*").eq("newsletter_id",Ae.id).order("sort_order"),Z.from("newsletter_pdfs").select("*").eq("newsletter_id",Ae.id).order("sort_order"),Z.from("newsletter_videos").select("*").eq("newsletter_id",Ae.id).order("sort_order"),Z.from("newsletter_canva_links").select("*").eq("newsletter_id",Ae.id).order("sort_order")]);b(Le.data||[]),j(Ue.data||[]),A(Ye.data||[]),I(Ie.data||[]),$([]),n(!0)},de=async Ae=>{const[Le,Ue,Ye,Ie]=await Promise.all([Z.from("newsletter_drive_links").select("*").eq("newsletter_id",Ae.id).order("sort_order"),Z.from("newsletter_pdfs").select("*").eq("newsletter_id",Ae.id).order("sort_order"),Z.from("newsletter_videos").select("*").eq("newsletter_id",Ae.id).order("sort_order"),Z.from("newsletter_canva_links").select("*").eq("newsletter_id",Ae.id).order("sort_order")]);o(null),i({title:`${Ae.title} (Copy)`,description:Ae.description||"",publish_date:Xr(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),y(Ae.preview_image_url),O(Ae.content_blocks||[]),b((Le.data||[]).map(({id:et,...It})=>It)),j((Ue.data||[]).map(({id:et,...It})=>It)),A((Ye.data||[]).map(({id:et,...It})=>It)),I((Ie.data||[]).map(({id:et,...It})=>It)),$([]),n(!0)},ue=()=>{n(!1),o(null),i({title:"",description:"",publish_date:Xr(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),m(null),y(null),b([]),j([]),A([]),I([]),O([]),$([])},xe=async Ae=>{var Ue;const Le=(Ue=Ae.target.files)==null?void 0:Ue[0];Le&&(m(Le),y(URL.createObjectURL(Le)))},Te=async()=>{if(!l.title){t({title:"Title is required",variant:"destructive"});return}W(!0);let Ae=g;if(d){const Le=`previews/${Date.now()}-${d.name}`,{error:Ue}=await Z.storage.from("newsletter-content").upload(Le,d);if(!Ue){const{data:Ye}=Z.storage.from("newsletter-content").getPublicUrl(Le);Ae=Ye.publicUrl}}a?le.mutate({id:a.id,...l,preview_image_url:Ae,content_blocks:F}):ae.mutate({...l,preview_image_url:Ae,content_blocks:F}),W(!1)},be=()=>b([...v,{title:"",drive_url:"",sort_order:v.length}]),we=()=>A([...S,{title:"",video_url:"",sort_order:S.length}]),ve=()=>I([...M,{title:"",canva_share_link:"",sort_order:M.length}]),tt=Ae=>{const Le=Ae.target.files;if(!Le)return;const Ue=Array.from(Le).map(Ye=>({file:Ye,name:Ye.name.replace(/\.[^/.]+$/,"")}));$([...B,...Ue])};return e.jsx(Fr,{title:"Newsletter Content",description:"Manage monthly newsletter templates and resources",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(Lu,{title:"Newsletter Content",description:"Manage monthly newsletter templates and resources"}),e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total"})}),e.jsx(qe,{children:e.jsx("div",{className:"text-2xl font-bold",children:(X==null?void 0:X.length)||0})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),e.jsx(qe,{children:e.jsx("div",{className:"text-2xl font-bold",children:(X==null?void 0:X.filter(Ae=>Ae.is_published).length)||0})})]})]}),e.jsxs(Dr,{open:s,onOpenChange:Ae=>!Ae&&ue(),children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{onClick:()=>n(!0),children:[e.jsx(gs,{className:"mr-2 h-4 w-4"})," Add Newsletter"]})}),e.jsxs(Lr,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[e.jsx(Ur,{children:e.jsx(Br,{children:a?"Edit Newsletter":"Add Newsletter"})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Title *"}),e.jsx(Qe,{value:l.title,onChange:Ae=>i({...l,title:Ae.target.value}),placeholder:"Newsletter title"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Publish Date"}),e.jsx(Qe,{type:"datetime-local",value:l.publish_date,onChange:Ae=>i({...l,publish_date:Ae.target.value})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Description"}),e.jsx(eg,{content:l.description,onChange:Ae=>i({...l,description:Ae}),placeholder:"Newsletter description",minHeight:"120px"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Preview Image"}),e.jsxs("div",{className:"flex items-center gap-4",children:[g&&e.jsxs("div",{className:"relative group",children:[e.jsx("img",{src:g,alt:"Preview",className:"h-20 w-32 object-cover rounded-md"}),e.jsx(Q,{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:()=>{m(null),y(null)},children:e.jsx(rn,{className:"h-3 w-3"})})]}),e.jsxs("div",{children:[e.jsx(Qe,{type:"file",accept:"image/*",onChange:xe,className:"hidden",id:"preview-upload"}),e.jsx(Q,{variant:"outline",asChild:!0,children:e.jsxs("label",{htmlFor:"preview-upload",className:"cursor-pointer",children:[e.jsx(to,{className:"mr-2 h-4 w-4"})," Upload Image"]})})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xn,{checked:l.is_published,onCheckedChange:Ae=>i({...l,is_published:Ae})}),e.jsx(Ee,{children:"Published"})]}),e.jsx(B3t,{rows:F,onChange:O}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ee,{className:"text-base font-medium",children:"Canva Links"}),e.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:ve,children:[e.jsx(gs,{className:"mr-1 h-3 w-3"})," Add Canva Link"]})]}),M.map((Ae,Le)=>e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx(Qe,{placeholder:"Link title",value:Ae.title,onChange:Ue=>{const Ye=[...M];Ye[Le].title=Ue.target.value,I(Ye)},className:"w-1/3"}),e.jsx(Qe,{placeholder:"Canva share link",value:Ae.canva_share_link,onChange:Ue=>{const Ye=[...M];Ye[Le].canva_share_link=Ue.target.value,I(Ye)},className:"flex-1"}),e.jsx(Q,{type:"button",variant:"ghost",size:"icon",onClick:()=>I(M.filter((Ue,Ye)=>Ye!==Le)),children:e.jsx(rn,{className:"h-4 w-4"})})]},Le))]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ee,{className:"text-base font-medium",children:"Google Drive Links"}),e.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:be,children:[e.jsx(gs,{className:"mr-1 h-3 w-3"})," Add Link"]})]}),v.map((Ae,Le)=>e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx(Qe,{placeholder:"Link title",value:Ae.title,onChange:Ue=>{const Ye=[...v];Ye[Le].title=Ue.target.value,b(Ye)},className:"w-1/3"}),e.jsx(Qe,{placeholder:"Google Drive URL",value:Ae.drive_url,onChange:Ue=>{const Ye=[...v];Ye[Le].drive_url=Ue.target.value,b(Ye)},className:"flex-1"}),e.jsx(Q,{type:"button",variant:"ghost",size:"icon",onClick:()=>b(v.filter((Ue,Ye)=>Ye!==Le)),children:e.jsx(rn,{className:"h-4 w-4"})})]},Le))]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ee,{className:"text-base font-medium",children:"PDF Files"}),e.jsxs("div",{children:[e.jsx(Qe,{type:"file",accept:".pdf",multiple:!0,onChange:tt,className:"hidden",id:"pdf-upload"}),e.jsx(Q,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("label",{htmlFor:"pdf-upload",className:"cursor-pointer",children:[e.jsx(to,{className:"mr-1 h-3 w-3"})," Upload PDF"]})})]})]}),N.map((Ae,Le)=>e.jsxs("div",{className:"flex gap-2 items-center bg-muted/50 p-2 rounded",children:[e.jsx(fa,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"flex-1 text-sm",children:Ae.name}),e.jsx(Q,{type:"button",variant:"ghost",size:"icon",onClick:()=>j(N.filter((Ue,Ye)=>Ye!==Le)),children:e.jsx(rn,{className:"h-4 w-4"})})]},`existing-${Le}`)),B.map((Ae,Le)=>e.jsxs("div",{className:"flex gap-2 items-center bg-muted/50 p-2 rounded",children:[e.jsx(fa,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{value:Ae.name,onChange:Ue=>{const Ye=[...B];Ye[Le].name=Ue.target.value,$(Ye)},className:"flex-1 h-8",placeholder:"PDF name"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"(new)"}),e.jsx(Q,{type:"button",variant:"ghost",size:"icon",onClick:()=>$(B.filter((Ue,Ye)=>Ye!==Le)),children:e.jsx(rn,{className:"h-4 w-4"})})]},`pending-${Le}`))]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ee,{className:"text-base font-medium",children:"Video Links"}),e.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:we,children:[e.jsx(gs,{className:"mr-1 h-3 w-3"})," Add Video"]})]}),S.map((Ae,Le)=>e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx(Qe,{placeholder:"Video title",value:Ae.title,onChange:Ue=>{const Ye=[...S];Ye[Le].title=Ue.target.value,A(Ye)},className:"w-1/3"}),e.jsx(Qe,{placeholder:"Video URL",value:Ae.video_url,onChange:Ue=>{const Ye=[...S];Ye[Le].video_url=Ue.target.value,A(Ye)},className:"flex-1"}),e.jsx(Q,{type:"button",variant:"ghost",size:"icon",onClick:()=>A(S.filter((Ue,Ye)=>Ye!==Le)),children:e.jsx(rn,{className:"h-4 w-4"})})]},Le))]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[e.jsx(Q,{variant:"outline",onClick:ue,children:"Cancel"}),e.jsx(Q,{onClick:Te,disabled:H||ae.isPending||le.isPending,children:H?"Uploading...":a?"Update":"Create"})]})]})]})]})]}),e.jsx(ze,{children:e.jsx(qe,{className:"p-0",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Name"}),e.jsx(Ct,{children:"Publish Date"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{className:"text-right",children:"Actions"})]})}),e.jsx(zn,{children:se?e.jsx(Nr,{children:e.jsx(dt,{colSpan:4,className:"text-center py-8",children:"Loading..."})}):(X==null?void 0:X.length)===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:4,className:"text-center py-8 text-muted-foreground",children:"No newsletters yet. Create your first one!"})}):X==null?void 0:X.map(Ae=>e.jsxs(Nr,{children:[e.jsx(dt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[Ae.preview_image_url?e.jsx("img",{src:Ae.preview_image_url,alt:Ae.title,className:"w-10 h-10 rounded object-cover"}):e.jsx("div",{className:"w-10 h-10 rounded bg-muted flex items-center justify-center",children:e.jsx(fa,{className:"h-5 w-5 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:Ae.title}),Ae.description&&e.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:Ae.description.replace(/<[^>]*>/g,"")})]})]})}),e.jsx(dt,{children:Xr(new Date(Ae.publish_date),"MMM d, yyyy")}),e.jsx(dt,{children:e.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${Ae.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:Ae.is_published?"Published":"Draft"})}),e.jsx(dt,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-1",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>oe(Ae),title:"Edit",children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>de(Ae),title:"Duplicate",children:e.jsx(fo,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",title:"Delete",onClick:()=>{confirm("Are you sure you want to delete this newsletter?")&&ne.mutate(Ae.id)},children:e.jsx(Rs,{className:"h-4 w-4"})})]})})]},Ae.id))})]})})})]})})}const wCe={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 U3t(){const{user:t}=Gr(),{toast:r}=fi(),s=Ws(),n=qr(),[a,o]=E.useState(""),[l,i]=E.useState("popular"),[d,m]=E.useState(!1),[g,y]=E.useState(""),[v,b]=E.useState(""),[N,j]=E.useState(!1),{data:S=[],isLoading:A}=Ht({queryKey:["wishlist-items",l,N],queryFn:async()=>{let B=Z.from("wishlist_items").select("*");N&&t&&(B=B.eq("user_id",t.id)),l==="latest"?B=B.order("created_at",{ascending:!1}):l==="popular"?B=B.order("vote_count",{ascending:!1}):l==="trending"&&(B=B.order("vote_count",{ascending:!1}));const{data:$,error:H}=await B;if(H)throw H;const W=[...new Set(($==null?void 0:$.map(oe=>oe.user_id))||[])],{data:X}=await Z.from("profiles").select("id, name").in("id",W),se=new Map((X==null?void 0:X.map(oe=>[oe.id,oe]))||[]);let ae=[];if(t){const{data:oe}=await Z.from("wishlist_votes").select("item_id").eq("user_id",t.id);ae=(oe==null?void 0:oe.map(de=>de.item_id))||[]}const le=($==null?void 0:$.map(oe=>oe.id))||[],{data:ne}=await Z.from("wishlist_comments").select("item_id").in("item_id",le),fe=new Map;return ne==null||ne.forEach(oe=>{fe.set(oe.item_id,(fe.get(oe.item_id)||0)+1)}),$==null?void 0:$.map(oe=>{const de=se.get(oe.user_id),ue=(de==null?void 0:de.name)||"Unknown";return{...oe,user_name:ue,user_initials:ue.split(" ").map(xe=>xe[0]).join("").toUpperCase().slice(0,2),has_voted:ae.includes(oe.id),comment_count:fe.get(oe.id)||0}})}}),M=Jt({mutationFn:async({title:B,description:$})=>{const{error:H}=await Z.from("wishlist_items").insert({user_id:t.id,title:B,description:$});if(H)throw H},onSuccess:()=>{n.invalidateQueries({queryKey:["wishlist-items"]}),m(!1),y(""),b(""),r({title:"Idea submitted!",description:"Your idea has been added to the wishlist."})},onError:B=>{r({title:"Error",description:B.message,variant:"destructive"})}}),I=Jt({mutationFn:async({itemId:B,hasVoted:$})=>{if($){const{error:H}=await Z.from("wishlist_votes").delete().eq("item_id",B).eq("user_id",t.id);if(H)throw H;return{itemId:B,wasAdded:!1}}else{const{error:H}=await Z.from("wishlist_votes").insert({item_id:B,user_id:t.id});if(H)throw H;return{itemId:B,wasAdded:!0}}},onSuccess:async B=>{if(n.invalidateQueries({queryKey:["wishlist-items"]}),B!=null&&B.wasAdded){const $=S.find(W=>W.id===B.itemId),H=(($==null?void 0:$.vote_count)||0)+1;Z.functions.invoke("wishlist-notify",{body:{itemId:B.itemId,voteCount:H}}).catch(console.error)}},onError:B=>{r({title:"Error",description:B.message,variant:"destructive"})}}),F=S.filter(B=>B.title.toLowerCase().includes(a.toLowerCase())||B.description.toLowerCase().includes(a.toLowerCase())),O=()=>{if(!g.trim()||!v.trim()){r({title:"Error",description:"Please fill in both title and description.",variant:"destructive"});return}M.mutate({title:g.trim(),description:v.trim()})};return e.jsx(Fr,{title:"Wishlist",children:e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:e.jsx(yy,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-5xl font-bold",children:"Wishlist"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Share ideas and vote on what we build next"})]})]}),e.jsxs(Dr,{open:d,onOpenChange:m,children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{className:"gap-2",children:[e.jsx(gs,{className:"h-4 w-4"}),"Add Idea"]})}),e.jsxs(Lr,{children:[e.jsx(Ur,{children:e.jsx(Br,{children:"Submit a New Idea"})}),e.jsxs("div",{className:"space-y-4 pt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"title",children:"Title"}),e.jsx(Qe,{id:"title",placeholder:"Give your idea a clear title...",value:g,onChange:B=>y(B.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"description",children:"Description"}),e.jsx(Ks,{id:"description",placeholder:"Describe your idea in detail. What problem does it solve? How would it help agents?",value:v,onChange:B=>b(B.target.value),rows:4})]}),e.jsx(Q,{onClick:O,className:"w-full",disabled:M.isPending,children:M.isPending?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),"Submitting..."]}):"Submit Idea"})]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search ideas...",value:a,onChange:B=>o(B.target.value),className:"pl-10"})]}),e.jsx("div",{className:"flex gap-2",children:e.jsx(ci,{value:l,onValueChange:B=>i(B),children:e.jsxs(ri,{children:[e.jsx(Kr,{value:"popular",children:"Most Popular"}),e.jsx(Kr,{value:"latest",children:"Latest"}),e.jsx(Kr,{value:"trending",children:"Trending"})]})})})]}),e.jsx("div",{className:"flex items-center gap-2 mb-4",children:e.jsx(Q,{variant:N?"default":"outline",size:"sm",onClick:()=>j(!N),children:N?"Show All Ideas":"My Ideas"})}),A?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Hr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):F.length===0?e.jsxs("div",{className:"text-center py-12 bg-muted/30 rounded-lg",children:[e.jsx(yy,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No ideas yet"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Be the first to submit an idea!"}),e.jsxs(Q,{onClick:()=>m(!0),children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Idea"]})]}):e.jsx("div",{className:"space-y-3",children:F.map(B=>e.jsx("div",{className:"bg-card border rounded-lg p-4 hover:shadow-md transition-shadow cursor-pointer",onClick:()=>s(`/wishlist/${B.id}`),children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsxs("button",{onClick:$=>{$.stopPropagation(),I.mutate({itemId:B.id,hasVoted:B.has_voted||!1})},className:qt("flex flex-col items-center justify-center min-w-[50px] py-2 px-3 rounded-lg border transition-colors",B.has_voted?"bg-primary/10 border-primary text-primary":"bg-muted/50 border-border hover:bg-muted"),children:[e.jsx(fp,{className:qt("h-4 w-4",B.has_voted&&"fill-current")}),e.jsx("span",{className:"text-sm font-semibold",children:B.vote_count})]}),e.jsx(ln,{className:"h-10 w-10 bg-primary/20",children:e.jsx(cn,{className:"bg-primary/20 text-primary text-sm font-medium",children:B.user_initials})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:"font-semibold text-foreground",children:B.title}),e.jsx(bt,{className:qt("text-xs",wCe[B.status].color),children:wCe[B.status].label})]}),e.jsx("p",{className:"text-muted-foreground text-sm line-clamp-2",children:B.description}),e.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[e.jsx("span",{children:B.user_name}),e.jsx("span",{children:"•"}),e.jsx("span",{children:new Date(B.created_at).toLocaleDateString()})]})]}),e.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[e.jsx($o,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:B.comment_count})]})]})},B.id))})]})})}const jCe={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 q3t(){const{itemId:t}=Xl(),r=Ws(),{user:s}=Gr(),{toast:n}=fi(),a=qr(),[o,l]=E.useState(""),{data:i=!1}=Ht({queryKey:["user-is-admin",s==null?void 0:s.id],queryFn:async()=>{if(!s)return!1;const{data:S,error:A}=await Z.from("user_roles").select("role").eq("user_id",s.id).eq("role","admin").maybeSingle();return!A&&!!S},enabled:!!s}),{data:d,isLoading:m}=Ht({queryKey:["wishlist-item",t],queryFn:async()=>{const{data:S,error:A}=await Z.from("wishlist_items").select("*").eq("id",t).single();if(A)throw A;const{data:M}=await Z.from("profiles").select("name").eq("id",S.user_id).single();let I=!1;if(s){const{data:F}=await Z.from("wishlist_votes").select("id").eq("item_id",t).eq("user_id",s.id).maybeSingle();I=!!F}return{...S,user_name:(M==null?void 0:M.name)||"Unknown",user_initials:((M==null?void 0:M.name)||"U").split(" ").map(F=>F[0]).join("").toUpperCase().slice(0,2),has_voted:I}}}),{data:g=[],isLoading:y}=Ht({queryKey:["wishlist-comments",t],queryFn:async()=>{const{data:S,error:A}=await Z.from("wishlist_comments").select("*").eq("item_id",t).order("created_at",{ascending:!0});if(A)throw A;const M=[...new Set((S==null?void 0:S.map(O=>O.user_id))||[])],{data:I}=await Z.from("profiles").select("id, name").in("id",M),F=new Map((I==null?void 0:I.map(O=>[O.id,O]))||[]);return S==null?void 0:S.map(O=>{const B=F.get(O.user_id),$=(B==null?void 0:B.name)||"Unknown";return{...O,user_name:$,user_initials:$.split(" ").map(H=>H[0]).join("").toUpperCase().slice(0,2)}})}}),v=Jt({mutationFn:async S=>{if(S){const{error:A}=await Z.from("wishlist_votes").delete().eq("item_id",t).eq("user_id",s.id);if(A)throw A;return{wasAdded:!1}}else{const{error:A}=await Z.from("wishlist_votes").insert({item_id:t,user_id:s.id});if(A)throw A;return{wasAdded:!0}}},onSuccess:async S=>{if(a.invalidateQueries({queryKey:["wishlist-item",t]}),a.invalidateQueries({queryKey:["wishlist-items"]}),S!=null&&S.wasAdded&&d){const A=(d.vote_count||0)+1;Z.functions.invoke("wishlist-notify",{body:{itemId:t,voteCount:A}}).catch(console.error)}},onError:S=>{n({title:"Error",description:S.message,variant:"destructive"})}}),b=Jt({mutationFn:async S=>{const{error:A}=await Z.from("wishlist_comments").insert({item_id:t,user_id:s.id,content:S});if(A)throw A},onSuccess:()=>{a.invalidateQueries({queryKey:["wishlist-comments",t]}),l(""),n({title:"Comment added!"})},onError:S=>{n({title:"Error",description:S.message,variant:"destructive"})}}),N=Jt({mutationFn:async S=>{const{error:A}=await Z.from("wishlist_comments").delete().eq("id",S);if(A)throw A},onSuccess:()=>{a.invalidateQueries({queryKey:["wishlist-comments",t]}),n({title:"Comment deleted"})},onError:S=>{n({title:"Error",description:S.message,variant:"destructive"})}}),j=()=>{o.trim()&&b.mutate(o.trim())};return m?e.jsx(Fr,{title:"Wishlist",children:e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsx(fr,{className:"h-8 w-32 mb-6"}),e.jsx(fr,{className:"h-48 w-full mb-6"}),e.jsx(fr,{className:"h-32 w-full"})]})}):d?e.jsx(Fr,{title:"Wishlist",children:e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>r("/wishlist"),className:"mb-4",children:[e.jsx(_i,{className:"h-4 w-4 mr-2"}),"Back to Wishlist"]}),e.jsx("div",{className:"bg-card border rounded-lg p-6 mb-6",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsxs("button",{onClick:()=>v.mutate(d.has_voted),className:qt("flex flex-col items-center justify-center min-w-[60px] py-3 px-4 rounded-lg border transition-colors",d.has_voted?"bg-primary/10 border-primary text-primary":"bg-muted/50 border-border hover:bg-muted"),children:[e.jsx(fp,{className:qt("h-5 w-5",d.has_voted&&"fill-current")}),e.jsx("span",{className:"text-lg font-bold",children:d.vote_count}),e.jsx("span",{className:"text-xs",children:"votes"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h1",{className:"text-xl font-bold",children:d.title}),e.jsx(bt,{className:qt("text-xs",jCe[d.status].color),children:jCe[d.status].label})]}),e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap mb-4",children:d.description}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(ln,{className:"h-6 w-6",children:e.jsx(cn,{className:"bg-primary/20 text-primary text-xs",children:d.user_initials})}),e.jsx("span",{children:d.user_name}),e.jsx("span",{children:"•"}),e.jsx("span",{children:new Date(d.created_at).toLocaleDateString()})]})]})]})}),e.jsxs("div",{className:"bg-card border rounded-lg p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold mb-4",children:["Comments (",g.length,")"]}),e.jsxs("div",{className:"flex gap-3 mb-6",children:[e.jsx(rse,{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}),e.jsx(Q,{onClick:j,disabled:!o.trim()||b.isPending,size:"icon",className:"h-auto",children:b.isPending?e.jsx(Hr,{className:"h-4 w-4 animate-spin"}):e.jsx(Mi,{className:"h-4 w-4"})})]}),y?e.jsx("div",{className:"space-y-4",children:[1,2].map(S=>e.jsx(fr,{className:"h-20 w-full"},S))}):g.length===0?e.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No comments yet. Be the first to share your thoughts!"}):e.jsx("div",{className:"space-y-4",children:g.map(S=>e.jsxs("div",{className:"flex gap-3 p-3 bg-muted/30 rounded-lg",children:[e.jsx(ln,{className:"h-8 w-8",children:e.jsx(cn,{className:"bg-primary/20 text-primary text-xs",children:S.user_initials})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-medium text-sm",children:S.user_name}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(S.created_at).toLocaleDateString()})]}),e.jsx(Z0e,{content:S.content,className:"text-sm text-foreground"})]}),(s==null?void 0:s.id)===S.user_id&&e.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>N.mutate(S.id),children:e.jsx(Rs,{className:"h-4 w-4"})})]},S.id))})]})]})}):e.jsx(Fr,{title:"Wishlist",children:e.jsxs("div",{className:"max-w-3xl mx-auto text-center py-12",children:[e.jsx("p",{className:"text-muted-foreground",children:"Item not found"}),e.jsx(Q,{variant:"link",onClick:()=>r("/wishlist"),children:"Go back to Wishlist"})]})})}const kCe={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"}},NCe=["open","under_review","planned","in_progress","launched","declined"];function V3t(){const{toast:t}=fi(),r=Ws(),s=qr(),[n,a]=E.useState(""),[o,l]=E.useState("all"),[i,d]=E.useState(!1),[m,g]=E.useState(null),{data:y=[],isLoading:v}=Ht({queryKey:["admin-wishlist-items"],queryFn:async()=>{const{data:A,error:M}=await Z.from("wishlist_items").select("*").order("vote_count",{ascending:!1});if(M)throw M;const I=[...new Set((A==null?void 0:A.map(W=>W.user_id))||[])],{data:F}=await Z.from("profiles").select("id, name, email").in("id",I),O=new Map((F==null?void 0:F.map(W=>[W.id,W]))||[]),B=(A==null?void 0:A.map(W=>W.id))||[],{data:$}=await Z.from("wishlist_comments").select("item_id").in("item_id",B),H=new Map;return $==null||$.forEach(W=>{H.set(W.item_id,(H.get(W.item_id)||0)+1)}),A==null?void 0:A.map(W=>{const X=O.get(W.user_id);return{...W,user_name:(X==null?void 0:X.name)||"Unknown",user_email:(X==null?void 0:X.email)||"",comment_count:H.get(W.id)||0}})}}),b=Jt({mutationFn:async({itemId:A,status:M})=>{const{error:I}=await Z.from("wishlist_items").update({status:M}).eq("id",A);if(I)throw I},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-wishlist-items"]}),t({title:"Status updated!"})},onError:A=>{t({title:"Error",description:A.message,variant:"destructive"})}}),N=Jt({mutationFn:async A=>{const{error:M}=await Z.from("wishlist_items").delete().eq("id",A);if(M)throw M},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-wishlist-items"]}),d(!1),g(null),t({title:"Item deleted!"})},onError:A=>{t({title:"Error",description:A.message,variant:"destructive"})}}),j=y.filter(A=>{const M=A.title.toLowerCase().includes(n.toLowerCase())||A.description.toLowerCase().includes(n.toLowerCase())||A.user_name.toLowerCase().includes(n.toLowerCase()),I=o==="all"||A.status===o;return M&&I}),S={total:y.length,open:y.filter(A=>A.status==="open").length,inProgress:y.filter(A=>A.status==="in_progress").length,launched:y.filter(A=>A.status==="launched").length,highVotes:y.filter(A=>A.vote_count>=10).length};return e.jsx(Fr,{title:"Admin - Wishlist",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>r("/admin"),children:e.jsx(_i,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Wishlist Management"}),e.jsx("p",{className:"text-muted-foreground",children:"Review and manage community ideas"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[e.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Ideas"}),e.jsx("p",{className:"text-2xl font-bold",children:S.total})]}),e.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Open"}),e.jsx("p",{className:"text-2xl font-bold text-blue-600",children:S.open})]}),e.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"In Progress"}),e.jsx("p",{className:"text-2xl font-bold text-orange-600",children:S.inProgress})]}),e.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Launched"}),e.jsx("p",{className:"text-2xl font-bold text-green-600",children:S.launched})]}),e.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"10+ Votes"}),e.jsx("p",{className:"text-2xl font-bold text-primary",children:S.highVotes})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search ideas, users...",value:n,onChange:A=>a(A.target.value),className:"pl-10"})]}),e.jsxs(ds,{value:o,onValueChange:A=>l(A),children:[e.jsx(ls,{className:"w-[180px]",children:e.jsx(us,{placeholder:"Filter by status"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Statuses"}),NCe.map(A=>e.jsx(Ut,{value:A,children:kCe[A].label},A))]})]})]}),v?e.jsx("div",{className:"space-y-2",children:[1,2,3,4,5].map(A=>e.jsx(fr,{className:"h-16 w-full"},A))}):e.jsx("div",{className:"bg-card border rounded-lg overflow-hidden",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{className:"w-[60px]",children:"Votes"}),e.jsx(Ct,{children:"Title"}),e.jsx(Ct,{className:"hidden md:table-cell",children:"Submitted By"}),e.jsx(Ct,{className:"hidden sm:table-cell",children:"Comments"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{className:"w-[100px]",children:"Actions"})]})}),e.jsx(zn,{children:j.length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No items found"})}):j.map(A=>e.jsxs(Nr,{className:qt(A.vote_count>=10&&"bg-primary/5"),children:[e.jsx(dt,{children:e.jsx(bt,{variant:A.vote_count>=10?"default":"secondary",children:A.vote_count})}),e.jsx(dt,{children:e.jsxs("div",{children:[e.jsx("p",{className:"font-medium line-clamp-1",children:A.title}),e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:A.description})]})}),e.jsx(dt,{className:"hidden md:table-cell",children:e.jsxs("div",{children:[e.jsx("p",{className:"text-sm",children:A.user_name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:A.user_email})]})}),e.jsx(dt,{className:"hidden sm:table-cell",children:A.comment_count}),e.jsx(dt,{children:e.jsxs(ds,{value:A.status,onValueChange:M=>b.mutate({itemId:A.id,status:M}),children:[e.jsx(ls,{className:"w-[140px] h-8",children:e.jsx(us,{})}),e.jsx(cs,{children:NCe.map(M=>e.jsx(Ut,{value:M,children:kCe[M].label},M))})]})}),e.jsx(dt,{children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>window.open(`/wishlist/${A.id}`,"_blank"),children:e.jsx(En,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{g(A.id),d(!0)},children:e.jsx(Rs,{className:"h-4 w-4"})})]})})]},A.id))})]})}),e.jsx(Dr,{open:i,onOpenChange:d,children:e.jsxs(Lr,{children:[e.jsx(Ur,{children:e.jsx(Br,{children:"Delete Wishlist Item"})}),e.jsx("p",{className:"text-muted-foreground",children:"Are you sure you want to delete this idea? This will also delete all votes and comments."}),e.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[e.jsx(Q,{variant:"outline",onClick:()=>d(!1),children:"Cancel"}),e.jsx(Q,{variant:"destructive",onClick:()=>m&&N.mutate(m),disabled:N.isPending,children:N.isPending?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})})}function H3t(){const{user:t}=Gr(),[r,s]=E.useState([]),[n,a]=E.useState(!0),[o,l]=E.useState(!1),[i,d]=E.useState(null),[m,g]=E.useState(!1),[y,v]=E.useState(null),[b,N]=E.useState(""),[j,S]=E.useState(""),[A,M]=E.useState(""),[I,F]=E.useState(""),[O,B]=E.useState(""),[$,H]=E.useState(!1),[W,X]=E.useState(""),[se,ae]=E.useState("once"),[le,ne]=E.useState([]),[fe,oe]=E.useState([]),[de,ue]=E.useState(!1),[xe,Te]=E.useState(!1),[be,we]=E.useState([]),[ve,tt]=E.useState({total:0,dismissed:0});E.useEffect(()=>{Ae()},[]);const Ae=async()=>{const{data:Ve,error:ot}=await Z.from("levelup_briefs").select("*").order("created_at",{ascending:!1});ot?(Se.error("Failed to fetch briefs"),console.error(ot)):s(Ve||[]),a(!1)},Le=()=>{N(""),S(""),M(""),F(""),B(""),H(!1),X(new Date().toISOString().slice(0,16)),ae("once"),ne([]),oe([]),d(null)},Ue=()=>{Le(),l(!0)},Ye=async Ve=>{d(Ve),N(Ve.title),S(Ve.description||""),M(Ve.video_url||""),F(Ve.graphic_url||""),B(Ve.graphic_link_url||""),H(Ve.is_published),X(Ve.publish_date.slice(0,16)),ae(Ve.show_frequency);const{data:ot}=await Z.from("levelup_brief_links").select("*").eq("brief_id",Ve.id).order("sort_order");ne((ot==null?void 0:ot.map(ft=>({title:ft.title,url:ft.url})))||[]);const{data:mt}=await Z.from("levelup_brief_polls").select("*").eq("brief_id",Ve.id).order("sort_order");if(mt){const ft=[];for(const ct of mt){const{data:Mt}=await Z.from("levelup_brief_poll_options").select("*").eq("poll_id",ct.id).order("sort_order");ft.push({question:ct.question,poll_type:ct.poll_type,options:(Mt==null?void 0:Mt.map(Ot=>Ot.option_text))||[]})}oe(ft)}l(!0)},Ie=async Ve=>{var mt;const ot=(mt=Ve.target.files)==null?void 0:mt[0];if(ot){ue(!0);try{const ft=await Z.functions.invoke("bunny-upload",{body:{action:"create",title:ot.name.replace(/\.[^/.]+$/,"")}});if(ft.error)throw ft.error;const{videoId:ct,libraryId:Mt}=ft.data,Ot=await Z.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:ct}});if(Ot.error)throw Ot.error;const{uploadUrl:rr,apiKey:Ir}=Ot.data,cr=new XMLHttpRequest;await new Promise((As,At)=>{cr.upload.addEventListener("progress",Rt=>{if(Rt.lengthComputable){const Cr=Math.round(Rt.loaded/Rt.total*100);console.log("Upload progress:",Cr)}}),cr.addEventListener("load",()=>{cr.status>=200&&cr.status<300?As():At(new Error(`Upload failed with status ${cr.status}`))}),cr.addEventListener("error",()=>At(new Error("Upload failed"))),cr.open("PUT",rr),cr.setRequestHeader("AccessKey",Ir),cr.send(ot)});const Mr=`https://player.mediadelivery.net/embed/${Mt}/${ct}`;M(Mr),Se.success("Video uploaded successfully! It may take a few minutes to process.")}catch(ft){console.error("Upload error:",ft),Se.error("Failed to upload video")}finally{ue(!1)}}},et=async()=>{if(!b.trim()){Se.error("Title is required");return}try{let Ve;if(i){const{error:ot}=await Z.from("levelup_briefs").update({title:b,description:j||null,video_url:A||null,graphic_url:I||null,graphic_link_url:O||null,is_published:$,publish_date:W,show_frequency:se}).eq("id",i.id);if(ot)throw ot;Ve=i.id,await Z.from("levelup_brief_links").delete().eq("brief_id",Ve);const{data:mt}=await Z.from("levelup_brief_polls").select("id").eq("brief_id",Ve);if(mt)for(const ft of mt)await Z.from("levelup_brief_poll_options").delete().eq("poll_id",ft.id);await Z.from("levelup_brief_polls").delete().eq("brief_id",Ve)}else{const{data:ot,error:mt}=await Z.from("levelup_briefs").insert({title:b,description:j||null,video_url:A||null,graphic_url:I||null,graphic_link_url:O||null,is_published:$,publish_date:W,show_frequency:se,created_by:t==null?void 0:t.id}).select().single();if(mt)throw mt;Ve=ot.id}if(le.length>0){const ot=le.map((mt,ft)=>({brief_id:Ve,title:mt.title,url:mt.url,sort_order:ft}));await Z.from("levelup_brief_links").insert(ot)}for(let ot=0;ot0){const Mt=mt.options.map((Ot,rr)=>({poll_id:ft.id,option_text:Ot,sort_order:rr}));await Z.from("levelup_brief_poll_options").insert(Mt)}}Se.success(i?"Brief updated":"Brief created"),l(!1),Le(),Ae()}catch(Ve){console.error("Error saving brief:",Ve),Se.error("Failed to save brief")}},It=async Ve=>{if(confirm("Are you sure you want to delete this brief?"))try{const{error:ot}=await Z.from("levelup_briefs").delete().eq("id",Ve);if(ot)throw ot;Se.success("Brief deleted"),Ae()}catch(ot){console.error("Error deleting brief:",ot),Se.error("Failed to delete brief")}},Pe=async Ve=>{v(Ve);const{count:ot}=await Z.from("levelup_brief_views").select("*",{count:"exact",head:!0}).eq("brief_id",Ve.id),{count:mt}=await Z.from("levelup_brief_views").select("*",{count:"exact",head:!0}).eq("brief_id",Ve.id).not("dismissed_at","is",null);tt({total:ot||0,dismissed:mt||0});const{data:ft}=await Z.from("levelup_brief_polls").select("*").eq("brief_id",Ve.id).order("sort_order");if(ft){const ct=[];for(const Mt of ft){const{data:Ot}=await Z.from("levelup_brief_poll_options").select("*").eq("poll_id",Mt.id).order("sort_order"),{data:rr}=await Z.from("levelup_brief_poll_responses").select("option_id, user_id").eq("poll_id",Mt.id),Ir=[...new Set((rr==null?void 0:rr.map(Rt=>Rt.user_id))||[])];let cr={};if(Ir.length>0){const{data:Rt}=await Z.from("profiles").select("id, name, email").in("id",Ir);Rt&&Rt.forEach(Cr=>{cr[Cr.id]=Cr.name||Cr.email||"Unknown"})}const Mr=(rr||[]).map(Rt=>({optionId:Rt.option_id,userName:cr[Rt.user_id]||"Unknown",userId:Rt.user_id})),As={};let At=0;Ot&&Ot.forEach(Rt=>{const Cr=(rr==null?void 0:rr.filter(fs=>fs.option_id===Rt.id).length)||0;As[Rt.id]=Cr,At+=Cr}),ct.push({...Mt,options:Ot||[],results:As,respondents:Mr,totalResponses:Mt.poll_type==="single"?new Set(rr==null?void 0:rr.map(Rt=>Rt.user_id)).size:At})}we(ct)}g(!0)},at=()=>{ne([...le,{title:"",url:""}])},ce=(Ve,ot,mt)=>{const ft=[...le];ft[Ve][ot]=mt,ne(ft)},$e=Ve=>{ne(le.filter((ot,mt)=>mt!==Ve))},Ge=()=>{oe([...fe,{question:"",poll_type:"single",options:["",""]}])},rt=(Ve,ot)=>{const mt=[...fe];mt[Ve].question=ot,oe(mt)},je=(Ve,ot)=>{const mt=[...fe];mt[Ve].poll_type=ot,oe(mt)},it=Ve=>{const ot=[...fe];ot[Ve].options.push(""),oe(ot)},Me=(Ve,ot,mt)=>{const ft=[...fe];ft[Ve].options[ot]=mt,oe(ft)},Je=(Ve,ot)=>{const mt=[...fe];mt[Ve].options=mt[Ve].options.filter((ft,ct)=>ct!==ot),oe(mt)},Xe=Ve=>{oe(fe.filter((ot,mt)=>mt!==Ve))};return e.jsxs(Fr,{title:"The LevelUp Brief",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsx(Lu,{title:"The LevelUp Brief",description:"Create engaging popup briefs for your agents",children:e.jsxs(Q,{onClick:Ue,children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Create Brief"]})}),e.jsx(ze,{children:e.jsx(qe,{className:"p-0",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Title"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{children:"Frequency"}),e.jsx(Ct,{children:"Publish Date"}),e.jsx(Ct,{className:"text-right",children:"Actions"})]})}),e.jsx(zn,{children:n?e.jsx(Nr,{children:e.jsx(dt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):r.length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No briefs created yet"})}):r.map(Ve=>e.jsxs(Nr,{children:[e.jsx(dt,{className:"font-medium",children:Ve.title}),e.jsx(dt,{children:e.jsx(bt,{variant:Ve.is_published?"default":"secondary",children:Ve.is_published?"Published":"Draft"})}),e.jsx(dt,{className:"capitalize",children:Ve.show_frequency.replace("_"," ")}),e.jsx(dt,{children:Xr(new Date(Ve.publish_date),"MMM d, yyyy h:mm a")}),e.jsx(dt,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>Pe(Ve),children:e.jsx(Nc,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>Ye(Ve),children:e.jsx(wc,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>It(Ve.id),children:e.jsx(Rs,{className:"h-4 w-4 text-destructive"})})]})})]},Ve.id))})]})})})]}),e.jsx(Dr,{open:o,onOpenChange:l,children:e.jsxs(Lr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[e.jsx(Ur,{children:e.jsx(Br,{children:i?"Edit Brief":"Create New Brief"})}),e.jsxs(ci,{defaultValue:"content",className:"w-full",children:[e.jsxs(ri,{className:"grid w-full grid-cols-4",children:[e.jsx(Kr,{value:"content",children:"Content"}),e.jsx(Kr,{value:"media",children:"Media"}),e.jsx(Kr,{value:"links",children:"Links"}),e.jsx(Kr,{value:"polls",children:"Polls"})]}),e.jsxs(ms,{value:"content",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Title *"}),e.jsx(Qe,{value:b,onChange:Ve=>N(Ve.target.value),placeholder:"What's happening at LevelUp..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Description"}),e.jsx(eg,{content:j,onChange:Ve=>S(Ve),placeholder:"Brief overview for agents...",minHeight:"120px"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Publish Date"}),e.jsx(Qe,{type:"datetime-local",value:W,onChange:Ve=>X(Ve.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Show Frequency"}),e.jsxs(ds,{value:se,onValueChange:ae,children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"once",children:"Once (until dismissed)"}),e.jsx(Ut,{value:"every_login",children:"Every login"}),e.jsx(Ut,{value:"daily",children:"Daily"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(xn,{checked:$,onCheckedChange:H}),e.jsx(Ee,{children:"Publish immediately"})]})]}),e.jsxs(ms,{value:"media",className:"space-y-6 mt-4",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-semibold text-sm text-foreground",children:"Video (optional)"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Upload Video to Bunny.net"}),e.jsx("div",{className:"flex gap-2",children:e.jsx(Qe,{type:"file",accept:"video/*",onChange:Ie,disabled:de})}),de&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Or paste embed URL"}),e.jsx(Qe,{value:A,onChange:Ve=>M(Ve.target.value),placeholder:"https://iframe.mediadelivery.net/embed/..."})]}),A&&e.jsx("div",{className:"aspect-video rounded-lg overflow-hidden bg-muted",children:e.jsx("iframe",{src:A,className:"w-full h-full",allow:"autoplay; fullscreen",allowFullScreen:!0})})]}),e.jsxs("div",{className:"border-t pt-4 space-y-4",children:[e.jsx("h4",{className:"font-semibold text-sm text-foreground",children:"Graphic / Image (optional)"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Upload Image"}),e.jsx("div",{className:"flex gap-2",children:e.jsx(Qe,{type:"file",accept:"image/*",onChange:async Ve=>{var mt;const ot=(mt=Ve.target.files)==null?void 0:mt[0];if(ot){Te(!0);try{const ft=ot.name.split(".").pop(),ct=`brief-graphics/${Date.now()}.${ft}`,{error:Mt}=await Z.storage.from("banner-images").upload(ct,ot,{upsert:!0});if(Mt)throw Mt;const{data:Ot}=Z.storage.from("banner-images").getPublicUrl(ct);F(Ot.publicUrl),Se.success("Image uploaded!")}catch(ft){console.error(ft),Se.error("Failed to upload image")}finally{Te(!1)}}},disabled:xe})}),xe&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Or paste Image URL"}),e.jsx(Qe,{value:I,onChange:Ve=>F(Ve.target.value),placeholder:"https://example.com/image.png"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Click-through Link (optional)"}),e.jsx(Qe,{value:O,onChange:Ve=>B(Ve.target.value),placeholder:"https://example.com/landing-page"})]}),I&&e.jsx("div",{className:"rounded-lg overflow-hidden bg-muted border",children:e.jsx("img",{src:I,alt:"Brief graphic preview",className:"w-full object-contain max-h-64"})})]})]}),e.jsxs(ms,{value:"links",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(Ee,{children:"Quick Links"}),e.jsxs(Q,{variant:"outline",size:"sm",onClick:at,children:[e.jsx(gs,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),le.map((Ve,ot)=>e.jsxs("div",{className:"flex gap-2 items-start",children:[e.jsx(Qe,{value:Ve.title,onChange:mt=>ce(ot,"title",mt.target.value),placeholder:"Link title",className:"flex-1"}),e.jsx(Qe,{value:Ve.url,onChange:mt=>ce(ot,"url",mt.target.value),placeholder:"https://...",className:"flex-[2]"}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>$e(ot),children:e.jsx(Rs,{className:"h-4 w-4 text-destructive"})})]},ot)),le.length===0&&e.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No links added yet"})]}),e.jsxs(ms,{value:"polls",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(Ee,{children:"Polls"}),e.jsxs(Q,{variant:"outline",size:"sm",onClick:Ge,children:[e.jsx(gs,{className:"h-4 w-4 mr-1"}),"Add Poll"]})]}),fe.map((Ve,ot)=>e.jsx(ze,{className:"p-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(Qe,{value:Ve.question,onChange:mt=>rt(ot,mt.target.value),placeholder:"Poll question...",className:"flex-1 mr-2"}),e.jsxs(ds,{value:Ve.poll_type,onValueChange:mt=>je(ot,mt),children:[e.jsx(ls,{className:"w-32",children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"single",children:"Single"}),e.jsx(Ut,{value:"multi",children:"Multi-select"})]})]}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>Xe(ot),children:e.jsx(Rs,{className:"h-4 w-4 text-destructive"})})]}),e.jsxs("div",{className:"space-y-2 pl-4",children:[Ve.options.map((mt,ft)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Qe,{value:mt,onChange:ct=>Me(ot,ft,ct.target.value),placeholder:`Option ${ft+1}`}),Ve.options.length>2&&e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>Je(ot,ft),children:e.jsx(Rs,{className:"h-4 w-4 text-muted-foreground"})})]},ft)),e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>it(ot),children:[e.jsx(gs,{className:"h-4 w-4 mr-1"}),"Add Option"]})]})]})},ot)),fe.length===0&&e.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No polls added yet"})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[e.jsx(Q,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(Q,{onClick:et,children:i?"Update Brief":"Create Brief"})]})]})}),e.jsx(Dr,{open:m,onOpenChange:g,children:e.jsxs(Lr,{className:"max-w-2xl",children:[e.jsx(Ur,{children:e.jsxs(Br,{children:["Results: ",y==null?void 0:y.title]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Views"})}),e.jsx(qe,{children:e.jsx("p",{className:"text-2xl font-bold",children:ve.total})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Dismissed"})}),e.jsx(qe,{children:e.jsx("p",{className:"text-2xl font-bold",children:ve.dismissed})})]})]}),be.length>0?e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"font-semibold",children:"Poll Results"}),be.map(Ve=>e.jsxs(ze,{className:"p-4",children:[e.jsx("h4",{className:"font-medium mb-3",children:Ve.question}),e.jsx("div",{className:"space-y-2",children:Ve.options.map(ot=>{const mt=Ve.results[ot.id]||0,ft=Ve.totalResponses>0?Math.round(mt/Ve.totalResponses*100):0;return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{children:ot.option_text}),e.jsxs("span",{className:"text-muted-foreground",children:[mt," (",ft,"%)"]})]}),e.jsx("div",{className:"h-2 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${ft}%`}})}),mt>0&&e.jsx("div",{className:"flex flex-wrap gap-1 pt-1",children:(Ve.respondents||[]).filter(ct=>ct.optionId===ot.id).map((ct,Mt)=>e.jsx(bt,{variant:"secondary",className:"text-xs font-normal",children:ct.userName},Mt))})]},ot.id)})})]},Ve.id))]}):e.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No polls in this brief"})]})]})})]})}const W3t=()=>{const{user:t}=Gr(),{toast:r}=fi(),s=qr(),[n,a]=E.useState(!1),[o,l]=E.useState(null),[i,d]=E.useState({name:"",description:"",signup_link_url:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[m,g]=E.useState(null),[y,v]=E.useState(""),{data:b=[],isLoading:N}=Ht({queryKey:["additional-services-admin"],queryFn:async()=>{const{data:O,error:B}=await Z.from("additional_services").select("*").order("publish_date",{ascending:!1});if(B)throw B;return O}}),j=Jt({mutationFn:async O=>{let B=O.existingImageUrl;if(O.image){const H=O.image.name.split(".").pop(),W=`${Date.now()}-${Math.random().toString(36).substring(7)}.${H}`,{error:X}=await Z.storage.from("service-images").upload(W,O.image);if(X)throw X;const{data:se}=Z.storage.from("service-images").getPublicUrl(W);B=se.publicUrl}const $={name:O.item.name,description:O.item.description||null,preview_image_url:B,signup_link_url:O.item.signup_link_url,publish_date:O.item.publish_date?new Date(O.item.publish_date).toISOString():new Date().toISOString(),is_published:O.item.is_published,created_by:t==null?void 0:t.id};if(O.itemId){const{error:H}=await Z.from("additional_services").update($).eq("id",O.itemId);if(H)throw H}else{const{error:H}=await Z.from("additional_services").insert($);if(H)throw H}},onSuccess:()=>{s.invalidateQueries({queryKey:["additional-services-admin"]}),s.invalidateQueries({queryKey:["additional-services"]}),r({title:o?"Service updated":"Service created"}),a(!1),A()},onError:O=>{r({title:"Error saving service",description:O.message,variant:"destructive"})}}),S=Jt({mutationFn:async O=>{const{error:B}=await Z.from("additional_services").delete().eq("id",O);if(B)throw B},onSuccess:()=>{s.invalidateQueries({queryKey:["additional-services-admin"]}),s.invalidateQueries({queryKey:["additional-services"]}),r({title:"Service deleted"})},onError:O=>{r({title:"Error deleting service",description:O.message,variant:"destructive"})}}),A=()=>{d({name:"",description:"",signup_link_url:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),g(null),v(""),l(null)},M=O=>{l(O),d({name:O.name,description:O.description||"",signup_link_url:O.signup_link_url,publish_date:O.publish_date?new Date(O.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:O.is_published}),v(O.preview_image_url||""),a(!0)},I=O=>{var $;const B=($=O.target.files)==null?void 0:$[0];B&&(g(B),v(URL.createObjectURL(B)))},F=O=>{if(O.preventDefault(),!i.name.trim()){r({title:"Name is required",variant:"destructive"});return}if(!i.signup_link_url.trim()){r({title:"Signup link URL is required",variant:"destructive"});return}j.mutate({item:i,image:m,existingImageUrl:(o==null?void 0:o.preview_image_url)||null,itemId:o==null?void 0:o.id})};return e.jsx(Fr,{title:"Manage Additional Services",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Services"})}),e.jsx(qe,{children:e.jsx("div",{className:"text-2xl font-bold",children:b.length})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),e.jsx(qe,{children:e.jsx("div",{className:"text-2xl font-bold",children:b.filter(O=>O.is_published).length})})]})]}),e.jsxs(Dr,{open:n,onOpenChange:O=>{a(O),O||A()},children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{className:"gap-2",children:[e.jsx(gs,{className:"h-4 w-4"}),"Add Service"]})}),e.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsx(Ur,{children:e.jsx(Br,{children:o?"Edit Service":"Add New Service"})}),e.jsxs("form",{onSubmit:F,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"name",children:"Name *"}),e.jsx(Qe,{id:"name",value:i.name,onChange:O=>d({...i,name:O.target.value}),placeholder:"Enter service name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Description"}),e.jsx(eg,{content:i.description,onChange:O=>d({...i,description:O}),placeholder:"Enter description",minHeight:"120px"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"signup_link_url",children:"Signup Link URL *"}),e.jsx(Qe,{id:"signup_link_url",type:"url",value:i.signup_link_url,onChange:O=>d({...i,signup_link_url:O.target.value}),placeholder:"https://example.com/signup"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"publish_date",children:"Publish Date"}),e.jsx(Qe,{id:"publish_date",type:"date",value:i.publish_date,onChange:O=>d({...i,publish_date:O.target.value})})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(xn,{id:"is_published",checked:i.is_published,onCheckedChange:O=>d({...i,is_published:O})}),e.jsx(Ee,{htmlFor:"is_published",children:"Published"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Preview Image"}),y?e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:y,alt:"Preview",className:"w-full max-h-48 object-contain rounded-lg border"}),e.jsx(Q,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{g(null),v("")},children:e.jsx(rn,{className:"h-3 w-3"})})]}):e.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:[e.jsx(El,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),e.jsx(Qe,{type:"file",accept:"image/*",onChange:I,className:"cursor-pointer"})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsx(Q,{type:"submit",disabled:j.isPending,children:j.isPending?"Saving...":o?"Update":"Create"})]})]})]})]})]}),e.jsx(ze,{children:e.jsx(qe,{className:"p-0",children:N?e.jsx("div",{className:"flex justify-center py-8",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):b.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'No services yet. Click "Add Service" to create your first one.'}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{className:"w-16",children:"Preview"}),e.jsx(Ct,{children:"Name"}),e.jsx(Ct,{children:"Signup Link"}),e.jsx(Ct,{children:"Publish Date"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{className:"text-right",children:"Actions"})]})}),e.jsx(zn,{children:b.map(O=>e.jsxs(Nr,{children:[e.jsx(dt,{children:O.preview_image_url?e.jsx("img",{src:O.preview_image_url,alt:"",className:"w-12 h-12 object-cover rounded"}):e.jsx("div",{className:"w-12 h-12 bg-muted rounded flex items-center justify-center",children:e.jsx(El,{className:"h-5 w-5 text-muted-foreground"})})}),e.jsx(dt,{className:"font-medium",children:O.name}),e.jsx(dt,{children:e.jsxs("a",{href:O.signup_link_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",children:[e.jsx(En,{className:"h-3 w-3"}),"Link"]})}),e.jsx(dt,{children:new Date(O.publish_date).toLocaleDateString()}),e.jsx(dt,{children:e.jsx(bt,{variant:O.is_published?"default":"secondary",children:O.is_published?"Published":"Draft"})}),e.jsx(dt,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>M(O),children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this service?")&&S.mutate(O.id)},children:e.jsx(Rs,{className:"h-4 w-4 text-destructive"})})]})})]},O.id))})]})})})]})})};function G3t(){const{toast:t}=fi(),[r,s]=E.useState([]),[n,a]=E.useState(!0),[o,l]=E.useState(!1),[i,d]=E.useState(!1),[m,g]=E.useState({name:"",promotionCode:"",discountType:"percent",percentOff:"",amountOff:"",duration:"once",durationInMonths:""});E.useEffect(()=>{y()},[]);const y=async()=>{try{const{data:S,error:A}=await Z.functions.invoke("stripe-manage-coupons",{body:{action:"list"}});if(A)throw A;s(S.coupons||[])}catch(S){console.error("Error fetching coupons:",S),t({title:"Error",description:"Failed to load coupons",variant:"destructive"})}finally{a(!1)}},v=async()=>{if(!m.name){t({title:"Error",description:"Please enter a coupon name",variant:"destructive"});return}if(m.discountType==="percent"&&!m.percentOff){t({title:"Error",description:"Please enter a percent off value",variant:"destructive"});return}if(m.discountType==="amount"&&!m.amountOff){t({title:"Error",description:"Please enter an amount off value",variant:"destructive"});return}if(m.duration==="repeating"&&!m.durationInMonths){t({title:"Error",description:"Please enter duration in months",variant:"destructive"});return}l(!0);try{const S={action:"create",name:m.name,duration:m.duration,promotion_code:m.promotionCode.trim()||void 0};m.discountType==="percent"?S.percent_off=parseFloat(m.percentOff):(S.amount_off=Math.round(parseFloat(m.amountOff)*100),S.currency="usd"),m.duration==="repeating"&&(S.duration_in_months=parseInt(m.durationInMonths));const{data:A,error:M}=await Z.functions.invoke("stripe-manage-coupons",{body:S});if(M)throw M;t({title:"Success",description:"Coupon created successfully"}),d(!1),g({name:"",promotionCode:"",discountType:"percent",percentOff:"",amountOff:"",duration:"once",durationInMonths:""}),y()}catch(S){console.error("Error creating coupon:",S),t({title:"Error",description:S.message||"Failed to create coupon",variant:"destructive"})}finally{l(!1)}},b=async S=>{if(confirm("Are you sure you want to delete this coupon?"))try{const{error:A}=await Z.functions.invoke("stripe-manage-coupons",{body:{action:"delete",couponId:S}});if(A)throw A;t({title:"Success",description:"Coupon deleted successfully"}),y()}catch(A){console.error("Error deleting coupon:",A),t({title:"Error",description:A.message||"Failed to delete coupon",variant:"destructive"})}},N=S=>S.percent_off?`${S.percent_off}% off`:S.amount_off?`$${(S.amount_off/100).toFixed(2)} off`:"N/A",j=S=>{switch(S.duration){case"once":return"Once";case"forever":return"Forever";case"repeating":return`${S.duration_in_months} months`;default:return S.duration}};return e.jsx(Fr,{title:"Subscription Discounts",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(Lu,{title:"Subscription Discounts",description:"Create and manage discount coupons for subscriptions",children:e.jsxs(Dr,{open:i,onOpenChange:d,children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{children:[e.jsx(gs,{className:"mr-2 h-4 w-4"}),"Create Coupon"]})}),e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Create New Coupon"}),e.jsx(Gs,{children:"Create a discount coupon that can be applied to subscriptions"})]}),e.jsxs("div",{className:"space-y-4 pt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Promotion Code (what users will type)"}),e.jsx(Qe,{placeholder:"e.g., BROKERAGE50",value:m.promotionCode,onChange:S=>g({...m,promotionCode:S.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"")}),className:"font-mono uppercase"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters and numbers only. This is the code users enter at checkout."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Coupon Name (internal label)"}),e.jsx(Qe,{placeholder:"e.g., 50% Off Brokerage Launch",value:m.name,onChange:S=>g({...m,name:S.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Discount Type"}),e.jsxs(ds,{value:m.discountType,onValueChange:S=>{const A=S==="amount"&&m.duration==="forever"?"once":m.duration;g({...m,discountType:S,duration:A})},children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"percent",children:e.jsxs("span",{className:"flex items-center",children:[e.jsx(KS,{className:"mr-2 h-4 w-4"}),"Percentage Off"]})}),e.jsx(Ut,{value:"amount",children:e.jsxs("span",{className:"flex items-center",children:[e.jsx(yd,{className:"mr-2 h-4 w-4"}),"Fixed Amount Off"]})})]})]})]}),m.discountType==="percent"?e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Percent Off"}),e.jsxs("div",{className:"relative",children:[e.jsx(Qe,{type:"number",min:"1",max:"100",placeholder:"20",value:m.percentOff,onChange:S=>g({...m,percentOff:S.target.value})}),e.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Amount Off (USD)"}),e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"$"}),e.jsx(Qe,{type:"number",min:"1",placeholder:"10.00",className:"pl-7",value:m.amountOff,onChange:S=>g({...m,amountOff:S.target.value})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Duration"}),e.jsxs(ds,{value:m.duration,onValueChange:S=>g({...m,duration:S}),children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"once",children:"Once (first payment only)"}),e.jsx(Ut,{value:"repeating",children:"Multiple months"}),e.jsxs(Ut,{value:"forever",disabled:m.discountType==="amount",children:["Forever ",m.discountType==="amount"&&"(% discounts only)"]})]})]}),m.discountType==="amount"&&e.jsx("p",{className:"text-xs text-muted-foreground",children:'Note: "Forever" duration is only available for percentage-based discounts.'})]}),m.duration==="repeating"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Number of Months"}),e.jsx(Qe,{type:"number",min:"1",placeholder:"3",value:m.durationInMonths,onChange:S=>g({...m,durationInMonths:S.target.value})})]}),e.jsx(Q,{onClick:v,disabled:o,className:"w-full",children:o?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Coupon"})]})]})]})}),e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsx(Zt,{children:"Active Coupons"}),e.jsx(Ss,{children:"Share coupon codes with users to give them discounts on subscriptions"})]}),e.jsx(qe,{children:n?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Hr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No coupons created yet. Create your first coupon to get started."}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Promo Code"}),e.jsx(Ct,{children:"Name"}),e.jsx(Ct,{children:"Discount"}),e.jsx(Ct,{children:"Duration"}),e.jsx(Ct,{children:"Redemptions"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{className:"text-right",children:"Actions"})]})}),e.jsx(zn,{children:r.map(S=>{var A;return e.jsxs(Nr,{children:[e.jsx(dt,{className:"font-mono font-medium",children:((A=S.promotion_codes)==null?void 0:A.length)>0?S.promotion_codes.join(", "):e.jsx("span",{className:"text-muted-foreground text-xs",children:"No promo code"})}),e.jsx(dt,{children:S.name||"-"}),e.jsx(dt,{children:N(S)}),e.jsx(dt,{children:j(S)}),e.jsx(dt,{children:S.times_redeemed}),e.jsx(dt,{children:e.jsx(bt,{variant:S.valid?"default":"secondary",children:S.valid?"Active":"Inactive"})}),e.jsx(dt,{className:"text-right",children:e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>b(S.id),children:e.jsx(Rs,{className:"h-4 w-4 text-destructive"})})})]},S.id)})})]})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{children:"How to Use Coupons"})}),e.jsxs(qe,{className:"text-sm text-muted-foreground space-y-2",children:[e.jsx("p",{children:"1. Create a coupon above with your desired discount."}),e.jsx("p",{children:'2. Share the coupon code (shown in the "Code" column) with users.'}),e.jsx("p",{children:"3. Users can enter the code during checkout to receive the discount."}),e.jsx("p",{children:"4. Alternatively, you can create a promotion code in Stripe dashboard for public-facing promotions."})]})]})]})})}const Vde={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 K3t(){const[t,r]=E.useState(""),[s,n]=E.useState("all"),[a,o]=E.useState(null),{data:l,isLoading:i,refetch:d}=Ht({queryKey:["admin-subscriptions"],queryFn:async()=>{const{data:N,error:j}=await Z.from("profiles").select(` *, brokerages:brokerage_id (id, name) `).order("created_at",{ascending:!1});if(j)throw j;return N}}),{data:m}=Ht({queryKey:["admin-brokerages-subscriptions"],queryFn:async()=>{const{data:N,error:j}=await Z.from("brokerages").select("*").order("name");if(j)throw j;return await Promise.all((N||[]).map(async A=>{const{data:M}=await Z.from("profiles").select("id, name, email, subscription_status, subscription_product_id").eq("brokerage_id",A.id),{data:I}=await Z.from("user_roles").select("user_id").eq("role","brokerage_manager"),F=(I==null?void 0:I.map($=>$.user_id))||[],O=(M==null?void 0:M.filter($=>F.includes($.id)))||[],B=(M==null?void 0:M.length)||0;return{...A,managers:O,agentCount:B}}))}}),g=N=>{if(N.is_grandfathered)return{status:"Grandfathered",badge:"Legacy",variant:"secondary"};if(N.brokerage_id&&!N.subscription_product_id)return{status:"Brokerage",badge:"Team Member",variant:"outline"};if(N.is_trial&&N.trial_expires_at)return new Date(N.trial_expires_at)>new Date?{status:"Trial",badge:"Active Trial",variant:"default"}:{status:"Trial Expired",badge:"Expired",variant:"destructive"};if(N.subscription_status==="active"||N.subscription_status==="trialing"){const j=Vde[N.subscription_product_id];return{status:(j==null?void 0:j.name)||"Active",badge:N.subscription_status==="trialing"?"Trial":"Active",variant:"default"}}return N.subscription_status==="canceled"||N.subscription_status==="past_due"?{status:"Canceled",badge:"Inactive",variant:"destructive"}:{status:"None",badge:"No Subscription",variant:"outline"}},y=l==null?void 0:l.filter(N=>{var S,A;if(!(((S=N.name)==null?void 0:S.toLowerCase().includes(t.toLowerCase()))||((A=N.email)==null?void 0:A.toLowerCase().includes(t.toLowerCase()))))return!1;switch(g(N),s){case"active":return N.subscription_status==="active";case"trialing":return N.subscription_status==="trialing"||N.is_trial&&new Date(N.trial_expires_at)>new Date;case"grandfathered":return N.is_grandfathered;case"brokerage":return N.brokerage_id&&!N.subscription_product_id&&!N.is_grandfathered;case"expired":return N.subscription_status==="canceled"||N.subscription_status==="past_due"||N.is_trial&&new Date(N.trial_expires_at)<=new Date;case"none":return!N.subscription_status||N.subscription_status==="none";default:return!0}}),v={totalUsers:(l==null?void 0:l.length)||0,activeSubscriptions:(l==null?void 0:l.filter(N=>N.subscription_status==="active").length)||0,trials:(l==null?void 0:l.filter(N=>N.subscription_status==="trialing"||N.is_trial&&new Date(N.trial_expires_at)>new Date).length)||0,grandfathered:(l==null?void 0:l.filter(N=>N.is_grandfathered).length)||0,brokerageMembers:(l==null?void 0:l.filter(N=>N.brokerage_id&&!N.subscription_product_id&&!N.is_grandfathered).length)||0,individualSubscribers:(l==null?void 0:l.filter(N=>N.subscription_status==="active"&&N.subscription_product_id==="prod_Tc07cYplXUGNkm").length)||0,brokerageSubscribers:(l==null?void 0:l.filter(N=>N.subscription_status==="active"&&(N.subscription_product_id==="prod_Tc08MupgoVySDG"||N.subscription_product_id==="prod_Tc09N1tJ4RrAFn")).length)||0},b=N=>{window.open(`https://dashboard.stripe.com/customers/${N}`,"_blank")};return e.jsx(Fr,{title:"Subscription Management",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(Lu,{title:"Subscription Management",description:"Track and manage all subscriptions",children:e.jsxs(Q,{onClick:()=>d(),variant:"outline",size:"sm",children:[e.jsx(Ko,{className:"h-4 w-4 mr-2"}),"Refresh"]})}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-7 gap-4",children:[e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ws,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Users"})]}),e.jsx("p",{className:"text-2xl font-bold mt-1",children:v.totalUsers})]})}),e.jsx(ze,{className:"border-green-500/50",children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(gp,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Active Paid"})]}),e.jsx("p",{className:"text-2xl font-bold mt-1 text-green-600",children:v.activeSubscriptions})]})}),e.jsx(ze,{className:"border-blue-500/50",children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ea,{className:"h-4 w-4 text-blue-500"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Trials"})]}),e.jsx("p",{className:"text-2xl font-bold mt-1 text-blue-600",children:v.trials})]})}),e.jsx(ze,{className:"border-purple-500/50",children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ih,{className:"h-4 w-4 text-purple-500"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Grandfathered"})]}),e.jsx("p",{className:"text-2xl font-bold mt-1 text-purple-600",children:v.grandfathered})]})}),e.jsx(ze,{className:"border-orange-500/50",children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(bi,{className:"h-4 w-4 text-orange-500"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Brokerage Members"})]}),e.jsx("p",{className:"text-2xl font-bold mt-1 text-orange-600",children:v.brokerageMembers})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Jj,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Individual"})]}),e.jsx("p",{className:"text-2xl font-bold mt-1",children:v.individualSubscribers})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(bi,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Brokerage Subs"})]}),e.jsx("p",{className:"text-2xl font-bold mt-1",children:v.brokerageSubscribers})]})})]}),e.jsxs(ci,{defaultValue:"users",className:"space-y-4",children:[e.jsxs(ri,{children:[e.jsx(Kr,{value:"users",children:"All Users"}),e.jsx(Kr,{value:"brokerages",children:"Brokerages"})]}),e.jsxs(ms,{value:"users",className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search by name or email...",value:t,onChange:N=>r(N.target.value),className:"pl-9"})]}),e.jsxs(ds,{value:s,onValueChange:N=>n(N),children:[e.jsx(ls,{className:"w-[200px]",children:e.jsx(us,{placeholder:"Filter by status"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Users"}),e.jsx(Ut,{value:"active",children:"Active Subscriptions"}),e.jsx(Ut,{value:"trialing",children:"Trials"}),e.jsx(Ut,{value:"grandfathered",children:"Grandfathered"}),e.jsx(Ut,{value:"brokerage",children:"Brokerage Members"}),e.jsx(Ut,{value:"expired",children:"Expired/Canceled"}),e.jsx(Ut,{value:"none",children:"No Subscription"})]})]})]}),e.jsx(ze,{children:e.jsx(qe,{className:"p-0",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"User"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{children:"Plan"}),e.jsx(Ct,{children:"Brokerage"}),e.jsx(Ct,{children:"End Date"}),e.jsx(Ct,{className:"text-right",children:"Actions"})]})}),e.jsx(zn,{children:i?e.jsx(Nr,{children:e.jsx(dt,{colSpan:6,className:"text-center py-8",children:"Loading subscriptions..."})}):(y==null?void 0:y.length)===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No users found"})}):y==null?void 0:y.map(N=>{var A,M;const j=g(N),S=Vde[N.subscription_product_id];return e.jsxs(Nr,{children:[e.jsx(dt,{children:e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:N.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:N.email})]})}),e.jsx(dt,{children:e.jsx(bt,{variant:j.variant,children:j.badge})}),e.jsx(dt,{children:e.jsx("span",{className:"text-sm",children:N.is_grandfathered?"Legacy Access":N.brokerage_id&&!N.subscription_product_id?"Brokerage Subscription":(S==null?void 0:S.name)||j.status})}),e.jsx(dt,{children:(A=N.brokerages)!=null&&A.name?e.jsx("span",{className:"text-sm",children:N.brokerages.name}):e.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),e.jsx(dt,{children:N.subscription_end_date?e.jsx("span",{className:"text-sm",children:Xr(new Date(N.subscription_end_date),"MMM d, yyyy")}):N.trial_expires_at?e.jsxs("span",{className:"text-sm text-blue-600",children:["Trial: ",Xr(new Date(N.trial_expires_at),"MMM d, yyyy")]}):e.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),e.jsx(dt,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[N.stripe_customer_id&&e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>b(N.stripe_customer_id),children:e.jsx(En,{className:"h-4 w-4"})}),e.jsxs(Dr,{children:[e.jsx(xo,{asChild:!0,children:e.jsx(Q,{variant:"outline",size:"sm",onClick:()=>o(N),children:"Details"})}),e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Subscription Details"}),e.jsxs(Gs,{children:[N.name," (",N.email,")"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Status"}),e.jsx(bt,{variant:j.variant,className:"mt-1",children:j.badge})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Plan"}),e.jsx("p",{className:"font-medium",children:N.is_grandfathered?"Grandfathered (Legacy)":N.brokerage_id&&!N.subscription_product_id?"Brokerage Subscription":(S==null?void 0:S.name)||"None"})]}),N.brokerage_id&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Brokerage"}),e.jsx("p",{className:"font-medium",children:((M=N.brokerages)==null?void 0:M.name)||"Unknown"})]}),N.subscription_end_date&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Current Period End"}),e.jsx("p",{className:"font-medium",children:Xr(new Date(N.subscription_end_date),"MMMM d, yyyy")})]}),N.trial_expires_at&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Trial Expires"}),e.jsx("p",{className:"font-medium",children:Xr(new Date(N.trial_expires_at),"MMMM d, yyyy")})]}),N.stripe_customer_id&&e.jsxs("div",{className:"col-span-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Stripe Customer ID"}),e.jsx("p",{className:"font-mono text-sm",children:N.stripe_customer_id})]})]}),N.stripe_customer_id&&e.jsxs(Q,{className:"w-full",onClick:()=>b(N.stripe_customer_id),children:[e.jsx(En,{className:"h-4 w-4 mr-2"}),"View in Stripe Dashboard"]})]})]})]})]})})]},N.id)})})]})})})]}),e.jsx(ms,{value:"brokerages",className:"space-y-4",children:e.jsx("div",{className:"grid gap-4",children:m==null?void 0:m.map(N=>{var S,A;const j=(S=N.managers)==null?void 0:S.some(M=>M.subscription_status==="active"&&(M.subscription_product_id==="prod_Tc08MupgoVySDG"||M.subscription_product_id==="prod_Tc09N1tJ4RrAFn"));return e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:e.jsx(bi,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx(Zt,{className:"text-lg",children:N.name}),e.jsxs(Ss,{children:[N.agentCount," agents"]})]})]}),e.jsx(bt,{variant:j?"default":"outline",children:j?"Active Subscription":"No Active Subscription"})]})}),e.jsx(qe,{children:((A=N.managers)==null?void 0:A.length)>0?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Managers:"}),N.managers.map(M=>{const I=Vde[M.subscription_product_id];return e.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-muted/50",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:M.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:M.email})]}),e.jsx("div",{className:"text-right",children:I?e.jsxs("div",{children:[e.jsx(bt,{variant:"default",children:I.name}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:I.price})]}):e.jsx(bt,{variant:"outline",children:"No Subscription"})})]},M.id)})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No managers assigned"})})]},N.id)})})})]})]})})}function Z3t(){const[t,r]=E.useState([]),[s,n]=E.useState(!0),[a,o]=E.useState(""),[l,i]=E.useState("all"),[d,m]=E.useState({total:0,qualified:0,pending:0,cancelled:0,totalDiscounts:0});E.useEffect(()=>{g()},[]);const g=async()=>{try{const{data:N,error:j}=await Z.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(j)throw j;r(N||[]);const S=(N==null?void 0:N.filter(I=>I.status==="qualified").length)||0,A=(N==null?void 0:N.filter(I=>I.status==="pending").length)||0,M=(N==null?void 0:N.filter(I=>I.status==="cancelled").length)||0;m({total:(N==null?void 0:N.length)||0,qualified:S,pending:A,cancelled:M,totalDiscounts:S*25})}catch(N){console.error("Error fetching referrals:",N),Se.error("Failed to load referrals")}finally{n(!1)}},y=async()=>{try{Se.loading("Processing qualifications...");const{error:N}=await Z.functions.invoke("process-referral-qualifications");if(N)throw N;Se.dismiss(),Se.success("Qualifications processed successfully"),g()}catch(N){Se.dismiss(),console.error("Error processing qualifications:",N),Se.error("Failed to process qualifications")}},v=t.filter(N=>{var A,M,I,F,O,B;const j=((M=(A=N.referrer_brokerage)==null?void 0:A.name)==null?void 0:M.toLowerCase().includes(a.toLowerCase()))||((F=(I=N.referred_brokerage)==null?void 0:I.name)==null?void 0:F.toLowerCase().includes(a.toLowerCase()))||((B=(O=N.referred_user)==null?void 0:O.email)==null?void 0:B.toLowerCase().includes(a.toLowerCase())),S=l==="all"||N.status===l;return j&&S}),b=N=>{switch(N){case"qualified":return e.jsxs(bt,{className:"bg-green-100 text-green-800",children:[e.jsx(ui,{className:"h-3 w-3 mr-1"}),"Qualified"]});case"pending":return e.jsxs(bt,{variant:"secondary",children:[e.jsx(Ea,{className:"h-3 w-3 mr-1"}),"Pending"]});case"cancelled":return e.jsxs(bt,{variant:"destructive",children:[e.jsx(Sc,{className:"h-3 w-3 mr-1"}),"Cancelled"]});default:return e.jsx(bt,{children:N})}};return e.jsx(Fr,{title:"Referral Program",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(Lu,{title:"Referral Program",description:"Track and manage brokerage referrals",children:e.jsxs(Q,{onClick:y,variant:"outline",children:[e.jsx(Ko,{className:"h-4 w-4 mr-2"}),"Process Qualifications"]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4",children:[e.jsx(ze,{children:e.jsx(qe,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ws,{className:"h-5 w-5 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:d.total}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Referrals"})]})]})})}),e.jsx(ze,{children:e.jsx(qe,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ui,{className:"h-5 w-5 text-green-600"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:d.qualified}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Qualified"})]})]})})}),e.jsx(ze,{children:e.jsx(qe,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ea,{className:"h-5 w-5 text-amber-600"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:d.pending}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Pending"})]})]})})}),e.jsx(ze,{children:e.jsx(qe,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Sc,{className:"h-5 w-5 text-red-600"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:d.cancelled}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Cancelled"})]})]})})}),e.jsx(ze,{children:e.jsx(qe,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(yd,{className:"h-5 w-5 text-green-600"}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-2xl font-bold",children:["$",d.totalDiscounts]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Monthly Discounts"})]})]})})})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsx(Zt,{children:"All Referrals"}),e.jsx(Ss,{children:"View and manage all referral relationships"})]}),e.jsxs(qe,{children:[e.jsxs("div",{className:"flex gap-4 mb-4",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search by brokerage or email...",value:a,onChange:N=>o(N.target.value),className:"pl-10"})]}),e.jsxs(ds,{value:l,onValueChange:i,children:[e.jsx(ls,{className:"w-[180px]",children:e.jsx(us,{placeholder:"Filter by status"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Statuses"}),e.jsx(Ut,{value:"pending",children:"Pending"}),e.jsx(Ut,{value:"qualified",children:"Qualified"}),e.jsx(Ut,{value:"cancelled",children:"Cancelled"})]})]})]}),s?e.jsx("div",{className:"flex justify-center py-8",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Referrer"}),e.jsx(Ct,{children:"Referred"}),e.jsx(Ct,{children:"Signup Date"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{children:"Qualified Date"}),e.jsx(Ct,{children:"Discount"})]})}),e.jsx(zn,{children:v.length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No referrals found"})}):v.map(N=>{var j,S,A,M;return e.jsxs(Nr,{children:[e.jsx(dt,{className:"font-medium",children:((j=N.referrer_brokerage)==null?void 0:j.name)||"Unknown"}),e.jsx(dt,{children:e.jsxs("div",{children:[e.jsx("p",{children:((S=N.referred_brokerage)==null?void 0:S.name)||((A=N.referred_user)==null?void 0:A.name)||"Pending setup"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:(M=N.referred_user)==null?void 0:M.email})]})}),e.jsx(dt,{children:Xr(new Date(N.signup_date),"MMM d, yyyy")}),e.jsx(dt,{children:b(N.status)}),e.jsx(dt,{children:N.qualified_date?Xr(new Date(N.qualified_date),"MMM d, yyyy"):"-"}),e.jsx(dt,{children:N.discount_applied?e.jsx(bt,{variant:"outline",className:"text-green-600",children:"$25/mo applied"}):e.jsx("span",{className:"text-muted-foreground",children:"-"})})]},N.id)})})]})]})]})]})})}const Hde=[{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"}],Y3t=[{value:"brokerage_manager",label:"Brokerage Manager"},{value:"agent",label:"Agent"}];function X3t(){const[t,r]=E.useState([]),[s,n]=E.useState(!0),[a,o]=E.useState(!1),[l,i]=E.useState(null),[d,m]=E.useState({title:"",description:"",action_type:"view_template",target_role:"agent",is_active:!0});E.useEffect(()=>{g()},[]);const g=async()=>{try{const{data:M,error:I}=await Z.from("onboarding_checklist_items").select("*").order("target_role").order("sort_order");if(I)throw I;r(M||[])}catch(M){console.error("Error fetching checklist items:",M),Se.error("Failed to load checklist items")}finally{n(!1)}},y=()=>{i(null),m({title:"",description:"",action_type:"view_template",target_role:"agent",is_active:!0}),o(!0)},v=M=>{i(M),m({title:M.title,description:M.description||"",action_type:M.action_type,target_role:M.target_role,is_active:M.is_active}),o(!0)},b=async()=>{if(!d.title.trim()){Se.error("Title is required");return}try{if(l){const{error:M}=await Z.from("onboarding_checklist_items").update({title:d.title,description:d.description||null,action_type:d.action_type,target_role:d.target_role,is_active:d.is_active}).eq("id",l.id);if(M)throw M;Se.success("Checklist item updated")}else{const M=t.filter(F=>F.target_role===d.target_role).reduce((F,O)=>Math.max(F,O.sort_order),-1),{error:I}=await Z.from("onboarding_checklist_items").insert({title:d.title,description:d.description||null,action_type:d.action_type,target_role:d.target_role,is_active:d.is_active,sort_order:M+1});if(I)throw I;Se.success("Checklist item created")}o(!1),g()}catch(M){console.error("Error saving checklist item:",M),Se.error("Failed to save checklist item")}},N=async M=>{if(confirm("Are you sure you want to delete this checklist item?"))try{const{error:I}=await Z.from("onboarding_checklist_items").delete().eq("id",M);if(I)throw I;Se.success("Checklist item deleted"),g()}catch(I){console.error("Error deleting checklist item:",I),Se.error("Failed to delete checklist item")}},j=async M=>{try{const{error:I}=await Z.from("onboarding_checklist_items").update({is_active:!M.is_active}).eq("id",M.id);if(I)throw I;Se.success(M.is_active?"Item deactivated":"Item activated"),g()}catch(I){console.error("Error toggling item:",I),Se.error("Failed to update item")}},S=t.filter(M=>M.target_role==="brokerage_manager"),A=t.filter(M=>M.target_role==="agent");return e.jsxs(Fr,{title:"Onboarding Checklist",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Onboarding Checklist"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage checklist items shown to new users on their dashboard"})]}),e.jsxs(Q,{onClick:y,className:"gap-2",children:[e.jsx(gs,{className:"h-4 w-4"}),"Add Item"]})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(bt,{variant:"secondary",children:"Brokerage Manager"}),"Checklist Items"]})}),e.jsx(qe,{children:S.length===0?e.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No checklist items for brokerage managers"}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{className:"w-12",children:"#"}),e.jsx(Ct,{children:"Title"}),e.jsx(Ct,{children:"Action Type"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{className:"text-right",children:"Actions"})]})}),e.jsx(zn,{children:S.map((M,I)=>{var F;return e.jsxs(Nr,{children:[e.jsx(dt,{className:"text-muted-foreground",children:I+1}),e.jsx(dt,{children:e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:M.title}),M.description&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:M.description})]})}),e.jsx(dt,{children:e.jsx(bt,{variant:"outline",children:((F=Hde.find(O=>O.value===M.action_type))==null?void 0:F.label)||M.action_type})}),e.jsx(dt,{children:e.jsx(xn,{checked:M.is_active,onCheckedChange:()=>j(M)})}),e.jsx(dt,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>v(M),children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>N(M.id),children:e.jsx(Rs,{className:"h-4 w-4 text-destructive"})})]})})]},M.id)})})]})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(bt,{variant:"secondary",children:"Agent"}),"Checklist Items"]})}),e.jsx(qe,{children:A.length===0?e.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No checklist items for agents"}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{className:"w-12",children:"#"}),e.jsx(Ct,{children:"Title"}),e.jsx(Ct,{children:"Action Type"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{className:"text-right",children:"Actions"})]})}),e.jsx(zn,{children:A.map((M,I)=>{var F;return e.jsxs(Nr,{children:[e.jsx(dt,{className:"text-muted-foreground",children:I+1}),e.jsx(dt,{children:e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:M.title}),M.description&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:M.description})]})}),e.jsx(dt,{children:e.jsx(bt,{variant:"outline",children:((F=Hde.find(O=>O.value===M.action_type))==null?void 0:F.label)||M.action_type})}),e.jsx(dt,{children:e.jsx(xn,{checked:M.is_active,onCheckedChange:()=>j(M)})}),e.jsx(dt,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>v(M),children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>N(M.id),children:e.jsx(Rs,{className:"h-4 w-4 text-destructive"})})]})})]},M.id)})})]})})]})]}),e.jsx(Dr,{open:a,onOpenChange:o,children:e.jsxs(Lr,{children:[e.jsx(Ur,{children:e.jsx(Br,{children:l?"Edit Checklist Item":"Add Checklist Item"})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"title",children:"Title *"}),e.jsx(Qe,{id:"title",value:d.title,onChange:M=>m({...d,title:M.target.value}),placeholder:"e.g., Watch your first academy video"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"description",children:"Description"}),e.jsx(Ks,{id:"description",value:d.description,onChange:M=>m({...d,description:M.target.value}),placeholder:"Optional description for the checklist item",rows:2})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Target Role"}),e.jsxs(ds,{value:d.target_role,onValueChange:M=>m({...d,target_role:M}),children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsx(cs,{children:Y3t.map(M=>e.jsx(Ut,{value:M.value,children:M.label},M.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Action Type"}),e.jsxs(ds,{value:d.action_type,onValueChange:M=>m({...d,action_type:M}),children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsx(cs,{children:Hde.map(M=>e.jsx(Ut,{value:M.value,children:M.label},M.value))})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xn,{id:"is_active",checked:d.is_active,onCheckedChange:M=>m({...d,is_active:M})}),e.jsx(Ee,{htmlFor:"is_active",children:"Active"})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),e.jsx(Q,{onClick:b,children:l?"Save Changes":"Create Item"})]})]})})]})}function Q3t(){const[t,r]=E.useState(""),[s,n]=E.useState("all"),[a,o]=E.useState("name"),[l,i]=E.useState("asc"),[d,m]=E.useState(""),[g,y]=E.useState(""),[v,b]=E.useState(""),[N,j]=E.useState(""),{data:S}=Ht({queryKey:["admin-brokerages"],queryFn:async()=>{const{data:W,error:X}=await Z.from("brokerages").select("id, name").order("name");if(X)throw X;return W}}),A=async W=>{let se=[],ae=0,le=!0;for(;le;){const{data:ne,error:fe}=await W(ae,ae+1e3-1);if(fe)throw fe;ne&&ne.length>0?(se=[...se,...ne],ae+=1e3,le=ne.length===1e3):le=!1}return se},{data:M,isLoading:I}=Ht({queryKey:["admin-agent-os-user-stats"],queryFn:async()=>{const W=await A((ve,tt)=>Z.from("profiles").select("id, name, email, brokerage_id, created_at").range(ve,tt)),{data:X}=await Z.from("brokerages").select("id, name"),se=new Map((X==null?void 0:X.map(ve=>[ve.id,ve.name]))||[]),{data:ae}=await Z.rpc("get_admin_contact_counts"),le=new Map;ae==null||ae.forEach(ve=>{le.set(ve.owner_user_id,ve.contact_count)});const{data:ne}=await Z.rpc("get_admin_video_counts"),fe=new Map;ne==null||ne.forEach(ve=>{fe.set(ve.owner_user_id,ve.video_count)});const{data:oe}=await Z.rpc("get_admin_popby_counts"),de=new Map;oe==null||oe.forEach(ve=>{de.set(ve.owner_user_id,ve.popby_count)});const{data:ue}=await Z.rpc("get_admin_listing_counts"),xe=new Map;ue==null||ue.forEach(ve=>{xe.set(ve.agent_id,ve.listing_count)});const{data:Te}=await Z.rpc("get_admin_deal_counts"),be=new Map;return Te==null||Te.forEach(ve=>{be.set(ve.owner_user_id,ve.deal_count)}),W.map(ve=>({id:ve.id,name:ve.name||"Unknown",email:ve.email||"",brokerage_id:ve.brokerage_id,brokerage_name:ve.brokerage_id&&se.get(ve.brokerage_id)||null,contact_count:le.get(ve.id)||0,video_count:fe.get(ve.id)||0,popby_count:de.get(ve.id)||0,listing_count:xe.get(ve.id)||0,deal_count:be.get(ve.id)||0,created_at:ve.created_at}))}}),F=E.useMemo(()=>{if(!M)return[];let W=M.filter(X=>{const se=t.toLowerCase(),ae=!t||X.name.toLowerCase().includes(se)||X.email.toLowerCase().includes(se),le=s==="all"||s==="none"&&!X.brokerage_id||X.brokerage_id===s,ne=parseInt(d)||0,fe=parseInt(g)||0,oe=parseInt(v)||0,de=parseInt(N)||0,ue=X.contact_count>=ne&&X.video_count>=fe&&X.popby_count>=oe&&X.listing_count>=de;return ae&&le&&ue});return W.sort((X,se)=>{let ae=0;return a==="name"?ae=X.name.localeCompare(se.name):ae=X[a]-se[a],l==="asc"?ae:-ae}),W},[M,t,s,a,l,d,g,v,N]),O=W=>{a===W?i(l==="asc"?"desc":"asc"):(o(W),i("desc"))},B=()=>{const W=["Name","Email","Brokerage","Contacts","Videos","Popbys","Listings","Deals"],X=F.map(fe=>[fe.name,fe.email,fe.brokerage_name||"None",fe.contact_count,fe.video_count,fe.popby_count,fe.listing_count,fe.deal_count]),se=[W.join(","),...X.map(fe=>fe.map(oe=>`"${oe}"`).join(","))].join(` `),ae=new Blob([se],{type:"text/csv"}),le=URL.createObjectURL(ae),ne=document.createElement("a");ne.href=le,ne.download=`agent-os-user-stats-${new Date().toISOString().split("T")[0]}.csv`,ne.click(),URL.revokeObjectURL(le)},$=E.useMemo(()=>F.length?F.reduce((W,X)=>({contacts:W.contacts+X.contact_count,videos:W.videos+X.video_count,popbys:W.popbys+X.popby_count,listings:W.listings+X.listing_count,deals:W.deals+X.deal_count}),{contacts:0,videos:0,popbys:0,listings:0,deals:0}):{contacts:0,videos:0,popbys:0,listings:0,deals:0},[F]),H=({field:W,children:X})=>e.jsx(Ct,{className:"cursor-pointer hover:bg-muted/50 select-none",onClick:()=>O(W),children:e.jsxs("div",{className:"flex items-center gap-1",children:[X,e.jsx(Of,{className:`h-3 w-3 ${a===W?"text-primary":"text-muted-foreground"}`})]})});return e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(ws,{className:"h-5 w-5"}),"User Activity Analytics"]}),e.jsx(Ss,{children:"View all users and their Agent OS usage metrics"})]}),e.jsxs(Q,{variant:"outline",size:"sm",onClick:B,children:[e.jsx(Oi,{className:"h-4 w-4 mr-2"}),"Export CSV"]})]})}),e.jsxs(qe,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-6",children:[e.jsx("div",{className:"md:col-span-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search by name or email...",value:t,onChange:W=>r(W.target.value),className:"pl-9"})]})}),e.jsx("div",{children:e.jsxs(ds,{value:s,onValueChange:n,children:[e.jsxs(ls,{children:[e.jsx(bi,{className:"h-4 w-4 mr-2 text-muted-foreground"}),e.jsx(us,{placeholder:"Brokerage"})]}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Brokerages"}),e.jsx(Ut,{value:"none",children:"No Brokerage"}),S==null?void 0:S.map(W=>e.jsx(Ut,{value:W.id,children:W.name},W.id))]})]})}),e.jsx("div",{children:e.jsx(Qe,{type:"number",placeholder:"Min contacts",value:d,onChange:W=>m(W.target.value),min:"0"})}),e.jsx("div",{children:e.jsx(Qe,{type:"number",placeholder:"Min videos",value:g,onChange:W=>y(W.target.value),min:"0"})}),e.jsx("div",{children:e.jsx(Qe,{type:"number",placeholder:"Min popbys",value:v,onChange:W=>b(W.target.value),min:"0"})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-6 text-sm",children:[e.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:F.length}),e.jsx("div",{className:"text-muted-foreground",children:"Users"})]}),e.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:$.contacts.toLocaleString()}),e.jsx("div",{className:"text-muted-foreground",children:"Total Contacts"})]}),e.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:$.videos.toLocaleString()}),e.jsx("div",{className:"text-muted-foreground",children:"Total Videos"})]}),e.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:$.popbys.toLocaleString()}),e.jsx("div",{className:"text-muted-foreground",children:"Total Popbys"})]}),e.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:$.listings.toLocaleString()}),e.jsx("div",{className:"text-muted-foreground",children:"Total Listings"})]}),e.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:$.deals.toLocaleString()}),e.jsx("div",{className:"text-muted-foreground",children:"Total Deals"})]})]}),I?e.jsx("div",{className:"flex justify-center py-12",children:e.jsx(Hr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsx("div",{className:"rounded-md border",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(H,{field:"name",children:"Name"}),e.jsx(Ct,{children:"Email"}),e.jsx(Ct,{children:"Brokerage"}),e.jsx(H,{field:"contact_count",children:"Contacts"}),e.jsx(H,{field:"video_count",children:"Videos"}),e.jsx(H,{field:"popby_count",children:"Popbys"}),e.jsx(H,{field:"listing_count",children:"Listings"}),e.jsx(H,{field:"deal_count",children:"Deals"})]})}),e.jsx(zn,{children:F.length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"No users found matching your filters"})}):F.map(W=>e.jsxs(Nr,{children:[e.jsx(dt,{className:"font-medium",children:W.name}),e.jsx(dt,{className:"text-muted-foreground",children:W.email}),e.jsx(dt,{children:W.brokerage_name?e.jsx(bt,{variant:"secondary",children:W.brokerage_name}):e.jsx("span",{className:"text-muted-foreground",children:"—"})}),e.jsx(dt,{children:e.jsx(bt,{variant:W.contact_count>0?"default":"outline",children:W.contact_count})}),e.jsx(dt,{children:e.jsx(bt,{variant:W.video_count>0?"default":"outline",children:W.video_count})}),e.jsx(dt,{children:e.jsx(bt,{variant:W.popby_count>0?"default":"outline",children:W.popby_count})}),e.jsx(dt,{children:e.jsx(bt,{variant:W.listing_count>0?"default":"outline",children:W.listing_count})}),e.jsx(dt,{children:e.jsx(bt,{variant:W.deal_count>0?"default":"outline",children:W.deal_count})})]},W.id))})]})})]})]})}function J3t(){fi(),qr();const[t,r]=E.useState("user-analytics"),{data:s}=Ht({queryKey:["admin-feature-flags"],queryFn:async()=>{const{data:b,error:N}=await Z.from("feature_flags").select("*").order("key");if(N)throw N;return b}}),{data:n,isLoading:a}=Ht({queryKey:["admin-relationship-types"],queryFn:async()=>{const{data:b,error:N}=await Z.from("relationship_types").select("*").order("sort_order");if(N)throw N;return b}}),{data:o,isLoading:l}=Ht({queryKey:["admin-action-types"],queryFn:async()=>{const{data:b,error:N}=await Z.from("action_types").select("*").order("sort_order");if(N)throw N;return b}}),{data:i,isLoading:d}=Ht({queryKey:["admin-action-scripts"],queryFn:async()=>{const{data:b,error:N}=await Z.from("action_scripts").select("*, action_type:action_types(*)");if(N)throw N;return b}}),{data:m,isLoading:g}=Ht({queryKey:["admin-touchpoint-plans"],queryFn:async()=>{const{data:b,error:N}=await Z.from("touchpoint_plans").select("*").order("name");if(N)throw N;return b}}),{data:y,isLoading:v}=Ht({queryKey:["admin-popby-items"],queryFn:async()=>{const{data:b,error:N}=await Z.from("popby_items").select("*").is("owner_user_id",null).order("name");if(N)throw N;return b}});return e.jsx(Fr,{title:"Agent OS Control Center",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(Lu,{title:"Agent OS Control Center",description:"Manage InnerCircle settings, scripts, and touchpoint plans"}),e.jsxs(ci,{value:t,onValueChange:r,children:[e.jsxs(ri,{className:"grid w-full grid-cols-9",children:[e.jsxs(Kr,{value:"user-analytics",className:"gap-2",children:[e.jsx(Nc,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Users"})]}),e.jsxs(Kr,{value:"relationship-types",className:"gap-2",children:[e.jsx(ws,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Relationships"})]}),e.jsxs(Kr,{value:"action-types",className:"gap-2",children:[e.jsx(wi,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Actions"})]}),e.jsxs(Kr,{value:"scripts",className:"gap-2",children:[e.jsx(fa,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Scripts"})]}),e.jsxs(Kr,{value:"video-scripts",className:"gap-2",children:[e.jsx(Od,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Video Scripts"})]}),e.jsxs(Kr,{value:"plans",className:"gap-2",children:[e.jsx(Mn,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Plans"})]}),e.jsxs(Kr,{value:"popbys",className:"gap-2",children:[e.jsx(uo,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Popbys"})]}),e.jsxs(Kr,{value:"settings",className:"gap-2",children:[e.jsx(vd,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Settings"})]}),e.jsxs(Kr,{value:"feature-flags",className:"gap-2",children:[e.jsx(gy,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Flags"})]})]}),e.jsx(ms,{value:"user-analytics",className:"mt-6",children:e.jsx(Q3t,{})}),e.jsx(ms,{value:"relationship-types",className:"mt-6",children:e.jsx(e5t,{types:n||[],isLoading:a})}),e.jsx(ms,{value:"action-types",className:"mt-6",children:e.jsx(t5t,{types:o||[],isLoading:l})}),e.jsx(ms,{value:"scripts",className:"mt-6",children:e.jsx(r5t,{scripts:i||[],actionTypes:o||[],isLoading:d})}),e.jsx(ms,{value:"video-scripts",className:"mt-6",children:e.jsx(i5t,{})}),e.jsx(ms,{value:"plans",className:"mt-6",children:e.jsx(s5t,{plans:m||[],actionTypes:o||[],scripts:i||[],isLoading:g})}),e.jsx(ms,{value:"popbys",className:"mt-6",children:e.jsx(a5t,{items:y||[],isLoading:v})}),e.jsx(ms,{value:"settings",className:"mt-6",children:e.jsx(o5t,{})}),e.jsx(ms,{value:"feature-flags",className:"mt-6",children:e.jsx(n5t,{flags:s||[]})})]})]})})}function e5t({types:t,isLoading:r}){const{toast:s}=fi(),n=qr(),[a,o]=E.useState(null),[l,i]=E.useState(!1),d=Jt({mutationFn:async g=>{if(g.id){const{error:y}=await Z.from("relationship_types").update({name:g.name,description:g.description,icon:g.icon}).eq("id",g.id);if(y)throw y}else{const{error:y}=await Z.from("relationship_types").insert([{name:g.name,description:g.description,icon:g.icon,sort_order:t.length}]);if(y)throw y}},onSuccess:()=>{n.invalidateQueries({queryKey:["admin-relationship-types"]}),i(!1),o(null),s({title:"Saved successfully"})},onError:g=>{s({title:"Error",description:g.message,variant:"destructive"})}}),m=async g=>{await Z.from("relationship_types").update({active:!g.active}).eq("id",g.id),n.invalidateQueries({queryKey:["admin-relationship-types"]})};return e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Zt,{children:"Relationship Types"}),e.jsx(Ss,{children:"Define the relationship categories for InnerCircle contacts"})]}),e.jsxs(Q,{onClick:()=>{o(null),i(!0)},children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Type"]})]}),e.jsx(qe,{children:r?e.jsx("div",{className:"flex justify-center py-8",children:e.jsx(Hr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{className:"w-12"}),e.jsx(Ct,{children:"Name"}),e.jsx(Ct,{children:"Description"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{className:"w-24",children:"Actions"})]})}),e.jsx(zn,{children:t.map(g=>e.jsxs(Nr,{children:[e.jsx(dt,{children:e.jsx(xp,{className:"h-4 w-4 text-muted-foreground cursor-grab"})}),e.jsx(dt,{className:"font-medium",children:g.name}),e.jsx(dt,{className:"text-muted-foreground",children:g.description}),e.jsx(dt,{children:e.jsx(xn,{checked:g.active,onCheckedChange:()=>m(g)})}),e.jsx(dt,{children:e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{o(g),i(!0)},children:e.jsx(ei,{className:"h-4 w-4"})})})]},g.id))})]})}),e.jsx(Dr,{open:l,onOpenChange:i,children:e.jsxs(Lr,{children:[e.jsx(Ur,{children:e.jsxs(Br,{children:[a?"Edit":"Add"," Relationship Type"]})}),e.jsxs("form",{onSubmit:g=>{g.preventDefault();const y=new FormData(g.currentTarget);d.mutate({id:a==null?void 0:a.id,name:y.get("name"),description:y.get("description"),icon:y.get("icon")})},children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"name",children:"Name"}),e.jsx(Qe,{id:"name",name:"name",defaultValue:a==null?void 0:a.name,required:!0})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"description",children:"Description"}),e.jsx(Ks,{id:"description",name:"description",defaultValue:(a==null?void 0:a.description)||""})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"icon",children:"Icon"}),e.jsx(Qe,{id:"icon",name:"icon",defaultValue:(a==null?void 0:a.icon)||"",placeholder:"e.g., star, heart, user"})]})]}),e.jsxs(Dn,{className:"mt-4",children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsxs(Q,{type:"submit",disabled:d.isPending,children:[d.isPending&&e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function t5t({types:t,isLoading:r}){const{toast:s}=fi(),n=qr(),[a,o]=E.useState(null),[l,i]=E.useState(!1),d=Jt({mutationFn:async g=>{if(g.id){const{error:y}=await Z.from("action_types").update({name:g.name,description:g.description,icon:g.icon,color:g.color}).eq("id",g.id);if(y)throw y}else{const{error:y}=await Z.from("action_types").insert([{name:g.name,description:g.description,icon:g.icon,color:g.color,sort_order:t.length}]);if(y)throw y}},onSuccess:()=>{n.invalidateQueries({queryKey:["admin-action-types"]}),i(!1),o(null),s({title:"Saved successfully"})},onError:g=>{s({title:"Error",description:g.message,variant:"destructive"})}}),m=async g=>{await Z.from("action_types").update({active:!g.active}).eq("id",g.id),n.invalidateQueries({queryKey:["admin-action-types"]})};return e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Zt,{children:"Action Types"}),e.jsx(Ss,{children:"Define the types of touchpoint actions agents can take"})]}),e.jsxs(Q,{onClick:()=>{o(null),i(!0)},children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Action"]})]}),e.jsx(qe,{children:r?e.jsx("div",{className:"flex justify-center py-8",children:e.jsx(Hr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Name"}),e.jsx(Ct,{children:"Description"}),e.jsx(Ct,{children:"Color"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{className:"w-24",children:"Actions"})]})}),e.jsx(zn,{children:t.map(g=>e.jsxs(Nr,{children:[e.jsx(dt,{className:"font-medium",children:g.name}),e.jsx(dt,{className:"text-muted-foreground",children:g.description}),e.jsx(dt,{children:g.color&&e.jsx("div",{className:"w-6 h-6 rounded",style:{backgroundColor:g.color}})}),e.jsx(dt,{children:e.jsx(xn,{checked:g.active,onCheckedChange:()=>m(g)})}),e.jsx(dt,{children:e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{o(g),i(!0)},children:e.jsx(ei,{className:"h-4 w-4"})})})]},g.id))})]})}),e.jsx(Dr,{open:l,onOpenChange:i,children:e.jsxs(Lr,{children:[e.jsx(Ur,{children:e.jsxs(Br,{children:[a?"Edit":"Add"," Action Type"]})}),e.jsxs("form",{onSubmit:g=>{g.preventDefault();const y=new FormData(g.currentTarget);d.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:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"name",children:"Name"}),e.jsx(Qe,{id:"name",name:"name",defaultValue:a==null?void 0:a.name,required:!0})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"description",children:"Description"}),e.jsx(Ks,{id:"description",name:"description",defaultValue:(a==null?void 0:a.description)||""})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"icon",children:"Icon"}),e.jsx(Qe,{id:"icon",name:"icon",defaultValue:(a==null?void 0:a.icon)||"",placeholder:"e.g., phone, message"})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"color",children:"Color"}),e.jsx(Qe,{id:"color",name:"color",type:"color",defaultValue:(a==null?void 0:a.color)||"#6366f1"})]})]}),e.jsxs(Dn,{className:"mt-4",children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsxs(Q,{type:"submit",disabled:d.isPending,children:[d.isPending&&e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function r5t({scripts:t,actionTypes:r,isLoading:s}){const{toast:n}=fi(),a=qr(),[o,l]=E.useState(null),[i,d]=E.useState(!1),m=Jt({mutationFn:async y=>{if(y.id){const{error:v}=await Z.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(v)throw v}else{const{error:v}=await Z.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(v)throw v}},onSuccess:()=>{a.invalidateQueries({queryKey:["admin-action-scripts"]}),d(!1),l(null),n({title:"Saved successfully"})},onError:y=>{n({title:"Error",description:y.message,variant:"destructive"})}}),g=Jt({mutationFn:async y=>{const{error:v}=await Z.from("action_scripts").delete().eq("id",y);if(v)throw v},onSuccess:()=>{a.invalidateQueries({queryKey:["admin-action-scripts"]}),n({title:"Deleted successfully"})}});return e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Zt,{children:"Script Library"}),e.jsx(Ss,{children:"Create and manage scripts for each action type"})]}),e.jsxs(Q,{onClick:()=>{l(null),d(!0)},children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Script"]})]}),e.jsx(qe,{children:s?e.jsx("div",{className:"flex justify-center py-8",children:e.jsx(Hr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Title"}),e.jsx(Ct,{children:"Action Type"}),e.jsx(Ct,{children:"Tone"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{className:"w-24",children:"Actions"})]})}),e.jsx(zn,{children:t.map(y=>{var v;return e.jsxs(Nr,{children:[e.jsx(dt,{className:"font-medium",children:y.title}),e.jsx(dt,{children:e.jsx(bt,{variant:"outline",children:((v=y.action_type)==null?void 0:v.name)||"Unknown"})}),e.jsx(dt,{className:"text-muted-foreground",children:y.tone}),e.jsx(dt,{children:e.jsx(bt,{variant:y.active?"default":"secondary",children:y.active?"Active":"Inactive"})}),e.jsxs(dt,{className:"flex gap-1",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{l(y),d(!0)},children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>g.mutate(y.id),children:e.jsx(Rs,{className:"h-4 w-4 text-destructive"})})]})]},y.id)})})]})}),e.jsx(Dr,{open:i,onOpenChange:d,children:e.jsxs(Lr,{className:"max-w-2xl",children:[e.jsx(Ur,{children:e.jsxs(Br,{children:[o?"Edit":"Add"," Script"]})}),e.jsxs("form",{onSubmit:y=>{y.preventDefault();const v=new FormData(y.currentTarget);m.mutate({id:o==null?void 0:o.id,title:v.get("title"),action_type_id:v.get("action_type_id"),tone:v.get("tone"),script_body:v.get("script_body"),active:!0})},children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"title",children:"Title"}),e.jsx(Qe,{id:"title",name:"title",defaultValue:o==null?void 0:o.title,required:!0})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"action_type_id",children:"Action Type"}),e.jsxs(ds,{name:"action_type_id",defaultValue:o==null?void 0:o.action_type_id,children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Select action type"})}),e.jsx(cs,{children:r.map(y=>e.jsx(Ut,{value:y.id,children:y.name},y.id))})]})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"tone",children:"Tone (optional)"}),e.jsx(Qe,{id:"tone",name:"tone",defaultValue:(o==null?void 0:o.tone)||"",placeholder:"e.g., Friendly, Professional, Casual"})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"script_body",children:"Script Body"}),e.jsx(Ks,{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...`})]})]}),e.jsxs(Dn,{className:"mt-4",children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>d(!1),children:"Cancel"}),e.jsxs(Q,{type:"submit",disabled:m.isPending,children:[m.isPending&&e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function s5t({plans:t,actionTypes:r,scripts:s,isLoading:n}){const{toast:a}=fi(),o=qr(),[l,i]=E.useState(null),[d,m]=E.useState(!1),[g,y]=E.useState(null),[v,b]=E.useState(!1),[N,j]=E.useState(null),[S,A]=E.useState(null),{data:M}=Ht({queryKey:["plan-items",g],queryFn:async()=>{if(!g)return[];const{data:W,error:X}=await Z.from("touchpoint_plan_items").select("*").eq("plan_id",g).order("month_number");if(X)throw X;return W},enabled:!!g}),I=Jt({mutationFn:async W=>{if(W.id){const{error:X}=await Z.from("touchpoint_plans").update({name:W.name,description:W.description,active:W.active}).eq("id",W.id);if(X)throw X}else{const{error:X}=await Z.from("touchpoint_plans").insert([{name:W.name,description:W.description,active:!0}]);if(X)throw X}},onSuccess:()=>{o.invalidateQueries({queryKey:["admin-touchpoint-plans"]}),m(!1),i(null),a({title:"Saved successfully"})},onError:W=>{a({title:"Error",description:W.message,variant:"destructive"})}}),F=Jt({mutationFn:async W=>{if(W.id){const{error:X}=await Z.from("touchpoint_plan_items").update({action_type_id:W.action_type_id,default_script_id:W.default_script_id,notes:W.notes}).eq("id",W.id);if(X)throw X}else{const{error:X}=await Z.from("touchpoint_plan_items").insert([{plan_id:W.plan_id,month_number:W.month_number,action_type_id:W.action_type_id,default_script_id:W.default_script_id,notes:W.notes}]);if(X)throw X}},onSuccess:()=>{o.invalidateQueries({queryKey:["plan-items",g]}),a({title:"Item saved"})}}),O=Jt({mutationFn:async W=>{const{error:X}=await Z.from("touchpoint_plan_items").delete().eq("id",W);if(X)throw X},onSuccess:()=>{o.invalidateQueries({queryKey:["plan-items",g]})}}),B=Jt({mutationFn:async W=>{const{data:X,error:se}=await Z.from("action_scripts").insert([{...W,active:!0}]).select().single();if(se)throw se;return X},onSuccess:async W=>{o.invalidateQueries({queryKey:["admin-action-scripts"]}),N&&await F.mutateAsync({id:N.itemId,plan_id:g,month_number:N.month,action_type_id:N.actionTypeId,default_script_id:W.id}),b(!1),j(null),a({title:"Script created and assigned"})},onError:W=>{a({title:"Error",description:W.message,variant:"destructive"})}}),$=(W,X,se)=>{j({month:W,actionTypeId:X,itemId:se}),b(!0)},H=W=>s.find(X=>X.id===W);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Zt,{children:"Touchpoint Plans"}),e.jsx(Ss,{children:"Create annual touchpoint plans that agents can apply to their contacts"})]}),e.jsxs(Q,{onClick:()=>{i(null),m(!0)},children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Plan"]})]}),e.jsx(qe,{children:n?e.jsx("div",{className:"flex justify-center py-8",children:e.jsx(Hr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:t.map(W=>e.jsxs(ze,{className:`cursor-pointer transition-colors ${g===W.id?"border-primary":""}`,onClick:()=>y(W.id),children:[e.jsx(Wt,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Zt,{className:"text-base",children:W.name}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:X=>{X.stopPropagation(),i(W),m(!0)},children:e.jsx(ei,{className:"h-4 w-4"})})]})}),e.jsxs(qe,{children:[e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:W.description}),e.jsx(bt,{variant:W.active?"default":"secondary",className:"mt-2",children:W.active?"Active":"Inactive"})]})]},W.id))})})]}),g&&e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsx(Zt,{children:"Plan Schedule"}),e.jsx(Ss,{children:"Configure the monthly touchpoint schedule. Select an action type for each month, then assign or create a script."})]}),e.jsx(qe,{children:e.jsx("div",{className:"grid gap-3",children:Array.from({length:12},(W,X)=>X+1).map(W=>{const X=M==null?void 0:M.find(le=>le.month_number===W),se=X!=null&&X.default_script_id?H(X.default_script_id):null,ae=s.filter(le=>le.action_type_id===(X==null?void 0:X.action_type_id)&&le.active);return e.jsxs("div",{className:"p-4 border rounded-lg space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"w-20 font-medium text-sm",children:["Month ",W]}),e.jsxs(ds,{value:(X==null?void 0:X.action_type_id)||"none",onValueChange:le=>{le==="none"&&X?O.mutate(X.id):le!=="none"&&F.mutate({id:X==null?void 0:X.id,plan_id:g,month_number:W,action_type_id:le,default_script_id:null})},children:[e.jsx(ls,{className:"w-40",children:e.jsx(us,{placeholder:"No action"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"none",children:"No action"}),r.filter(le=>le.active).map(le=>e.jsx(Ut,{value:le.id,children:e.jsxs("span",{className:"flex items-center gap-2",children:[le.color&&e.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:le.color}}),le.name]})},le.id))]})]}),X&&e.jsxs(e.Fragment,{children:[e.jsxs(ds,{value:X.default_script_id||"none",onValueChange:le=>{A(null),F.mutate({id:X.id,default_script_id:le==="none"?null:le})},children:[e.jsx(ls,{className:"w-56",children:e.jsx(us,{placeholder:"Select script"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"none",children:"No default script"}),ae.map(le=>e.jsxs(Ut,{value:le.id,children:[le.title," ",le.tone&&`(${le.tone})`]},le.id))]})]}),e.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>$(W,X.action_type_id,X.id),children:[e.jsx(gs,{className:"h-3 w-3 mr-1"}),"New Script"]}),se&&e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>A((S==null?void 0:S.id)===se.id?null:se),children:(S==null?void 0:S.id)===se.id?"Hide":"Preview"})]})]}),S&&(X==null?void 0:X.default_script_id)===S.id&&e.jsxs("div",{className:"ml-24 p-3 bg-muted rounded-lg text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(bt,{variant:"outline",children:S.title}),S.tone&&e.jsx(bt,{variant:"secondary",children:S.tone})]}),e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:S.script_body})]})]},W)})})})]}),e.jsx(Dr,{open:d,onOpenChange:m,children:e.jsxs(Lr,{children:[e.jsx(Ur,{children:e.jsxs(Br,{children:[l?"Edit":"Add"," Touchpoint Plan"]})}),e.jsxs("form",{onSubmit:W=>{W.preventDefault();const X=new FormData(W.currentTarget);I.mutate({id:l==null?void 0:l.id,name:X.get("name"),description:X.get("description"),active:!0})},children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"name",children:"Name"}),e.jsx(Qe,{id:"name",name:"name",defaultValue:l==null?void 0:l.name,required:!0})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"description",children:"Description"}),e.jsx(Ks,{id:"description",name:"description",defaultValue:(l==null?void 0:l.description)||"",rows:3})]})]}),e.jsxs(Dn,{className:"mt-4",children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>m(!1),children:"Cancel"}),e.jsxs(Q,{type:"submit",disabled:I.isPending,children:[I.isPending&&e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})}),e.jsx(Dr,{open:v,onOpenChange:b,children:e.jsxs(Lr,{className:"max-w-2xl",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Create New Script"}),e.jsxs(Gs,{children:["Create a script for Month ",N==null?void 0:N.month,". Use ","{{FirstName}}",", ","{{LastName}}",", and ","{{AgentName}}"," as placeholders."]})]}),e.jsxs("form",{onSubmit:W=>{W.preventDefault();const X=new FormData(W.currentTarget);B.mutate({title:X.get("title"),action_type_id:N.actionTypeId,tone:X.get("tone"),script_body:X.get("script_body")})},children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"script_title",children:"Title"}),e.jsx(Qe,{id:"script_title",name:"title",placeholder:"e.g., Warm Check-In",required:!0})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"script_tone",children:"Tone"}),e.jsx(Qe,{id:"script_tone",name:"tone",placeholder:"e.g., Friendly, Professional"})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"script_body",children:"Script Body"}),e.jsx(Ks,{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..."})]})]}),e.jsxs(Dn,{className:"mt-4",children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>b(!1),children:"Cancel"}),e.jsxs(Q,{type:"submit",disabled:B.isPending,children:[B.isPending&&e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),"Create & Assign"]})]})]})]})})]})}function n5t({flags:t}){const{toast:r}=fi(),s=qr(),n=async(a,o)=>{const{error:l}=await Z.from("feature_flags").update({...o,updated_at:new Date().toISOString()}).eq("id",a.id);l?r({title:"Error",description:l.message,variant:"destructive"}):(s.invalidateQueries({queryKey:["admin-feature-flags"]}),r({title:"Flag updated"}))};return e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsx(Zt,{children:"Feature Flags"}),e.jsx(Ss,{children:"Control which features are enabled for members"})]}),e.jsx(qe,{children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Flag"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{children:"Notes"}),e.jsx(Ct,{children:"Last Updated"})]})}),e.jsx(zn,{children:t.map(a=>e.jsxs(Nr,{children:[e.jsx(dt,{className:"font-mono text-sm",children:a.key}),e.jsx(dt,{children:e.jsx(xn,{checked:a.enabled,onCheckedChange:o=>n(a,{enabled:o})})}),e.jsx(dt,{children:e.jsx(Qe,{defaultValue:a.notes||"",placeholder:"Add notes...",className:"max-w-xs",onBlur:o=>{o.target.value!==a.notes&&n(a,{notes:o.target.value})}})}),e.jsx(dt,{className:"text-muted-foreground text-sm",children:new Date(a.updated_at).toLocaleDateString()})]},a.id))})]})})]})}function a5t({items:t,isLoading:r}){const{toast:s}=fi(),n=qr(),[a,o]=E.useState(null),[l,i]=E.useState(!1),d=Jt({mutationFn:async y=>{if(y.id){const{error:v}=await Z.from("popby_items").update({name:y.name,description:y.description}).eq("id",y.id);if(v)throw v}else{const{error:v}=await Z.from("popby_items").insert([{name:y.name,description:y.description,owner_user_id:null}]);if(v)throw v}},onSuccess:()=>{n.invalidateQueries({queryKey:["admin-popby-items"]}),n.invalidateQueries({queryKey:["popby-items"]}),i(!1),o(null),s({title:"Saved successfully"})},onError:y=>{s({title:"Error",description:y.message,variant:"destructive"})}}),m=async y=>{await Z.from("popby_items").update({is_active:!y.is_active}).eq("id",y.id),n.invalidateQueries({queryKey:["admin-popby-items"]}),n.invalidateQueries({queryKey:["popby-items"]})},g=async y=>{await Z.from("popby_items").delete().eq("id",y),n.invalidateQueries({queryKey:["admin-popby-items"]}),n.invalidateQueries({queryKey:["popby-items"]}),s({title:"Deleted successfully"})};return e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Zt,{children:"Popby Ideas"}),e.jsx(Ss,{children:"Manage global popby ideas that all agents can see"})]}),e.jsxs(Q,{onClick:()=>{o(null),i(!0)},children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Popby Idea"]})]}),e.jsx(qe,{children:r?e.jsx("div",{className:"flex justify-center py-8",children:e.jsx(Hr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):t.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(uo,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"No popby ideas yet. Add your first one!"})]}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Name"}),e.jsx(Ct,{children:"Description"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{className:"w-24",children:"Actions"})]})}),e.jsx(zn,{children:t.map(y=>e.jsxs(Nr,{children:[e.jsx(dt,{className:"font-medium",children:y.name}),e.jsx(dt,{className:"text-muted-foreground",children:y.description}),e.jsx(dt,{children:e.jsx(xn,{checked:y.is_active,onCheckedChange:()=>m(y)})}),e.jsx(dt,{children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{o(y),i(!0)},children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>g(y.id),children:e.jsx(Rs,{className:"h-4 w-4 text-destructive"})})]})})]},y.id))})]})}),e.jsx(Dr,{open:l,onOpenChange:i,children:e.jsxs(Lr,{children:[e.jsx(Ur,{children:e.jsxs(Br,{children:[a?"Edit":"Add"," Popby Idea"]})}),e.jsxs("form",{onSubmit:y=>{y.preventDefault();const v=new FormData(y.currentTarget);d.mutate({id:a==null?void 0:a.id,name:v.get("name"),description:v.get("description")})},children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"name",children:"Name"}),e.jsx(Qe,{id:"name",name:"name",defaultValue:a==null?void 0:a.name,required:!0,placeholder:"e.g., Homemade Cookies"})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"description",children:"Description"}),e.jsx(Ks,{id:"description",name:"description",defaultValue:(a==null?void 0:a.description)||"",placeholder:"Brief description of the popby idea..."})]})]}),e.jsxs(Dn,{className:"mt-4",children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsxs(Q,{type:"submit",disabled:d.isPending,children:[d.isPending&&e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function i5t(){var b;const{toast:t}=fi(),r=qr(),[s,n]=E.useState(null),[a,o]=E.useState(!1),{data:l,isLoading:i}=Ht({queryKey:["admin-video-script-categories"],queryFn:async()=>{const{data:N,error:j}=await Z.from("video_script_categories").select("*").order("sort_order");if(j)throw j;return N}}),{data:d,isLoading:m}=Ht({queryKey:["admin-video-scripts"],queryFn:async()=>{const{data:N,error:j}=await Z.from("video_scripts").select("*, category:video_script_categories(*)").order("title");if(j)throw j;return N}}),g=Jt({mutationFn:async N=>{var j,S;if(N.id){const{error:A}=await Z.from("video_scripts").update({title:N.title,script_text:N.script_text,category_id:N.category_id,tags:((j=N.tags)==null?void 0:j.split(",").map(M=>M.trim()).filter(Boolean))||[]}).eq("id",N.id);if(A)throw A}else{const{error:A}=await Z.from("video_scripts").insert([{title:N.title,script_text:N.script_text,category_id:N.category_id||null,tags:((S=N.tags)==null?void 0:S.split(",").map(M=>M.trim()).filter(Boolean))||[]}]);if(A)throw A}},onSuccess:()=>{r.invalidateQueries({queryKey:["admin-video-scripts"]}),o(!1),n(null),t({title:"Video script saved!"})},onError:N=>t({title:"Error",description:N.message,variant:"destructive"})}),y=async N=>{await Z.from("video_scripts").update({is_active:!N.is_active}).eq("id",N.id),r.invalidateQueries({queryKey:["admin-video-scripts"]})},v=async N=>{confirm("Delete this video script?")&&(await Z.from("video_scripts").delete().eq("id",N),r.invalidateQueries({queryKey:["admin-video-scripts"]}),t({title:"Script deleted"}))};return e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Zt,{children:"Video Scripts"}),e.jsx(Ss,{children:"Manage teleprompter scripts for Quick Video Touch"})]}),e.jsxs(Q,{onClick:()=>{n(null),o(!0)},children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Script"]})]}),e.jsx(qe,{children:m?e.jsx("div",{className:"flex justify-center py-8",children:e.jsx(Hr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Title"}),e.jsx(Ct,{children:"Category"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{className:"w-24",children:"Actions"})]})}),e.jsx(zn,{children:d==null?void 0:d.map(N=>{var j;return e.jsxs(Nr,{children:[e.jsx(dt,{className:"font-medium",children:N.title}),e.jsx(dt,{className:"text-muted-foreground",children:((j=N.category)==null?void 0:j.name)||"Uncategorized"}),e.jsx(dt,{children:e.jsx(xn,{checked:N.is_active,onCheckedChange:()=>y(N)})}),e.jsxs(dt,{className:"flex gap-1",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{n(N),o(!0)},children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>v(N.id),children:e.jsx(Rs,{className:"h-4 w-4"})})]})]},N.id)})})]})}),e.jsx(Dr,{open:a,onOpenChange:o,children:e.jsxs(Lr,{className:"max-w-2xl",children:[e.jsx(Ur,{children:e.jsxs(Br,{children:[s?"Edit":"Add"," Video Script"]})}),e.jsxs("form",{onSubmit:N=>{N.preventDefault();const j=new FormData(N.currentTarget);g.mutate({id:s==null?void 0:s.id,title:j.get("title"),script_text:j.get("script_text"),category_id:j.get("category_id")||null,tags:j.get("tags")})},children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"title",children:"Title"}),e.jsx(Qe,{id:"title",name:"title",defaultValue:s==null?void 0:s.title,required:!0})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"category_id",children:"Category"}),e.jsxs(ds,{name:"category_id",defaultValue:(s==null?void 0:s.category_id)||"",children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Select category"})}),e.jsx(cs,{children:l==null?void 0:l.map(N=>e.jsx(Ut,{value:N.id,children:N.name},N.id))})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"script_text",children:"Script Text"}),e.jsx(Ks,{id:"script_text",name:"script_text",defaultValue:s==null?void 0:s.script_text,rows:6,required:!0,placeholder:"Enter the teleprompter script..."})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"tags",children:"Tags (comma-separated)"}),e.jsx(Qe,{id:"tags",name:"tags",defaultValue:((b=s==null?void 0:s.tags)==null?void 0:b.join(", "))||"",placeholder:"birthday, follow-up, thank-you"})]})]}),e.jsxs(Dn,{className:"mt-4",children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),e.jsxs(Q,{type:"submit",disabled:g.isPending,children:[g.isPending&&e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function o5t(){const{toast:t}=fi(),[r,s]=E.useState(""),[n,a]=E.useState(!0),[o,l]=E.useState(!1);E.useEffect(()=>{(async()=>{a(!0);try{const{data:m}=await Z.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();m!=null&&m.value&&s(m.value)}catch(m){console.error("Error fetching settings:",m)}a(!1)})()},[]);const i=async()=>{l(!0);try{await Z.from("settings").upsert({key:"mapbox_public_token",value:r.trim()}),t({title:"Mapbox token saved!"})}catch{t({title:"Error saving token",variant:"destructive"})}l(!1)};return n?e.jsx(ze,{children:e.jsx(qe,{className:"flex justify-center py-8",children:e.jsx(Hr,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}):e.jsx("div",{className:"space-y-6",children:e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(eo,{className:"h-5 w-5"}),"Popby Map Settings"]}),e.jsx(Ss,{children:"Configure the map feature for popbys"})]}),e.jsxs(qe,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"mapbox-token",children:"Mapbox Public Token"}),e.jsx(Qe,{id:"mapbox-token",placeholder:"pk.eyJ1I...",value:r,onChange:d=>s(d.target.value)}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your token at"," ",e.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."]})]}),e.jsxs(Q,{onClick:i,disabled:o,children:[o&&e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Token"]}),r&&e.jsx(bt,{variant:"secondary",className:"ml-2",children:"Token configured"})]})]})})}const l5t=()=>{const[t,r]=E.useState(""),[s,n]=E.useState("grid"),a=Ws(),{data:o=[],isLoading:l}=Ht({queryKey:["additional-services"],queryFn:async()=>{const{data:d,error:m}=await Z.from("additional_services").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(m)throw m;return d}}),i=o.filter(d=>{var g;return d.name.toLowerCase().includes(t.toLowerCase())||((g=d.description)==null?void 0:g.toLowerCase().includes(t.toLowerCase()))});return e.jsx(Fr,{title:"Additional Services",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Additional Services"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Explore our additional services and offerings"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search services...",value:t,onChange:d=>r(d.target.value),className:"pl-9"})]}),e.jsxs("div",{className:"flex gap-2",children:[t&&e.jsx(Q,{variant:"outline",size:"sm",onClick:()=>r(""),children:"Clear"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(Q,{variant:s==="grid"?"secondary":"outline",size:"icon",onClick:()=>n("grid"),className:"rounded-full",children:e.jsx(yp,{className:"h-4 w-4"})}),e.jsx(Q,{variant:s==="list"?"secondary":"outline",size:"icon",onClick:()=>n("list"),className:"rounded-full",children:e.jsx(vp,{className:"h-4 w-4"})})]})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[i.length," service",i.length!==1?"s":""," found"]}),l&&e.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(4)].map((d,m)=>e.jsx(ze,{children:e.jsxs(qe,{className:"p-4",children:[e.jsx(fr,{className:"aspect-[3/2] w-full rounded-lg mb-4"}),e.jsx(fr,{className:"h-5 w-3/4 mb-2"}),e.jsx(fr,{className:"h-4 w-full mb-4"})]})},m))}),!l&&i.length===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"text-muted-foreground mb-4",children:t?"No services match your search":"No additional services available yet"}),t&&e.jsx(Q,{variant:"outline",onClick:()=>r(""),children:"Clear Search"})]}),!l&&i.length>0&&e.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(d=>e.jsxs(ze,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${s==="list"?"flex flex-row":""}`,onClick:()=>a(`/additional-services/${d.id}`),children:[e.jsx("div",{className:`relative overflow-hidden bg-muted ${s==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:d.preview_image_url?e.jsx("img",{src:d.preview_image_url,alt:d.name,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:e.jsx(An,{className:"h-8 w-8"})})}),e.jsxs(qe,{className:`p-4 flex flex-col ${s==="list"?"flex-1":""}`,children:[e.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:d.name}),d.description&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 flex-1",children:kne(d.description)})]})]},d.id))})]})})},c5t=()=>{const{serviceId:t}=Xl(),r=Ws(),{data:s,isLoading:n}=Ht({queryKey:["additional-service",t],queryFn:async()=>{const{data:a,error:o}=await Z.from("additional_services").select("*").eq("id",t).eq("is_published",!0).single();if(o)throw o;return a},enabled:!!t});return n?e.jsx(Fr,{title:"Loading...",children:e.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[e.jsx(fr,{className:"h-8 w-48"}),e.jsx(fr,{className:"h-64 w-full rounded-lg"}),e.jsx(fr,{className:"h-24 w-full"})]})}):s?e.jsx(Fr,{title:s.name,children:e.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[e.jsxs(Q,{variant:"ghost",onClick:()=>r("/additional-services"),className:"gap-2",children:[e.jsx(_i,{className:"h-4 w-4"}),"Back to Services"]}),e.jsx(ze,{className:"overflow-hidden",children:e.jsx("div",{className:"relative bg-muted",children:s.preview_image_url?e.jsx("img",{src:s.preview_image_url,alt:s.name,className:"w-full h-auto max-h-[500px] object-contain mx-auto"}):e.jsx("div",{className:"w-full h-64 flex items-center justify-center text-muted-foreground",children:e.jsx(An,{className:"h-16 w-16"})})})}),e.jsx(ze,{children:e.jsxs(qe,{className:"p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground mb-2",children:s.name}),e.jsxs("div",{className:"flex items-center text-sm text-muted-foreground",children:[e.jsx(Mn,{className:"h-4 w-4 mr-1"}),"Published ",Xr(new Date(s.publish_date),"MMMM d, yyyy")]})]}),s.description&&e.jsx("div",{className:"prose prose-sm max-w-none text-muted-foreground [&_a]:text-primary [&_a]:underline",dangerouslySetInnerHTML:{__html:s.description}}),e.jsx("div",{className:"pt-4 border-t",children:e.jsxs(Q,{size:"lg",className:"gap-2",onClick:()=>window.open(s.signup_link_url,"_blank"),children:[e.jsx(En,{className:"h-5 w-5"}),"Sign Up Now"]})})]})})]})}):e.jsx(Fr,{title:"Not Found",children:e.jsxs("div",{className:"max-w-4xl mx-auto text-center py-12",children:[e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-4",children:"Service Not Found"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"The service you're looking for doesn't exist or has been removed."}),e.jsxs(Q,{onClick:()=>r("/additional-services"),children:[e.jsx(_i,{className:"h-4 w-4 mr-2"}),"Back to Services"]})]})})},MT=[{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 d5t(){const[t,r]=E.useState(MT[0].id),s=MT.find(n=>n.id===t)||MT[0];return e.jsx(Fr,{title:"AI Toolkit",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:e.jsx(OS,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"AI Toolkit"}),e.jsx("p",{className:"text-muted-foreground",children:"Powerful AI tools to boost your real estate business"})]})]}),e.jsx("div",{className:"md:hidden",children:e.jsxs(ds,{value:t,onValueChange:r,children:[e.jsx(ls,{className:"w-full",children:e.jsx(us,{placeholder:"Select a tool"})}),e.jsx(cs,{children:MT.map(n=>e.jsx(Ut,{value:n.id,children:n.name},n.id))})]})}),e.jsx("div",{className:"hidden md:block",children:e.jsx(ci,{value:t,onValueChange:r,className:"w-full",children:e.jsx(ri,{className:"w-full flex-wrap h-auto gap-1 bg-muted p-1",children:MT.map(n=>e.jsx(Kr,{value:n.id,className:"flex-1 min-w-[150px] text-xs lg:text-sm whitespace-normal h-auto py-2",children:n.name},n.id))})})}),e.jsx("div",{className:"flex justify-center",children:e.jsx("div",{className:"w-full max-w-[700px]",dangerouslySetInnerHTML:{__html:s.iframe}})})]})})}const SCe="agent-os-onboarding-completed",q8=[{icon:Kg,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:Qg,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:ws,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:Ff,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:uo,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:Nc,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"]}],u5t=()=>{const[t,r]=E.useState(!1),[s,n]=E.useState(0),[a,o]=E.useState(!1);E.useEffect(()=>{if(!localStorage.getItem(SCe)){const N=setTimeout(()=>r(!0),500);return()=>clearTimeout(N)}},[]);const l=()=>{s{n(s+1),o(!1)},150)):d()},i=()=>{d()},d=()=>{localStorage.setItem(SCe,"true"),r(!1)},m=q8[s],g=m.icon,y=s===q8.length-1,v=b=>{b||d(),r(b)};return e.jsx(Dr,{open:t,onOpenChange:v,children:e.jsxs(Lr,{className:"sm:max-w-lg overflow-hidden p-0 gap-0",children:[e.jsxs("div",{className:`relative bg-gradient-to-br ${m.bgGradient} p-8 pb-12 transition-all duration-500`,children:[e.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[e.jsx("div",{className:"absolute -top-4 -right-4 w-32 h-32 bg-white/10 rounded-full blur-2xl animate-pulse"}),e.jsx("div",{className:"absolute -bottom-8 -left-8 w-40 h-40 bg-white/10 rounded-full blur-3xl animate-pulse",style:{animationDelay:"1s"}}),e.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"})]}),e.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:[e.jsx("div",{className:"absolute inset-0 bg-white/20 rounded-2xl blur-xl"}),e.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:e.jsx(g,{className:`h-10 w-10 ${m.iconColor} drop-shadow-lg`})})]}),s===0&&e.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:[e.jsx(An,{className:"h-3 w-3"}),"Beta"]})]}),e.jsxs("div",{className:"p-6 pt-4",children:[e.jsxs(Ur,{className:"text-center sm:text-center pb-2",children:[e.jsx(Br,{className:`text-2xl font-bold transition-all duration-300 ${a?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:m.title}),e.jsx(Gs,{className:`text-base pt-2 transition-all duration-300 delay-75 ${a?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:m.description})]}),m.highlights&&e.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:m.highlights.map((b,N)=>e.jsxs("div",{className:"flex items-center gap-3 group",style:{transitionDelay:`${150+N*50}ms`},children:[e.jsx("div",{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-gradient-to-br ${m.bgGradient} shadow-sm`,children:e.jsx(li,{className:"h-3.5 w-3.5 text-white"})}),e.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors",children:b})]},N))}),e.jsx("div",{className:"flex justify-center gap-2 py-4",children:q8.map((b,N)=>e.jsx("button",{onClick:()=>{N!==s&&(o(!0),setTimeout(()=>{n(N),o(!1)},150))},className:`h-2 rounded-full transition-all duration-300 ${N===s?"w-8 bg-gradient-to-r "+m.bgGradient:N{const{user:t}=Gr();return Ht({queryKey:["contact-snoozes",t==null?void 0:t.id],queryFn:async()=>{const{data:r,error:s}=await Z.from("contact_snoozes").select("*").gte("snoozed_until",new Date().toISOString());if(s)throw s;return r},enabled:!!t})},m5t=()=>{const t=qr(),{user:r}=Gr();return Jt({mutationFn:async({contactId:s,days:n})=>{if(!(r!=null&&r.id))throw new Error("Not authenticated");const a=sc(new Date,n);await Z.from("contact_snoozes").delete().eq("contact_id",s);const{error:o}=await Z.from("contact_snoozes").insert({contact_id:s,owner_user_id:r.id,snoozed_until:a.toISOString()});if(o)throw o},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-snoozes"]}),t.invalidateQueries({queryKey:["today-actions"]}),t.invalidateQueries({queryKey:["popby-logs"]}),Jn({title:"Touch snoozed!",description:"Contact has been snoozed."})},onError:s=>{Jn({title:"Error snoozing contact",description:s.message,variant:"destructive"})}})},p5t=()=>{const t=qr();return Jt({mutationFn:async r=>{const{error:s}=await Z.from("contact_snoozes").delete().eq("contact_id",r);if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-snoozes"]}),Jn({title:"Snooze cancelled"})},onError:r=>{Jn({title:"Error cancelling snooze",description:r.message,variant:"destructive"})}})},f5t=[{label:"1 week",days:7},{label:"2 weeks",days:14},{label:"1 month",days:30}];function Wae({open:t,onOpenChange:r,contactId:s,contactName:n}){const[a,o]=E.useState(null),l=m5t(),i=async()=>{a&&(await l.mutateAsync({contactId:s,days:a}),o(null),r(!1))},d=m=>Xr(sc(new Date,m),"MMM d, yyyy");return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"sm:max-w-md",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{className:"flex items-center gap-2",children:[e.jsx(Ea,{className:"h-5 w-5"}),"Snooze Touch"]}),e.jsxs(Gs,{children:["Postpone the next scheduled touch for ",n,". Select how long to snooze."]})]}),e.jsx("div",{className:"space-y-3 py-4",children:f5t.map(m=>e.jsxs("button",{type:"button",onClick:()=>o(m.days),className:qt("w-full flex items-center justify-between p-3 rounded-lg border transition-colors",a===m.days?"border-primary bg-primary/5":"border-border hover:border-primary/50 hover:bg-accent/50"),children:[e.jsx("span",{className:"font-medium",children:m.label}),e.jsxs("span",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(Mn,{className:"h-3.5 w-3.5"}),"Until ",d(m.days)]})]},m.days))}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(Q,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsx(Q,{onClick:i,disabled:!a||l.isPending,children:l.isPending?"Snoozing...":"Snooze Touch"})]})]})})}const g5t={Crown:ih,FileText:fa,Users:ws,Globe:Gg,Star:Ln,Phone:wi,MessageSquare:$o,PenTool:Kj,Video:ya,Gift:uo};function x5t({actions:t,onMarkComplete:r,onViewScript:s,isLoading:n,buildSmsLink:a,buildEmailLink:o,onGmailCompose:l}){const i=Ws(),[d,m]=E.useState("name"),[g,y]=E.useState("asc"),[v,b]=E.useState(null),[N,j]=E.useState(""),S=O=>{d===O?y(B=>B==="asc"?"desc":"asc"):(m(O),y("asc"))},A=E.useMemo(()=>[...t].sort((O,B)=>{var H,W;let $=0;switch(d){case"name":{const X=`${O.contact.first_name} ${O.contact.last_name||""}`.toLowerCase(),se=`${B.contact.first_name} ${B.contact.last_name||""}`.toLowerCase();$=X.localeCompare(se);break}case"relationship_type":$=(O.relationshipTypeName||"").localeCompare(B.relationshipTypeName||"");break;case"action_type":$=(((H=O.actionType)==null?void 0:H.name)||"").localeCompare(((W=B.actionType)==null?void 0:W.name)||"");break;case"last_touch":$=(O.monthNumber||0)-(B.monthNumber||0);break}return g==="asc"?$:-$}),[t,d,g]),M=O=>g5t[O||"Phone"]||wi,I=({field:O,children:B})=>e.jsxs(Q,{variant:"ghost",size:"sm",className:"h-8 -ml-3 font-medium",onClick:()=>S(O),children:[B,d===O?g==="asc"?e.jsx(fp,{className:"ml-2 h-4 w-4"}):e.jsx(my,{className:"ml-2 h-4 w-4"}):e.jsx(Of,{className:"ml-2 h-4 w-4 opacity-50"})]}),F=(O,B,$)=>{b(O),j(`${B} ${$||""}`.trim())};return t.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx("p",{children:"No actions scheduled for today."}),e.jsx("p",{className:"text-sm mt-1",children:"Add contacts and enable touchpoint plans to get started."})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border rounded-lg overflow-hidden",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{className:"bg-muted/50",children:[e.jsx(Ct,{className:"w-[180px]",children:e.jsx(I,{field:"name",children:"Contact"})}),e.jsx(Ct,{className:"w-[130px]",children:e.jsx(I,{field:"relationship_type",children:"Type"})}),e.jsx(Ct,{className:"w-[120px]",children:e.jsx(I,{field:"action_type",children:"Action"})}),e.jsx(Ct,{className:"w-[130px]",children:"Phone"}),e.jsx(Ct,{className:"w-[200px]",children:"Quick Actions"})]})}),e.jsx(zn,{children:A.map((O,B)=>{var ae,le,ne,fe,oe,de;const $=O.isSpecialDate,H=O.specialDateType,W=$?H==="birthday"?vm:Wn:M(((ae=O.actionType)==null?void 0:ae.icon)||null),X=O.contact.phone,se=O.contact.email;return e.jsxs(Nr,{className:qt("hover:bg-muted/50 transition-colors",$&&H==="birthday"&&"bg-pink-50/50 dark:bg-pink-950/20",$&&H==="anniversary"&&"bg-purple-50/50 dark:bg-purple-950/20"),children:[e.jsx(dt,{className:"font-medium",children:e.jsx("div",{children:e.jsxs("button",{onClick:()=>i(`/mission-control/contacts/${O.contact.id}`),className:"truncate max-w-[160px] text-left hover:text-primary hover:underline transition-colors",children:[O.contact.first_name," ",O.contact.last_name]})})}),e.jsx(dt,{children:O.relationshipTypeName?e.jsx(bt,{variant:"secondary",className:"text-xs",children:O.relationshipTypeName}):e.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),e.jsx(dt,{children:e.jsx("div",{className:"flex items-center gap-1.5",children:$?e.jsx(bt,{className:qt("gap-1",H==="birthday"&&"bg-pink-500 hover:bg-pink-600",H==="anniversary"&&"bg-purple-500 hover:bg-purple-600"),children:H==="birthday"?e.jsxs(e.Fragment,{children:[e.jsx(vm,{className:"h-3 w-3"})," Birthday"]}):e.jsxs(e.Fragment,{children:[e.jsx(Wn,{className:"h-3 w-3"})," Anniversary"]})}):e.jsxs(bt,{variant:"outline",className:"gap-1",children:[e.jsx(W,{className:"h-3 w-3"}),(le=O.actionType)==null?void 0:le.name]})})}),e.jsx(dt,{children:X?e.jsx("span",{className:"text-sm font-mono",children:O.contact.phone}):e.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),e.jsx(dt,{children:e.jsxs("div",{className:"flex items-center gap-1",children:[X&&e.jsx("a",{href:`tel:${O.contact.phone}`,className:"p-1.5 rounded bg-primary/10 hover:bg-primary/20 text-primary transition-colors",title:"Call",children:e.jsx(wi,{className:"h-3.5 w-3.5"})}),X&&e.jsx("a",{href:a(O.contact.phone,(ne=O.script)==null?void 0:ne.script_body,O.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:e.jsx($o,{className:"h-3.5 w-3.5"})}),se&&(l?e.jsx("button",{onClick:()=>l({id:O.contact.id,first_name:O.contact.first_name,last_name:O.contact.last_name,email:O.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:e.jsx(mn,{className:"h-3.5 w-3.5"})}):e.jsx("a",{href:o(O.contact.email,(fe=O.script)==null?void 0:fe.script_body,(oe=O.script)==null?void 0:oe.email_subject,(de=O.actionType)==null?void 0:de.name,O.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:e.jsx(mn,{className:"h-3.5 w-3.5"})})),e.jsx(Q,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>F(O.contact.id,O.contact.first_name,O.contact.last_name),title:"Snooze",children:e.jsx(Nm,{className:"h-3.5 w-3.5"})}),e.jsxs(Q,{variant:"default",size:"sm",className:"h-7 px-2 text-xs ml-1",onClick:()=>{var ue;return r(O.contact.id,O.actionType.id,(ue=O.script)==null?void 0:ue.id)},disabled:n,children:[e.jsx(Li,{className:"h-3.5 w-3.5 mr-1"}),"Done"]})]})})]},`${O.contact.id}-${B}`)})})]})}),e.jsx(Wae,{open:!!v,onOpenChange:O=>!O&&b(null),contactId:v||"",contactName:N})]})}function J3(){const{data:t,isLoading:r}=Ht({queryKey:["gmail-integration"],queryFn:async()=>{const{data:a,error:o}=await Z.from("gmail_integrations").select("*").maybeSingle();if(o)throw o;return a}}),s=!!(t!=null&&t.is_active),n=(t==null?void 0:t.gmail_email)||null;return{isGmailConnected:s,gmailEmail:n,isLoading:r}}function y5t({onSelect:t}){const[r,s]=E.useState(null),{data:n=[],isLoading:a}=Ht({queryKey:["agent-email-template-categories"],queryFn:async()=>{const{data:d,error:m}=await Z.from("email_template_categories").select("*").order("sort_order");if(m)throw m;return d}}),{data:o=[],isLoading:l}=Ht({queryKey:["agent-email-templates",r],queryFn:async()=>{let d=Z.from("agent_email_templates").select("*").eq("is_active",!0).order("sort_order");r&&(d=d.eq("category_id",r));const{data:m,error:g}=await d;if(g)throw g;return m}}),i=n.find(d=>d.id===r);return a?e.jsx("div",{className:"flex items-center justify-center py-6",children:e.jsx(Hr,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):r?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{onClick:()=>s(null),className:"flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(uc,{className:"h-3.5 w-3.5"}),"Back to categories"]}),e.jsxs("p",{className:"text-xs font-medium flex items-center gap-1.5",children:[e.jsx("span",{children:i==null?void 0:i.icon})," ",i==null?void 0:i.name]}),l?e.jsx("div",{className:"flex items-center justify-center py-6",children:e.jsx(Hr,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):o.length===0?e.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No templates in this category"}):e.jsx(Eo,{className:"max-h-[280px]",children:e.jsx("div",{className:"space-y-1",children:o.map(d=>e.jsxs("button",{onClick:()=>t(d),className:"w-full p-2.5 rounded-lg border hover:bg-accent transition-colors text-left",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"font-medium text-sm",children:d.title}),d.tone&&e.jsx(bt,{variant:"secondary",className:"text-[10px] shrink-0",children:d.tone})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:d.subject})]},d.id))})})]}):e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground px-1 mb-2",children:"Select a category"}),e.jsx("div",{className:"max-h-[200px] overflow-y-auto space-y-1 pr-1",children:n.map(d=>e.jsxs("button",{onClick:()=>s(d.id),className:"w-full flex items-center justify-between p-2.5 rounded-lg border hover:bg-accent transition-colors text-left",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"text-lg",children:d.icon}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:d.name}),d.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:d.description})]})]}),e.jsx(Wi,{className:"h-4 w-4 text-muted-foreground shrink-0"})]},d.id))})]})}const v5t=5*1024*1024,_5t=["application/pdf","image/jpeg","image/png","image/gif","image/webp","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","text/csv"];function b5t(t){return t<1024?t+" B":t<1024*1024?(t/1024).toFixed(1)+" KB":(t/(1024*1024)).toFixed(1)+" MB"}function w5t(t){return new Promise((r,s)=>{const n=new FileReader;n.onload=()=>{const a=n.result;r(a.split(",")[1])},n.onerror=s,n.readAsDataURL(t)})}function TT(t,r){return t.replace(/\{\{first_name\}\}/gi,r.first_name).replace(/\{\{last_name\}\}/gi,r.last_name||"").replace(/\{\{full_name\}\}/gi,`${r.first_name} ${r.last_name||""}`.trim())}function Gae({open:t,onOpenChange:r,contact:s,bulkContacts:n,defaultSubject:a="",defaultBody:o="",gmailEmail:l,onSendComplete:i}){const d=!!n&&n.length>0,m=d?n:s?[s]:[],g=m[0],[y,v]=E.useState((g==null?void 0:g.email)||""),[b,N]=E.useState(a),[j,S]=E.useState(o),[A,M]=E.useState(!1),[I,F]=E.useState(!1),[O,B]=E.useState([]);E.useEffect(()=>{t&&(v((g==null?void 0:g.email)||""),N(TT(a,g||{first_name:""})),S(TT(o,g||{first_name:""})),F(!a&&!o),B([]))},[t,g,a,o]);const $=async le=>{const ne=le.target.files;if(!ne)return;const fe=O.reduce((de,ue)=>de+ue.size,0),oe=[];for(const de of Array.from(ne)){if(!_5t.includes(de.type)){Se.error(`${de.name}: Unsupported file type`);continue}if(fe+de.size>v5t){Se.error("Total attachments exceed 20MB limit");break}try{const ue=await w5t(de);oe.push({name:de.name,type:de.type,size:de.size,data:ue})}catch{Se.error(`Failed to read ${de.name}`)}}B(de=>[...de,...oe]),le.target.value=""},H=le=>{B(ne=>ne.filter((fe,oe)=>oe!==le))},W=le=>{N(TT(le.subject,g||{first_name:""})),S(TT(le.body,g||{first_name:""})),F(!1)},X=le=>le.split(/\n\n+/).map(ne=>`

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

`).join(""),se=async le=>{if(!b||!j)return Se.error("Please fill in subject and message"),!1;const ne=TT(j,le),fe=X(ne);try{const{data:oe,error:de}=await Z.functions.invoke("gmail-send",{body:{to:le.email,subject:b,body:fe,contactId:le.id,attachments:O.map(({name:ue,type:xe,data:Te})=>({name:ue,type:xe,data:Te}))}});if(de)throw de;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),Se.error("Failed to send to "+le.first_name+": "+(oe instanceof Error?oe.message:"Unknown error")),!1}},ae=async()=>{if(!b||!j){Se.error("Please fill in subject and message");return}if(d&&m.length>50){Se.error("Maximum 50 recipients per bulk send");return}M(!0);try{if(d){let le=0;for(const ne of m)await se(ne)&&le++,await new Promise(oe=>setTimeout(oe,100));Se.success(`Sent ${le} of ${m.length} emails`)}else await se(g)&&Se.success("Email sent successfully!");r(!1),i==null||i()}catch(le){console.error("Bulk send error:",le),Se.error("Error sending emails")}finally{M(!1)}};return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"sm:max-w-[600px] max-h-[90vh] overflow-y-auto",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{className:"flex items-center gap-2",children:[e.jsx(mn,{className:"h-5 w-5 text-red-500"}),d?`Send to ${m.length} Contacts`:"Compose Email"]}),l&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sending from ",e.jsx("span",{className:"font-medium",children:l})]})]}),e.jsxs("div",{className:"space-y-4",children:[I?e.jsxs("div",{className:"border rounded-lg p-3 bg-muted/30 max-h-[50vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("p",{className:"text-sm font-medium flex items-center gap-1.5",children:[e.jsx(fa,{className:"h-4 w-4"})," Choose a Template"]}),e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>F(!1),className:"h-7 px-2 text-xs",children:[e.jsx(rn,{className:"h-3 w-3 mr-1"})," Write from scratch"]})]}),e.jsx(y5t,{onSelect:W})]}):e.jsxs(Q,{variant:"outline",size:"sm",className:"gap-2",onClick:()=>F(!0),children:[e.jsx(fa,{className:"h-4 w-4"}),"Browse Templates"]}),e.jsx(gd,{}),e.jsx("div",{className:"space-y-1.5",children:d?e.jsxs(e.Fragment,{children:[e.jsx(Ee,{children:"Recipients"}),e.jsx("div",{className:"bg-muted p-3 rounded-md space-y-1 max-h-24 overflow-y-auto text-muted-foreground",children:m.map(le=>e.jsxs("div",{className:"text-sm",children:[le.first_name," ",le.last_name," — ",le.email]},le.id))})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ee,{htmlFor:"gmail-to",children:"To"}),e.jsx(Qe,{id:"gmail-to",value:y,onChange:le=>v(le.target.value),placeholder:"recipient@example.com"})]})}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{htmlFor:"gmail-subject",children:"Subject"}),e.jsx(Qe,{id:"gmail-subject",value:b,onChange:le=>N(le.target.value),placeholder:"Enter subject..."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ee,{htmlFor:"gmail-body",children:"Message"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(bt,{variant:"outline",className:"text-[10px] cursor-pointer hover:bg-accent",onClick:()=>S(le=>le+"{{first_name}}"),children:"{{first_name}}"}),e.jsx(bt,{variant:"outline",className:"text-[10px] cursor-pointer hover:bg-accent",onClick:()=>S(le=>le+"{{last_name}}"),children:"{{last_name}}"})]})]}),e.jsx(Ks,{id:"gmail-body",value:j,onChange:le=>S(le.target.value),placeholder:"Write your message...",rows:10,className:"resize-y"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Q,{type:"button",variant:"outline",size:"sm",className:"gap-2",onClick:()=>{var le;return(le=document.getElementById("gmail-attachments"))==null?void 0:le.click()},disabled:A,children:[e.jsx(Gj,{className:"h-4 w-4"}),"Attach Files"]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"PDF, images, Word, Excel (max 5MB total)"}),e.jsx("input",{id:"gmail-attachments",type:"file",multiple:!0,accept:".pdf,.jpg,.jpeg,.png,.gif,.webp,.doc,.docx,.xls,.xlsx,.csv",className:"hidden",onChange:$})]}),O.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:O.map((le,ne)=>e.jsxs(bt,{variant:"secondary",className:"gap-1.5 pl-2 pr-1 py-1",children:[e.jsx(Gj,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-[140px] truncate text-xs",children:le.name}),e.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["(",b5t(le.size),")"]}),e.jsx("button",{type:"button",onClick:()=>H(ne),className:"ml-0.5 rounded-full p-0.5 hover:bg-muted",children:e.jsx(rn,{className:"h-3 w-3"})})]},ne))})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(Q,{variant:"outline",onClick:()=>r(!1),disabled:A,children:"Cancel"}),e.jsxs(Q,{onClick:ae,disabled:A||!b||!j,className:"gap-2",children:[A?e.jsx(Hr,{className:"h-4 w-4 animate-spin"}):e.jsx(Mi,{className:"h-4 w-4"}),A?"Sending...":d?`Send to ${m.length}`:"Send Email"]})]})]})]})})}const CCe={Crown:ih,FileText:fa,Users:ws,Globe:Gg,Star:Ln,Phone:wi,MessageSquare:$o,PenTool:Kj,Video:ya,Gift:uo},j5t={"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 k5t(){const t=Ws(),{user:r}=Gr(),{data:s}=Qf(),{data:n}=zRe(),{data:a}=Ip(),{data:o}=Wye(),{data:l}=WRe(),i=Ext(),d=HRe(),m=Txt(90),g=URe(),[y,v]=E.useState(null),[b,N]=E.useState(null),[j,S]=E.useState(!1),[A,M]=E.useState(""),[I,F]=E.useState(!1),[O,B]=E.useState(""),[$,H]=E.useState(ure()),[W,X]=E.useState("cards"),[se,ae]=E.useState(!1),[le,ne]=E.useState(null),[fe,oe]=E.useState(null),[de,ue]=E.useState(""),{isGmailConnected:xe,gmailEmail:Te}=J3(),be=()=>{const Me=parseInt(O,10);if(isNaN(Me)||Me<1){Jn({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}H(Me),VRe(Me),F(!1),Jn({title:"Goal updated",description:`Weekly touch goal set to ${Me}`})},we=()=>{B($.toString()),F(!0)};E.useEffect(()=>{(async()=>{if(!(r!=null&&r.id))return;const{data:Je}=await Z.from("profiles").select("name").eq("id",r.id).single();Je!=null&&Je.name&&M(Je.name.split(" ")[0])})()},[r==null?void 0:r.id]),E.useEffect(()=>{i.mutate()},[]);const ve=Em(new Date),tt=sc(ve,7),Ae=Me=>{if(!Me)return null;const Je=new Date(Me);return new Date(ve.getFullYear(),Je.getMonth(),Je.getDate())},Le=(a==null?void 0:a.filter(Me=>{const Je=Ae(Me.birthday),Xe=Ae(Me.home_anniversary);return Je&&Vl(Je,ve)||Xe&&Vl(Xe,ve)}))||[],Ue=(a==null?void 0:a.filter(Me=>{if(!Me.birthday&&!Me.home_anniversary)return!1;const Je=Xe=>{if(!Xe)return!1;const Ve=Ae(Xe);return Ve?Zte(Ve,ve)&&Jne(Ve,tt):!1};return Je(Me.birthday)||Je(Me.home_anniversary)}).slice(0,5))||[],Ye=Le.map(Me=>{var ot,mt,ft;const Je=Ae(Me.birthday),Xe=Je&&Vl(Je,ve),Ve=(o==null?void 0:o.find(ct=>ct.name==="Call"))||(o==null?void 0:o[0]);return{contact:Me,actionType:Ve||{id:"special-date",name:Xe?"Birthday Call":"Anniversary Call",icon:Xe?"Cake":"Home",color:Xe?"#EC4899":"#8B5CF6",description:Xe?"Wish them happy birthday!":"Celebrate their home anniversary!",active:!0,sort_order:0,created_at:"",updated_at:""},planName:Xe?"🎂 Birthday Today!":"🏠 Home Anniversary!",relationshipTypeName:((ft=(mt=(ot=Me.tags)==null?void 0:ot[0])==null?void 0:mt.relationship_type)==null?void 0:ft.name)||"",monthNumber:0,isSpecialDate:!0,specialDateType:Xe?"birthday":"anniversary"}}),et=l!==void 0?l||[]:(a==null?void 0:a.slice(0,5).map((Me,Je)=>{var Ve,ot,mt;const Xe=o==null?void 0:o[Je%((o==null?void 0:o.length)||1)];return Xe?{contact:Me,actionType:Xe,planName:"Quick Touch",relationshipTypeName:((mt=(ot=(Ve=Me.tags)==null?void 0:Ve[0])==null?void 0:ot.relationship_type)==null?void 0:mt.name)||"",monthNumber:0}:null}).filter(Boolean))||[],It=[...Ye,...et],Pe=async(Me,Je,Xe)=>{await g.mutateAsync({contactId:Me,actionTypeId:Je,scriptUsedId:Xe}),S(!1),N(null)},at=Me=>{Me.script?(N(Me),S(!0)):Pe(Me.contact.id,Me.actionType.id)},ce=Me=>CCe[Me||"Phone"]||wi,$e=Me=>CCe[Me||"Users"]||ws,Ge=(Me,Je)=>Me.replace(/\{\{FirstName\}\}/g,Je.first_name).replace(/\{\{LastName\}\}/g,Je.last_name||"").replace(/\{\{AgentName\}\}/g,A||"there"),rt=(Me,Je)=>({Call:`Thinking of you, ${Je}!`,Text:`Quick hello, ${Je}`,Email:`Checking in, ${Je}`,"Handwritten Note":`A note for ${Je}`,Video:`Video message for ${Je}`,Gift:`Something special for you, ${Je}`})[Me]||`Hello ${Je}!`,je=(Me,Je,Xe)=>{const Ve=`sms:${Me}`;if(Je&&Xe){const ot=Ge(Je,Xe);return`${Ve}?body=${encodeURIComponent(ot)}`}return Ve},it=(Me,Je,Xe,Ve,ot)=>{const mt=`mailto:${Me}`,ft=[];if(ot){const ct=Xe||rt(Ve||"Email",ot.first_name);if(ft.push(`subject=${encodeURIComponent(ct)}`),Je){const Mt=Ge(Je,ot);ft.push(`body=${encodeURIComponent(Mt)}`)}}return ft.length>0?`${mt}?${ft.join("&")}`:mt};return e.jsxs(e.Fragment,{children:[e.jsxs(Fr,{title:"Mission Control",description:"Your relationship-first contact system",children:[e.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Mission Control"}),e.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"})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Your Sphere"}),e.jsx("div",{className:"flex flex-wrap gap-3",children:s==null?void 0:s.filter(Me=>Me.active).map(Me=>{const Je=$e(Me.icon),Xe=(n==null?void 0:n[Me.id])||0,Ve=y===Me.id,ot=j5t[Me.name]||"bg-secondary text-secondary-foreground";return e.jsxs("button",{onClick:()=>{Ve?(v(null),t("/mission-control/contacts")):(v(Me.id),t(`/mission-control/contacts?type=${Me.id}`))},className:` flex items-center gap-2 px-4 py-3 rounded-lg border transition-all ${Ve?ot:"bg-card hover:bg-accent"} `,children:[e.jsx(Je,{className:"h-5 w-5"}),e.jsxs("div",{className:"text-left",children:[e.jsx("div",{className:"font-medium",children:Me.name}),e.jsxs("div",{className:`text-sm ${Ve?"opacity-90":"text-muted-foreground"}`,children:[Xe," Contacts"]})]})]},Me.id)})})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[e.jsxs(Q,{onClick:()=>t("/mission-control/video/record"),className:"w-full bg-gradient-to-r from-primary to-primary/80",children:[e.jsx(Od,{className:"h-4 w-4 mr-1"}),"Quick Video"]}),e.jsxs(Q,{onClick:()=>t("/mission-control/contacts"),className:"w-full",variant:"outline",children:["View Contacts",e.jsx(Wi,{className:"h-4 w-4 ml-1"})]}),e.jsx(Q,{variant:"outline",onClick:()=>t("/mission-control/video-library"),className:"w-full",children:"Video Library"}),e.jsx(Q,{variant:"outline",onClick:()=>t("/mission-control/plans"),className:"w-full",children:"Manage Plans"})]}),e.jsxs("section",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Today in Your InnerCircle"}),l!==void 0&&e.jsxs(bt,{variant:"outline",className:"gap-1",children:[e.jsx(An,{className:"h-3 w-3"}),"Plan-based"]}),e.jsxs("div",{className:"ml-auto flex items-center gap-1 border rounded-lg p-0.5",children:[e.jsx(Q,{variant:W==="cards"?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>X("cards"),title:"Card view",children:e.jsx(yp,{className:"h-4 w-4"})}),e.jsx(Q,{variant:W==="table"?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>X("table"),title:"Table view",children:e.jsx(vp,{className:"h-4 w-4"})})]})]}),e.jsx(ze,{children:e.jsx(qe,{className:"p-4",children:It.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx("p",{children:"No actions scheduled for today."}),e.jsx("p",{className:"text-sm mt-1",children:"Add contacts and enable touchpoint plans to get started."}),e.jsx(Q,{variant:"outline",className:"mt-4",onClick:()=>t("/mission-control/plans"),children:"Manage Plans"})]}):W==="table"?e.jsx(x5t,{actions:It,onMarkComplete:Pe,onViewScript:at,isLoading:g.isPending,buildSmsLink:je,buildEmailLink:it,onGmailCompose:xe?Me=>{ne(Me),ae(!0)}:void 0}):e.jsxs("div",{className:"flex gap-3 overflow-x-auto pb-2",children:[It.map((Me,Je)=>{var Ot,rr,Ir,cr,Mr,As,At;const Xe=Me.isSpecialDate,Ve=Me.specialDateType,ot=Xe?Ve==="birthday"?vm:Wn:ce(((Ot=Me.actionType)==null?void 0:Ot.icon)||null),mt=Me.contact.phone,ft=Me.contact.email,ct=Xe?Ve==="birthday"?"#EC4899":"#8B5CF6":((rr=Me.actionType)==null?void 0:rr.color)||"#3B82F6",Mt=Xe?Ve==="birthday"?"🎂 Birthday Today!":"🏠 Home Anniversary!":(Ir=Me.actionType)==null?void 0:Ir.name;return e.jsxs("div",{className:`flex-shrink-0 w-[260px] border rounded-lg overflow-hidden ${Xe?"ring-2 ring-offset-2":""}`,style:Xe?{"--tw-ring-color":ct}:void 0,children:[e.jsxs("div",{className:"p-3 text-white flex items-center gap-2",style:{backgroundColor:ct},children:[e.jsx(ot,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium text-sm",children:Mt})]}),e.jsxs("div",{className:"p-3 space-y-2",children:[e.jsxs("button",{onClick:()=>t(`/mission-control/contacts/${Me.contact.id}`),className:"font-medium text-sm hover:text-primary hover:underline transition-colors text-left",children:[Me.contact.first_name," ",Me.contact.last_name]}),e.jsxs("div",{className:"flex gap-1.5",children:[mt&&e.jsxs(e.Fragment,{children:[e.jsxs("a",{href:`tel:${Me.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:[e.jsx(wi,{className:"h-3 w-3"}),"Call"]}),e.jsxs("a",{href:je(Me.contact.phone,(cr=Me.script)==null?void 0:cr.script_body,Me.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:[e.jsx($o,{className:"h-3 w-3"}),"Text"]})]}),ft&&(xe?e.jsxs("button",{onClick:()=>{ne({id:Me.contact.id,first_name:Me.contact.first_name,last_name:Me.contact.last_name,email:Me.contact.email}),ae(!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:[e.jsx(mn,{className:"h-3 w-3"}),"Email"]}):e.jsxs("a",{href:it(Me.contact.email,(Mr=Me.script)==null?void 0:Mr.script_body,(As=Me.script)==null?void 0:As.email_subject,(At=Me.actionType)==null?void 0:At.name,Me.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:[e.jsx(mn,{className:"h-3 w-3"}),"Email"]}))]}),!mt&&!ft&&e.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No contact info"}),e.jsxs("div",{className:"flex gap-1 flex-wrap",children:[Me.relationshipTypeName&&e.jsx(bt,{variant:"secondary",className:"text-xs",children:Me.relationshipTypeName}),Me.monthNumber>0&&e.jsxs(bt,{variant:"outline",className:"text-xs",children:["Month ",Me.monthNumber]})]}),Me.script&&e.jsx(Q,{size:"sm",variant:"outline",className:"w-full",onClick:()=>at(Me),children:"View Script"}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsxs(Q,{size:"sm",variant:"outline",className:"flex-1 gap-1",onClick:()=>{oe(Me.contact.id),ue(`${Me.contact.first_name} ${Me.contact.last_name||""}`.trim())},children:[e.jsx(Nm,{className:"h-3.5 w-3.5"}),"Snooze"]}),e.jsx(Q,{size:"sm",className:"flex-1",onClick:()=>{var Rt;return Pe(Me.contact.id,Me.actionType.id,(Rt=Me.script)==null?void 0:Rt.id)},disabled:g.isPending,children:"Mark Complete"})]})]})]},Me.contact.id+Je)}),e.jsx("div",{className:"flex-shrink-0 w-[100px] border rounded-lg flex items-center justify-center",children:e.jsxs(mh,{children:[e.jsx(ph,{asChild:!0,children:e.jsxs(Q,{variant:"ghost",className:"h-full w-full",children:[e.jsx(kf,{className:"h-5 w-5 mr-2"}),"More"]})}),e.jsx(Au,{children:e.jsx(Ba,{onClick:()=>t("/mission-control/contacts"),children:"View all contacts"})})]})})]})})})]}),e.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[e.jsxs(ze,{className:"md:col-span-2",children:[e.jsx(Wt,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Zt,{className:"text-lg",children:"Momentum"}),e.jsxs(Dr,{open:I,onOpenChange:F,children:[e.jsx(xo,{asChild:!0,children:e.jsx("button",{onClick:we,className:"p-0.5 rounded hover:bg-muted transition-colors","aria-label":"Edit weekly goal",children:e.jsx(vd,{className:"h-4 w-4 text-muted-foreground hover:text-primary"})})}),e.jsxs(Lr,{className:"sm:max-w-[360px]",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Set Weekly Goal"}),e.jsx(Gs,{children:"How many touches do you want to complete each week?"})]}),e.jsxs("div",{className:"space-y-4 pt-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"weekly-goal-ic",children:"Weekly touch goal"}),e.jsx(Qe,{id:"weekly-goal-ic",type:"number",min:"1",value:O,onChange:Me=>B(Me.target.value),placeholder:"20",onKeyDown:Me=>{Me.key==="Enter"&&be()}})]}),e.jsx(Q,{onClick:be,className:"w-full",children:"Save Goal"})]})]})]})]})}),e.jsxs(qe,{className:"space-y-4",children:[e.jsx(hc,{value:Math.min(d.actionsThisWeek/$*100,100),className:"h-3 w-full max-w-full"}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(_m,{className:"h-5 w-5 text-orange-500"}),e.jsxs("span",{className:"font-medium",children:[d.actionsThisWeek," / ",$]}),e.jsx("span",{className:"text-muted-foreground",children:"Actions Completed This Week"})]}),d.streak>0&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-lg",children:"🔥"}),e.jsx("span",{className:"font-medium",children:"Great Job!"}),e.jsxs("span",{className:"text-muted-foreground",children:["Keep Your Streak Going! (",d.streak," days)"]})]})]})]}),e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-lg",children:"Upcoming Reminders"})}),e.jsxs(qe,{className:"space-y-3",children:[Ue.length>0?Ue.map(Me=>{const Je=Me.birthday,Xe=Me.home_anniversary;return e.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[Je?e.jsx("span",{className:"text-lg",children:"🎂"}):e.jsx("span",{className:"text-lg",children:"🏠"}),e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium",children:[Me.first_name,"'s"]}),e.jsxs("span",{className:"text-muted-foreground",children:[" ",Je?"Birthday":"Home Anniversary"]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[Je&&Me.birthday&&(()=>{const Ve=Me.birthday.split(/[-/T]/);return Xr(new Date(new Date().getFullYear(),parseInt(Ve[1],10)-1,parseInt(Ve[2],10)),"MMM d")})(),Je&&Xe&&" · ",Xe&&Me.home_anniversary&&(()=>{const Ve=Me.home_anniversary.split(/[-/T]/);return Xr(new Date(new Date().getFullYear(),parseInt(Ve[1],10)-1,parseInt(Ve[2],10)),"MMM d")})()]})]})]},Me.id)}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No upcoming reminders"}),m.count>0&&e.jsxs("button",{onClick:()=>t("/mission-control/contacts?filter=not-touched-90"),className:"flex items-start gap-2 text-sm pt-2 border-t w-full text-left hover:bg-accent/50 -mx-4 px-4 py-2 rounded-md transition-colors",children:[e.jsx(Ea,{className:"h-4 w-4 text-orange-500 mt-0.5"}),e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium text-orange-600 dark:text-orange-400",children:[m.count," Contact",m.count!==1?"s":""]}),e.jsx("span",{className:"text-muted-foreground",children:" Not Reached in 90+ Days"})]}),e.jsx(Wi,{className:"h-4 w-4 text-muted-foreground ml-auto mt-0.5"})]})]})]}),e.jsx(lFe,{})]})]}),e.jsx(Dr,{open:j,onOpenChange:S,children:e.jsxs(Lr,{className:"max-w-md",children:[e.jsx(Ur,{children:e.jsx(Br,{className:"flex items-center gap-2",children:b&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:b.actionType.color||"#3B82F6"}}),b.actionType.name," Script"]})})}),b&&b.script&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["For: ",e.jsxs("span",{className:"font-medium text-foreground",children:[b.contact.first_name," ",b.contact.last_name]})]}),e.jsx("div",{className:"bg-muted p-4 rounded-lg",children:e.jsx("p",{className:"whitespace-pre-wrap",children:Ge(b.script.script_body,b.contact)})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Q,{variant:"outline",className:"flex-1",onClick:()=>S(!1),children:"Close"}),e.jsx(Q,{className:"flex-1",onClick:()=>{var Me;return Pe(b.contact.id,b.actionType.id,(Me=b.script)==null?void 0:Me.id)},disabled:g.isPending,children:"Mark Complete"})]})]})]})}),e.jsx(u5t,{})]}),xe&&le&&e.jsx(Gae,{open:se,onOpenChange:ae,contact:le,gmailEmail:Te}),e.jsx(Wae,{open:!!fe,onOpenChange:Me=>!Me&&oe(null),contactId:fe||"",contactName:de})]})}const BBe=()=>{const{user:t}=Gr();return Ht({queryKey:["popby-items",t==null?void 0:t.id],queryFn:async()=>{const{data:r,error:s}=await Z.from("popby_items").select("*").or(`owner_user_id.is.null,owner_user_id.eq.${t==null?void 0:t.id}`).eq("is_active",!0).order("name");if(s)throw s;return r},enabled:!!t})},Kae=t=>{const{user:r}=Gr();return Ht({queryKey:["popby-logs",r==null?void 0:r.id,t],queryFn:async()=>{let s=Z.from("popby_logs").select("*").order("completed_at",{ascending:!1});if(t){const o=new Date;o.setDate(o.getDate()-t),s=s.gte("completed_at",o.toISOString())}const{data:n,error:a}=await s;if(a)throw a;return n},enabled:!!r})},l1e=()=>{const{user:t}=Gr();return Ht({queryKey:["relationship-type-popby-defaults",t==null?void 0:t.id],queryFn:async()=>{const{data:r,error:s}=await Z.from("relationship_type_popby_defaults").select("*");if(s)throw s;return r},enabled:!!t})},$Be=()=>{const{user:t}=Gr();return Ht({queryKey:["contact-popby-settings",t==null?void 0:t.id],queryFn:async()=>{const{data:r,error:s}=await Z.from("contact_popby_settings").select("*");if(s)throw s;return r},enabled:!!t})},UBe=()=>{const{data:t}=Ip(),{data:r}=Qf(),{data:s}=Kae(),{data:n}=$Be(),{data:a}=l1e(),o=new Map;s==null||s.forEach(g=>{const y=o.get(g.contact_id);(!y||new Date(g.completed_at)>new Date(y))&&o.set(g.contact_id,g.completed_at)});const l=new Map;a==null||a.forEach(g=>l.set(g.relationship_type_id,g.frequency_days));const i=new Map;n==null||n.filter(g=>g.is_active).forEach(g=>{i.set(g.contact_id,g.frequency_days)});const d=Em(new Date);return(t||[]).map(g=>{let y=90;if(i.has(g.id))y=i.get(g.id);else if(g.tags&&g.tags.length>0){const S=g.tags.map(A=>l.get(A.relationship_type_id)).filter(A=>A!==void 0);S.length>0&&(y=Math.min(...S))}const v=o.get(g.id)||null,b=v?Dy(d,Em(new Date(v))):null,N=b===null||b>=y,j=N&&b!==null?b-y:0;return{...g,lastPopby:v,daysSinceLastPopby:b,frequencyDays:y,isDue:N,daysOverdue:j}}).sort((g,y)=>y.daysOverdue-g.daysOverdue)},qBe=()=>UBe().filter(r=>r.isDue),N5t=()=>{const t=qr(),{user:r}=Gr();return Jt({mutationFn:async s=>{const{error:n}=await Z.from("popby_items").insert({...s,owner_user_id:r==null?void 0:r.id});if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["popby-items"]}),Jn({title:"Popby item created!"})},onError:s=>{Jn({title:"Error creating popby item",description:s.message,variant:"destructive"})}})},VBe=()=>{const t=qr(),{user:r}=Gr();return Jt({mutationFn:async s=>{const{error:n}=await Z.from("popby_logs").insert({...s,owner_user_id:r==null?void 0:r.id});if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["popby-logs"]}),Jn({title:"Popby logged!"})},onError:s=>{Jn({title:"Error logging popby",description:s.message,variant:"destructive"})}})},S5t=()=>{const t=qr(),{user:r}=Gr();return Jt({mutationFn:async s=>{const{error:n}=await Z.from("relationship_type_popby_defaults").upsert({...s,owner_user_id:r==null?void 0:r.id},{onConflict:"relationship_type_id,owner_user_id"});if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["relationship-type-popby-defaults"]}),Jn({title:"Frequency updated!"})},onError:s=>{Jn({title:"Error updating frequency",description:s.message,variant:"destructive"})}})},C5t=()=>{const{data:t}=Kae(30),r=qBe(),s=new Date;s.setDate(s.getDate()-7);const n=(t==null?void 0:t.filter(o=>new Date(o.completed_at)>=s).length)||0,a=(t==null?void 0:t.length)||0;return{thisWeekCount:n,thisMonthCount:a,dueCount:r.length}};function M5t(){const{user:t}=Gr();return Ht({queryKey:["contact-touch-logs",t==null?void 0:t.id],queryFn:async()=>{const{data:r,error:s}=await Z.from("contact_touch_logs").select("*").order("completed_at",{ascending:!1});if(s)throw s;return r},enabled:!!t})}function HBe(t){const{data:r}=M5t(),{data:s}=$Be(),{data:n}=l1e(),{data:a}=h5t();return E.useMemo(()=>{const o=a==null?void 0:a.find(S=>S.contact_id===t.id),l=o?new Date(o.snoozed_until):null,i=Em(new Date);if(l&&!Jne(l,i))return{nextTouchDate:l,daysUntil:Dy(l,i),status:"snoozed",frequencyDays:90,lastTouchDate:null,snoozedUntil:l};const m=((r==null?void 0:r.filter(S=>S.contact_id===t.id))||[]).sort((S,A)=>new Date(A.completed_at).getTime()-new Date(S.completed_at).getTime())[0],g=m?new Date(m.completed_at):null;let y=90;const v=s==null?void 0:s.find(S=>S.contact_id===t.id&&S.is_active);if(v)y=v.frequency_days;else if(t.tags&&t.tags.length>0){const S=t.tags.map(A=>{const M=n==null?void 0:n.find(I=>I.relationship_type_id===A.relationship_type_id);return M==null?void 0:M.frequency_days}).filter(A=>A!==void 0);S.length>0&&(y=Math.min(...S))}if(!g)return{nextTouchDate:null,daysUntil:null,status:"never-touched",frequencyDays:y,lastTouchDate:null,snoozedUntil:null};const b=sc(Em(g),y),N=Dy(b,i);let j;return N<0?j="overdue":N<=7?j="due-soon":j="on-track",{nextTouchDate:b,daysUntil:N,status:j,frequencyDays:y,lastTouchDate:g,snoozedUntil:null}},[t,r,s,n,a])}function Ape({contact:t}){const r=HBe(t),n=(()=>{switch(r.status){case"overdue":return{variant:"destructive",icon:_l,text:`${Math.abs(r.daysUntil)} days overdue`,className:""};case"due-soon":return{variant:"secondary",icon:Ea,text:r.daysUntil===0?"Due today":`Due in ${r.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:Li,text:`Next touch in ${r.daysUntil} days`,className:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-400"};case"snoozed":return{variant:"secondary",icon:Nm,text:`Snoozed until ${Xr(r.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:Mn,text:"Never touched",className:"border-dashed"}}})(),a=n.icon;return e.jsxs(bt,{variant:n.variant,className:qt("gap-1",n.className),children:[e.jsx(a,{className:"h-3 w-3"}),n.text]})}function T5t({contact:t,onLogTouch:r,onSnooze:s}){const n=HBe(t),a=p5t(),[o,l]=E.useState(!1),i=()=>{switch(n.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"}},d=()=>{switch(n.status){case"overdue":return e.jsx(_l,{className:"h-5 w-5 text-destructive"});case"due-soon":return e.jsx(Ea,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"});case"on-track":return e.jsx(Li,{className:"h-5 w-5 text-emerald-600 dark:text-emerald-400"});case"snoozed":return e.jsx(Nm,{className:"h-5 w-5 text-slate-600 dark:text-slate-400"});case"never-touched":return e.jsx(Mn,{className:"h-5 w-5 text-muted-foreground"})}},m=()=>{switch(n.status){case"overdue":return`${Math.abs(n.daysUntil)} days overdue`;case"due-soon":return n.daysUntil===0?"Due today!":`Due in ${n.daysUntil} days`;case"on-track":return`On track - ${n.daysUntil} days remaining`;case"snoozed":return`Snoozed for ${n.daysUntil} more days`;case"never-touched":return"No touches logged yet"}},g=async()=>{await a.mutateAsync(t.id)};return e.jsxs(e.Fragment,{children:[e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsxs(Zt,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Mn,{className:"h-4 w-4"}),"Next Touch"]})}),e.jsxs(qe,{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[d(),e.jsx("span",{className:qt("font-medium",i()),children:m()})]}),n.status==="snoozed"&&n.snoozedUntil&&e.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"Snoozed until:"})," ",Xr(n.snoozedUntil,"MMMM d, yyyy")]}),n.status!=="snoozed"&&n.nextTouchDate&&e.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"Scheduled:"})," ",Xr(n.nextTouchDate,"MMMM d, yyyy")]}),n.lastTouchDate&&e.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.jsx("span",{className:"font-medium",children:"Last touch:"})," ",Xr(n.lastTouchDate,"MMM d, yyyy")]}),n.status!=="snoozed"&&e.jsxs("div",{className:"text-xs text-muted-foreground border-t pt-2",children:["Touch frequency: Every ",n.frequencyDays," days"]}),n.status==="snoozed"&&e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsxs(Q,{size:"sm",variant:"outline",className:"flex-1",onClick:g,disabled:a.isPending,children:[e.jsx(rn,{className:"h-4 w-4 mr-1"}),"Cancel Snooze"]}),r&&e.jsx(Q,{size:"sm",className:"flex-1",onClick:r,children:"Log Touch"})]}),n.status!=="snoozed"&&e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsxs(Q,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>l(!0),children:[e.jsx(Nm,{className:"h-4 w-4 mr-1"}),"Snooze"]}),(n.status==="overdue"||n.status==="due-soon"||n.status==="never-touched")&&r&&e.jsx(Q,{size:"sm",className:"flex-1",variant:n.status==="overdue"?"default":"outline",onClick:r,children:"Log Touch"})]})]})]}),e.jsx(Wae,{open:o,onOpenChange:l,contactId:t.id,contactName:`${t.first_name} ${t.last_name||""}`.trim()})]})}const Wde=768;function e5(){const[t,r]=E.useState(void 0);return E.useEffect(()=>{const s=window.matchMedia(`(max-width: ${Wde-1}px)`),n=()=>{r(window.innerWidths.removeEventListener("change",n)},[]),!!t}const A5t={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"}},E5t={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 Gde({score:t,showScore:r=!1,showTooltip:s=!0,size:n="sm",className:a}){const o=A5t[t.status],l=E5t[n],i=e.jsxs("div",{className:qt("inline-flex items-center rounded-full font-medium",o.bgLightClass,o.textClass,l.badge,l.text,a),children:[e.jsx("span",{className:qt("rounded-full",o.bgClass,l.dot)}),r?e.jsx("span",{children:t.score}):e.jsx("span",{children:o.label})]});return s?e.jsx(L3,{children:e.jsxs(Uf,{children:[e.jsx(qf,{asChild:!0,children:i}),e.jsx(wp,{side:"top",className:"w-64 p-3",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-semibold",children:"Relationship Score"}),e.jsxs("span",{className:qt("font-bold",o.textClass),children:[t.score,"/100"]})]}),e.jsx(hc,{value:t.score,className:"h-2"}),e.jsxs("div",{className:"space-y-1.5 text-xs",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Recency"}),e.jsxs("span",{children:[t.breakdown.recency,"/40"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Touchpoints (12mo)"}),e.jsxs("span",{children:[t.breakdown.touchpoints,"/30"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Transactions"}),e.jsxs("span",{children:[t.breakdown.transactions,"/20"]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Referrals"}),e.jsxs("span",{children:[t.breakdown.referrals,"/10"]})]})]}),t.daysSinceTouch!==null&&e.jsxs("p",{className:"text-xs text-muted-foreground pt-1 border-t",children:["Last contact: ",t.daysSinceTouch===0?"Today":`${t.daysSinceTouch} days ago`]}),t.daysSinceTouch===null&&e.jsx("p",{className:"text-xs text-muted-foreground pt-1 border-t italic",children:"Never contacted"})]})})]})}):i}const I5t=[{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}],P5t=({open:t,onOpenChange:r,relationshipTypes:s,onSuccess:n})=>{const{user:a}=Gr(),{toast:o}=fi(),l=E.useRef(null),[i,d]=E.useState("upload"),[m,g]=E.useState([]),[y,v]=E.useState([]),[b,N]=E.useState({}),[j,S]=E.useState([]),[A,M]=E.useState([]),[I,F]=E.useState(!1),[O,B]=E.useState(null),$=()=>{d("upload"),g([]),v([]),N({}),S([]),M([]),B(null),l.current&&(l.current.value="")},H=()=>{$(),r(!1)},W=de=>{const ue=de.split(` `).map(we=>we.trim()).filter(we=>we);if(ue.length===0)return{headers:[],data:[]};const xe=we=>{const ve=[];let tt="",Ae=!1;for(let Le=0;Le{var Te;const ue=(Te=de.target.files)==null?void 0:Te[0];if(!ue)return;const xe=new FileReader;xe.onload=be=>{var Le;const we=(Le=be.target)==null?void 0:Le.result,{headers:ve,data:tt}=W(we);if(ve.length===0){o({title:"No data found",description:"The CSV file appears to be empty.",variant:"destructive"});return}g(ve),v(tt);const Ae={};ve.forEach(Ue=>{const Ye=Ue.toLowerCase().replace(/[_\s-]/g,"");Ye.includes("firstname")||Ye==="first"?Ae.first_name=Ue:Ye.includes("lastname")||Ye==="last"?Ae.last_name=Ue:Ye.includes("email")?Ae.email=Ue:Ye.includes("phone")||Ye.includes("mobile")||Ye.includes("cell")?Ae.phone=Ue:Ye.includes("address")||Ye.includes("street")?Ae.address=Ue:Ye==="city"?Ae.city=Ue:Ye==="state"||Ye==="province"?Ae.state=Ue:Ye==="zip"||Ye==="zipcode"||Ye==="postalcode"?Ae.zip=Ue:Ye.includes("spouse")&&Ye.includes("email")?Ae.spouse_email=Ue:Ye.includes("spouse")||Ye.includes("partner")?Ae.spouse_name=Ue:Ye.includes("company")||Ye.includes("organization")||Ye.includes("business")?Ae.company_name=Ue:Ye.includes("jobtitle")||Ye.includes("title")||Ye.includes("position")?Ae.job_title=Ue:Ye.includes("birthday")||Ye.includes("dob")||Ye.includes("birthdate")?Ae.birthday=Ue:Ye.includes("anniversary")||Ye.includes("homeanniversary")?Ae.home_anniversary=Ue:(Ye.includes("notes")||Ye.includes("comment"))&&(Ae.notes=Ue)}),N(Ae),d("mapping")},xe.readAsText(ue)},se=(de,ue)=>{N(xe=>{if(ue==="none"){const{[de]:Te,...be}=xe;return be}return{...xe,[de]:ue}})},ae=de=>{S(ue=>ue.includes(de)?ue.filter(xe=>xe!==de):[...ue,de])},le=()=>{const de=y.map(ue=>{const xe=we=>{const ve=b[we];if(!ve)return"";const tt=m.indexOf(ve);return tt>=0?(ue[tt]||"").trim():""},Te=xe("first_name"),be=Te.length>0;return{first_name:Te,last_name:xe("last_name"),email:xe("email"),phone:xe("phone"),address:xe("address"),city:xe("city"),state:xe("state"),zip:xe("zip"),spouse_name:xe("spouse_name"),spouse_email:xe("spouse_email"),company_name:xe("company_name"),job_title:xe("job_title"),birthday:xe("birthday"),home_anniversary:xe("home_anniversary"),notes:xe("notes"),isValid:be,error:be?void 0:"First name is required"}});M(de),d("preview")},ne=async()=>{if(!(a!=null&&a.id))return;const de=A.filter(be=>be.isValid);if(de.length===0){o({title:"No valid contacts",description:"There are no valid contacts to import.",variant:"destructive"});return}F(!0);let ue=0,xe=0,Te=0;try{for(const be of de)try{let we=null;if(be.email){const{data:tt}=await Z.from("innercircle_contacts").select("id").eq("owner_user_id",a.id).eq("email",be.email).maybeSingle();we=tt}if(!we&&be.phone){const{data:tt}=await Z.from("innercircle_contacts").select("id").eq("owner_user_id",a.id).eq("phone",be.phone).maybeSingle();we=tt}const ve={owner_user_id:a.id,first_name:be.first_name,last_name:be.last_name||null,email:be.email||null,phone:be.phone||null,address:be.address||null,city:be.city||null,state:be.state||null,zip:be.zip||null,spouse_name:be.spouse_name||null,spouse_email:be.spouse_email||null,company_name:be.company_name||null,job_title:be.job_title||null,birthday:be.birthday||null,home_anniversary:be.home_anniversary||null,notes:be.notes||null};if(we)await Z.from("innercircle_contacts").update(ve).eq("id",we.id),xe++;else{const{data:tt}=await Z.from("innercircle_contacts").insert(ve).select("id").single();tt&&j.length>0&&await Z.from("innercircle_contact_tags").insert(j.map(Ae=>({contact_id:tt.id,relationship_type_id:Ae}))),ue++}}catch(we){console.error("Error importing contact:",we),Te++}B({created:ue,updated:xe,failed:Te}),d("result"),(ue>0||xe>0)&&n(),o({title:"Import Complete",description:`${ue} created, ${xe} updated${Te>0?`, ${Te} failed`:""}.`})}catch(be){console.error("Import error:",be),o({title:"Import Failed",description:be.message||"Failed to import contacts",variant:"destructive"})}finally{F(!1)}},fe=A.filter(de=>de.isValid).length,oe=A.filter(de=>!de.isValid).length;return e.jsx(Dr,{open:t,onOpenChange:H,children:e.jsxs(Lr,{className:"max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{className:"flex items-center gap-2",children:[e.jsx(K1,{className:"h-5 w-5"}),"Import Contacts from CSV"]}),e.jsx(Gs,{children:"Upload a CSV file with your contacts. You can map columns and select relationship types."})]}),i==="upload"&&e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"border-2 border-dashed rounded-lg p-8 text-center",children:[e.jsx("input",{type:"file",accept:".csv,.txt",ref:l,onChange:X,className:"hidden"}),e.jsx(to,{className:"h-10 w-10 mx-auto text-muted-foreground mb-4"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Click to upload or drag and drop a CSV file"}),e.jsx(Q,{onClick:()=>{var de;return(de=l.current)==null?void 0:de.click()},children:"Select CSV File"})]}),e.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 text-sm",children:[e.jsx("p",{className:"font-medium mb-2",children:"Supported Fields:"}),e.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"}),e.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>{const de=`First Name,Last Name,Email,Phone,Street Address,City,State,Zip,Spouse Name,Company,Job Title,Birthday,Home Anniversary,Notes John,Doe,john@example.com,555-123-4567,123 Main St,Austin,TX,78701,Jane Doe,ABC Realty,Real Estate Agent,1985-06-15,2020-03-22,Met at open house`,ue=new Blob([de],{type:"text/csv"}),xe=URL.createObjectURL(ue),Te=document.createElement("a");Te.href=xe,Te.download="contact_import_template.csv",Te.click(),URL.revokeObjectURL(xe)},children:[e.jsx(Oi,{className:"h-4 w-4 mr-2"}),"Download Template"]})]})]}),i==="mapping"&&e.jsxs("div",{className:"flex-1 overflow-auto space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(Ee,{className:"text-base font-medium",children:"Map CSV Columns to Contact Fields"}),e.jsx("div",{className:"grid gap-3",children:I5t.map(de=>e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(Ee,{className:"w-40 text-sm",children:[de.label,de.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),e.jsxs(ds,{value:b[de.key]||"none",onValueChange:ue=>se(de.key,ue),children:[e.jsx(ls,{className:"w-48",children:e.jsx(us,{placeholder:"Select column..."})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"none",children:"-- Not mapped --"}),m.map(ue=>e.jsx(Ut,{value:ue,children:ue},ue))]})]})]},de.key))})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(Ee,{className:"text-base font-medium",children:"Apply Relationship Types (optional)"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.map(de=>e.jsx(bt,{variant:j.includes(de.id)?"default":"outline",className:"cursor-pointer",onClick:()=>ae(de.id),children:de.name},de.id))})]}),e.jsx("div",{className:"bg-muted/50 rounded-lg p-3 text-sm",children:e.jsxs("p",{className:"text-muted-foreground",children:["Preview: ",y.length," row(s) found in CSV"]})})]}),i==="preview"&&e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Li,{className:"h-4 w-4 text-green-500"}),e.jsxs("span",{children:[fe," valid"]})]}),oe>0&&e.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[e.jsx(_l,{className:"h-4 w-4"}),e.jsxs("span",{children:[oe," invalid"]})]})]}),e.jsxs("div",{className:"flex-1 overflow-auto border rounded-lg",children:[e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{className:"bg-muted/30",children:[e.jsx(Ct,{children:"First Name"}),e.jsx(Ct,{children:"Last Name"}),e.jsx(Ct,{children:"Email"}),e.jsx(Ct,{children:"Phone"}),e.jsx(Ct,{children:"Status"})]})}),e.jsx(zn,{children:A.slice(0,100).map((de,ue)=>e.jsxs(Nr,{children:[e.jsx(dt,{children:de.first_name}),e.jsx(dt,{children:de.last_name}),e.jsx(dt,{children:de.email}),e.jsx(dt,{children:de.phone}),e.jsx(dt,{children:de.isValid?e.jsx(bt,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):e.jsx(bt,{variant:"destructive",children:de.error||"Invalid"})})]},ue))})]}),A.length>100&&e.jsxs("p",{className:"text-sm text-muted-foreground text-center py-2",children:["Showing first 100 of ",A.length," contacts"]})]})]}),i==="result"&&O&&e.jsxs("div",{className:"space-y-4 py-4 text-center",children:[e.jsx(Li,{className:"h-12 w-12 mx-auto text-green-500"}),e.jsx("h3",{className:"text-lg font-semibold",children:"Import Complete"}),e.jsxs("p",{className:"text-muted-foreground",children:[O.created," contact(s) created, ",O.updated," updated"]}),O.failed>0&&e.jsxs("p",{className:"text-destructive",children:[O.failed," failed to import"]})]}),e.jsxs(Dn,{children:[i==="upload"&&e.jsx(Q,{variant:"outline",onClick:H,children:"Cancel"}),i==="mapping"&&e.jsxs(e.Fragment,{children:[e.jsx(Q,{variant:"outline",onClick:$,children:"Back"}),e.jsx(Q,{onClick:le,disabled:!b.first_name,children:"Continue"})]}),i==="preview"&&e.jsxs(e.Fragment,{children:[e.jsx(Q,{variant:"outline",onClick:()=>d("mapping"),children:"Back"}),e.jsx(Q,{onClick:ne,disabled:I||fe===0,children:I?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${fe} Contact${fe!==1?"s":""}`})]}),i==="result"&&e.jsx(Q,{onClick:H,children:"Done"})]})]})})};function L5t(){return"contacts"in navigator&&"ContactsManager"in window}function O5t(t){const r=[],s=t.split("BEGIN:VCARD").filter(n=>n.trim());for(const n of s){const a=n.split(/\r?\n/);let o="",l="",i="",d="",m="";for(const g of a){const y=g.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))&&!d&&(d=y.substring(y.indexOf(":")+1).trim()),(y.startsWith("ADR")||y.match(/^item\d+\.ADR/i))&&!m&&(m=y.substring(y.indexOf(":")+1).split(";").map(N=>N.trim()).filter(Boolean).join(", "))}(o||l)&&r.push({first_name:o,last_name:l,email:i,phone:d,address:m})}return r}function D5t({open:t,onOpenChange:r,onComplete:s}){const{user:n}=Gr(),{data:a}=Ip(),o=Vye(),l=E.useRef(null),[i,d]=E.useState("choose"),[m,g]=E.useState([]),[y,v]=E.useState(new Set),[b,N]=E.useState(0),[j,S]=E.useState(0),A=L5t(),M=E.useCallback(se=>{if(!a)return se;const ae=new Set(a.filter(ne=>ne.email).map(ne=>ne.email.toLowerCase())),le=new Set(a.filter(ne=>ne.phone).map(ne=>ne.phone.replace(/\D/g,"")));return se.map(ne=>{var de,ue;const fe=(de=ne.email)==null?void 0:de.toLowerCase(),oe=(ue=ne.phone)==null?void 0:ue.replace(/\D/g,"");return fe&&ae.has(fe)?{...ne,isDuplicate:!0,duplicateField:"email"}:oe&&oe.length>=7&&le.has(oe)?{...ne,isDuplicate:!0,duplicateField:"phone"}:ne})},[a]),I=async()=>{try{const se=["name","email","tel","address"],ae=await navigator.contacts.select(se,{multiple:!0});if(!ae||ae.length===0)return;const le=ae.map(oe=>{var xe,Te,be,we;const ue=(((xe=oe.name)==null?void 0:xe[0])||"").split(" ");return{first_name:ue[0]||"",last_name:ue.slice(1).join(" "),email:((Te=oe.email)==null?void 0:Te[0])||"",phone:((be=oe.tel)==null?void 0:be[0])||"",address:(we=oe.address)!=null&&we[0]?[oe.address[0].streetAddress,oe.address[0].city,oe.address[0].region,oe.address[0].postalCode].filter(Boolean).join(", "):""}}),ne=M(le);g(ne);const fe=new Set;ne.forEach((oe,de)=>{oe.isDuplicate||fe.add(de)}),v(fe),d("preview")}catch(se){console.error("Contact Picker error:",se),Jn({title:"Could not access contacts",description:"Please try the file upload option instead.",variant:"destructive"})}},F=se=>{var ne;const ae=(ne=se.target.files)==null?void 0:ne[0];if(!ae)return;const le=new FileReader;le.onload=fe=>{var Te;const oe=(Te=fe.target)==null?void 0:Te.result,de=O5t(oe);if(de.length===0){Jn({title:"No contacts found",description:"The file didn't contain any valid contacts.",variant:"destructive"});return}const ue=M(de);g(ue);const xe=new Set;ue.forEach((be,we)=>{be.isDuplicate||xe.add(we)}),v(xe),d("preview")},le.readAsText(ae),l.current&&(l.current.value="")},O=async()=>{const se=m.filter((le,ne)=>y.has(ne));if(se.length===0)return;d("importing");let ae=0;for(const le of se)try{await o.mutateAsync({first_name:le.first_name,last_name:le.last_name||void 0,email:le.email||void 0,phone:le.phone||void 0,address:le.address||void 0}),ae++,S(Math.round(ae/se.length*100))}catch(ne){console.error(`Failed to import ${le.first_name} ${le.last_name}:`,ne)}N(ae),d("done")},B=se=>{v(ae=>{const le=new Set(ae);return le.has(se)?le.delete(se):le.add(se),le})},$=()=>{y.size===m.length?v(new Set):v(new Set(m.map((se,ae)=>ae)))},H=se=>{se||(d("choose"),g([]),v(new Set),N(0),S(0),i==="done"&&s()),r(se)},W=m.filter(se=>se.isDuplicate).length,X=y.size;return e.jsx(Dr,{open:t,onOpenChange:H,children:e.jsxs(Lr,{className:"sm:max-w-lg max-h-[90vh]",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{className:"flex items-center gap-2",children:[e.jsx(by,{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"&&e.jsx(Gs,{children:"Add contacts from your phone directly into Agent OS."})]}),i==="choose"&&e.jsxs("div",{className:"space-y-4 pt-2",children:[A&&e.jsxs(Q,{onClick:I,className:"w-full h-auto py-4 flex flex-col items-center gap-2",children:[e.jsx(by,{className:"h-6 w-6"}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"font-semibold",children:"Select from Phone"}),e.jsx("div",{className:"text-xs opacity-80",children:"Pick contacts directly from your device"})]})]}),e.jsxs("div",{className:"relative",children:[A&&e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),A&&e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"or"})})]}),e.jsxs(Q,{variant:A?"outline":"default",onClick:()=>{var se;return(se=l.current)==null?void 0:se.click()},className:"w-full h-auto py-4 flex flex-col items-center gap-2",children:[e.jsx(to,{className:"h-6 w-6"}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"font-semibold",children:"Upload Contact File"}),e.jsx("div",{className:"text-xs opacity-80",children:A?"Import a .vcf file exported from your Contacts app":"Export contacts from your phone as a .vcf file, then upload here"})]})]}),e.jsx("input",{ref:l,type:"file",accept:".vcf,.vcard",onChange:F,className:"hidden"}),!A&&e.jsxs("div",{className:"rounded-lg bg-muted p-3 text-sm text-muted-foreground space-y-2",children:[e.jsx("p",{className:"font-medium",children:"How to export contacts:"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-xs",children:"iPhone:"}),e.jsx("p",{className:"text-xs",children:'Open Contacts → select contacts → Share → choose "Export vCard"'})]}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-xs",children:"Android:"}),e.jsx("p",{className:"text-xs",children:"Open Contacts → Menu → Export → save as .vcf file"})]})]})]}),i==="preview"&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("span",{children:[m.length," contact",m.length!==1?"s":""," found",W>0&&e.jsxs("span",{className:"text-amber-600 ml-1",children:["(",W," already exist)"]})]}),e.jsx(Q,{variant:"ghost",size:"sm",onClick:$,children:y.size===m.length?"Deselect All":"Select All"})]}),e.jsx(Eo,{className:"h-[350px] rounded-md border",children:e.jsx("div",{className:"divide-y",children:m.map((se,ae)=>e.jsxs("div",{className:`flex items-start gap-3 p-3 cursor-pointer hover:bg-accent/50 transition-colors ${se.isDuplicate?"opacity-60":""}`,onClick:()=>B(ae),children:[e.jsx(Yo,{checked:y.has(ae),onCheckedChange:()=>B(ae),className:"mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-medium text-sm truncate",children:[se.first_name," ",se.last_name]}),se.isDuplicate&&e.jsxs(bt,{variant:"secondary",className:"text-[10px] px-1.5 py-0 bg-amber-500/10 text-amber-600 border-amber-200",children:["Exists (",se.duplicateField,")"]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground space-y-0.5 mt-0.5",children:[se.phone&&e.jsx("div",{children:se.phone}),se.email&&e.jsx("div",{className:"truncate",children:se.email})]})]})]},ae))})}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>d("choose"),children:"Back"}),e.jsxs(Q,{onClick:O,disabled:X===0,children:["Import ",X," Contact",X!==1?"s":""]})]})]}),i==="importing"&&e.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[e.jsx(Hr,{className:"h-8 w-8 animate-spin text-primary"}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-medium",children:"Importing contacts..."}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[j,"% complete"]})]}),e.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:e.jsx("div",{className:"bg-primary h-2 rounded-full transition-all",style:{width:`${j}%`}})})]}),i==="done"&&e.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[e.jsx("div",{className:"h-12 w-12 rounded-full bg-emerald-500/10 flex items-center justify-center",children:e.jsx(li,{className:"h-6 w-6 text-emerald-600"})}),e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"font-semibold text-lg",children:[b," contact",b!==1?"s":""," imported!"]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Your contacts are now in Agent OS and ready for touchpoint plans."})]}),e.jsx(Q,{onClick:()=>H(!1),className:"mt-2",children:"Done"})]})]})})}function R5t({selectedIds:t,contacts:r,onClearSelection:s,onSendToLeadPond:n,showLeadPondAction:a,onTransfer:o,showTransferAction:l}){const{data:i}=Qf(),d=Hye(),m=qr(),{isGmailConnected:g}=J3(),[y,v]=E.useState(!1),[b,N]=E.useState(!1),j=t.size;if(j===0)return null;const S=async I=>{v(!0);try{const O=Array.from(t).map($=>({contact_id:$,relationship_type_id:I})),{error:B}=await Z.from("innercircle_contact_tags").upsert(O,{onConflict:"contact_id,relationship_type_id",ignoreDuplicates:!0});if(B)throw B;m.invalidateQueries({queryKey:["innercircle-contacts"]}),m.invalidateQueries({queryKey:["innercircle-contact-counts"]}),Jn({title:`Assigned type to ${j} contacts`}),s()}catch(F){Jn({title:"Error assigning type",description:F.message,variant:"destructive"})}finally{v(!1)}},A=()=>{const I=r.filter(X=>t.has(X.id)),F=["First Name","Last Name","Email","Phone","Address","Birthday","Home Anniversary","Notes","Relationship Types"],O=I.map(X=>{var se;return[X.first_name,X.last_name||"",X.email||"",X.phone||"",X.address||"",X.birthday||"",X.home_anniversary||"",X.notes||"",((se=X.tags)==null?void 0:se.map(ae=>{var le;return(le=ae.relationship_type)==null?void 0:le.name}).join("; "))||""]}),B=[F.join(","),...O.map(X=>X.map(se=>`"${(se||"").replace(/"/g,'""')}"`).join(","))].join(` `),$=new Blob([B],{type:"text/csv"}),H=URL.createObjectURL($),W=document.createElement("a");W.href=H,W.download=`contacts-export-${new Date().toISOString().slice(0,10)}.csv`,W.click(),URL.revokeObjectURL(H),Jn({title:`Exported ${j} contacts`})},M=async()=>{if(confirm(`Are you sure you want to delete ${j} contacts? This cannot be undone.`)){v(!0);try{const I=Array.from(t);for(const F of I)await d.mutateAsync(F);s()}catch(I){Jn({title:"Error deleting contacts",description:I.message,variant:"destructive"})}finally{v(!1)}}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-primary/5 border border-primary/20 rounded-lg",children:[e.jsxs(bt,{variant:"secondary",className:"font-semibold",children:[j," selected"]}),e.jsxs(ds,{onValueChange:S,disabled:y,children:[e.jsx(ls,{className:"w-[180px] h-8",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Xg,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"text-sm",children:"Assign Type"})]})}),e.jsx(cs,{children:i==null?void 0:i.filter(I=>I.active).map(I=>e.jsx(Ut,{value:I.id,children:I.name},I.id))})]}),g&&e.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>N(!0),disabled:y,children:[e.jsx(mn,{className:"h-3.5 w-3.5 mr-1"}),"Email"]}),a&&n&&e.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>n(Array.from(t)),disabled:y,children:[e.jsx(Wg,{className:"h-3.5 w-3.5 mr-1"}),"Send to Lead Pond"]}),l&&o&&e.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>o(Array.from(t)),disabled:y,children:[e.jsx(py,{className:"h-3.5 w-3.5 mr-1"}),"Transfer"]}),e.jsxs(Q,{variant:"outline",size:"sm",onClick:A,disabled:y,children:[e.jsx(Oi,{className:"h-3.5 w-3.5 mr-1"}),"Export"]}),e.jsxs(Q,{variant:"outline",size:"sm",onClick:M,disabled:y,className:"text-destructive hover:text-destructive",children:[e.jsx(Rs,{className:"h-3.5 w-3.5 mr-1"}),"Delete"]}),e.jsxs(Q,{variant:"ghost",size:"sm",onClick:s,className:"ml-auto",children:[e.jsx(rn,{className:"h-3.5 w-3.5 mr-1"}),"Clear"]})]}),e.jsx(Gae,{open:b,onOpenChange:N,bulkContacts:Array.from(t).map(I=>{const F=r.find(O=>O.id===I);return F?{id:F.id,first_name:F.first_name,last_name:F.last_name,email:F.email||""}:null}).filter(I=>I!==null&&I.email!==""),onSendComplete:()=>{N(!1),s()}})]})}function MCe({contact:t,onEdit:r,onDelete:s,onSnooze:n,onSendToLeadPond:a,showLeadPondAction:o,onTransfer:l,showTransferAction:i}){const d=Ws(),m=`${t.first_name} ${t.last_name||""}`.trim();return e.jsxs(mh,{children:[e.jsx(ph,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:g=>g.stopPropagation(),children:e.jsx(kf,{className:"h-4 w-4"})})}),e.jsxs(Au,{align:"end",onClick:g=>g.stopPropagation(),children:[e.jsxs(Ba,{onClick:()=>d(`/mission-control/contacts/${t.id}?tab=activity&action=log`),children:[e.jsx(wi,{className:"h-4 w-4 mr-2"}),"Log Touch"]}),e.jsxs(Ba,{onClick:()=>d(`/mission-control/video?contactId=${t.id}`),children:[e.jsx(ya,{className:"h-4 w-4 mr-2"}),"Send Video"]}),e.jsxs(Ba,{onClick:()=>d(`/mission-control/popbys?contactId=${t.id}`),children:[e.jsx(eo,{className:"h-4 w-4 mr-2"}),"Schedule Pop-by"]}),e.jsxs(Ba,{onClick:()=>n(t.id,m),children:[e.jsx(Nm,{className:"h-4 w-4 mr-2"}),"Snooze"]}),o&&a&&e.jsxs(Ba,{onClick:()=>a(t.id),children:[e.jsx(Wg,{className:"h-4 w-4 mr-2"}),"Send to Lead Pond"]}),i&&l&&e.jsxs(Ba,{onClick:()=>l(t.id),children:[e.jsx(py,{className:"h-4 w-4 mr-2"}),"Transfer to Team Member"]}),e.jsxs(Ba,{onClick:()=>r(t),children:[e.jsx(ei,{className:"h-4 w-4 mr-2"}),"Edit"]}),e.jsxs(Ba,{onClick:()=>s(t.id),className:"text-destructive focus:text-destructive",children:[e.jsx(Rs,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})}function F5t(){const{user:t}=Gr();return Ht({queryKey:["contact-smart-lists",t==null?void 0:t.id],queryFn:async()=>{const{data:r,error:s}=await Z.from("contact_smart_lists").select("*").order("created_at",{ascending:!1});if(s)throw s;return r},enabled:!!t})}function z5t(){const t=qr(),{user:r}=Gr();return Jt({mutationFn:async({name:s,filters:n,sort_by:a})=>{const{data:o,error:l}=await Z.from("contact_smart_lists").insert({owner_user_id:r.id,name:s,filters:n,sort_by:a}).select().single();if(l)throw l;return o},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-smart-lists"]}),Jn({title:"Smart filter saved"})},onError:s=>{Jn({title:"Error saving smart filter",description:s.message,variant:"destructive"})}})}function B5t(){const t=qr();return Jt({mutationFn:async r=>{const{error:s}=await Z.from("contact_smart_lists").delete().eq("id",r);if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-smart-lists"]}),Jn({title:"Smart filter deleted"})}})}function $5t({currentFilters:t,currentSortBy:r,onApplySmartList:s}){const{data:n}=F5t(),a=z5t(),o=B5t(),[l,i]=E.useState(!1),[d,m]=E.useState(""),g=t.search||t.type&&t.type!=="all"||t.status&&t.status!=="all",y=async()=>{d.trim()&&(await a.mutateAsync({name:d.trim(),filters:t,sort_by:r}),m(""),i(!1))};return e.jsxs(e.Fragment,{children:[e.jsxs(mh,{children:[e.jsx(ph,{asChild:!0,children:e.jsxs(Q,{variant:"outline",size:"sm",className:"gap-1.5",children:[e.jsx(Z1,{className:"h-3.5 w-3.5"}),"Smart Filters",n&&n.length>0&&e.jsx(bt,{variant:"secondary",className:"h-5 px-1.5 text-[10px]",children:n.length}),e.jsx(Jc,{className:"h-3.5 w-3.5"})]})}),e.jsxs(Au,{align:"start",className:"w-56",children:[n&&n.length>0?e.jsxs(e.Fragment,{children:[n.map(v=>e.jsxs(Ba,{className:"flex items-center justify-between group",children:[e.jsx("span",{className:"flex-1 cursor-pointer",onClick:()=>s(v.filters,v.sort_by),children:v.name}),e.jsx(Q,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 opacity-0 group-hover:opacity-100",onClick:b=>{b.stopPropagation(),o.mutate(v.id)},children:e.jsx(Rs,{className:"h-3 w-3 text-destructive"})})]},v.id)),e.jsx(yk,{})]}):e.jsx(Ba,{disabled:!0,className:"text-muted-foreground text-xs",children:"No saved filters yet"}),g&&e.jsxs(Ba,{onClick:()=>i(!0),children:[e.jsx(pA,{className:"h-4 w-4 mr-2"}),"Save Current Filter"]})]})]}),e.jsx(Dr,{open:l,onOpenChange:i,children:e.jsxs(Lr,{className:"max-w-sm",children:[e.jsx(Ur,{children:e.jsx(Br,{children:"Save Smart Filter"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(Qe,{placeholder:"e.g. Buyers in 40205",value:d,onChange:v=>m(v.target.value),onKeyDown:v=>v.key==="Enter"&&y(),autoFocus:!0}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(Q,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(Q,{onClick:y,disabled:!d.trim()||a.isPending,children:"Save"})]})]})]})})]})}function eA(t){if(!t)return null;try{const r=t.split(/[-/T]/);if(r.length<3)return null;const s=parseInt(r[1],10)-1,n=parseInt(r[2],10);if(isNaN(s)||isNaN(n))return null;const a=new Date;a.setHours(0,0,0,0);let o=new Date(a.getFullYear(),s,n);return o.setHours(0,0,0,0),os)return null;const a=r==="birthday"?"🎂":"🏡",o=n===0?r==="birthday"?"Birthday today!":"Anniversary today!":n===1?r==="birthday"?"Birthday tomorrow":"Anniversary tomorrow":`${a} in ${n}d`;return{emoji:a,label:o,daysUntil:n}}function ACe({birthday:t,homeAnniversary:r,className:s}){const n=TCe(t,"birthday",7),a=TCe(r,"anniversary",7);return!n&&!a?null:e.jsxs("div",{className:qt("flex flex-wrap gap-1",s),children:[n&&e.jsx(bt,{variant:"secondary",className:qt("text-[10px] gap-0.5 font-medium",n.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:n.label}),a&&e.jsx(bt,{variant:"secondary",className:qt("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 ECe({deal:t}){if(!t||!t.stage)return null;const{stage:r}=t;return e.jsxs(bt,{variant:"outline",className:"text-[10px] gap-1 font-medium whitespace-nowrap",style:{borderColor:r.color,color:r.color,backgroundColor:`${r.color}10`},children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full inline-block",style:{backgroundColor:r.color}}),r.name]})}function U5t(){const t=Ll();return Ht({queryKey:["contact-deals-map",t],queryFn:async()=>{const{data:r,error:s}=await Z.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(s)throw s;const n={};return(r||[]).forEach(a=>{a.contact_id&&!n[a.contact_id]&&(n[a.contact_id]=a)}),n},enabled:!!t})}function q5t(){var At;const t=Ws(),[r]=Bc(),{user:s}=Gr(),n=e5(),a=qr(),o=r.get("type"),l=r.get("filter")??r.get("status"),i=r.get("new")==="true",{contactsWithScores:d,isLoading:m}=Kye(),{data:g}=Qf(),{data:y}=U5t(),v=Vye(),b=BRe(),N=Hye(),[j,S]=E.useState(""),[A,M]=E.useState(o||"all"),[I,F]=E.useState(l||"all"),[O,B]=E.useState("date-added"),[$,H]=E.useState(i),[W,X]=E.useState(null),[se,ae]=E.useState(!1),[le,ne]=E.useState(!1),[fe,oe]=E.useState(null),[de,ue]=E.useState(""),[xe,Te]=E.useState(new Set),[be,we]=E.useState(!1),[ve,tt]=E.useState(1),[Ae,Le]=E.useState(50),[Ue,Ye]=E.useState("my"),{data:Ie}=Lv(),{addToLeadPond:et}=dBe(Ie==null?void 0:Ie.teamId),It=!!((At=Ie==null?void 0:Ie.team)!=null&&At.lead_pond_enabled&&(Ie!=null&&Ie.teamId)),Pe=!!(Ie!=null&&Ie.teamId),[at,ce]=E.useState([]),[$e,Ge]=E.useState(!1),rt=Rt=>{ce([Rt]),Ge(!0)},je=Rt=>{ce(Rt),Ge(!0)},it=Rt=>{Ie!=null&&Ie.teamId&&et.mutate({contact_id:Rt,team_id:Ie.teamId})},Me=Rt=>{Ie!=null&&Ie.teamId&&Rt.forEach(Cr=>{et.mutate({contact_id:Cr,team_id:Ie.teamId})})},Je=E.useCallback(Rt=>{we(!1),Te(Cr=>{const fs=new Set(Cr);return fs.has(Rt)?fs.delete(Rt):fs.add(Rt),fs})},[]);E.useEffect(()=>{if(!(s!=null&&s.id))return;const Rt=Z.channel(`innercircle_contacts_inserts_${s.id}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"innercircle_contacts",filter:`owner_user_id=eq.${s.id}`},()=>{a.invalidateQueries({queryKey:["innercircle-contacts"]}),a.invalidateQueries({queryKey:["innercircle-contact-counts"]})}).subscribe();return()=>{Z.removeChannel(Rt)}},[a,s==null?void 0:s.id]),E.useEffect(()=>{l&&F(l)},[l]);const[Xe,Ve]=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&&H(!0)},[i]),E.useEffect(()=>{var Rt;W&&Ve({first_name:W.first_name||"",last_name:W.last_name||"",email:W.email||"",phone:W.phone||"",address:W.address||"",city:W.city||"",state:W.state||"",zip_code:W.zip_code||"",birthday:W.birthday||"",home_anniversary:W.home_anniversary||"",spouse_name:W.spouse_name||"",spouse_email:W.spouse_email||"",notes:W.notes||"",tagIds:((Rt=W.tags)==null?void 0:Rt.map(Cr=>Cr.relationship_type_id))||[]})},[W]);const ot=E.useMemo(()=>{if(!d)return[];let Rt=d.filter(Cr=>{var Js,hi,Ia;const fs=j===""||`${Cr.first_name} ${Cr.last_name}`.toLowerCase().includes(j.toLowerCase())||((Js=Cr.email)==null?void 0:Js.toLowerCase().includes(j.toLowerCase()))||((hi=Cr.phone)==null?void 0:hi.includes(j)),Vs=A==="all"||((Ia=Cr.tags)==null?void 0:Ia.some(dn=>dn.relationship_type_id===A));return fs&&Vs});return I==="not-touched-90"?Rt=Rt.filter(Cr=>{const fs=Cr.relationshipScore.daysSinceTouch;return fs===null||fs>90}):I==="at-risk"?Rt=Rt.filter(Cr=>Cr.relationshipScore.status==="at-risk"):I==="cooling"?Rt=Rt.filter(Cr=>Cr.relationshipScore.status==="cooling"):I==="warm"?Rt=Rt.filter(Cr=>Cr.relationshipScore.status==="warm"):I==="has-deal"?Rt=Rt.filter(Cr=>y&&y[Cr.id]):I==="no-deal"?Rt=Rt.filter(Cr=>!y||!y[Cr.id]):I==="open-house"&&(Rt=Rt.filter(Cr=>Cr.lead_source==="Open House")),Rt=[...Rt].sort((Cr,fs)=>{switch(O){case"important-dates":{const Vs=eA(Cr.birthday),Js=eA(fs.birthday),hi=eA(Cr.home_anniversary),Ia=eA(fs.home_anniversary),dn=[Vs,hi].filter(en=>en!==null).sort((en,Un)=>(en??1/0)-(Un??1/0))[0]??1/0,na=[Js,Ia].filter(en=>en!==null).sort((en,Un)=>(en??1/0)-(Un??1/0))[0]??1/0;return dn-na}case"last-touched":{const Vs=Cr.relationshipScore.lastTouchDate,Js=fs.relationshipScore.lastTouchDate;return!Vs&&!Js?0:Vs?Js?new Date(Vs).getTime()-new Date(Js).getTime():1:-1}case"next-touch":{const Vs=Cr.relationshipScore.daysSinceTouch,Js=fs.relationshipScore.daysSinceTouch;return Vs===null&&Js===null?0:Vs===null?-1:Js===null?1:Js-Vs}case"score":return Cr.relationshipScore.score-fs.relationshipScore.score;case"date-added":{const Vs=Cr.created_at,Js=fs.created_at;return!Vs&&!Js?0:Vs?Js?new Date(Js).getTime()-new Date(Vs).getTime():-1:1}case"name":default:{const Vs=`${Cr.first_name||""} ${Cr.last_name||""}`.toLowerCase(),Js=`${fs.first_name||""} ${fs.last_name||""}`.toLowerCase();return Vs.localeCompare(Js)}}}),Rt},[d,j,A,I,O,y]),mt=ot.length,ft=Math.max(1,Math.ceil(mt/Ae)),ct=Math.min(ve,ft),Mt=E.useMemo(()=>{const Rt=(ct-1)*Ae;return ot.slice(Rt,Rt+Ae)},[ot,ct,Ae]);E.useEffect(()=>{tt(1)},[j,A,I,O]);const Ot=E.useCallback(()=>{we(!1),Te(Rt=>Rt.size>0?new Set:new Set(Mt.map(Cr=>Cr.id)))},[Mt]),rr=E.useCallback(()=>{we(!0),Te(new Set(ot.map(Rt=>Rt.id)))},[ot]),Ir=E.useCallback((Rt,Cr)=>{S(Rt.search||""),M(Rt.type||"all"),F(Rt.status||"all"),B(Cr||"name")},[]),cr=()=>{Ve({first_name:"",last_name:"",email:"",phone:"",address:"",city:"",state:"",zip_code:"",birthday:"",home_anniversary:"",spouse_name:"",spouse_email:"",notes:"",tagIds:[]})},Mr=async Rt=>{Rt.preventDefault(),W?(await b.mutateAsync({id:W.id,...Xe}),X(null)):(await v.mutateAsync(Xe),H(!1)),cr()},As=async Rt=>{confirm("Are you sure you want to delete this contact?")&&await N.mutateAsync(Rt)};return e.jsx(Fr,{title:"Contacts",description:"Manage your InnerCircle contacts",children:e.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Contacts"}),e.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"})]}),Ie&&e.jsxs("div",{className:"flex bg-muted rounded-lg p-1 gap-0.5",children:[e.jsx("button",{onClick:()=>Ye("my"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-colors ${Ue==="my"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"My Contacts"}),(Ie.team.contact_visibility==="full_team"||Ie.team.contact_visibility==="leader_only"&&Ie.role==="team_leader")&&e.jsxs("button",{onClick:()=>Ye("team"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-colors flex items-center gap-1.5 ${Ue==="team"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[e.jsx(ws,{className:"h-3.5 w-3.5"}),"Team"]}),Ie.team.lead_pond_enabled&&e.jsxs("button",{onClick:()=>Ye("lead-pond"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-colors flex items-center gap-1.5 ${Ue==="lead-pond"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[e.jsx(Wg,{className:"h-3.5 w-3.5"}),"Lead Pond"]})]})]}),e.jsx("div",{className:"flex items-center gap-4",children:e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>t("/mission-control"),children:[e.jsx(uc,{className:"h-4 w-4 mr-1"}),"Back"]})}),Ue==="team"?e.jsx(Y0e,{}):Ue==="lead-pond"&&Ie?e.jsx(X0e,{teamId:Ie.teamId}):e.jsxs(e.Fragment,{children:[e.jsx(ze,{children:e.jsx(qe,{className:"p-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search by name, email, or phone...",value:j,onChange:Rt=>S(Rt.target.value),className:"pl-9"})]}),e.jsxs(ds,{value:A,onValueChange:M,children:[e.jsx(ls,{className:"w-[160px]",children:e.jsx(us,{placeholder:"Filter by type"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Types"}),g==null?void 0:g.filter(Rt=>Rt.active).map(Rt=>e.jsx(Ut,{value:Rt.id,children:Rt.name},Rt.id))]})]}),e.jsxs(ds,{value:I,onValueChange:F,children:[e.jsx(ls,{className:"w-[160px]",children:e.jsx(us,{placeholder:"Filter by status"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Status"}),e.jsx(Ut,{value:"warm",children:"🟢 Warm"}),e.jsx(Ut,{value:"cooling",children:"🟡 Cooling Off"}),e.jsx(Ut,{value:"at-risk",children:"🔴 At Risk"}),e.jsx(Ut,{value:"has-deal",children:"📋 Has Deal"}),e.jsx(Ut,{value:"no-deal",children:"📭 No Deal"}),e.jsx(Ut,{value:"open-house",children:"🏠 Open House"})]})]}),e.jsxs(ds,{value:O,onValueChange:B,children:[e.jsx(ls,{className:"w-[180px]",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Of,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(us,{placeholder:"Sort by"})]})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"name",children:"Name (A-Z)"}),e.jsx(Ut,{value:"important-dates",children:"Important Dates"}),e.jsx(Ut,{value:"last-touched",children:"Last Touched"}),e.jsx(Ut,{value:"next-touch",children:"Next Touch Due"}),e.jsx(Ut,{value:"score",children:"Relationship Score"}),e.jsx(Ut,{value:"date-added",children:"Date Added"})]})]}),e.jsx($5t,{currentFilters:{search:j,type:A,status:I},currentSortBy:O,onApplySmartList:Ir}),e.jsxs(Q,{onClick:()=>H(!0),children:[e.jsx(gs,{className:"h-4 w-4 mr-1"}),"Add Contact"]}),e.jsxs(Q,{variant:"outline",onClick:()=>ae(!0),children:[e.jsx(to,{className:"h-4 w-4 mr-1"}),"Import CSV"]}),e.jsxs(Q,{variant:"outline",onClick:()=>ne(!0),children:[e.jsx(by,{className:"h-4 w-4 mr-1"}),"Import from Phone"]})]})})}),e.jsx(R5t,{selectedIds:xe,contacts:ot,onClearSelection:()=>{Te(new Set),we(!1)},showLeadPondAction:It,onSendToLeadPond:Me,showTransferAction:Pe,onTransfer:je}),xe.size>0&&xe.size===Mt.length&&!be&&mt>Ae&&e.jsxs("div",{className:"flex items-center justify-center gap-2 p-2 bg-primary/5 border border-primary/20 rounded-lg text-sm",children:[e.jsxs("span",{children:["All ",Mt.length," contacts on this page are selected."]}),e.jsxs(Q,{variant:"link",size:"sm",className:"h-auto p-0 font-semibold",onClick:rr,children:["Select all ",mt.toLocaleString()," matching contacts"]})]}),be&&e.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.",e.jsx(Q,{variant:"link",size:"sm",className:"h-auto p-0",onClick:()=>{Te(new Set),we(!1)},children:"Clear selection"})]}),n?e.jsx("div",{className:"space-y-3",children:m?e.jsx(ze,{className:"p-6 text-center text-muted-foreground",children:"Loading contacts..."}):ot.length===0?e.jsx(ze,{className:"p-6 text-center text-muted-foreground",children:j||A!=="all"||I!=="all"?"No contacts match your search":"No contacts yet. Add your first contact!"}):Mt.map(Rt=>{var fs;const{relationshipScore:Cr}=Rt;return e.jsx(ze,{className:"cursor-pointer hover:bg-accent/50 transition-colors",onClick:()=>{const Vs=new URLSearchParams;j&&Vs.set("search",j),A!=="all"&&Vs.set("type",A),I!=="all"&&Vs.set("filter",I);const Js=Vs.toString();t(`/mission-control/contacts/${Rt.id}${Js?`?${Js}`:""}`)},children:e.jsx(qe,{className:"p-4",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("h3",{className:"font-semibold text-base truncate",children:[Rt.first_name," ",Rt.last_name]}),e.jsx(Wi,{className:"h-4 w-4 text-muted-foreground shrink-0"})]}),e.jsxs("div",{className:"space-y-1 text-sm mb-3",children:[Rt.email&&e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(mn,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"truncate",children:Rt.email})]}),Rt.phone&&e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(wi,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{children:Rt.phone})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1 mb-2",children:[e.jsx(Gde,{score:Cr,size:"sm"}),e.jsx(Ape,{contact:Rt}),Rt.lead_source&&e.jsx(bt,{variant:"outline",className:"text-xs gap-1 border-primary/30 text-primary",children:Rt.lead_source}),(fs=Rt.tags)==null?void 0:fs.map(Vs=>{var Js;return e.jsx(bt,{variant:"secondary",className:"text-xs",children:(Js=Vs.relationship_type)==null?void 0:Js.name},Vs.id)}),e.jsx(ECe,{deal:y==null?void 0:y[Rt.id]})]}),e.jsx(ACe,{birthday:Rt.birthday,homeAnniversary:Rt.home_anniversary,className:"mb-2"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[Cr.lastTouchDate?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Ea,{className:"h-3 w-3"}),Xr(new Date(Cr.lastTouchDate),"MMM d")]}):e.jsx("span",{className:"italic",children:"Never contacted"}),Rt.birthday&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Mn,{className:"h-3 w-3"}),Xr(new Date(Rt.birthday),"MMM d")]}),Rt.home_anniversary&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Wn,{className:"h-3 w-3"}),Xr(new Date(Rt.home_anniversary),"MMM d")]})]})]}),e.jsx("div",{className:"ml-2",onClick:Vs=>Vs.stopPropagation(),children:e.jsx(MCe,{contact:Rt,onEdit:X,onDelete:As,onSnooze:(Vs,Js)=>{oe(Vs),ue(Js)},showLeadPondAction:It,onSendToLeadPond:it,showTransferAction:Pe,onTransfer:rt})})]})})},Rt.id)})}):e.jsx(ze,{children:e.jsx(qe,{className:"p-0 overflow-x-auto",children:e.jsxs(Rn,{className:"min-w-[800px]",children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{className:"w-[40px]",children:e.jsx(Yo,{checked:Mt.length>0&&Mt.every(Rt=>xe.has(Rt.id)),onCheckedChange:()=>Ot()})}),e.jsx(Ct,{children:"Name"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{children:"Score"}),e.jsx(Ct,{children:"Contact Info"}),e.jsx(Ct,{children:"Types / Pipeline"}),e.jsx(Ct,{children:"Last Contact"}),e.jsx(Ct,{children:"Important Dates"}),e.jsx(Ct,{className:"w-[50px]",children:"Actions"})]})}),e.jsx(zn,{children:m?e.jsx(Nr,{children:e.jsx(dt,{colSpan:9,className:"text-center py-8",children:"Loading contacts..."})}):ot.length===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:9,className:"text-center py-8 text-muted-foreground",children:j||A!=="all"||I!=="all"?"No contacts match your search":"No contacts yet. Add your first contact!"})}):Mt.map(Rt=>{var Vs;const{relationshipScore:Cr}=Rt,fs=y==null?void 0:y[Rt.id];return e.jsxs(Nr,{className:`cursor-pointer hover:bg-accent/50 ${xe.has(Rt.id)?"bg-accent/30":""}`,onClick:()=>{const Js=new URLSearchParams;j&&Js.set("search",j),A!=="all"&&Js.set("type",A),I!=="all"&&Js.set("status",I);const hi=Js.toString();t(`/mission-control/contacts/${Rt.id}${hi?`?${hi}`:""}`)},children:[e.jsx(dt,{onClick:Js=>Js.stopPropagation(),children:e.jsx(Yo,{checked:xe.has(Rt.id),onCheckedChange:()=>Je(Rt.id)})}),e.jsxs(dt,{className:"font-medium",children:[Rt.first_name," ",Rt.last_name]}),e.jsx(dt,{children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(Gde,{score:Cr,size:"sm"}),e.jsx(Ape,{contact:Rt})]})}),e.jsx(dt,{children:e.jsx(Gde,{score:Cr,size:"sm",showScore:!0})}),e.jsx(dt,{children:e.jsxs("div",{className:"space-y-1 text-sm",children:[Rt.email&&e.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[e.jsx(mn,{className:"h-3 w-3"}),Rt.email]}),Rt.phone&&e.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[e.jsx(wi,{className:"h-3 w-3"}),Rt.phone]})]})}),e.jsx(dt,{children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[Rt.lead_source&&e.jsx(bt,{variant:"outline",className:"text-xs border-primary/30 text-primary",children:Rt.lead_source}),(Vs=Rt.tags)==null?void 0:Vs.map(Js=>{var hi;return e.jsx(bt,{variant:"secondary",className:"text-xs",children:(hi=Js.relationship_type)==null?void 0:hi.name},Js.id)}),e.jsx(ECe,{deal:fs})]})}),e.jsx(dt,{children:e.jsx("div",{className:"text-sm",children:Cr.lastTouchDate?e.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[e.jsx(Ea,{className:"h-3 w-3"}),Xr(new Date(Cr.lastTouchDate),"MMM d, yyyy")]}):e.jsx("span",{className:"text-muted-foreground text-xs italic",children:"Never contacted"})})}),e.jsx(dt,{children:e.jsxs("div",{className:"space-y-1",children:[e.jsx(ACe,{birthday:Rt.birthday,homeAnniversary:Rt.home_anniversary}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[Rt.birthday&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Mn,{className:"h-3 w-3"}),Xr(new Date(Rt.birthday),"MMM d")]}),Rt.home_anniversary&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Wn,{className:"h-3 w-3"}),Xr(new Date(Rt.home_anniversary),"MMM d")]})]})]})}),e.jsx(dt,{children:e.jsx(MCe,{contact:Rt,onEdit:X,onDelete:As,onSnooze:(Js,hi)=>{oe(Js),ue(hi)},showLeadPondAction:It,onSendToLeadPond:it,showTransferAction:Pe,onTransfer:rt})})]},Rt.id)})})]})})}),mt>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsxs("span",{children:["Showing ",(ct-1)*Ae+1,"–",Math.min(ct*Ae,mt)," of ",mt.toLocaleString()," contacts"]}),e.jsxs(ds,{value:String(Ae),onValueChange:Rt=>{Le(Number(Rt)),tt(1)},children:[e.jsx(ls,{className:"w-[80px] h-8",children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"50",children:"50"}),e.jsx(Ut,{value:"100",children:"100"}),e.jsx(Ut,{value:"250",children:"250"})]})]}),e.jsx("span",{className:"text-xs",children:"per page"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Q,{variant:"outline",size:"sm",disabled:ct<=1,onClick:()=>tt(1),children:"First"}),e.jsx(Q,{variant:"outline",size:"sm",disabled:ct<=1,onClick:()=>tt(Rt=>Rt-1),children:e.jsx(uc,{className:"h-4 w-4"})}),e.jsxs("span",{className:"px-3 text-sm font-medium",children:["Page ",ct," of ",ft]}),e.jsx(Q,{variant:"outline",size:"sm",disabled:ct>=ft,onClick:()=>tt(Rt=>Rt+1),children:e.jsx(Wi,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"outline",size:"sm",disabled:ct>=ft,onClick:()=>tt(ft),children:"Last"})]})]}),e.jsx(Dr,{open:$||!!W,onOpenChange:Rt=>{Rt||(H(!1),X(null),cr())},children:e.jsxs(Lr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[e.jsx(Ur,{children:e.jsx(Br,{children:W?"Edit Contact":"Add Contact"})}),e.jsxs("form",{onSubmit:Mr,className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"first_name",children:"First Name *"}),e.jsx(Qe,{id:"first_name",value:Xe.first_name,onChange:Rt=>Ve({...Xe,first_name:Rt.target.value}),required:!0})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"last_name",children:"Last Name"}),e.jsx(Qe,{id:"last_name",value:Xe.last_name,onChange:Rt=>Ve({...Xe,last_name:Rt.target.value})})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"email",children:"Email"}),e.jsx(Qe,{id:"email",type:"email",value:Xe.email,onChange:Rt=>Ve({...Xe,email:Rt.target.value})})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"phone",children:"Phone"}),e.jsx(Qe,{id:"phone",value:Xe.phone,onChange:Rt=>Ve({...Xe,phone:Rt.target.value})})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"address",children:"Address"}),e.jsx(Qe,{id:"address",value:Xe.address,onChange:Rt=>Ve({...Xe,address:Rt.target.value}),placeholder:"Street address"})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"city",children:"City"}),e.jsx(Qe,{id:"city",value:Xe.city,onChange:Rt=>Ve({...Xe,city:Rt.target.value})})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"state",children:"State"}),e.jsx(Qe,{id:"state",value:Xe.state,onChange:Rt=>Ve({...Xe,state:Rt.target.value})})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"zip_code",children:"Zip"}),e.jsx(Qe,{id:"zip_code",value:Xe.zip_code,onChange:Rt=>Ve({...Xe,zip_code:Rt.target.value})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"birthday",children:"Birthday"}),e.jsx(Qe,{id:"birthday",type:"date",value:Xe.birthday,onChange:Rt=>Ve({...Xe,birthday:Rt.target.value})})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"home_anniversary",children:"Home Anniversary"}),e.jsx(Qe,{id:"home_anniversary",type:"date",value:Xe.home_anniversary,onChange:Rt=>Ve({...Xe,home_anniversary:Rt.target.value})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"spouse_name",children:"Spouse/Partner Name"}),e.jsx(Qe,{id:"spouse_name",value:Xe.spouse_name,onChange:Rt=>Ve({...Xe,spouse_name:Rt.target.value}),placeholder:"Spouse/partner name"})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"spouse_email",children:"Spouse/Partner Email"}),e.jsx(Qe,{id:"spouse_email",type:"email",value:Xe.spouse_email,onChange:Rt=>Ve({...Xe,spouse_email:Rt.target.value}),placeholder:"Spouse/partner email"})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"Relationship Types"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:g==null?void 0:g.filter(Rt=>Rt.active).map(Rt=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx(Yo,{checked:Xe.tagIds.includes(Rt.id),onCheckedChange:Cr=>{Ve(Cr?{...Xe,tagIds:[...Xe.tagIds,Rt.id]}:{...Xe,tagIds:Xe.tagIds.filter(fs=>fs!==Rt.id)})}}),e.jsx("span",{className:"text-sm",children:Rt.name})]},Rt.id))})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"notes",children:"Notes"}),e.jsx(Ks,{id:"notes",value:Xe.notes,onChange:Rt=>Ve({...Xe,notes:Rt.target.value}),rows:3})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>{H(!1),X(null),cr()},children:"Cancel"}),e.jsxs(Q,{type:"submit",disabled:v.isPending||b.isPending,children:[W?"Update":"Create"," Contact"]})]})]})]})}),e.jsx(P5t,{open:se,onOpenChange:ae,relationshipTypes:(g==null?void 0:g.filter(Rt=>Rt.active))||[],onSuccess:()=>{ae(!1)}}),e.jsx(D5t,{open:le,onOpenChange:ne,onComplete:()=>ne(!1)}),e.jsx(Wae,{open:!!fe,onOpenChange:Rt=>{Rt||oe(null)},contactId:fe||"",contactName:de}),e.jsx(uBe,{open:$e,onOpenChange:Ge,contactIds:at,contactNames:at.map(Rt=>{const Cr=ot.find(fs=>fs.id===Rt);return Cr?`${Cr.first_name} ${Cr.last_name||""}`.trim():""}),onComplete:()=>{ce([]),Te(new Set),we(!1)}})]})]})})}function V5t(){return Ht({queryKey:["video-script-categories"],queryFn:async()=>{const{data:t,error:r}=await Z.from("video_script_categories").select("*").order("sort_order");if(r)throw r;return t}})}function H5t(t){return Ht({queryKey:["video-scripts",t],queryFn:async()=>{let r=Z.from("video_scripts").select("*, category:video_script_categories(*)").eq("is_active",!0).order("title");const{data:s,error:n}=await r;if(n)throw n;return s}})}function W5t(){const{user:t}=Gr();return Ht({queryKey:["user-video-scripts",t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id))return[];const{data:r,error:s}=await Z.from("user_video_scripts").select("*, category:video_script_categories(*)").eq("owner_user_id",t.id).order("title");if(s)throw s;return r},enabled:!!(t!=null&&t.id)})}function G5t(){const{user:t}=Gr(),r=qr();return Jt({mutationFn:async s=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const{data:n,error:a}=await Z.from("user_video_scripts").insert([{owner_user_id:t.id,source_script_id:s.id,category_id:s.category_id,title:s.title,script_text:s.script_text,tags:s.tags,is_custom:!1}]).select().single();if(a)throw a;return n},onSuccess:()=>{r.invalidateQueries({queryKey:["user-video-scripts"]})}})}function K5t(t){const{user:r}=Gr();return Ht({queryKey:["agent-videos",r==null?void 0:r.id,t],queryFn:async()=>{if(!(r!=null&&r.id))return[];let s=Z.from("agent_videos").select("*, contact:innercircle_contacts(id, first_name, last_name)").eq("owner_user_id",r.id).order("created_at",{ascending:!1});s=s.eq("is_deleted",!1);const{data:n,error:a}=await s;if(a)throw a;return n},enabled:!!(r!=null&&r.id)})}function Z5t(t){return Ht({queryKey:["agent-video",t],queryFn:async()=>{const{data:r,error:s}=await Z.from("agent_videos").select("*, contact:innercircle_contacts(id, first_name, last_name)").eq("id",t).single();if(s)throw s;return r},enabled:!!t})}function Zae(){const{user:t}=Gr(),r=qr();return Jt({mutationFn:async s=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const{data:n,error:a}=await Z.from("agent_videos").insert([{owner_user_id:t.id,contact_id:s.contact_id,bunny_video_id:s.bunny_video_id,playback_url:s.playback_url,thumbnail_url:s.thumbnail_url,preview_url:s.preview_url,duration_seconds:s.duration_seconds,file_size_mb:s.file_size_mb||0,title:s.title,notes:s.notes,task_id:s.task_id,status:s.status||"processing",touch_type:s.touch_type||"video",page_template:"default"}]).select("*, share_token").single();if(a)throw a;return n},onSuccess:()=>{r.invalidateQueries({queryKey:["agent-videos"]}),r.invalidateQueries({queryKey:["storage-usage"]})}})}function Y5t(){const t=qr();return Jt({mutationFn:async({id:r,...s})=>{const{data:n,error:a}=await Z.from("agent_videos").update(s).eq("id",r).select().single();if(a)throw a;return n},onSuccess:r=>{t.invalidateQueries({queryKey:["agent-videos"]}),t.invalidateQueries({queryKey:["agent-video",r.id]})}})}function X5t(){const t=qr();return Jt({mutationFn:async({id:r,bunnyVideoId:s,hardDelete:n=!1})=>{if(console.log("Deleting video:",{id:r,bunnyVideoId:s,hardDelete:n}),s){console.log("Calling bunny-upload delete for videoId:",s);const{data:a,error:o}=await Z.functions.invoke("bunny-upload",{body:{action:"delete",videoId:s,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(n){console.log("Hard deleting from database:",r);const{error:a}=await Z.from("agent_videos").delete().eq("id",r);if(a)throw a}else{console.log("Soft deleting from database:",r);const{error:a}=await Z.from("agent_videos").update({is_deleted:!0}).eq("id",r);if(a)throw a}console.log("Video deletion complete")},onSuccess:()=>{t.invalidateQueries({queryKey:["agent-videos"]}),t.invalidateQueries({queryKey:["storage-usage"]})}})}function Yae(){const{user:t}=Gr();return Ht({queryKey:["storage-usage",t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id))return null;const{data:r,error:s}=await Z.from("agent_storage_usage").select("*").eq("user_id",t.id).maybeSingle();if(s)throw s;return r||{user_id:t.id,total_storage_mb:0,storage_tier:"basic",max_storage_mb:1024}},enabled:!!(t!=null&&t.id)})}function WBe(){const{data:t,isLoading:r}=Yae(),s=t?t.total_storage_mb0?t.total_storage_mb/t.max_storage_mb*100:0,o=a>=80;return{canRecord:s,remainingMb:n,usagePercent:a,isNearLimit:o,storage:t,isLoading:r}}async function GBe(t){const{data:r,error:s}=await Z.functions.invoke("bunny-upload",{body:{action:"create",title:t,isAgentVideo:!0}});if(s)throw s;return r}async function KBe(t){const{data:r,error:s}=await Z.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:t,isAgentVideo:!0}});if(s)throw s;return r}async function ZBe(t){const{data:r,error:s}=await Z.functions.invoke("bunny-upload",{body:{action:"status",videoId:t,isAgentVideo:!0}});if(s)throw s;return r}function Q5t(){const{user:t}=Gr(),r=qr();return Jt({mutationFn:async({contactId:s,videoId:n,notes:a})=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const{data:o}=await Z.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 Z.from("contact_touch_logs").insert([{owner_user_id:t.id,contact_id:s,action_type_id:o.id,notes:a||`Quick Video Touch - Video ID: ${n}`}]).select().single();if(i)throw i;return l},onSuccess:()=>{r.invalidateQueries({queryKey:["contact-touch-logs"]}),r.invalidateQueries({queryKey:["contacts"]})}})}function J5t(t){return Ht({queryKey:["contact-video-replies",t],queryFn:async()=>{if(!t)return[];const{data:r,error:s}=await Z.from("video_replies").select(` *, video:agent_videos(id, title, thumbnail_url, playback_url) `).eq("contact_id",t).order("created_at",{ascending:!1});if(s)throw s;return r},enabled:!!t})}function eMt({videoId:t}){var l;const{data:r,isLoading:s,error:n}=Z5t(t);if(s)return e.jsxs("div",{className:"space-y-4",children:[e.jsx(fr,{className:"w-full aspect-video rounded-lg"}),e.jsx(fr,{className:"h-4 w-1/3"})]});if(n||!r||r.is_deleted)return e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Qu,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"font-medium",children:"Video Unavailable"}),e.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 d=i;return d.includes("iframe.mediadelivery.net/play/")&&(d=d.replace("/play/","/embed/"),d+=(d.includes("?")?"&":"?")+"autoplay=true&responsive=true"),d},o=(l=r.playback_url)==null?void 0:l.includes("iframe.mediadelivery.net");return e.jsxs("div",{className:"space-y-4",children:[r.playback_url?e.jsx("div",{className:"relative w-full aspect-video bg-black rounded-lg overflow-hidden",children:o?e.jsx("iframe",{src:a(r.playback_url),title:r.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}):e.jsx("video",{src:r.playback_url,controls:!0,autoPlay:!0,className:"absolute top-0 left-0 w-full h-full object-contain"})}):e.jsx("div",{className:"w-full aspect-video bg-muted rounded-lg flex items-center justify-center",children:e.jsx("p",{className:"text-muted-foreground",children:"Video is still processing..."})}),r.title&&e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium",children:r.title}),r.notes&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:r.notes})]})]})}function tMt({contactId:t}){const r=Ws(),{data:s,isLoading:n}=Ht({queryKey:["contact-linked-deals",t],queryFn:async()=>{const{data:a,error:o}=await Z.from("deal_pipeline").select(` id, deal_name, deal_type, expected_price, property_address, stage:deal_pipeline_stages(id, name, color, icon, is_won_stage, is_lost_stage) `).eq("contact_id",t).order("updated_at",{ascending:!1});if(o)throw o;return a},enabled:!!t});return n||!s||s.length===0?null:e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsxs(Zt,{className:"text-base flex items-center gap-2",children:[e.jsx(wu,{className:"h-4 w-4"}),"Linked Deals"]})}),e.jsx(qe,{className:"space-y-2",children:s.map(a=>{const o=a.stage;return e.jsx("button",{onClick:()=>r(`/mission-control/pipeline?deal=${a.id}`),className:"w-full text-left p-3 rounded-lg border hover:bg-accent transition-colors group",children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-medium text-sm truncate",children:a.deal_name}),a.property_address&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:a.property_address}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(bt,{variant:"outline",className:"text-[10px] capitalize",children:a.deal_type}),o&&e.jsxs(bt,{variant:"outline",className:"text-[10px] gap-1",style:{borderColor:o.color,color:o.color,backgroundColor:`${o.color}10`},children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full inline-block",style:{backgroundColor:o.color}}),o.name]})]})]}),e.jsx(Hi,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors flex-shrink-0"})]})},a.id)})})]})}function rMt(){var at,ce;const{contactId:t}=Xl(),r=Ws(),[s]=Bc(),n=s.get("search")||"",a=s.get("type")||"all",o=s.get("status")||"all",{data:l,isLoading:i}=yxt(t||""),{data:d}=Qf(),{data:m}=Wye(),{data:g}=gae(365),{data:y}=Kae(365),{data:v}=J5t(t),{contactsWithScores:b}=Kye(),N=BRe(),j=Hye(),S=URe(),[A,M]=E.useState(!1),[I,F]=E.useState({}),[O,B]=E.useState(!1),[$,H]=E.useState(null),[W,X]=E.useState(""),[se,ae]=E.useState(null),[le,ne]=E.useState(!1),[fe,oe]=E.useState(null),{isGmailConnected:de,gmailEmail:ue}=J3(),{data:xe}=Ht({queryKey:["gmail-sent-emails",t],queryFn:async()=>{const{data:$e,error:Ge}=await Z.from("gmail_sent_emails").select("*").eq("contact_id",t).order("sent_at",{ascending:!1});if(Ge)throw Ge;return $e},enabled:!!t}),Te=$e=>{if(!$e)return null;const Ge=$e.match(/Video ID:\s*([a-f0-9-]+)/i);return Ge?Ge[1]:null},be=E.useMemo(()=>{if(!b)return[];let $e=b.filter(Ge=>{var it,Me,Je;const rt=n===""||`${Ge.first_name} ${Ge.last_name}`.toLowerCase().includes(n.toLowerCase())||((it=Ge.email)==null?void 0:it.toLowerCase().includes(n.toLowerCase()))||((Me=Ge.phone)==null?void 0:Me.includes(n)),je=a==="all"||((Je=Ge.tags)==null?void 0:Je.some(Xe=>Xe.relationship_type_id===a));return rt&&je});return o==="not-touched-90"?$e=$e.filter(Ge=>{const rt=Ge.relationshipScore.daysSinceTouch;return rt===null||rt>90}):o==="at-risk"?$e=$e.filter(Ge=>Ge.relationshipScore.status==="at-risk"):o==="cooling"?$e=$e.filter(Ge=>Ge.relationshipScore.status==="cooling"):o==="warm"&&($e=$e.filter(Ge=>Ge.relationshipScore.status==="warm")),$e.map(Ge=>Ge.id)},[b,n,a,o]),we=be.indexOf(t||""),ve=we>0?be[we-1]:null,tt=we1&&we!==-1,Le=$e=>{const Ge=new URLSearchParams;n&&Ge.set("search",n),a!=="all"&&Ge.set("type",a),o!=="all"&&Ge.set("status",o);const rt=Ge.toString();return`/mission-control/contacts/${$e}${rt?`?${rt}`:""}`},Ue=E.useMemo(()=>{const $e=((g==null?void 0:g.filter(rt=>rt.contact_id===t))||[]).map(rt=>{var it,Me;const je=Te(rt.notes);return{id:rt.id,type:"touch",completed_at:rt.completed_at,name:((it=rt.action_type)==null?void 0:it.name)||"Touch",color:((Me=rt.action_type)==null?void 0:Me.color)||"#3B82F6",notes:rt.notes,videoId:je}}),Ge=((y==null?void 0:y.filter(rt=>rt.contact_id===t))||[]).map(rt=>({id:rt.id,type:"popby",completed_at:rt.completed_at,name:"Pop-by",color:"#F97316",notes:rt.notes,videoId:null}));return[...$e,...Ge].sort((rt,je)=>new Date(je.completed_at).getTime()-new Date(rt.completed_at).getTime())},[g,y,t]),Ye=()=>{var $e;l&&(F({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:(($e=l.tags)==null?void 0:$e.map(Ge=>Ge.relationship_type_id))||[]}),M(!0))},Ie=async()=>{await N.mutateAsync({id:t,...I}),M(!1)},et=async()=>{confirm("Are you sure you want to delete this contact?")&&(await j.mutateAsync(t),r("/mission-control/contacts"))},It=async()=>{$&&(await S.mutateAsync({contactId:t,actionTypeId:$,notes:W}),B(!1),H(null),X(""))},Pe=($e,Ge)=>{de&&l?(oe({email:$e,name:Ge||`${l.first_name} ${l.last_name||""}`.trim()}),ne(!0)):window.location.href=`mailto:${$e}`};return i?e.jsx(Fr,{title:"Contact Details",children:e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})})}):l?e.jsxs(e.Fragment,{children:[e.jsx(Fr,{title:`${l.first_name} ${l.last_name||""}`,description:"Contact details and activity",children:e.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>r("/mission-control/contacts"),children:[e.jsx(uc,{className:"h-4 w-4 mr-1"}),"Back to Contacts"]}),Ae&&e.jsxs("div",{className:"flex items-center gap-1 ml-2 border-l pl-2",children:[e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>ve&&r(Le(ve)),disabled:!ve,className:"px-2",children:[e.jsx(uc,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only sm:not-sr-only sm:ml-1",children:"Prev"})]}),e.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[we+1," of ",be.length]}),e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>tt&&r(Le(tt)),disabled:!tt,className:"px-2",children:[e.jsx("span",{className:"sr-only sm:not-sr-only sm:mr-1",children:"Next"}),e.jsx(Wi,{className:"h-4 w-4"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto justify-end flex-wrap",children:[l.email&&e.jsxs(Q,{variant:"outline",onClick:()=>Pe(l.email,`${l.first_name} ${l.last_name||""}`.trim()),children:[e.jsx(mn,{className:"h-4 w-4 mr-1"}),"Email"]}),e.jsxs(Q,{variant:"default",onClick:()=>r(`/mission-control/video/record?contact_id=${t}`),className:"bg-gradient-to-r from-primary to-primary/80",children:[e.jsx(ya,{className:"h-4 w-4 mr-1"}),"Quick Video Touch"]}),e.jsxs(Dr,{open:O,onOpenChange:B,children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{variant:"outline",children:[e.jsx(gs,{className:"h-4 w-4 mr-1"}),"Log Action"]})}),e.jsxs(Lr,{children:[e.jsx(Ur,{children:e.jsx(Br,{children:"Log an Action"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{children:"Action Type"}),e.jsx("div",{className:"grid grid-cols-2 gap-2 mt-2",children:m==null?void 0:m.filter($e=>$e.active).map($e=>e.jsxs("button",{onClick:()=>H($e.id),className:` p-3 rounded-lg border text-left transition-all ${$===$e.id?"border-primary bg-primary/10":"hover:bg-accent"} `,children:[e.jsx("div",{className:"font-medium",children:$e.name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:$e.description})]},$e.id))})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"action-notes",children:"Notes (optional)"}),e.jsx(Ks,{id:"action-notes",value:W,onChange:$e=>X($e.target.value),placeholder:"Add any notes about this interaction...",rows:3})]}),e.jsxs(Q,{onClick:It,disabled:!$||S.isPending,className:"w-full",children:[e.jsx(li,{className:"h-4 w-4 mr-1"}),"Complete Action"]})]})]})]}),e.jsxs(Q,{variant:"outline",onClick:Ye,children:[e.jsx(wc,{className:"h-4 w-4 mr-1"}),"Edit"]}),e.jsx(Q,{variant:"destructive",size:"icon",onClick:et,children:e.jsx(Rs,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"bg-card border rounded-lg p-4 sm:p-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold",children:[l.first_name," ",l.last_name||""]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 mt-2 text-muted-foreground",children:[l.email&&e.jsxs("button",{onClick:()=>Pe(l.email),className:"flex items-center gap-1 hover:text-primary transition-colors",children:[e.jsx(mn,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:l.email})]}),l.phone&&e.jsxs("a",{href:`tel:${l.phone}`,className:"flex items-center gap-1 hover:text-primary transition-colors",children:[e.jsx(wi,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:l.phone})]})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(Ape,{contact:l}),(at=l.tags)==null?void 0:at.map($e=>{const Ge=d==null?void 0:d.find(rt=>rt.id===$e.relationship_type_id);return Ge?e.jsx(bt,{variant:"secondary",className:"text-xs",children:Ge.name},$e.id):null})]})]})}),e.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[e.jsxs(ze,{className:"md:col-span-2",children:[e.jsx(Wt,{children:e.jsx(Zt,{children:"Contact Information"})}),e.jsx(qe,{children:A?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"first_name",children:"First Name"}),e.jsx(Qe,{id:"first_name",value:I.first_name,onChange:$e=>F({...I,first_name:$e.target.value})})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"last_name",children:"Last Name"}),e.jsx(Qe,{id:"last_name",value:I.last_name,onChange:$e=>F({...I,last_name:$e.target.value})})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"email",children:"Email"}),e.jsx(Qe,{id:"email",type:"email",value:I.email,onChange:$e=>F({...I,email:$e.target.value})})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"phone",children:"Phone"}),e.jsx(Qe,{id:"phone",value:I.phone,onChange:$e=>F({...I,phone:$e.target.value})})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"address",children:"Street Address"}),e.jsx(Qe,{id:"address",value:I.address,onChange:$e=>F({...I,address:$e.target.value}),placeholder:"123 Main St"})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"col-span-2",children:[e.jsx(Ee,{htmlFor:"city",children:"City"}),e.jsx(Qe,{id:"city",value:I.city,onChange:$e=>F({...I,city:$e.target.value}),placeholder:"City"})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"state",children:"State"}),e.jsx(Qe,{id:"state",value:I.state,onChange:$e=>F({...I,state:$e.target.value}),placeholder:"TX",maxLength:2})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"zip_code",children:"Zip Code"}),e.jsx(Qe,{id:"zip_code",value:I.zip_code,onChange:$e=>F({...I,zip_code:$e.target.value}),placeholder:"12345"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"birthday",children:"Birthday"}),e.jsx(Qe,{id:"birthday",type:"date",value:I.birthday,onChange:$e=>F({...I,birthday:$e.target.value})})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"home_anniversary",children:"Home Anniversary"}),e.jsx(Qe,{id:"home_anniversary",type:"date",value:I.home_anniversary,onChange:$e=>F({...I,home_anniversary:$e.target.value})})]})]}),e.jsx(gd,{}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"spouse_name",children:"Spouse/Partner Name"}),e.jsx(Qe,{id:"spouse_name",value:I.spouse_name,onChange:$e=>F({...I,spouse_name:$e.target.value}),placeholder:"Enter spouse name"})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"spouse_email",children:"Spouse/Partner Email"}),e.jsx(Qe,{id:"spouse_email",type:"email",value:I.spouse_email,onChange:$e=>F({...I,spouse_email:$e.target.value}),placeholder:"Enter spouse email"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"company_name",children:"Company"}),e.jsx(Qe,{id:"company_name",value:I.company_name,onChange:$e=>F({...I,company_name:$e.target.value}),placeholder:"Enter company name"})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"job_title",children:"Job Title"}),e.jsx(Qe,{id:"job_title",value:I.job_title,onChange:$e=>F({...I,job_title:$e.target.value}),placeholder:"Enter job title"})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"Relationship Types"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:d==null?void 0:d.filter($e=>$e.active).map($e=>{var Ge;return e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx(Yo,{checked:(Ge=I.tagIds)==null?void 0:Ge.includes($e.id),onCheckedChange:rt=>{var je;F(rt?{...I,tagIds:[...I.tagIds||[],$e.id]}:{...I,tagIds:(je=I.tagIds)==null?void 0:je.filter(it=>it!==$e.id)})}}),e.jsx("span",{className:"text-sm",children:$e.name})]},$e.id)})})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"notes",children:"Notes"}),e.jsx(Ks,{id:"notes",value:I.notes,onChange:$e=>F({...I,notes:$e.target.value}),rows:4})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Q,{onClick:Ie,disabled:N.isPending,children:"Save Changes"}),e.jsx(Q,{variant:"outline",onClick:()=>M(!1),children:"Cancel"})]})]}):e.jsxs("div",{className:"space-y-4",children:[Ue.length>0&&e.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 flex items-center gap-2",children:[e.jsx(Mn,{className:"h-4 w-4 text-primary"}),e.jsxs("span",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:"Last Contacted:"})," ",Xr(new Date(Ue[0].completed_at),"MMM d, yyyy")," ","(",Ue[0].name,")"]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:gap-6 gap-2",children:[l.email&&e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(mn,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("button",{onClick:()=>Pe(l.email),className:"text-primary hover:underline truncate text-left",children:l.email})]}),l.phone&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(wi,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("a",{href:`tel:${l.phone}`,className:"text-primary hover:underline",children:l.phone})]})]}),(l.address||l.city||l.state||l.zip_code)&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(eo,{className:"h-4 w-4 text-muted-foreground mt-0.5"}),e.jsxs("div",{className:"flex flex-col",children:[l.address&&e.jsx("span",{children:l.address}),(l.city||l.state||l.zip_code)&&e.jsxs("span",{className:"text-muted-foreground",children:[[l.city,l.state].filter(Boolean).join(", "),l.zip_code&&` ${l.zip_code}`]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.birthday&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Mn,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("span",{children:["Birthday: ",Xr(new Date(l.birthday),"MMMM d")]})]}),l.home_anniversary&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Wn,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("span",{children:["Home Anniversary: ",Xr(new Date(l.home_anniversary),"MMMM d")]})]})]}),(l.spouse_name||l.spouse_email||l.company_name||l.job_title)&&e.jsxs(e.Fragment,{children:[e.jsx(gd,{}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(l.spouse_name||l.spouse_email)&&e.jsxs("div",{className:"space-y-1",children:[l.spouse_name&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Kl,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("span",{children:["Spouse: ",l.spouse_name]})]}),l.spouse_email&&e.jsxs("div",{className:"flex items-center gap-2 ml-6",children:[e.jsx(mn,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("button",{onClick:()=>Pe(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)&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(bi,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:l.job_title&&l.company_name?`${l.job_title} at ${l.company_name}`:l.job_title||l.company_name})]})]})]}),e.jsx(gd,{}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium mb-2",children:"Relationship Types"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:(ce=l.tags)!=null&&ce.length?l.tags.map($e=>{var Ge;return e.jsx(bt,{variant:"secondary",children:(Ge=$e.relationship_type)==null?void 0:Ge.name},$e.id)}):e.jsx("span",{className:"text-sm text-muted-foreground",children:"No relationship types assigned"})})]}),l.notes&&e.jsxs(e.Fragment,{children:[e.jsx(gd,{}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium mb-2",children:"Notes"}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:l.notes})]})]})]})})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(T5t,{contact:l,onLogTouch:()=>B(!0)}),e.jsx(tMt,{contactId:t}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{children:"Activity Log"})}),e.jsx(qe,{children:Ue.length>0?e.jsx("div",{className:"space-y-4",children:Ue.map($e=>{var Ge;return e.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0",children:[e.jsx("div",{className:"h-8 w-8 rounded-full flex items-center justify-center text-white text-xs",style:{backgroundColor:$e.color},children:$e.type==="popby"?e.jsx(uo,{className:"h-4 w-4"}):(Ge=$e.name)==null?void 0:Ge.charAt(0)}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm",children:$e.name}),$e.videoId&&e.jsxs(Q,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>ae($e.videoId),children:[e.jsx(Gl,{className:"h-3 w-3 mr-1"}),"Preview"]})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:Xr(new Date($e.completed_at),"MMM d, yyyy h:mm a")}),$e.notes&&!$e.videoId&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:$e.notes})]})]},$e.id)})}):e.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No activity logged yet"})})]}),v&&v.length>0&&e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx($o,{className:"h-5 w-5 text-primary"}),"Video Replies"]})}),e.jsx(qe,{children:e.jsx("div",{className:"space-y-4",children:v.map($e=>{var Ge,rt;return e.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0",children:[(Ge=$e.video)!=null&&Ge.thumbnail_url?e.jsx("img",{src:$e.video.thumbnail_url,alt:$e.video.title||"Video",className:"h-12 w-16 object-cover rounded cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>ae($e.video_id)}):e.jsx("div",{className:"h-12 w-16 bg-muted rounded flex items-center justify-center cursor-pointer hover:bg-muted/80 transition-colors",onClick:()=>ae($e.video_id),children:e.jsx(ya,{className:"h-5 w-5 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-medium text-sm truncate",children:["Replied to: ",((rt=$e.video)==null?void 0:rt.title)||"Untitled Video"]}),e.jsxs(Q,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs flex-shrink-0",onClick:()=>ae($e.video_id),children:[e.jsx(Gl,{className:"h-3 w-3 mr-1"}),"Watch"]})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:Xr(new Date($e.created_at),"MMM d, yyyy h:mm a")}),$e.message&&e.jsxs("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:['"',$e.message,'"']})]})]},$e.id)})})})]}),xe&&xe.length>0&&e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(Mi,{className:"h-5 w-5 text-sky-500"}),"Sent Emails"]})}),e.jsx(qe,{children:e.jsx("div",{className:"space-y-4",children:xe.map($e=>e.jsxs("details",{className:"group pb-3 border-b last:border-0",children:[e.jsxs("summary",{className:"flex items-start gap-3 cursor-pointer list-none",children:[e.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:e.jsx(mn,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-sm truncate",children:$e.subject}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["To: ",$e.to_email," · ",Xr(new Date($e.sent_at),"MMM d, yyyy h:mm a")]})]})]}),e.jsx("div",{className:"mt-2 ml-11 p-3 bg-muted/30 rounded-lg text-sm whitespace-pre-wrap",children:$e.body})]},$e.id))})})]})]}),e.jsx(Dr,{open:!!se,onOpenChange:$e=>!$e&&ae(null),children:e.jsxs(Lr,{className:"max-w-2xl",children:[e.jsx(Ur,{children:e.jsx(Br,{children:"Video Preview"})}),se&&e.jsx(eMt,{videoId:se})]})})]})]})}),de&&l&&fe&&e.jsx(Gae,{open:le,onOpenChange:ne,contact:{id:l.id,first_name:l.first_name,last_name:l.last_name,email:fe.email},gmailEmail:ue})]}):e.jsx(Fr,{title:"Contact Not Found",children:e.jsxs("div",{className:"text-center py-12",children:[e.jsx("p",{className:"text-muted-foreground mb-4",children:"This contact was not found."}),e.jsx(Q,{onClick:()=>r("/mission-control/contacts"),children:"Back to Contacts"})]})})}const ICe={Crown:ih,FileText:fa,Users:ws,Globe:Gg,Star:Ln,Phone:wi,MessageSquare:$o,PenTool:Kj,Video:ya,Gift:uo},Kde=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function sMt(){var ot,mt;const t=Ws(),{user:r}=Gr(),{data:s}=Qf(),{data:n}=_xt(),{data:a}=Cxt(),{data:o}=zRe(),{data:l}=Wye(),{data:i}=vxt(),d=Mxt(),m=bxt(),g=jxt(),y=kxt(),v=Nxt(),b=Sxt(),N=wxt(),[j,S]=E.useState(null),[A,M]=E.useState(!1),[I,F]=E.useState(null),[O,B]=E.useState(""),[$,H]=E.useState(""),[W,X]=E.useState([]),[se,ae]=E.useState(null),[le,ne]=E.useState(null),[fe,oe]=E.useState(!1),[de,ue]=E.useState(""),[xe,Te]=E.useState(""),[be,we]=E.useState(""),[ve,tt]=E.useState(""),Ae=(ft,ct)=>a==null?void 0:a.some(Mt=>Mt.plan_id===ft&&Mt.relationship_type_id===ct&&Mt.active),Le=ft=>a==null?void 0:a.find(ct=>ct.relationship_type_id===ft&&ct.active),Ue=async(ft,ct)=>{const Mt=Ae(ft,ct);await d.mutateAsync({planId:ft,relationshipTypeId:ct,active:!Mt})},Ye=(n==null?void 0:n.filter(ft=>ft.active&&!ft.owner_user_id))||[],Ie=(n==null?void 0:n.filter(ft=>ft.owner_user_id===(r==null?void 0:r.id)))||[],et=s==null?void 0:s.find(ft=>ft.id===j),It=j?Le(j):null,Pe=n==null?void 0:n.find(ft=>ft.id===(It==null?void 0:It.plan_id)),at=async()=>{if(!O.trim())return;const ft=await m.mutateAsync({name:O,description:$});ft&&W.length>0&&await v.mutateAsync({planId:ft.id,items:W}),Ge()},ce=async()=>{!O.trim()||!I||(await g.mutateAsync({id:I,name:O,description:$}),await v.mutateAsync({planId:I,items:W}),Ge())},$e=ft=>{var ct;F(ft.id),B(ft.name),H(ft.description||""),X(((ct=ft.items)==null?void 0:ct.map(Mt=>({month_number:Mt.month_number,action_type_id:Mt.action_type_id,default_script_id:Mt.default_script_id||void 0,notes:Mt.notes||void 0})))||[]),M(!0)},Ge=()=>{M(!1),F(null),B(""),H(""),X([])},rt=(ft,ct)=>{ne(ct)},je=(ft,ct,Mt)=>{X(Ot=>[...Ot.filter(Ir=>Ir.month_number!==ft),{month_number:ft,action_type_id:ct,default_script_id:Mt}]),ae(null),ne(null)},it=ft=>{X(ct=>ct.filter(Mt=>Mt.month_number!==ft))},Me=async()=>{if(!de.trim()||!xe.trim()||!le)return;const ft=await b.mutateAsync({actionTypeId:le,title:de,scriptBody:xe,emailSubject:be||void 0,tone:ve||void 0});ft&&se!==null&&je(se,le,ft.id),oe(!1),ue(""),Te(""),we(""),tt("")},Je=le?i==null?void 0:i.filter(ft=>ft.action_type_id===le&&ft.active):[],Xe=ft=>ICe[ft||"Phone"]||wi,Ve=ft=>ICe[ft||"Users"]||ws;return e.jsxs(Fr,{title:"Touchpoint Plans",description:"Assign plans to your contact groups",children:[e.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Touchpoint Plans"}),e.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"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>t("/mission-control"),children:[e.jsx(uc,{className:"h-4 w-4 mr-1"}),"Back"]}),e.jsxs(Q,{onClick:()=>M(!0),className:"w-full sm:w-auto",children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Create Custom Plan"]})]}),e.jsxs("div",{className:"grid lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"font-semibold text-lg",children:"Your Contact Groups"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a group to assign a touchpoint plan"}),s==null?void 0:s.filter(ft=>ft.active).map(ft=>{const ct=Ve(ft.icon),Mt=(o==null?void 0:o[ft.id])||0,Ot=Le(ft.id),rr=n==null?void 0:n.find(cr=>cr.id===(Ot==null?void 0:Ot.plan_id)),Ir=j===ft.id;return e.jsxs("button",{onClick:()=>S(ft.id),className:` w-full flex items-center gap-3 p-4 rounded-lg border text-left transition-all ${Ir?"border-primary bg-primary/5 ring-2 ring-primary":"hover:bg-accent"} `,children:[e.jsx(ct,{className:"h-5 w-5 text-muted-foreground"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium",children:ft.name}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[Mt," contacts"]})]}),rr?e.jsxs(bt,{variant:"secondary",className:"text-xs",children:[e.jsx(ui,{className:"h-3 w-3 mr-1"}),rr.name.split(" ")[0]]}):e.jsx(bt,{variant:"outline",className:"text-xs text-muted-foreground",children:"No plan"})]},ft.id)})]}),e.jsx("div",{className:"lg:col-span-2",children:j&&et?e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[(()=>{const ft=Ve(et.icon);return e.jsx(ft,{className:"h-5 w-5"})})(),et.name," Touchpoint Plan"]}),e.jsxs(Ss,{children:["Choose a plan for your ",et.name," contacts"]})]}),e.jsxs(qe,{className:"space-y-6",children:[Pe&&e.jsxs("div",{className:"p-4 bg-primary/5 rounded-lg border border-primary/20",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium flex items-center gap-2",children:[e.jsx(ui,{className:"h-4 w-4 text-green-500"}),"Currently using: ",Pe.name]}),Pe.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:Pe.description})]}),e.jsx(Q,{variant:"outline",size:"sm",onClick:()=>Ue(Pe.id,j),children:"Disable"})]}),Pe.items&&Pe.items.length>0&&e.jsxs("div",{className:"mt-4",children:[e.jsxs("div",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(Mn,{className:"h-4 w-4"}),"12-Month Schedule"]}),e.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-6 gap-2",children:Kde.map((ft,ct)=>{var Ir,cr;const Mt=((Ir=Pe.items)==null?void 0:Ir.filter(Mr=>Mr.month_number===ct+1))||[],Ot=(cr=Mt[0])==null?void 0:cr.action_type,rr=Ot?Xe(Ot.icon):null;return e.jsxs("div",{className:` p-2 rounded border text-center ${Mt.length>0?"bg-primary/10 border-primary":"bg-muted"} `,children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:ft}),rr&&e.jsx(rr,{className:"h-4 w-4 mx-auto mt-1",style:{color:(Ot==null?void 0:Ot.color)||"#3B82F6"}})]},ct)})})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium mb-3",children:Pe?"Switch to a Different Plan":"Choose a Plan"}),Ye.length>0&&e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"Pre-built Templates"}),Ye.map(ft=>{var Mt;const ct=(Pe==null?void 0:Pe.id)===ft.id;return e.jsxs("div",{className:` flex items-center justify-between p-3 rounded-lg border ${ct?"opacity-50":"hover:bg-accent"} `,children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:ft.name}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[((Mt=ft.items)==null?void 0:Mt.length)||0," touchpoints/year"]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Q,{size:"sm",variant:"ghost",title:"Duplicate as my own plan",disabled:N.isPending,onClick:()=>{const Ot=`${ft.name} (Copy)`;N.mutate({sourcePlanId:ft.id,newName:Ot})},children:e.jsx(fo,{className:"h-4 w-4"})}),e.jsx(Q,{size:"sm",variant:ct?"outline":"default",disabled:ct||d.isPending,onClick:()=>Ue(ft.id,j),children:ct?"Active":"Use This"})]})]},ft.id)})]}),Ie.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"My Custom Plans"}),Ie.map(ft=>{var Mt;const ct=(Pe==null?void 0:Pe.id)===ft.id;return e.jsxs("div",{className:` flex items-center justify-between p-3 rounded-lg border ${ct?"opacity-50":"hover:bg-accent"} `,children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:ft.name}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[((Mt=ft.items)==null?void 0:Mt.length)||0," touchpoints/year"]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Q,{size:"sm",variant:"ghost",title:"Edit plan",onClick:()=>$e(ft),children:e.jsx(J0,{className:"h-4 w-4"})}),e.jsx(Q,{size:"sm",variant:"ghost",title:"Delete plan",onClick:()=>y.mutate(ft.id),children:e.jsx(Rs,{className:"h-4 w-4 text-destructive"})}),e.jsx(Q,{size:"sm",variant:ct?"outline":"default",disabled:ct||d.isPending,onClick:()=>Ue(ft.id,j),children:ct?"Active":"Use This"})]})]},ft.id)})]}),Ye.length===0&&Ie.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No plans available. Create a custom plan to get started."})]})]})]}):e.jsx(ze,{children:e.jsxs(qe,{className:"py-12 text-center text-muted-foreground",children:[e.jsx(Mn,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"Select a contact group to view and assign plans"})]})})})]}),e.jsx(ze,{className:"bg-muted/50",children:e.jsx(qe,{className:"py-4",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.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."]})})})]}),e.jsx(Dr,{open:A,onOpenChange:ft=>{ft?M(!0):Ge()},children:e.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsx(Ur,{children:e.jsx(Br,{children:I?"Edit Touchpoint Plan":"Create Custom Touchpoint Plan"})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"plan-name",children:"Plan Name"}),e.jsx(Qe,{id:"plan-name",value:O,onChange:ft=>B(ft.target.value),placeholder:"e.g., My VIP Plan"})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"plan-description",children:"Description (optional)"}),e.jsx(Ks,{id:"plan-description",value:$,onChange:ft=>H(ft.target.value),placeholder:"Describe your plan...",rows:2})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"12-Month Schedule"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Click on a month to add a touchpoint"}),e.jsx("div",{className:"grid grid-cols-6 gap-2",children:Kde.map((ft,ct)=>{const Mt=ct+1,Ot=W.find(cr=>cr.month_number===Mt),rr=Ot?l==null?void 0:l.find(cr=>cr.id===Ot.action_type_id):null,Ir=rr?Xe(rr.icon):null;return e.jsxs("div",{className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>ae(se===Mt?null:Mt),className:` w-full p-3 rounded-lg border text-center transition-all ${Ot?"bg-primary/10 border-primary":"bg-muted hover:bg-accent"} ${se===Mt?"ring-2 ring-primary":""} `,children:[e.jsx("div",{className:"text-xs text-muted-foreground font-medium",children:ft}),Ir?e.jsx(Ir,{className:"h-5 w-5 mx-auto mt-1",style:{color:(rr==null?void 0:rr.color)||"#3B82F6"}}):e.jsx(gs,{className:"h-5 w-5 mx-auto mt-1 text-muted-foreground/50"})]}),Ot&&e.jsx("button",{type:"button",onClick:cr=>{cr.stopPropagation(),it(Mt)},className:"absolute -top-1 -right-1 p-1 bg-destructive text-destructive-foreground rounded-full",children:e.jsx(rn,{className:"h-3 w-3"})})]},ct)})}),se!==null&&!le&&e.jsxs("div",{className:"mt-4 p-3 bg-muted rounded-lg",children:[e.jsxs("div",{className:"text-sm font-medium mb-2",children:["Step 1: Select action for ",Kde[se-1],":"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:l==null?void 0:l.filter(ft=>ft.active).map(ft=>{const ct=Xe(ft.icon);return e.jsxs("button",{type:"button",onClick:()=>rt(se,ft.id),className:"flex items-center gap-2 px-3 py-2 rounded-lg border bg-background hover:bg-accent transition-colors",children:[e.jsx(ct,{className:"h-4 w-4",style:{color:ft.color||"#3B82F6"}}),e.jsx("span",{className:"text-sm",children:ft.name})]},ft.id)})})]}),se!==null&&le&&e.jsxs("div",{className:"mt-4 p-3 bg-muted rounded-lg space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-sm font-medium",children:"Step 2: Select a script (optional)"}),e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>ne(null),children:[e.jsx(uc,{className:"h-4 w-4 mr-1"})," Back"]})]}),e.jsxs("div",{className:"space-y-2 max-h-[300px] overflow-y-auto pr-1",children:[e.jsx("button",{type:"button",onClick:()=>je(se,le),className:"w-full flex items-center gap-3 p-3 rounded-lg border bg-background hover:bg-accent transition-colors text-left",children:e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium text-sm",children:"No Script"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Use without a predefined script"})]})}),Je==null?void 0:Je.map(ft=>e.jsx("button",{type:"button",onClick:()=>je(se,le,ft.id),className:"w-full flex items-center gap-3 p-3 rounded-lg border bg-background hover:bg-accent transition-colors text-left",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm",children:ft.title}),ft.tone&&e.jsx(bt,{variant:"secondary",className:"text-xs mt-1",children:ft.tone}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:[ft.script_body.substring(0,100),"..."]})]})},ft.id)),e.jsxs("button",{type:"button",onClick:()=>oe(!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:[e.jsx(gs,{className:"h-5 w-5 text-muted-foreground"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium text-sm",children:"Create Custom Script"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Write your own script for this action"})]})]})]})]})]}),W.length>0&&e.jsxs("div",{className:"text-sm text-muted-foreground",children:[W.length," touchpoint",W.length!==1?"s":""," per year"]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:Ge,children:"Cancel"}),e.jsxs(Q,{onClick:I?ce:at,disabled:!O.trim()||m.isPending||g.isPending,children:[e.jsx(_p,{className:"h-4 w-4 mr-2"}),I?"Save Changes":"Create Plan"]})]})]})}),e.jsx(Dr,{open:fe,onOpenChange:oe,children:e.jsxs(Lr,{className:"max-w-lg",children:[e.jsx(Ur,{children:e.jsx(Br,{children:"Create Custom Script"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"script-title",children:"Script Title"}),e.jsx(Qe,{id:"script-title",value:de,onChange:ft=>ue(ft.target.value),placeholder:"e.g., Friendly Check-in Call"})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"script-tone",children:"Tone (optional)"}),e.jsxs(ds,{value:ve,onValueChange:tt,children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Select tone..."})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"friendly",children:"Friendly"}),e.jsx(Ut,{value:"professional",children:"Professional"}),e.jsx(Ut,{value:"casual",children:"Casual"}),e.jsx(Ut,{value:"formal",children:"Formal"})]})]})]}),((mt=(ot=l==null?void 0:l.find(ft=>ft.id===le))==null?void 0:ot.name)==null?void 0:mt.toLowerCase().includes("email"))&&e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"script-email-subject",children:"Email Subject"}),e.jsx(Qe,{id:"script-email-subject",value:be,onChange:ft=>we(ft.target.value),placeholder:"e.g., Quick Hello!"})]}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"script-body",children:"Script Content"}),e.jsx(Ks,{id:"script-body",value:xe,onChange:ft=>Te(ft.target.value),placeholder:"Write your script here... You can use {{FirstName}} and {{LastName}} as placeholders.",rows:6}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Tip: Use ","{{FirstName}}"," and ","{{LastName}}"," as placeholders"]})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>oe(!1),children:"Cancel"}),e.jsxs(Q,{onClick:Me,disabled:!de.trim()||!xe.trim()||b.isPending,children:[e.jsx(_p,{className:"h-4 w-4 mr-2"}),"Create & Use Script"]})]})]})})]})}const nMt="0dde5abb-0005-4c8c-a471-30d0cbc9e280",aMt=[{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 iMt(){const t=Ws(),r=qBe(),{data:s}=BBe(),{data:n}=Qf(),{data:a}=l1e(),{data:o}=Kae(90),{data:l}=Ip(),i=C5t(),d=VBe(),m=N5t(),g=S5t(),{data:y=[],isLoading:v}=Ht({queryKey:["popby-templates"],queryFn:async()=>{const{data:fe,error:oe}=await Z.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).eq("category_id",nMt).order("publish_date",{ascending:!1});if(oe)throw oe;const{data:de}=await Z.from("template_likes").select("template_id"),{data:ue}=await Z.from("template_comments").select("template_id"),xe=new Map;de==null||de.forEach(be=>{xe.set(be.template_id,(xe.get(be.template_id)||0)+1)});const Te=new Map;return ue==null||ue.forEach(be=>{Te.set(be.template_id,(Te.get(be.template_id)||0)+1)}),(fe||[]).map(be=>({...be,likesCount:xe.get(be.id)||0,commentsCount:Te.get(be.id)||0}))}}),b=fe=>{const oe=l==null?void 0:l.find(de=>de.id===fe);return oe?`${oe.first_name} ${oe.last_name||""}`.trim():"Unknown"},N=fe=>{if(!fe)return null;const oe=s==null?void 0:s.find(de=>de.id===fe);return(oe==null?void 0:oe.name)||null},[j,S]=E.useState(null),[A,M]=E.useState(!1),[I,F]=E.useState(!1),[O,B]=E.useState(!1),[$,H]=E.useState({popby_item_id:"",notes:""}),[W,X]=E.useState({name:"",description:""}),se=async()=>{j&&(await d.mutateAsync({contact_id:j.id,popby_item_id:$.popby_item_id||void 0,notes:$.notes||void 0}),M(!1),S(null),H({popby_item_id:"",notes:""}))},ae=async()=>{W.name.trim()&&(await m.mutateAsync({name:W.name.trim(),description:W.description.trim()||void 0}),B(!1),X({name:"",description:""}))},le=async(fe,oe)=>{await g.mutateAsync({relationship_type_id:fe,frequency_days:parseInt(oe)})},ne=fe=>{var de;const oe=a==null?void 0:a.find(ue=>ue.relationship_type_id===fe);return((de=oe==null?void 0:oe.frequency_days)==null?void 0:de.toString())||"90"};return e.jsx(Fr,{title:"Popbys",description:"Drop off gifts to stay top of mind",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Popbys"}),e.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"})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(ze,{children:e.jsxs(qe,{className:"p-4 text-center",children:[e.jsx("div",{className:"text-3xl font-bold text-primary",children:i.thisWeekCount}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"This Week"})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"p-4 text-center",children:[e.jsx("div",{className:"text-3xl font-bold text-emerald-500",children:i.thisMonthCount}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"This Month"})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"p-4 text-center",children:[e.jsx("div",{className:"text-3xl font-bold text-amber-500",children:i.dueCount}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Due Now"})]})})]}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs(Q,{onClick:()=>t("/mission-control/popbys/map"),children:[e.jsx(eo,{className:"h-4 w-4 mr-2"}),"View Map"]}),e.jsxs(Q,{variant:"outline",onClick:()=>F(!0),children:[e.jsx(vd,{className:"h-4 w-4 mr-2"}),"Frequency Settings"]}),e.jsxs(Q,{variant:"outline",onClick:()=>B(!0),children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Popby Idea"]})]}),e.jsxs(ci,{defaultValue:"due",children:[e.jsxs(ri,{children:[e.jsx(Kr,{value:"due",children:"Due for Popby"}),e.jsx(Kr,{value:"activity",children:"Recent Activity"}),e.jsx(Kr,{value:"library",children:"Popby Library"}),e.jsx(Kr,{value:"templates",children:"Popby Templates"})]}),e.jsx(ms,{value:"due",className:"space-y-4 mt-4",children:!r||r.length===0?e.jsx(ze,{children:e.jsxs(qe,{className:"p-8 text-center text-muted-foreground",children:[e.jsx(uo,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"No contacts due for a popby right now!"}),e.jsx("p",{className:"text-sm mt-1",children:"Great job staying connected."})]})}):e.jsx("div",{className:"space-y-3",children:r.map(fe=>e.jsx(ze,{className:"hover:shadow-md transition-shadow",children:e.jsx(qe,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-medium",children:[fe.first_name," ",fe.last_name]}),fe.daysOverdue>0&&e.jsxs(bt,{variant:"destructive",className:"text-xs",children:[fe.daysOverdue,"+ days overdue"]}),fe.daysSinceLastPopby===null&&e.jsx(bt,{variant:"outline",className:"text-xs",children:"Never visited"})]}),e.jsxs("div",{className:"flex items-center gap-4 mt-1 text-sm text-muted-foreground",children:[fe.address&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(eo,{className:"h-3 w-3"}),fe.city||fe.address]}),fe.tags&&fe.tags.length>0&&e.jsx("span",{children:fe.tags.map(oe=>{var de;return(de=oe.relationship_type)==null?void 0:de.name}).join(", ")})]}),fe.lastPopby&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Last popby: ",Xr(new Date(fe.lastPopby),"MMM d, yyyy")]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[fe.phone&&e.jsx(Q,{size:"sm",variant:"ghost",asChild:!0,children:e.jsx("a",{href:`tel:${fe.phone}`,children:e.jsx(wi,{className:"h-4 w-4"})})}),e.jsxs(Q,{size:"sm",onClick:()=>{S(fe),M(!0)},children:[e.jsx(ui,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})})},fe.id))})}),e.jsx(ms,{value:"activity",className:"space-y-4 mt-4",children:!o||o.length===0?e.jsx(ze,{children:e.jsxs(qe,{className:"p-8 text-center text-muted-foreground",children:[e.jsx(Ea,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"No popby activity yet!"}),e.jsx("p",{className:"text-sm mt-1",children:"Start logging popbys to see your history here."})]})}):e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{className:"text-lg",children:"Recent Popby Log"})}),e.jsx(qe,{className:"space-y-3",children:o.map(fe=>e.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0 last:pb-0",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-orange-500/10 flex items-center justify-center",children:e.jsx(uo,{className:"h-5 w-5 text-orange-500"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium",children:b(fe.contact_id)}),N(fe.popby_item_id)&&e.jsx(bt,{variant:"secondary",className:"text-xs",children:N(fe.popby_item_id)})]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:Xr(new Date(fe.completed_at),"MMM d, yyyy h:mm a")}),fe.notes&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:fe.notes})]})]},fe.id))})]})}),e.jsx(ms,{value:"library",className:"space-y-4 mt-4",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[s==null?void 0:s.map(fe=>e.jsx(ze,{children:e.jsx(qe,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:e.jsx(uo,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-medium",children:fe.name}),fe.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:fe.description}),!fe.owner_user_id&&e.jsx(bt,{variant:"secondary",className:"mt-2 text-xs",children:"Shared"})]})]})})},fe.id)),e.jsx(ze,{className:"border-dashed cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>B(!0),children:e.jsx(qe,{className:"p-4 flex items-center justify-center h-full min-h-[100px]",children:e.jsxs("div",{className:"text-center text-muted-foreground",children:[e.jsx(gs,{className:"h-8 w-8 mx-auto mb-2"}),e.jsx("p",{children:"Add New Popby Idea"})]})})})]})}),e.jsxs(ms,{value:"templates",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:[y.length," template",y.length!==1?"s":""," found"]}),v&&e.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((fe,oe)=>e.jsx(ze,{children:e.jsxs(qe,{className:"p-4",children:[e.jsx(fr,{className:"aspect-[3/2] w-full rounded-lg mb-4"}),e.jsx(fr,{className:"h-5 w-3/4 mb-2"}),e.jsx(fr,{className:"h-4 w-full mb-4"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(fr,{className:"h-5 w-16"}),e.jsx(fr,{className:"h-5 w-20"})]})]})},oe))}),!v&&y.length===0&&e.jsx(ze,{children:e.jsxs(qe,{className:"p-8 text-center text-muted-foreground",children:[e.jsx(Wl,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"No popby templates available yet!"}),e.jsx("p",{className:"text-sm mt-1",children:"Check back soon for new templates."})]})}),!v&&y.length>0&&e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:y.map(fe=>e.jsxs(ze,{className:"group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer",onClick:()=>t(`/templates/${fe.id}`),children:[e.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:fe.preview_image_url?e.jsx("img",{src:fe.preview_image_url,alt:fe.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No Preview"})}),e.jsxs(qe,{className:"p-4 flex flex-col",children:[e.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:fe.name}),fe.description&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:kne(fe.description)}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:e.jsx(bt,{variant:"secondary",className:"text-xs",children:"PopBys"})}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(_d,{className:"h-3.5 w-3.5"}),fe.likesCount]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Pl,{className:"h-3.5 w-3.5"}),fe.commentsCount]})]}),e.jsxs(Q,{size:"sm",className:"w-full gap-2",onClick:oe=>{oe.stopPropagation(),t(`/templates/${fe.id}`)},children:[e.jsx(En,{className:"h-4 w-4"}),"View Template"]})]})]},fe.id))})]})]}),e.jsx(Dr,{open:A,onOpenChange:M,children:e.jsxs(Lr,{children:[e.jsx(Ur,{children:e.jsxs(Br,{children:["Log Popby for ",j==null?void 0:j.first_name," ",j==null?void 0:j.last_name]})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Popby Item (optional)"}),e.jsxs(ds,{value:$.popby_item_id,onValueChange:fe=>H(oe=>({...oe,popby_item_id:fe})),children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Select a popby item..."})}),e.jsx(cs,{children:s==null?void 0:s.map(fe=>e.jsx(Ut,{value:fe.id,children:fe.name},fe.id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Notes (optional)"}),e.jsx(Ks,{placeholder:"Any notes about this popby...",value:$.notes,onChange:fe=>H(oe=>({...oe,notes:fe.target.value}))})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),e.jsx(Q,{onClick:se,disabled:d.isPending,children:"Log Popby"})]})]})}),e.jsx(Dr,{open:I,onOpenChange:F,children:e.jsxs(Lr,{className:"max-w-md",children:[e.jsx(Ur,{children:e.jsx(Br,{children:"Popby Frequency Settings"})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Set default popby frequency for each relationship type. You can override these per-contact."}),n==null?void 0:n.map(fe=>e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx(Ee,{className:"font-medium",children:fe.name}),e.jsxs(ds,{value:ne(fe.id),onValueChange:oe=>le(fe.id,oe),children:[e.jsx(ls,{className:"w-[180px]",children:e.jsx(us,{})}),e.jsx(cs,{children:aMt.map(oe=>e.jsx(Ut,{value:oe.value,children:oe.label},oe.value))})]})]},fe.id))]}),e.jsx(Dn,{children:e.jsx(Q,{onClick:()=>F(!1),children:"Done"})})]})}),e.jsx(Dr,{open:O,onOpenChange:B,children:e.jsxs(Lr,{children:[e.jsx(Ur,{children:e.jsx(Br,{children:"Add Popby Idea"})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Name *"}),e.jsx(Qe,{placeholder:"e.g., Homemade cookies",value:W.name,onChange:fe=>X(oe=>({...oe,name:fe.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Description"}),e.jsx(Ks,{placeholder:"Optional description...",value:W.description,onChange:fe=>X(oe=>({...oe,description:fe.target.value}))})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>B(!1),children:"Cancel"}),e.jsx(Q,{onClick:ae,disabled:!W.name.trim()||m.isPending,children:"Add Item"})]})]})})]})})}function oMt(){const t=Ws(),{isAdmin:r}=Gr(),s=E.useRef(null),n=E.useRef(null),a=E.useRef([]),o=UBe(),{data:l}=BBe(),i=VBe(),[d,m]=E.useState(""),[g,y]=E.useState(""),[v,b]=E.useState(!0),[N,j]=E.useState(null),[S,A]=E.useState(null),[M,I]=E.useState(!1),[F,O]=E.useState({popby_item_id:"",notes:""}),B=o.filter(X=>X.address||X.city&&X.state);E.useEffect(()=>{(async()=>{b(!0);try{const{data:se}=await Z.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();se!=null&&se.value&&m(se.value)}catch(se){console.error("Error fetching mapbox token:",se)}b(!1)})()},[]),E.useEffect(()=>{"geolocation"in navigator&&navigator.geolocation.getCurrentPosition(X=>{j([X.coords.longitude,X.coords.latitude])},X=>{console.log("Could not get location:",X)})},[]),E.useEffect(()=>{if(!(!s.current||!d||n.current))return oc.accessToken=d,n.current=new oc.Map({container:s.current,style:"mapbox://styles/mapbox/streets-v12",zoom:N?12:4,center:N||[-98.5795,39.8283]}),n.current.addControl(new oc.NavigationControl,"top-right"),()=>{var X;(X=n.current)==null||X.remove(),n.current=null}},[d,N]),E.useEffect(()=>{!n.current||!d||(a.current.forEach(X=>X.remove()),a.current=[],B.forEach(async X=>{var ae;const se=[X.address,X.city,X.state,X.zip].filter(Boolean).join(", ");if(se)try{const ne=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(se)}.json?access_token=${d}`)).json();if(ne.features&&ne.features.length>0){const[fe,oe]=ne.features[0].center,de=document.createElement("div");de.className="cursor-pointer",de.innerHTML=`
${X.first_name[0]}${((ae=X.last_name)==null?void 0:ae[0])||""}
${X.isDue?'
':""}
`;const ue=new oc.Marker(de).setLngLat([fe,oe]).addTo(n.current);de.addEventListener("click",()=>{A(X)}),a.current.push(ue)}}catch(le){console.error("Geocoding error for",X.first_name,le)}}))},[B,d]);const $=()=>{N&&n.current?n.current.flyTo({center:N,zoom:13}):Jn({title:"Location not available",description:"Please enable location services",variant:"destructive"})},H=async()=>{S&&(await i.mutateAsync({contact_id:S.id,popby_item_id:F.popby_item_id||void 0,notes:F.notes||void 0,latitude:N==null?void 0:N[1],longitude:N==null?void 0:N[0]}),I(!1),A(null),O({popby_item_id:"",notes:""}))},W=async()=>{if(g.trim())try{await Z.from("settings").upsert({key:"mapbox_public_token",value:g.trim()}),m(g.trim()),Jn({title:"Mapbox token saved!"})}catch{Jn({title:"Error saving token",variant:"destructive"})}};return v?e.jsx(Fr,{title:"Popby Map",children:e.jsx("div",{className:"flex items-center justify-center h-[60vh]",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})}):d?e.jsx(Fr,{title:"Popby Map",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Q,{variant:"ghost",onClick:()=>t("/mission-control/popbys"),children:[e.jsx(_i,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]}),e.jsxs(Q,{onClick:$,children:[e.jsx(wA,{className:"h-4 w-4 mr-2"}),"My Location"]})]}),e.jsxs("div",{className:"flex gap-4 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded-full bg-primary"}),e.jsx("span",{children:"Up to date"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded-full bg-amber-500"}),e.jsx("span",{children:"Due for popby"})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{ref:s,className:"w-full h-[60vh] rounded-lg shadow-lg"}),B.length===0&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/80 rounded-lg",children:e.jsxs("div",{className:"text-center p-6",children:[e.jsx(_l,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),e.jsx("p",{className:"font-medium",children:"No contacts with addresses"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Add addresses to your contacts to see them on the map."})]})})]}),S&&e.jsx(ze,{className:"fixed bottom-4 left-4 right-4 md:left-auto md:right-4 md:w-96 z-50 shadow-xl",children:e.jsxs(qe,{className:"p-4",children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"font-semibold",children:[S.first_name," ",S.last_name]}),S.address&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:[S.city,", ",S.state]})]}),e.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>A(null),children:"×"})]}),e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[S.isDue?e.jsxs(bt,{variant:"destructive",children:[S.daysOverdue,"+ days overdue"]}):e.jsx(bt,{variant:"secondary",children:"Up to date"}),S.lastPopby&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last: ",Xr(new Date(S.lastPopby),"MMM d")]})]}),e.jsxs("div",{className:"flex gap-2",children:[S.phone&&e.jsx(Q,{size:"sm",variant:"outline",asChild:!0,className:"flex-1",children:e.jsxs("a",{href:`tel:${S.phone}`,children:[e.jsx(wi,{className:"h-4 w-4 mr-1"}),"Call"]})}),S.address&&e.jsxs(Q,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>{const X=[S.address,S.city,S.state,S.zip].filter(Boolean).join(", ");window.open(`https://maps.google.com/maps?daddr=${encodeURIComponent(X)}`,"_blank")},children:[e.jsx(AA,{className:"h-4 w-4 mr-1"}),"Navigate"]}),e.jsxs(Q,{size:"sm",className:"flex-1",onClick:()=>I(!0),children:[e.jsx(uo,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})}),e.jsx(Dr,{open:M,onOpenChange:I,children:e.jsxs(Lr,{children:[e.jsx(Ur,{children:e.jsxs(Br,{children:["Log Popby for ",S==null?void 0:S.first_name," ",S==null?void 0:S.last_name]})}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Popby Item (optional)"}),e.jsxs(ds,{value:F.popby_item_id,onValueChange:X=>O(se=>({...se,popby_item_id:X})),children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Select a popby item..."})}),e.jsx(cs,{children:l==null?void 0:l.map(X=>e.jsx(Ut,{value:X.id,children:X.name},X.id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Notes (optional)"}),e.jsx(Ks,{placeholder:"Any notes about this popby...",value:F.notes,onChange:X=>O(se=>({...se,notes:X.target.value}))})]}),N&&e.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(eo,{className:"h-3 w-3"}),"Your current location will be recorded"]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>I(!1),children:"Cancel"}),e.jsxs(Q,{onClick:H,disabled:i.isPending,children:[e.jsx(ui,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})})]})}):r?e.jsx(Fr,{title:"Popby Map",children:e.jsx("div",{className:"max-w-md mx-auto mt-8",children:e.jsx(ze,{children:e.jsxs(qe,{className:"p-6 space-y-4",children:[e.jsxs("div",{className:"text-center mb-4",children:[e.jsx(eo,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),e.jsx("h2",{className:"text-lg font-semibold",children:"Setup Map"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your Mapbox public token to enable the map feature."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Mapbox Public Token"}),e.jsx(Qe,{placeholder:"pk.eyJ1I...",value:g,onChange:X=>y(X.target.value)}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your token at"," ",e.jsx("a",{href:"https://mapbox.com/",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"mapbox.com"})]})]}),e.jsx(Q,{onClick:W,className:"w-full",children:"Save Token"}),e.jsxs(Q,{variant:"outline",className:"w-full",onClick:()=>t("/mission-control/popbys"),children:[e.jsx(_i,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]})]})})})}):e.jsx(Fr,{title:"Popby Map",children:e.jsx("div",{className:"max-w-md mx-auto mt-8",children:e.jsx(ze,{children:e.jsxs(qe,{className:"p-6 space-y-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsx(_l,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),e.jsx("h2",{className:"text-lg font-semibold",children:"Map Not Available"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"The map feature has not been configured yet. Please contact your administrator."})]}),e.jsxs(Q,{variant:"outline",className:"w-full",onClick:()=>t("/mission-control/popbys"),children:[e.jsx(_i,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]})]})})})})}const lMt=Pv({property_address:Do().min(1,"Property address is required"),city:Do().optional(),state:Do().optional(),zip:Do().optional(),transaction_type:fDe(["buyer","seller"]),close_date:Do().min(1,"Close date is required"),sale_price:QA().min(0,"Sale price must be positive"),commission_amount:QA().optional(),lead_source_id:Do().optional(),client_type_id:Do().optional(),contact_id:Do().optional(),notes:Do().optional(),is_win:Nmt()});function YBe({open:t,onOpenChange:r,transaction:s}){const[n,a]=E.useState(!1),[o,l]=E.useState(""),[i,d]=E.useState(!1),[m,g]=E.useState(""),y=yae(),v=Qxt(),{data:b}=xae(),{data:N}=Qf(),{data:j}=Ip(),S=Vye(),A=Xxt(),{data:M}=vae(),I=(M==null?void 0:M.show_commission)??!0,F=lae({resolver:cae(lMt),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(()=>{s?F.reset({property_address:s.property_address,city:s.city||"",state:s.state||"",zip:s.zip||"",transaction_type:s.transaction_type,close_date:s.close_date,sale_price:Number(s.sale_price),commission_amount:s.commission_amount?Number(s.commission_amount):void 0,lead_source_id:s.lead_source_id||void 0,client_type_id:s.client_type_id||void 0,contact_id:s.contact_id||void 0,notes:s.notes||"",is_win:s.is_win}):F.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})},[s,F]);const O=async W=>{const X={property_address:W.property_address,transaction_type:W.transaction_type,close_date:W.close_date,sale_price:W.sale_price,is_win:W.is_win,commission_amount:W.commission_amount||null,lead_source_id:W.lead_source_id||null,client_type_id:W.client_type_id||null,contact_id:W.contact_id||null,city:W.city||null,state:W.state||null,zip:W.zip||null,notes:W.notes||null};s?await v.mutateAsync({id:s.id,...X}):await y.mutateAsync(X),r(!1)},B=async()=>{if(!o.trim())return;const[W,...X]=o.trim().split(" "),se=X.join(" ")||null,ae=await S.mutateAsync({first_name:W,last_name:se,tagIds:[]});ae&&(F.setValue("contact_id",ae.id),l(""),d(!1),a(!1))},$=async()=>{if(!m.trim())return;const W=await A.mutateAsync(m.trim());W&&(F.setValue("lead_source_id",W.id),g(""))},H=j==null?void 0:j.find(W=>W.id===F.watch("contact_id"));return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"max-w-lg max-h-[90vh]",children:[e.jsx(Ur,{children:e.jsx(Br,{children:s?"Edit Transaction":"Add Transaction"})}),e.jsx(Eo,{className:"max-h-[70vh] pr-4",children:e.jsx(dae,{...F,children:e.jsxs("form",{onSubmit:F.handleSubmit(O),className:"space-y-4",children:[e.jsx(zl,{control:F.control,name:"property_address",render:({field:W})=>e.jsxs(Cl,{children:[e.jsx(Ml,{children:"Property Address *"}),e.jsx(Tl,{children:e.jsx(Qe,{placeholder:"123 Main St",...W})}),e.jsx(Ju,{})]})}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsx(zl,{control:F.control,name:"city",render:({field:W})=>e.jsxs(Cl,{children:[e.jsx(Ml,{children:"City"}),e.jsx(Tl,{children:e.jsx(Qe,{placeholder:"City",...W})})]})}),e.jsx(zl,{control:F.control,name:"state",render:({field:W})=>e.jsxs(Cl,{children:[e.jsx(Ml,{children:"State"}),e.jsx(Tl,{children:e.jsx(Qe,{placeholder:"TX",...W})})]})}),e.jsx(zl,{control:F.control,name:"zip",render:({field:W})=>e.jsxs(Cl,{children:[e.jsx(Ml,{children:"Zip"}),e.jsx(Tl,{children:e.jsx(Qe,{placeholder:"75001",...W})})]})})]}),e.jsx(zl,{control:F.control,name:"transaction_type",render:({field:W})=>e.jsxs(Cl,{children:[e.jsx(Ml,{children:"Transaction Type *"}),e.jsxs(ds,{onValueChange:W.onChange,value:W.value,children:[e.jsx(Tl,{children:e.jsx(ls,{children:e.jsx(us,{placeholder:"Select type"})})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"buyer",children:"Buyer"}),e.jsx(Ut,{value:"seller",children:"Seller"})]})]}),e.jsx(Ju,{})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(zl,{control:F.control,name:"close_date",render:({field:W})=>e.jsxs(Cl,{children:[e.jsx(Ml,{children:"Close Date *"}),e.jsx(Tl,{children:e.jsx(Qe,{type:"date",...W})}),e.jsx(Ju,{})]})}),e.jsx(zl,{control:F.control,name:"sale_price",render:({field:W})=>e.jsxs(Cl,{children:[e.jsx(Ml,{children:"Sale Price *"}),e.jsx(Tl,{children:e.jsx(Qe,{type:"number",placeholder:"0",...W,onChange:X=>W.onChange(Number(X.target.value))})}),e.jsx(Ju,{})]})})]}),I&&e.jsx(zl,{control:F.control,name:"commission_amount",render:({field:W})=>e.jsxs(Cl,{children:[e.jsx(Ml,{children:"Commission"}),e.jsx(Tl,{children:e.jsx(Qe,{type:"number",placeholder:"0",...W,value:W.value??"",onChange:X=>W.onChange(X.target.value?Number(X.target.value):void 0)})})]})}),e.jsx(zl,{control:F.control,name:"lead_source_id",render:({field:W})=>e.jsxs(Cl,{children:[e.jsx(Ml,{children:"Lead Source"}),e.jsxs(ds,{onValueChange:W.onChange,value:W.value||"",children:[e.jsx(Tl,{children:e.jsx(ls,{children:e.jsx(us,{placeholder:"Select source"})})}),e.jsx(cs,{children:b==null?void 0:b.map(X=>e.jsx(Ut,{value:X.id,children:X.name},X.id))})]})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Qe,{placeholder:"Add custom source...",value:m,onChange:W=>g(W.target.value),className:"flex-1"}),e.jsx(Q,{type:"button",variant:"outline",size:"icon",onClick:$,disabled:!m.trim(),children:e.jsx(gs,{className:"h-4 w-4"})})]}),e.jsx(zl,{control:F.control,name:"client_type_id",render:({field:W})=>e.jsxs(Cl,{children:[e.jsx(Ml,{children:"Client Type"}),e.jsxs(ds,{onValueChange:W.onChange,value:W.value||"",children:[e.jsx(Tl,{children:e.jsx(ls,{children:e.jsx(us,{placeholder:"Select client type"})})}),e.jsx(cs,{children:N==null?void 0:N.map(X=>e.jsx(Ut,{value:X.id,children:X.name},X.id))})]})]})}),e.jsx(zl,{control:F.control,name:"contact_id",render:({field:W})=>e.jsxs(Cl,{children:[e.jsx(Ml,{children:"Client Contact"}),e.jsxs(rd,{open:n,onOpenChange:a,children:[e.jsx(sd,{asChild:!0,children:e.jsx(Tl,{children:e.jsxs(Q,{variant:"outline",role:"combobox",className:qt("w-full justify-between",!W.value&&"text-muted-foreground"),children:[H?`${H.first_name} ${H.last_name||""}`.trim():"Select contact",e.jsx(fy,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})})}),e.jsxs(Fc,{className:"w-full p-0",align:"start",children:[e.jsxs(Ry,{children:[e.jsx(Fy,{placeholder:"Search contacts..."}),e.jsxs(zy,{children:[e.jsx(By,{children:e.jsxs("div",{className:"p-2 space-y-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"No contact found."}),!i&&e.jsxs(Q,{variant:"outline",size:"sm",className:"w-full",onClick:()=>d(!0),children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add New Contact"]})]})}),e.jsx($y,{children:j==null?void 0:j.map(X=>e.jsxs(Uy,{value:`${X.first_name} ${X.last_name||""}`,onSelect:()=>{W.onChange(X.id),a(!1)},children:[e.jsx(li,{className:qt("mr-2 h-4 w-4",X.id===W.value?"opacity-100":"opacity-0")}),X.first_name," ",X.last_name||""]},X.id))})]})]}),i&&e.jsxs("div",{className:"p-2 border-t space-y-2",children:[e.jsx(Qe,{placeholder:"Enter contact name...",value:o,onChange:X=>l(X.target.value)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Q,{size:"sm",onClick:B,disabled:!o.trim()||S.isPending,children:"Add Contact"}),e.jsx(Q,{size:"sm",variant:"outline",onClick:()=>{d(!1),l("")},children:"Cancel"})]})]})]})]})]})}),e.jsx(zl,{control:F.control,name:"notes",render:({field:W})=>e.jsxs(Cl,{children:[e.jsx(Ml,{children:"Notes"}),e.jsx(Tl,{children:e.jsx(Ks,{placeholder:"Any notes about this transaction...",...W})})]})}),e.jsx(zl,{control:F.control,name:"is_win",render:({field:W})=>e.jsxs(Cl,{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(Ml,{children:"Mark as Win 🏆"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Highlight this as a notable success"})]}),e.jsx(Tl,{children:e.jsx(xn,{checked:W.value,onCheckedChange:W.onChange})})]})}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsxs(Q,{type:"submit",disabled:y.isPending||v.isPending,children:[s?"Update":"Add"," Transaction"]})]})]})})})]})})}function XBe({transactions:t,showCommission:r,isLoading:s}){const[n,a]=E.useState(null),[o,l]=E.useState(null),[i,d]=E.useState(""),[m,g]=E.useState("all"),[y,v]=E.useState("all"),[b,N]=E.useState("all"),[j,S]=E.useState(!1),A=Jxt(),M=yae(),{data:I}=xae(),{data:F}=Qf(),O=e5(),B=W=>{const{id:X,created_at:se,updated_at:ae,lead_source:le,client_type:ne,contact:fe,...oe}=W;M.mutate(oe)},$=()=>{o&&(A.mutate(o),l(null))},H=t.filter(W=>{var fe,oe,de,ue;const X=i===""||W.property_address.toLowerCase().includes(i.toLowerCase())||((oe=(fe=W.contact)==null?void 0:fe.first_name)==null?void 0:oe.toLowerCase().includes(i.toLowerCase()))||((ue=(de=W.contact)==null?void 0:de.last_name)==null?void 0:ue.toLowerCase().includes(i.toLowerCase())),se=m==="all"||W.transaction_type===m,ae=y==="all"||W.lead_source_id===y,le=b==="all"||W.client_type_id===b,ne=!j||W.is_win;return X&&se&&ae&&le&&ne});return s?e.jsx(ze,{children:e.jsx(qe,{className:"p-6 space-y-4",children:[1,2,3].map(W=>e.jsx(fr,{className:"h-16 w-full"},W))})}):e.jsxs(e.Fragment,{children:[e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-3",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs(Zt,{children:["Transactions (",H.length,")"]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Qn,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search...",value:i,onChange:W=>d(W.target.value),className:"pl-8 w-[150px]"})]}),e.jsxs(ds,{value:m,onValueChange:g,children:[e.jsx(ls,{className:"w-[100px]",children:e.jsx(us,{placeholder:"Type"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Types"}),e.jsx(Ut,{value:"buyer",children:"Buyer"}),e.jsx(Ut,{value:"seller",children:"Seller"})]})]}),e.jsxs(ds,{value:y,onValueChange:v,children:[e.jsx(ls,{className:"w-[130px]",children:e.jsx(us,{placeholder:"Lead Source"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Sources"}),I==null?void 0:I.map(W=>e.jsx(Ut,{value:W.id,children:W.name},W.id))]})]}),e.jsxs(Q,{variant:j?"default":"outline",size:"sm",onClick:()=>S(!j),children:[e.jsx(ql,{className:"h-4 w-4 mr-1"}),"Wins"]})]})]})}),e.jsx(qe,{children:H.length===0?e.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No transactions found"}):O?e.jsx("div",{className:"space-y-3",children:H.map(W=>e.jsxs(ze,{className:"p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-medium truncate",children:W.property_address}),W.is_win&&e.jsx(ql,{className:"h-4 w-4 text-yellow-500 flex-shrink-0"})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[W.city,W.state?`, ${W.state}`:""]})]}),e.jsx(bt,{variant:W.transaction_type==="buyer"?"default":"secondary",children:W.transaction_type})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 mt-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Close Date: "}),Dje(W.close_date)]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Price: "}),ru(W.sale_price)]}),r&&W.commission_amount&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Commission: "}),ru(W.commission_amount)]}),W.lead_source&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Source: "}),W.lead_source.name]}),W.contact&&e.jsxs("div",{className:"col-span-2",children:[e.jsx("span",{className:"text-muted-foreground",children:"Client: "}),W.contact.first_name," ",W.contact.last_name]})]}),e.jsxs("div",{className:"flex justify-end gap-2 mt-3 pt-3 border-t",children:[e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>a(W),children:e.jsx(wc,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>B(W),children:e.jsx(fo,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>l(W.id),children:e.jsx(Rs,{className:"h-4 w-4 text-destructive"})})]})]},W.id))}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Property"}),e.jsx(Ct,{children:"Type"}),e.jsx(Ct,{children:"Close Date"}),e.jsx(Ct,{children:"Sale Price"}),r&&e.jsx(Ct,{children:"Commission"}),e.jsx(Ct,{children:"Lead Source"}),e.jsx(Ct,{children:"Client"}),e.jsx(Ct,{className:"w-[50px]"})]})}),e.jsx(zn,{children:H.map(W=>{var X;return e.jsxs(Nr,{children:[e.jsx(dt,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[W.is_win&&e.jsx(ql,{className:"h-4 w-4 text-yellow-500"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:W.property_address}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[W.city,W.state?`, ${W.state}`:""]})]})]})}),e.jsx(dt,{children:e.jsx(bt,{variant:W.transaction_type==="buyer"?"default":"secondary",children:W.transaction_type})}),e.jsx(dt,{children:Dje(W.close_date)}),e.jsx(dt,{children:ru(W.sale_price)}),r&&e.jsx(dt,{children:W.commission_amount?ru(W.commission_amount):"-"}),e.jsx(dt,{children:((X=W.lead_source)==null?void 0:X.name)||"-"}),e.jsx(dt,{children:W.contact?`${W.contact.first_name} ${W.contact.last_name||""}`.trim():"-"}),e.jsx(dt,{children:e.jsxs(mh,{children:[e.jsx(ph,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"icon",children:e.jsx(Pg,{className:"h-4 w-4"})})}),e.jsxs(Au,{align:"end",children:[e.jsxs(Ba,{onClick:()=>a(W),children:[e.jsx(wc,{className:"h-4 w-4 mr-2"}),"Edit"]}),e.jsxs(Ba,{onClick:()=>B(W),children:[e.jsx(fo,{className:"h-4 w-4 mr-2"}),"Duplicate"]}),e.jsxs(Ba,{onClick:()=>l(W.id),className:"text-destructive",children:[e.jsx(Rs,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},W.id)})})]})})})]}),e.jsx(YBe,{open:!!n,onOpenChange:W=>!W&&a(null),transaction:n||void 0}),e.jsx(Xc,{open:!!o,onOpenChange:W=>!W&&l(null),children:e.jsxs(Tc,{children:[e.jsxs(Ac,{children:[e.jsx(Ic,{children:"Delete Transaction?"}),e.jsx(Pc,{children:"This action cannot be undone. This will permanently delete this transaction."})]}),e.jsxs(Ec,{children:[e.jsx(Lc,{children:"Cancel"}),e.jsx(dc,{onClick:$,className:"bg-destructive text-destructive-foreground",children:"Delete"})]})]})})]})}function QBe({goals:t,stats:r,year:s,showCommission:n}){const a=new Date().getMonth()+1,o=new Date().getFullYear()===s?a:12,l=12-o,i=(v,b)=>{if(!b||b===0)return null;const N=Math.min(v/b*100,100),j=Math.max(b-v,0),S=l>0?j/l:0,A=o/12*100,M=N>=A?"ahead":N>=A*.8?"on-track":"behind";return{percent:N,remaining:j,pace:S,status:M}},d=i(r.totalTransactions,t.transactions_goal),m=i(r.totalVolume,t.volume_goal),g=n?i(r.totalCommission,t.gci_goal):null,y=v=>{switch(v){case"ahead":return e.jsxs(bt,{className:"bg-green-500 text-white",children:[e.jsx(ou,{className:"h-3 w-3 mr-1"}),"Ahead"]});case"on-track":return e.jsxs(bt,{variant:"secondary",children:[e.jsx(Q1,{className:"h-3 w-3 mr-1"}),"On Track"]});case"behind":return e.jsxs(bt,{variant:"destructive",children:[e.jsx(Qj,{className:"h-3 w-3 mr-1"}),"Behind"]});default:return null}};return!t.transactions_goal&&!t.volume_goal&&!t.gci_goal?null:e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(bp,{className:"h-5 w-5 text-primary"}),e.jsxs(Zt,{children:[s," Goals Progress"]})]})}),e.jsx(qe,{children:e.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[t.transactions_goal&&d&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium",children:"Transactions"}),y(d.status)]}),e.jsx(hc,{value:d.percent,className:"h-2"}),e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{children:[r.totalTransactions," of ",t.transactions_goal]}),e.jsxs("span",{children:[Math.round(d.percent),"%"]})]}),d.remaining>0&&l>0&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",Math.ceil(d.pace),"/month to hit goal"]})]}),t.volume_goal&&m&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium",children:"Volume"}),y(m.status)]}),e.jsx(hc,{value:m.percent,className:"h-2"}),e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{children:[ru(r.totalVolume,!0)," of ",ru(t.volume_goal,!0)]}),e.jsxs("span",{children:[Math.round(m.percent),"%"]})]}),m.remaining>0&&l>0&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",ru(m.pace,!0),"/month"]})]}),n&&t.gci_goal&&g&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium",children:"GCI"}),y(g.status)]}),e.jsx(hc,{value:g.percent,className:"h-2"}),e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{children:[ru(r.totalCommission,!0)," of ",ru(t.gci_goal,!0)]}),e.jsxs("span",{children:[Math.round(g.percent),"%"]})]}),g.remaining>0&&l>0&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",ru(g.pace,!0),"/month"]})]})]})})]})}var cMt=Array.isArray,Wh=cMt,dMt=typeof ny=="object"&&ny&&ny.Object===Object&&ny,JBe=dMt,uMt=JBe,hMt=typeof self=="object"&&self&&self.Object===Object&&self,mMt=uMt||hMt||Function("return this")(),fx=mMt,pMt=fx,fMt=pMt.Symbol,FP=fMt,PCe=FP,e$e=Object.prototype,gMt=e$e.hasOwnProperty,xMt=e$e.toString,AT=PCe?PCe.toStringTag:void 0;function yMt(t){var r=gMt.call(t,AT),s=t[AT];try{t[AT]=void 0;var n=!0}catch{}var a=xMt.call(t);return n&&(r?t[AT]=s:delete t[AT]),a}var vMt=yMt,_Mt=Object.prototype,bMt=_Mt.toString;function wMt(t){return bMt.call(t)}var jMt=wMt,LCe=FP,kMt=vMt,NMt=jMt,SMt="[object Null]",CMt="[object Undefined]",OCe=LCe?LCe.toStringTag:void 0;function MMt(t){return t==null?t===void 0?CMt:SMt:OCe&&OCe in Object(t)?kMt(t):NMt(t)}var Zy=MMt;function TMt(t){return t!=null&&typeof t=="object"}var Yy=TMt,AMt=Zy,EMt=Yy,IMt="[object Symbol]";function PMt(t){return typeof t=="symbol"||EMt(t)&&AMt(t)==IMt}var t5=PMt,LMt=Wh,OMt=t5,DMt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,RMt=/^\w*$/;function FMt(t,r){if(LMt(t))return!1;var s=typeof t;return s=="number"||s=="symbol"||s=="boolean"||t==null||OMt(t)?!0:RMt.test(t)||!DMt.test(t)||r!=null&&t in Object(r)}var c1e=FMt;function zMt(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}var zv=zMt;const r5=oo(zv);var BMt=Zy,$Mt=zv,UMt="[object AsyncFunction]",qMt="[object Function]",VMt="[object GeneratorFunction]",HMt="[object Proxy]";function WMt(t){if(!$Mt(t))return!1;var r=BMt(t);return r==qMt||r==VMt||r==UMt||r==HMt}var d1e=WMt;const Ja=oo(d1e);var GMt=fx,KMt=GMt["__core-js_shared__"],ZMt=KMt,Zde=ZMt,DCe=function(){var t=/[^.]+$/.exec(Zde&&Zde.keys&&Zde.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function YMt(t){return!!DCe&&DCe in t}var XMt=YMt,QMt=Function.prototype,JMt=QMt.toString;function eTt(t){if(t!=null){try{return JMt.call(t)}catch{}try{return t+""}catch{}}return""}var t$e=eTt,tTt=d1e,rTt=XMt,sTt=zv,nTt=t$e,aTt=/[\\^$.*+?()[\]{}|]/g,iTt=/^\[object .+?Constructor\]$/,oTt=Function.prototype,lTt=Object.prototype,cTt=oTt.toString,dTt=lTt.hasOwnProperty,uTt=RegExp("^"+cTt.call(dTt).replace(aTt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function hTt(t){if(!sTt(t)||rTt(t))return!1;var r=tTt(t)?uTt:iTt;return r.test(nTt(t))}var mTt=hTt;function pTt(t,r){return t==null?void 0:t[r]}var fTt=pTt,gTt=mTt,xTt=fTt;function yTt(t,r){var s=xTt(t,r);return gTt(s)?s:void 0}var Hk=yTt,vTt=Hk,_Tt=vTt(Object,"create"),Xae=_Tt,RCe=Xae;function bTt(){this.__data__=RCe?RCe(null):{},this.size=0}var wTt=bTt;function jTt(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}var kTt=jTt,NTt=Xae,STt="__lodash_hash_undefined__",CTt=Object.prototype,MTt=CTt.hasOwnProperty;function TTt(t){var r=this.__data__;if(NTt){var s=r[t];return s===STt?void 0:s}return MTt.call(r,t)?r[t]:void 0}var ATt=TTt,ETt=Xae,ITt=Object.prototype,PTt=ITt.hasOwnProperty;function LTt(t){var r=this.__data__;return ETt?r[t]!==void 0:PTt.call(r,t)}var OTt=LTt,DTt=Xae,RTt="__lodash_hash_undefined__";function FTt(t,r){var s=this.__data__;return this.size+=this.has(t)?0:1,s[t]=DTt&&r===void 0?RTt:r,this}var zTt=FTt,BTt=wTt,$Tt=kTt,UTt=ATt,qTt=OTt,VTt=zTt;function s5(t){var r=-1,s=t==null?0:t.length;for(this.clear();++r-1}var oAt=iAt,lAt=Qae;function cAt(t,r){var s=this.__data__,n=lAt(s,t);return n<0?(++this.size,s.push([t,r])):s[n][1]=r,this}var dAt=cAt,uAt=GTt,hAt=tAt,mAt=nAt,pAt=oAt,fAt=dAt;function n5(t){var r=-1,s=t==null?0:t.length;for(this.clear();++r0?1:-1},yj=function(r){return Ak(r)&&r.indexOf("%")===r.length-1},Us=function(r){return OEt(r)&&!zP(r)},zEt=function(r){return Ri(r)},xd=function(r){return Us(r)||Ak(r)},BEt=0,BP=function(r){var s=++BEt;return"".concat(r||"").concat(s)},rh=function(r,s){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Us(r)&&!Ak(r))return n;var o;if(yj(r)){var l=r.indexOf("%");o=s*parseFloat(r.slice(0,l))/100}else o=+r;return zP(o)&&(o=n),a&&o>s&&(o=s),o},g1=function(r){if(!r)return null;var s=Object.keys(r);return s&&s.length?r[s[0]]:null},$Et=function(r){if(!Array.isArray(r))return!1;for(var s=r.length,n={},a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function KEt(t,r){if(t==null)return{};var s={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(r.indexOf(n)>=0)continue;s[n]=t[n]}return s}var VCe={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"},Ny=function(r){return typeof r=="string"?r:r?r.displayName||r.name||"Component":""},HCe=null,Xde=null,_1e=function t(r){if(r===HCe&&Array.isArray(Xde))return Xde;var s=[];return E.Children.forEach(r,function(n){Ri(n)||(AEt.isFragment(n)?s=s.concat(t(n.props.children)):s.push(n))}),Xde=s,HCe=r,s};function Sp(t,r){var s=[],n=[];return Array.isArray(r)?n=r.map(function(a){return Ny(a)}):n=[Ny(r)],_1e(t).forEach(function(a){var o=Mm(a,"type.displayName")||Mm(a,"type.name");n.indexOf(o)!==-1&&s.push(a)}),s}function lm(t,r){var s=Sp(t,r);return s&&s[0]}var WCe=function(r){if(!r||!r.props)return!1;var s=r.props,n=s.width,a=s.height;return!(!Us(n)||n<=0||!Us(a)||a<=0)},ZEt=["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"],YEt=function(r){return r&&r.type&&Ak(r.type)&&ZEt.indexOf(r.type)>=0},XEt=function(r,s,n,a){var o,l=(o=Yde==null?void 0:Yde[a])!==null&&o!==void 0?o:[];return s.startsWith("data-")||!Ja(r)&&(a&&l.includes(s)||VEt.includes(s))||n&&v1e.includes(s)},Ga=function(r,s,n){if(!r||typeof r=="function"||typeof r=="boolean")return null;var a=r;if(E.isValidElement(r)&&(a=r.props),!r5(a))return null;var o={};return Object.keys(a).forEach(function(l){var i;XEt((i=a)===null||i===void 0?void 0:i[l],l,s,n)&&(o[l]=a[l])}),o},Ppe=function t(r,s){if(r===s)return!0;var n=E.Children.count(r);if(n!==E.Children.count(s))return!1;if(n===0)return!0;if(n===1)return GCe(Array.isArray(r)?r[0]:r,Array.isArray(s)?s[0]:s);for(var a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function rIt(t,r){if(t==null)return{};var s={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(r.indexOf(n)>=0)continue;s[n]=t[n]}return s}function Ope(t){var r=t.children,s=t.width,n=t.height,a=t.viewBox,o=t.className,l=t.style,i=t.title,d=t.desc,m=tIt(t,eIt),g=a||{width:s,height:n,x:0,y:0},y=vi("recharts-surface",o);return lt.createElement("svg",Lpe({},Ga(m,!0,"svg"),{className:y,width:s,height:n,style:l,viewBox:"".concat(g.x," ").concat(g.y," ").concat(g.width," ").concat(g.height)}),lt.createElement("title",null,i),lt.createElement("desc",null,d),r)}var sIt=["children","className"];function Dpe(){return Dpe=Object.assign?Object.assign.bind():function(t){for(var r=1;r=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function aIt(t,r){if(t==null)return{};var s={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(r.indexOf(n)>=0)continue;s[n]=t[n]}return s}var Fo=lt.forwardRef(function(t,r){var s=t.children,n=t.className,a=nIt(t,sIt),o=vi("recharts-layer",n);return lt.createElement("g",Dpe({className:o},Ga(a,!0),{ref:r}),s)}),Hf=function(r,s){for(var n=arguments.length,a=new Array(n>2?n-2:0),o=2;oa?0:a+r),s=s>a?a:s,s<0&&(s+=a),a=r>s?0:s-r>>>0,r>>>=0;for(var o=Array(a);++n=n?t:lIt(t,r,s)}var dIt=cIt,uIt="\\ud800-\\udfff",hIt="\\u0300-\\u036f",mIt="\\ufe20-\\ufe2f",pIt="\\u20d0-\\u20ff",fIt=hIt+mIt+pIt,gIt="\\ufe0e\\ufe0f",xIt="\\u200d",yIt=RegExp("["+xIt+uIt+fIt+gIt+"]");function vIt(t){return yIt.test(t)}var u$e=vIt;function _It(t){return t.split("")}var bIt=_It,h$e="\\ud800-\\udfff",wIt="\\u0300-\\u036f",jIt="\\ufe20-\\ufe2f",kIt="\\u20d0-\\u20ff",NIt=wIt+jIt+kIt,SIt="\\ufe0e\\ufe0f",CIt="["+h$e+"]",Rpe="["+NIt+"]",Fpe="\\ud83c[\\udffb-\\udfff]",MIt="(?:"+Rpe+"|"+Fpe+")",m$e="[^"+h$e+"]",p$e="(?:\\ud83c[\\udde6-\\uddff]){2}",f$e="[\\ud800-\\udbff][\\udc00-\\udfff]",TIt="\\u200d",g$e=MIt+"?",x$e="["+SIt+"]?",AIt="(?:"+TIt+"(?:"+[m$e,p$e,f$e].join("|")+")"+x$e+g$e+")*",EIt=x$e+g$e+AIt,IIt="(?:"+[m$e+Rpe+"?",Rpe,p$e,f$e,CIt].join("|")+")",PIt=RegExp(Fpe+"(?="+Fpe+")|"+IIt+EIt,"g");function LIt(t){return t.match(PIt)||[]}var OIt=LIt,DIt=bIt,RIt=u$e,FIt=OIt;function zIt(t){return RIt(t)?FIt(t):DIt(t)}var BIt=zIt,$It=dIt,UIt=u$e,qIt=BIt,VIt=a$e;function HIt(t){return function(r){r=VIt(r);var s=UIt(r)?qIt(r):void 0,n=s?s[0]:r.charAt(0),a=s?$It(s,1).join(""):r.slice(1);return n[t]()+a}}var WIt=HIt,GIt=WIt,KIt=GIt("toUpperCase"),ZIt=KIt;const hie=oo(ZIt);function ol(t){return function(){return t}}const y$e=Math.cos,lse=Math.sin,tg=Math.sqrt,cse=Math.PI,mie=2*cse,zpe=Math.PI,Bpe=2*zpe,ej=1e-6,YIt=Bpe-ej;function v$e(t){this._+=t[0];for(let r=1,s=t.length;r=0))throw new Error(`invalid digits: ${t}`);if(r>15)return v$e;const s=10**r;return function(n){this._+=n[0];for(let a=1,o=n.length;aej)if(!(Math.abs(y*d-m*g)>ej)||!o)this._append`L${this._x1=r},${this._y1=s}`;else{let b=n-l,N=a-i,j=d*d+m*m,S=b*b+N*N,A=Math.sqrt(j),M=Math.sqrt(v),I=o*Math.tan((zpe-Math.acos((j+v-S)/(2*A*M)))/2),F=I/M,O=I/A;Math.abs(F-1)>ej&&this._append`L${r+F*g},${s+F*y}`,this._append`A${o},${o},0,0,${+(y*b>g*N)},${this._x1=r+O*d},${this._y1=s+O*m}`}}arc(r,s,n,a,o,l){if(r=+r,s=+s,n=+n,l=!!l,n<0)throw new Error(`negative radius: ${n}`);let i=n*Math.cos(a),d=n*Math.sin(a),m=r+i,g=s+d,y=1^l,v=l?a-o:o-a;this._x1===null?this._append`M${m},${g}`:(Math.abs(this._x1-m)>ej||Math.abs(this._y1-g)>ej)&&this._append`L${m},${g}`,n&&(v<0&&(v=v%Bpe+Bpe),v>YIt?this._append`A${n},${n},0,1,${y},${r-i},${s-d}A${n},${n},0,1,${y},${this._x1=m},${this._y1=g}`:v>ej&&this._append`A${n},${n},0,${+(v>=zpe)},${y},${this._x1=r+n*Math.cos(o)},${this._y1=s+n*Math.sin(o)}`)}rect(r,s,n,a){this._append`M${this._x0=this._x1=+r},${this._y0=this._y1=+s}h${n=+n}v${+a}h${-n}Z`}toString(){return this._}}function b1e(t){let r=3;return t.digits=function(s){if(!arguments.length)return r;if(s==null)r=null;else{const n=Math.floor(s);if(!(n>=0))throw new RangeError(`invalid digits: ${s}`);r=n}return t},()=>new QIt(r)}function w1e(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function _$e(t){this._context=t}_$e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;default:this._context.lineTo(t,r);break}}};function pie(t){return new _$e(t)}function b$e(t){return t[0]}function w$e(t){return t[1]}function j$e(t,r){var s=ol(!0),n=null,a=pie,o=null,l=b1e(i);t=typeof t=="function"?t:t===void 0?b$e:ol(t),r=typeof r=="function"?r:r===void 0?w$e:ol(r);function i(d){var m,g=(d=w1e(d)).length,y,v=!1,b;for(n==null&&(o=a(b=l())),m=0;m<=g;++m)!(m=b;--N)i.point(I[N],F[N]);i.lineEnd(),i.areaEnd()}A&&(I[v]=+t(S,v,y),F[v]=+r(S,v,y),i.point(n?+n(S,v,y):I[v],s?+s(S,v,y):F[v]))}if(M)return i=null,M+""||null}function g(){return j$e().defined(a).curve(l).context(o)}return m.x=function(y){return arguments.length?(t=typeof y=="function"?y:ol(+y),n=null,m):t},m.x0=function(y){return arguments.length?(t=typeof y=="function"?y:ol(+y),m):t},m.x1=function(y){return arguments.length?(n=y==null?null:typeof y=="function"?y:ol(+y),m):n},m.y=function(y){return arguments.length?(r=typeof y=="function"?y:ol(+y),s=null,m):r},m.y0=function(y){return arguments.length?(r=typeof y=="function"?y:ol(+y),m):r},m.y1=function(y){return arguments.length?(s=y==null?null:typeof y=="function"?y:ol(+y),m):s},m.lineX0=m.lineY0=function(){return g().x(t).y(r)},m.lineY1=function(){return g().x(t).y(s)},m.lineX1=function(){return g().x(n).y(r)},m.defined=function(y){return arguments.length?(a=typeof y=="function"?y:ol(!!y),m):a},m.curve=function(y){return arguments.length?(l=y,o!=null&&(i=l(o)),m):l},m.context=function(y){return arguments.length?(y==null?o=i=null:i=l(o=y),m):o},m}class k$e{constructor(r,s){this._context=r,this._x=s}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(r,s){switch(r=+r,s=+s,this._point){case 0:{this._point=1,this._line?this._context.lineTo(r,s):this._context.moveTo(r,s);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+r)/2,this._y0,this._x0,s,r,s):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+s)/2,r,this._y0,r,s);break}}this._x0=r,this._y0=s}}function JIt(t){return new k$e(t,!0)}function ePt(t){return new k$e(t,!1)}const j1e={draw(t,r){const s=tg(r/cse);t.moveTo(s,0),t.arc(0,0,s,0,mie)}},tPt={draw(t,r){const s=tg(r/5)/2;t.moveTo(-3*s,-s),t.lineTo(-s,-s),t.lineTo(-s,-3*s),t.lineTo(s,-3*s),t.lineTo(s,-s),t.lineTo(3*s,-s),t.lineTo(3*s,s),t.lineTo(s,s),t.lineTo(s,3*s),t.lineTo(-s,3*s),t.lineTo(-s,s),t.lineTo(-3*s,s),t.closePath()}},N$e=tg(1/3),rPt=N$e*2,sPt={draw(t,r){const s=tg(r/rPt),n=s*N$e;t.moveTo(0,-s),t.lineTo(n,0),t.lineTo(0,s),t.lineTo(-n,0),t.closePath()}},nPt={draw(t,r){const s=tg(r),n=-s/2;t.rect(n,n,s,s)}},aPt=.8908130915292852,S$e=lse(cse/10)/lse(7*cse/10),iPt=lse(mie/10)*S$e,oPt=-y$e(mie/10)*S$e,lPt={draw(t,r){const s=tg(r*aPt),n=iPt*s,a=oPt*s;t.moveTo(0,-s),t.lineTo(n,a);for(let o=1;o<5;++o){const l=mie*o/5,i=y$e(l),d=lse(l);t.lineTo(d*s,-i*s),t.lineTo(i*n-d*a,d*n+i*a)}t.closePath()}},Qde=tg(3),cPt={draw(t,r){const s=-tg(r/(Qde*3));t.moveTo(0,s*2),t.lineTo(-Qde*s,-s),t.lineTo(Qde*s,-s),t.closePath()}},Xm=-.5,Qm=tg(3)/2,$pe=1/tg(12),dPt=($pe/2+1)*3,uPt={draw(t,r){const s=tg(r/dPt),n=s/2,a=s*$pe,o=n,l=s*$pe+s,i=-o,d=l;t.moveTo(n,a),t.lineTo(o,l),t.lineTo(i,d),t.lineTo(Xm*n-Qm*a,Qm*n+Xm*a),t.lineTo(Xm*o-Qm*l,Qm*o+Xm*l),t.lineTo(Xm*i-Qm*d,Qm*i+Xm*d),t.lineTo(Xm*n+Qm*a,Xm*a-Qm*n),t.lineTo(Xm*o+Qm*l,Xm*l-Qm*o),t.lineTo(Xm*i+Qm*d,Xm*d-Qm*i),t.closePath()}};function hPt(t,r){let s=null,n=b1e(a);t=typeof t=="function"?t:ol(t||j1e),r=typeof r=="function"?r:ol(r===void 0?64:+r);function a(){let o;if(s||(s=o=n()),t.apply(this,arguments).draw(s,+r.apply(this,arguments)),o)return s=null,o+""||null}return a.type=function(o){return arguments.length?(t=typeof o=="function"?o:ol(o),a):t},a.size=function(o){return arguments.length?(r=typeof o=="function"?o:ol(+o),a):r},a.context=function(o){return arguments.length?(s=o??null,a):s},a}function dse(){}function use(t,r,s){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+r)/6,(t._y0+4*t._y1+s)/6)}function C$e(t){this._context=t}C$e.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:use(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);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:use(this,t,r);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r}};function mPt(t){return new C$e(t)}function M$e(t){this._context=t}M$e.prototype={areaStart:dse,areaEnd:dse,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1,this._x2=t,this._y2=r;break;case 1:this._point=2,this._x3=t,this._y3=r;break;case 2:this._point=3,this._x4=t,this._y4=r,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+r)/6);break;default:use(this,t,r);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r}};function pPt(t){return new M$e(t)}function T$e(t){this._context=t}T$e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var s=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+r)/6;this._line?this._context.lineTo(s,n):this._context.moveTo(s,n);break;case 3:this._point=4;default:use(this,t,r);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r}};function fPt(t){return new T$e(t)}function A$e(t){this._context=t}A$e.prototype={areaStart:dse,areaEnd:dse,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,r){t=+t,r=+r,this._point?this._context.lineTo(t,r):(this._point=1,this._context.moveTo(t,r))}};function gPt(t){return new A$e(t)}function ZCe(t){return t<0?-1:1}function YCe(t,r,s){var n=t._x1-t._x0,a=r-t._x1,o=(t._y1-t._y0)/(n||a<0&&-0),l=(s-t._y1)/(a||n<0&&-0),i=(o*a+l*n)/(n+a);return(ZCe(o)+ZCe(l))*Math.min(Math.abs(o),Math.abs(l),.5*Math.abs(i))||0}function XCe(t,r){var s=t._x1-t._x0;return s?(3*(t._y1-t._y0)/s-r)/2:r}function Jde(t,r,s){var n=t._x0,a=t._y0,o=t._x1,l=t._y1,i=(o-n)/3;t._context.bezierCurveTo(n+i,a+i*r,o-i,l-i*s,o,l)}function hse(t){this._context=t}hse.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:Jde(this,this._t0,XCe(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){var s=NaN;if(t=+t,r=+r,!(t===this._x1&&r===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;break;case 2:this._point=3,Jde(this,XCe(this,s=YCe(this,t,r)),s);break;default:Jde(this,this._t0,s=YCe(this,t,r));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r,this._t0=s}}};function E$e(t){this._context=new I$e(t)}(E$e.prototype=Object.create(hse.prototype)).point=function(t,r){hse.prototype.point.call(this,r,t)};function I$e(t){this._context=t}I$e.prototype={moveTo:function(t,r){this._context.moveTo(r,t)},closePath:function(){this._context.closePath()},lineTo:function(t,r){this._context.lineTo(r,t)},bezierCurveTo:function(t,r,s,n,a,o){this._context.bezierCurveTo(r,t,n,s,o,a)}};function xPt(t){return new hse(t)}function yPt(t){return new E$e(t)}function P$e(t){this._context=t}P$e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,r=this._y,s=t.length;if(s)if(this._line?this._context.lineTo(t[0],r[0]):this._context.moveTo(t[0],r[0]),s===2)this._context.lineTo(t[1],r[1]);else for(var n=QCe(t),a=QCe(r),o=0,l=1;l=0;--r)a[r]=(l[r]-a[r+1])/o[r];for(o[s-1]=(t[s]+a[s-1])/2,r=0;r=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,r){switch(t=+t,r=+r,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,r),this._context.lineTo(t,r);else{var s=this._x*(1-this._t)+t*this._t;this._context.lineTo(s,this._y),this._context.lineTo(s,r)}break}}this._x=t,this._y=r}};function _Pt(t){return new fie(t,.5)}function bPt(t){return new fie(t,0)}function wPt(t){return new fie(t,1)}function t3(t,r){if((l=t.length)>1)for(var s=1,n,a,o=t[r[0]],l,i=o.length;s=0;)s[r]=r;return s}function jPt(t,r){return t[r]}function kPt(t){const r=[];return r.key=t,r}function NPt(){var t=ol([]),r=Upe,s=t3,n=jPt;function a(o){var l=Array.from(t.apply(this,arguments),kPt),i,d=l.length,m=-1,g;for(const y of o)for(i=0,++m;i0){for(var s,n,a=0,o=t[0].length,l;a0){for(var s=0,n=t[r[0]],a,o=n.length;s0)||!((o=(a=t[r[0]]).length)>0))){for(var s=0,n=1,a,o,l;n=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function LPt(t,r){if(t==null)return{};var s={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(r.indexOf(n)>=0)continue;s[n]=t[n]}return s}var L$e={symbolCircle:j1e,symbolCross:tPt,symbolDiamond:sPt,symbolSquare:nPt,symbolStar:lPt,symbolTriangle:cPt,symbolWye:uPt},OPt=Math.PI/180,DPt=function(r){var s="symbol".concat(hie(r));return L$e[s]||j1e},RPt=function(r,s,n){if(s==="area")return r;switch(n){case"cross":return 5*r*r/9;case"diamond":return .5*r*r/Math.sqrt(3);case"square":return r*r;case"star":{var a=18*OPt;return 1.25*r*r*(Math.tan(a)-Math.tan(a*2)*Math.pow(Math.tan(a),2))}case"triangle":return Math.sqrt(3)*r*r/4;case"wye":return(21-10*Math.sqrt(3))*r*r/8;default:return Math.PI*r*r/4}},FPt=function(r,s){L$e["symbol".concat(hie(r))]=s},k1e=function(r){var s=r.type,n=s===void 0?"circle":s,a=r.size,o=a===void 0?64:a,l=r.sizeType,i=l===void 0?"area":l,d=PPt(r,TPt),m=e3e(e3e({},d),{},{type:n,size:o,sizeType:i}),g=function(){var S=DPt(n),A=hPt().type(S).size(RPt(o,i,n));return A()},y=m.className,v=m.cx,b=m.cy,N=Ga(m,!0);return v===+v&&b===+b&&o===+o?lt.createElement("path",qpe({},N,{className:vi("recharts-symbols",y),transform:"translate(".concat(v,", ").concat(b,")"),d:g()})):null};k1e.registerSymbol=FPt;function r3(t){"@babel/helpers - typeof";return r3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},r3(t)}function Vpe(){return Vpe=Object.assign?Object.assign.bind():function(t){for(var r=1;r`);var M=b.inactive?m:b.color;return lt.createElement("li",Vpe({className:S,style:y,key:"legend-item-".concat(N)},Ek(n.props,b,N)),lt.createElement(Ope,{width:l,height:l,viewBox:g,style:v},n.renderIcon(b)),lt.createElement("span",{className:"recharts-legend-item-text",style:{color:M}},j?j(A,b,N):A))})}},{key:"render",value:function(){var n=this.props,a=n.payload,o=n.layout,l=n.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);yI(N1e,"displayName","Legend");yI(N1e,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var KPt=Jae;function ZPt(){this.__data__=new KPt,this.size=0}var YPt=ZPt;function XPt(t){var r=this.__data__,s=r.delete(t);return this.size=r.size,s}var QPt=XPt;function JPt(t){return this.__data__.get(t)}var e6t=JPt;function t6t(t){return this.__data__.has(t)}var r6t=t6t,s6t=Jae,n6t=h1e,a6t=m1e,i6t=200;function o6t(t,r){var s=this.__data__;if(s instanceof s6t){var n=s.__data__;if(!n6t||n.lengthi))return!1;var m=o.get(t),g=o.get(r);if(m&&g)return m==r&&g==t;var y=-1,v=!0,b=s&T6t?new N6t:void 0;for(o.set(t,r),o.set(r,t);++y-1&&t%1==0&&t-1&&t%1==0&&t<=PLt}var T1e=LLt,OLt=Zy,DLt=T1e,RLt=Yy,FLt="[object Arguments]",zLt="[object Array]",BLt="[object Boolean]",$Lt="[object Date]",ULt="[object Error]",qLt="[object Function]",VLt="[object Map]",HLt="[object Number]",WLt="[object Object]",GLt="[object RegExp]",KLt="[object Set]",ZLt="[object String]",YLt="[object WeakMap]",XLt="[object ArrayBuffer]",QLt="[object DataView]",JLt="[object Float32Array]",e8t="[object Float64Array]",t8t="[object Int8Array]",r8t="[object Int16Array]",s8t="[object Int32Array]",n8t="[object Uint8Array]",a8t="[object Uint8ClampedArray]",i8t="[object Uint16Array]",o8t="[object Uint32Array]",xl={};xl[JLt]=xl[e8t]=xl[t8t]=xl[r8t]=xl[s8t]=xl[n8t]=xl[a8t]=xl[i8t]=xl[o8t]=!0;xl[FLt]=xl[zLt]=xl[XLt]=xl[BLt]=xl[QLt]=xl[$Lt]=xl[ULt]=xl[qLt]=xl[VLt]=xl[HLt]=xl[WLt]=xl[GLt]=xl[KLt]=xl[ZLt]=xl[YLt]=!1;function l8t(t){return RLt(t)&&DLt(t.length)&&!!xl[OLt(t)]}var c8t=l8t;function d8t(t){return function(r){return t(r)}}var H$e=d8t,gse={exports:{}};gse.exports;(function(t,r){var s=JBe,n=r&&!r.nodeType&&r,a=n&&!0&&t&&!t.nodeType&&t,o=a&&a.exports===n,l=o&&s.process,i=function(){try{var d=a&&a.require&&a.require("util").types;return d||l&&l.binding&&l.binding("util")}catch{}}();t.exports=i})(gse,gse.exports);var u8t=gse.exports,h8t=c8t,m8t=H$e,o3e=u8t,l3e=o3e&&o3e.isTypedArray,p8t=l3e?m8t(l3e):h8t,W$e=p8t,f8t=yLt,g8t=C1e,x8t=Wh,y8t=V$e,v8t=M1e,_8t=W$e,b8t=Object.prototype,w8t=b8t.hasOwnProperty;function j8t(t,r){var s=x8t(t),n=!s&&g8t(t),a=!s&&!n&&y8t(t),o=!s&&!n&&!a&&_8t(t),l=s||n||a||o,i=l?f8t(t.length,String):[],d=i.length;for(var m in t)(r||w8t.call(t,m))&&!(l&&(m=="length"||a&&(m=="offset"||m=="parent")||o&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||v8t(m,d)))&&i.push(m);return i}var k8t=j8t,N8t=Object.prototype;function S8t(t){var r=t&&t.constructor,s=typeof r=="function"&&r.prototype||N8t;return t===s}var C8t=S8t;function M8t(t,r){return function(s){return t(r(s))}}var G$e=M8t,T8t=G$e,A8t=T8t(Object.keys,Object),E8t=A8t,I8t=C8t,P8t=E8t,L8t=Object.prototype,O8t=L8t.hasOwnProperty;function D8t(t){if(!I8t(t))return P8t(t);var r=[];for(var s in Object(t))O8t.call(t,s)&&s!="constructor"&&r.push(s);return r}var R8t=D8t,F8t=d1e,z8t=T1e;function B8t(t){return t!=null&&z8t(t.length)&&!F8t(t)}var $P=B8t,$8t=k8t,U8t=R8t,q8t=$P;function V8t(t){return q8t(t)?$8t(t):U8t(t)}var gie=V8t,H8t=iLt,W8t=gLt,G8t=gie;function K8t(t){return H8t(t,G8t,W8t)}var Z8t=K8t,c3e=Z8t,Y8t=1,X8t=Object.prototype,Q8t=X8t.hasOwnProperty;function J8t(t,r,s,n,a,o){var l=s&Y8t,i=c3e(t),d=i.length,m=c3e(r),g=m.length;if(d!=g&&!l)return!1;for(var y=d;y--;){var v=i[y];if(!(l?v in r:Q8t.call(r,v)))return!1}var b=o.get(t),N=o.get(r);if(b&&N)return b==r&&N==t;var j=!0;o.set(t,r),o.set(r,t);for(var S=l;++y-1}var XDt=YDt;function QDt(t,r,s){for(var n=-1,a=t==null?0:t.length;++n=mRt){var m=r?null:uRt(t);if(m)return hRt(m);l=!1,a=dRt,d=new oRt}else d=r?[]:i;e:for(;++n=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function TRt(t,r){if(t==null)return{};var s={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(r.indexOf(n)>=0)continue;s[n]=t[n]}return s}function ARt(t){return t.value}function ERt(t,r){if(lt.isValidElement(t))return lt.cloneElement(t,r);if(typeof t=="function")return lt.createElement(t,r);r.ref;var s=MRt(r,_Rt);return lt.createElement(N1e,s)}var N3e=1,mC=function(t){function r(){var s;bRt(this,r);for(var n=arguments.length,a=new Array(n),o=0;oN3e||Math.abs(a.height-this.lastBoundingBox.height)>N3e)&&(this.lastBoundingBox.width=a.width,this.lastBoundingBox.height=a.height,n&&n(a)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Hx({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var a=this.props,o=a.layout,l=a.align,i=a.verticalAlign,d=a.margin,m=a.chartWidth,g=a.chartHeight,y,v;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(l==="center"&&o==="vertical"){var b=this.getBBoxSnapshot();y={left:((m||0)-b.width)/2}}else y=l==="right"?{right:d&&d.right||0}:{left:d&&d.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(i==="middle"){var N=this.getBBoxSnapshot();v={top:((g||0)-N.height)/2}}else v=i==="bottom"?{bottom:d&&d.bottom||0}:{top:d&&d.top||0};return Hx(Hx({},y),v)}},{key:"render",value:function(){var n=this,a=this.props,o=a.content,l=a.width,i=a.height,d=a.wrapperStyle,m=a.payloadUniqBy,g=a.payload,y=Hx(Hx({position:"absolute",width:l||"auto",height:i||"auto"},this.getDefaultPosition(d)),d);return lt.createElement("div",{className:"recharts-legend-wrapper",style:y,ref:function(b){n.wrapperNode=b}},ERt(o,Hx(Hx({},this.props),{},{payload:eUe(g,m,ARt)})))}}],[{key:"getWithHeight",value:function(n,a){var o=Hx(Hx({},this.defaultProps),n.props),l=o.layout;return l==="vertical"&&Us(n.props.height)?{height:n.props.height}:l==="horizontal"?{width:n.props.width||a}:null}}])}(E.PureComponent);xie(mC,"displayName","Legend");xie(mC,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var S3e=FP,IRt=C1e,PRt=Wh,C3e=S3e?S3e.isConcatSpreadable:void 0;function LRt(t){return PRt(t)||IRt(t)||!!(C3e&&t&&t[C3e])}var ORt=LRt,DRt=U$e,RRt=ORt;function sUe(t,r,s,n,a){var o=-1,l=t.length;for(s||(s=RRt),a||(a=[]);++o0&&s(i)?r>1?sUe(i,r-1,s,n,a):DRt(a,i):n||(a[a.length]=i)}return a}var nUe=sUe;function FRt(t){return function(r,s,n){for(var a=-1,o=Object(r),l=n(r),i=l.length;i--;){var d=l[t?i:++a];if(s(o[d],d,o)===!1)break}return r}}var zRt=FRt,BRt=zRt,$Rt=BRt(),URt=$Rt,qRt=URt,VRt=gie;function HRt(t,r){return t&&qRt(t,r,VRt)}var aUe=HRt,WRt=$P;function GRt(t,r){return function(s,n){if(s==null)return s;if(!WRt(s))return t(s,n);for(var a=s.length,o=r?a:-1,l=Object(s);(r?o--:++or||o&&l&&d&&!i&&!m||n&&l&&d||!s&&d||!a)return 1;if(!n&&!o&&!m&&t=i)return d;var m=s[n];return d*(m=="desc"?-1:1)}}return t.index-r.index}var oFt=iFt,sue=f1e,lFt=g1e,cFt=gx,dFt=iUe,uFt=rFt,hFt=H$e,mFt=oFt,pFt=l5,fFt=Wh;function gFt(t,r,s){r.length?r=sue(r,function(o){return fFt(o)?function(l){return lFt(l,o.length===1?o[0]:o)}:o}):r=[pFt];var n=-1;r=sue(r,hFt(cFt));var a=dFt(t,function(o,l,i){var d=sue(r,function(m){return m(o)});return{criteria:d,index:++n,value:o}});return uFt(a,function(o,l){return mFt(o,l,s)})}var xFt=gFt;function yFt(t,r,s){switch(s.length){case 0:return t.call(r);case 1:return t.call(r,s[0]);case 2:return t.call(r,s[0],s[1]);case 3:return t.call(r,s[0],s[1],s[2])}return t.apply(r,s)}var vFt=yFt,_Ft=vFt,T3e=Math.max;function bFt(t,r,s){return r=T3e(r===void 0?t.length-1:r,0),function(){for(var n=arguments,a=-1,o=T3e(n.length-r,0),l=Array(o);++a0){if(++r>=EFt)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}var OFt=LFt,DFt=AFt,RFt=OFt,FFt=RFt(DFt),zFt=FFt,BFt=l5,$Ft=wFt,UFt=zFt;function qFt(t,r){return UFt($Ft(t,r,BFt),t+"")}var VFt=qFt,HFt=u1e,WFt=$P,GFt=M1e,KFt=zv;function ZFt(t,r,s){if(!KFt(s))return!1;var n=typeof r;return(n=="number"?WFt(s)&&GFt(r,s.length):n=="string"&&r in s)?HFt(s[r],t):!1}var yie=ZFt,YFt=nUe,XFt=xFt,QFt=VFt,E3e=yie,JFt=QFt(function(t,r){if(t==null)return[];var s=r.length;return s>1&&E3e(t,r[0],r[1])?r=[]:s>2&&E3e(r[0],r[1],r[2])&&(r=[r[0]]),XFt(t,YFt(r,1),[])}),ezt=JFt;const I1e=oo(ezt);function vI(t){"@babel/helpers - typeof";return vI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},vI(t)}function Qpe(){return Qpe=Object.assign?Object.assign.bind():function(t){for(var r=1;rt.length)&&(r=t.length);for(var s=0,n=new Array(r);s=r.x),"".concat(ET,"-left"),Us(s)&&r&&Us(r.x)&&s=r.y),"".concat(ET,"-top"),Us(n)&&r&&Us(r.y)&&nj?Math.max(g,d[n]):Math.max(y,d[n])}function fzt(t){var r=t.translateX,s=t.translateY,n=t.useTranslate3d;return{transform:n?"translate3d(".concat(r,"px, ").concat(s,"px, 0)"):"translate(".concat(r,"px, ").concat(s,"px)")}}function gzt(t){var r=t.allowEscapeViewBox,s=t.coordinate,n=t.offsetTopLeft,a=t.position,o=t.reverseDirection,l=t.tooltipBox,i=t.useTranslate3d,d=t.viewBox,m,g,y;return l.height>0&&l.width>0&&s?(g=L3e({allowEscapeViewBox:r,coordinate:s,key:"x",offsetTopLeft:n,position:a,reverseDirection:o,tooltipDimension:l.width,viewBox:d,viewBoxDimension:d.width}),y=L3e({allowEscapeViewBox:r,coordinate:s,key:"y",offsetTopLeft:n,position:a,reverseDirection:o,tooltipDimension:l.height,viewBox:d,viewBoxDimension:d.height}),m=fzt({translateX:g,translateY:y,useTranslate3d:i})):m=mzt,{cssProperties:m,cssClasses:pzt({translateX:g,translateY:y,coordinate:s})}}function n3(t){"@babel/helpers - typeof";return n3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},n3(t)}function O3e(t,r){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),s.push.apply(s,n)}return s}function D3e(t){for(var r=1;rR3e||Math.abs(n.height-this.state.lastBoundingBox.height)>R3e)&&this.setState({lastBoundingBox:{width:n.width,height:n.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 n,a;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.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 n=this,a=this.props,o=a.active,l=a.allowEscapeViewBox,i=a.animationDuration,d=a.animationEasing,m=a.children,g=a.coordinate,y=a.hasPayload,v=a.isAnimationActive,b=a.offset,N=a.position,j=a.reverseDirection,S=a.useTranslate3d,A=a.viewBox,M=a.wrapperStyle,I=gzt({allowEscapeViewBox:l,coordinate:g,offsetTopLeft:b,position:N,reverseDirection:j,tooltipBox:this.state.lastBoundingBox,useTranslate3d:S,viewBox:A}),F=I.cssClasses,O=I.cssProperties,B=D3e(D3e({transition:v&&o?"transform ".concat(i,"ms ").concat(d):void 0},O),{},{pointerEvents:"none",visibility:!this.state.dismissed&&o&&y?"visible":"hidden",position:"absolute",top:0,left:0},M);return lt.createElement("div",{tabIndex:-1,className:F,style:B,ref:function(H){n.wrapperNode=H}},m)}}])}(E.PureComponent),Szt=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},c5={isSsr:Szt()};function a3(t){"@babel/helpers - typeof";return a3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},a3(t)}function F3e(t,r){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),s.push.apply(s,n)}return s}function z3e(t){for(var r=1;r0;return lt.createElement(Nzt,{allowEscapeViewBox:l,animationDuration:i,animationEasing:d,isAnimationActive:v,active:o,coordinate:g,hasPayload:B,offset:b,position:S,reverseDirection:A,useTranslate3d:M,viewBox:I,wrapperStyle:F},Dzt(m,z3e(z3e({},this.props),{},{payload:O})))}}])}(E.PureComponent);P1e(bf,"displayName","Tooltip");P1e(bf,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!c5.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 Rzt=fx,Fzt=function(){return Rzt.Date.now()},zzt=Fzt,Bzt=/\s/;function $zt(t){for(var r=t.length;r--&&Bzt.test(t.charAt(r)););return r}var Uzt=$zt,qzt=Uzt,Vzt=/^\s+/;function Hzt(t){return t&&t.slice(0,qzt(t)+1).replace(Vzt,"")}var Wzt=Hzt,Gzt=Wzt,B3e=zv,Kzt=t5,$3e=NaN,Zzt=/^[-+]0x[0-9a-f]+$/i,Yzt=/^0b[01]+$/i,Xzt=/^0o[0-7]+$/i,Qzt=parseInt;function Jzt(t){if(typeof t=="number")return t;if(Kzt(t))return $3e;if(B3e(t)){var r=typeof t.valueOf=="function"?t.valueOf():t;t=B3e(r)?r+"":r}if(typeof t!="string")return t===0?t:+t;t=Gzt(t);var s=Yzt.test(t);return s||Xzt.test(t)?Qzt(t.slice(2),s?2:8):Zzt.test(t)?$3e:+t}var hUe=Jzt,e7t=zv,aue=zzt,U3e=hUe,t7t="Expected a function",r7t=Math.max,s7t=Math.min;function n7t(t,r,s){var n,a,o,l,i,d,m=0,g=!1,y=!1,v=!0;if(typeof t!="function")throw new TypeError(t7t);r=U3e(r)||0,e7t(s)&&(g=!!s.leading,y="maxWait"in s,o=y?r7t(U3e(s.maxWait)||0,r):o,v="trailing"in s?!!s.trailing:v);function b(B){var $=n,H=a;return n=a=void 0,m=B,l=t.apply(H,$),l}function N(B){return m=B,i=setTimeout(A,r),g?b(B):l}function j(B){var $=B-d,H=B-m,W=r-$;return y?s7t(W,o-H):W}function S(B){var $=B-d,H=B-m;return d===void 0||$>=r||$<0||y&&H>=o}function A(){var B=aue();if(S(B))return M(B);i=setTimeout(A,j(B))}function M(B){return i=void 0,v&&n?b(B):(n=a=void 0,l)}function I(){i!==void 0&&clearTimeout(i),m=0,n=d=a=i=void 0}function F(){return i===void 0?l:M(aue())}function O(){var B=aue(),$=S(B);if(n=arguments,a=this,d=B,$){if(i===void 0)return N(d);if(y)return clearTimeout(i),i=setTimeout(A,r),b(d)}return i===void 0&&(i=setTimeout(A,r)),l}return O.cancel=I,O.flush=F,O}var a7t=n7t,i7t=a7t,o7t=zv,l7t="Expected a function";function c7t(t,r,s){var n=!0,a=!0;if(typeof t!="function")throw new TypeError(l7t);return o7t(s)&&(n="leading"in s?!!s.leading:n,a="trailing"in s?!!s.trailing:a),i7t(t,r,{leading:n,maxWait:r,trailing:a})}var d7t=c7t;const mUe=oo(d7t);function bI(t){"@babel/helpers - typeof";return bI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},bI(t)}function q3e(t,r){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),s.push.apply(s,n)}return s}function G8(t){for(var r=1;rt.length)&&(r=t.length);for(var s=0,n=new Array(r);s0&&(le=mUe(le,j,{trailing:!0,leading:!1}));var ne=new ResizeObserver(le),fe=O.current.getBoundingClientRect(),oe=fe.width,de=fe.height;return se(oe,de),ne.observe(O.current),function(){ne.disconnect()}},[se,j]);var ae=E.useMemo(function(){var le=W.containerWidth,ne=W.containerHeight;if(le<0||ne<0)return null;Hf(yj(l)||yj(d),`The width(%s) and height(%s) are both fixed numbers, maybe you don't need to use a ResponsiveContainer.`,l,d),Hf(!s||s>0,"The aspect(%s) must be greater than zero.",s);var fe=yj(l)?le:l,oe=yj(d)?ne:d;s&&s>0&&(fe?oe=fe/s:oe&&(fe=oe*s),v&&oe>v&&(oe=v)),Hf(fe>0||oe>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.`,fe,oe,l,d,g,y,s);var de=!Array.isArray(b)&&Ny(b.type).endsWith("Chart");return lt.Children.map(b,function(ue){return lt.isValidElement(ue)?E.cloneElement(ue,G8({width:fe,height:oe},de?{style:G8({height:"100%",width:"100%",maxHeight:oe,maxWidth:fe},ue.props.style)}:{})):ue})},[s,b,d,v,y,g,W,l]);return lt.createElement("div",{id:S?"".concat(S):void 0,className:vi("recharts-responsive-container",A),style:G8(G8({},F),{},{width:l,height:d,minWidth:g,minHeight:y,maxHeight:v}),ref:O},ae)}),vie=function(r){return null};vie.displayName="Cell";function wI(t){"@babel/helpers - typeof";return wI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},wI(t)}function H3e(t,r){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),s.push.apply(s,n)}return s}function sfe(t){for(var r=1;r1&&arguments[1]!==void 0?arguments[1]:{};if(r==null||c5.isSsr)return{width:0,height:0};var n=k7t(s),a=JSON.stringify({text:r,copyStyle:n});if(K4.widthCache[a])return K4.widthCache[a];try{var o=document.getElementById(W3e);o||(o=document.createElement("span"),o.setAttribute("id",W3e),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var l=sfe(sfe({},j7t),n);Object.assign(o.style,l),o.textContent="".concat(r);var i=o.getBoundingClientRect(),d={width:i.width,height:i.height};return K4.widthCache[a]=d,++K4.cacheCount>w7t&&(K4.cacheCount=0,K4.widthCache={}),d}catch{return{width:0,height:0}}},N7t=function(r){return{top:r.top+window.scrollY-document.documentElement.clientTop,left:r.left+window.scrollX-document.documentElement.clientLeft}};function jI(t){"@babel/helpers - typeof";return jI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},jI(t)}function _se(t,r){return T7t(t)||M7t(t,r)||C7t(t,r)||S7t()}function S7t(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function C7t(t,r){if(t){if(typeof t=="string")return G3e(t,r);var s=Object.prototype.toString.call(t).slice(8,-1);if(s==="Object"&&t.constructor&&(s=t.constructor.name),s==="Map"||s==="Set")return Array.from(t);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return G3e(t,r)}}function G3e(t,r){(r==null||r>t.length)&&(r=t.length);for(var s=0,n=new Array(r);s=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function q7t(t,r){if(t==null)return{};var s={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(r.indexOf(n)>=0)continue;s[n]=t[n]}return s}function J3e(t,r){return G7t(t)||W7t(t,r)||H7t(t,r)||V7t()}function V7t(){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 H7t(t,r){if(t){if(typeof t=="string")return e5e(t,r);var s=Object.prototype.toString.call(t).slice(8,-1);if(s==="Object"&&t.constructor&&(s=t.constructor.name),s==="Map"||s==="Set")return Array.from(t);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return e5e(t,r)}}function e5e(t,r){(r==null||r>t.length)&&(r=t.length);for(var s=0,n=new Array(r);s0&&arguments[0]!==void 0?arguments[0]:[];return fe.reduce(function(oe,de){var ue=de.word,xe=de.width,Te=oe[oe.length-1];if(Te&&(a==null||o||Te.width+xe+nde.width?oe:de})};if(!g)return b;for(var j="…",S=function(fe){var oe=y.slice(0,fe),de=xUe({breakAll:m,style:d,children:oe+j}).wordsWithComputedWidth,ue=v(de),xe=ue.length>l||N(ue).width>Number(a);return[xe,ue]},A=0,M=y.length-1,I=0,F;A<=M&&I<=y.length-1;){var O=Math.floor((A+M)/2),B=O-1,$=S(B),H=J3e($,2),W=H[0],X=H[1],se=S(O),ae=J3e(se,1),le=ae[0];if(!W&&!le&&(A=O+1),W&&le&&(M=O-1),!W&&le){F=X;break}I++}return F||b},t5e=function(r){var s=Ri(r)?[]:r.toString().split(gUe);return[{words:s}]},Z7t=function(r){var s=r.width,n=r.scaleToFit,a=r.children,o=r.style,l=r.breakAll,i=r.maxLines;if((s||n)&&!c5.isSsr){var d,m,g=xUe({breakAll:l,children:a,style:o});if(g){var y=g.wordsWithComputedWidth,v=g.spaceWidth;d=y,m=v}else return t5e(a);return K7t({breakAll:l,children:a,maxLines:i,style:o},d,m,s,n)}return t5e(a)},r5e="#808080",Ik=function(r){var s=r.x,n=s===void 0?0:s,a=r.y,o=a===void 0?0:a,l=r.lineHeight,i=l===void 0?"1em":l,d=r.capHeight,m=d===void 0?"0.71em":d,g=r.scaleToFit,y=g===void 0?!1:g,v=r.textAnchor,b=v===void 0?"start":v,N=r.verticalAnchor,j=N===void 0?"end":N,S=r.fill,A=S===void 0?r5e:S,M=Q3e(r,$7t),I=E.useMemo(function(){return Z7t({breakAll:M.breakAll,children:M.children,maxLines:M.maxLines,scaleToFit:y,style:M.style,width:M.width})},[M.breakAll,M.children,M.maxLines,y,M.style,M.width]),F=M.dx,O=M.dy,B=M.angle,$=M.className,H=M.breakAll,W=Q3e(M,U7t);if(!xd(n)||!xd(o))return null;var X=n+(Us(F)?F:0),se=o+(Us(O)?O:0),ae;switch(j){case"start":ae=iue("calc(".concat(m,")"));break;case"middle":ae=iue("calc(".concat((I.length-1)/2," * -").concat(i," + (").concat(m," / 2))"));break;default:ae=iue("calc(".concat(I.length-1," * -").concat(i,")"));break}var le=[];if(y){var ne=I[0].width,fe=M.width;le.push("scale(".concat((Us(fe)?fe/ne:1)/ne,")"))}return B&&le.push("rotate(".concat(B,", ").concat(X,", ").concat(se,")")),le.length&&(W.transform=le.join(" ")),lt.createElement("text",nfe({},Ga(W,!0),{x:X,y:se,className:vi("recharts-text",$),textAnchor:b,fill:A.includes("url")?r5e:A}),I.map(function(oe,de){var ue=oe.words.join(H?"":" ");return lt.createElement("tspan",{x:X,dy:de===0?ae:i,key:"".concat(ue,"-").concat(de)},ue)}))};function uv(t,r){return t==null||r==null?NaN:tr?1:t>=r?0:NaN}function Y7t(t,r){return t==null||r==null?NaN:rt?1:r>=t?0:NaN}function L1e(t){let r,s,n;t.length!==2?(r=uv,s=(i,d)=>uv(t(i),d),n=(i,d)=>t(i)-d):(r=t===uv||t===Y7t?t:X7t,s=t,n=t);function a(i,d,m=0,g=i.length){if(m>>1;s(i[y],d)<0?m=y+1:g=y}while(m>>1;s(i[y],d)<=0?m=y+1:g=y}while(mm&&n(i[y-1],d)>-n(i[y],d)?y-1:y}return{left:a,center:l,right:o}}function X7t(){return 0}function yUe(t){return t===null?NaN:+t}function*Q7t(t,r){for(let s of t)s!=null&&(s=+s)>=s&&(yield s)}const J7t=L1e(uv),UP=J7t.right;L1e(yUe).center;class s5e extends Map{constructor(r,s=r9t){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:s}}),r!=null)for(const[n,a]of r)this.set(n,a)}get(r){return super.get(n5e(this,r))}has(r){return super.has(n5e(this,r))}set(r,s){return super.set(e9t(this,r),s)}delete(r){return super.delete(t9t(this,r))}}function n5e({_intern:t,_key:r},s){const n=r(s);return t.has(n)?t.get(n):s}function e9t({_intern:t,_key:r},s){const n=r(s);return t.has(n)?t.get(n):(t.set(n,s),s)}function t9t({_intern:t,_key:r},s){const n=r(s);return t.has(n)&&(s=t.get(n),t.delete(n)),s}function r9t(t){return t!==null&&typeof t=="object"?t.valueOf():t}function s9t(t=uv){if(t===uv)return vUe;if(typeof t!="function")throw new TypeError("compare is not a function");return(r,s)=>{const n=t(r,s);return n||n===0?n:(t(s,s)===0)-(t(r,r)===0)}}function vUe(t,r){return(t==null||!(t>=t))-(r==null||!(r>=r))||(tr?1:0)}const n9t=Math.sqrt(50),a9t=Math.sqrt(10),i9t=Math.sqrt(2);function bse(t,r,s){const n=(r-t)/Math.max(0,s),a=Math.floor(Math.log10(n)),o=n/Math.pow(10,a),l=o>=n9t?10:o>=a9t?5:o>=i9t?2:1;let i,d,m;return a<0?(m=Math.pow(10,-a)/l,i=Math.round(t*m),d=Math.round(r*m),i/mr&&--d,m=-m):(m=Math.pow(10,a)*l,i=Math.round(t/m),d=Math.round(r/m),i*mr&&--d),d0))return[];if(t===r)return[t];const n=r=a))return[];const i=o-a+1,d=new Array(i);if(n)if(l<0)for(let m=0;m=n)&&(s=n);return s}function i5e(t,r){let s;for(const n of t)n!=null&&(s>n||s===void 0&&n>=n)&&(s=n);return s}function _Ue(t,r,s=0,n=1/0,a){if(r=Math.floor(r),s=Math.floor(Math.max(0,s)),n=Math.floor(Math.min(t.length-1,n)),!(s<=r&&r<=n))return t;for(a=a===void 0?vUe:s9t(a);n>s;){if(n-s>600){const d=n-s+1,m=r-s+1,g=Math.log(d),y=.5*Math.exp(2*g/3),v=.5*Math.sqrt(g*y*(d-y)/d)*(m-d/2<0?-1:1),b=Math.max(s,Math.floor(r-m*y/d+v)),N=Math.min(n,Math.floor(r+(d-m)*y/d+v));_Ue(t,r,b,N,a)}const o=t[r];let l=s,i=n;for(IT(t,s,r),a(t[n],o)>0&&IT(t,s,n);l0;)--i}a(t[s],o)===0?IT(t,s,i):(++i,IT(t,i,n)),i<=r&&(s=i+1),r<=i&&(n=i-1)}return t}function IT(t,r,s){const n=t[r];t[r]=t[s],t[s]=n}function o9t(t,r,s){if(t=Float64Array.from(Q7t(t)),!(!(n=t.length)||isNaN(r=+r))){if(r<=0||n<2)return i5e(t);if(r>=1)return a5e(t);var n,a=(n-1)*r,o=Math.floor(a),l=a5e(_Ue(t,o).subarray(0,o+1)),i=i5e(t.subarray(o+1));return l+(i-l)*(a-o)}}function l9t(t,r,s=yUe){if(!(!(n=t.length)||isNaN(r=+r))){if(r<=0||n<2)return+s(t[0],0,t);if(r>=1)return+s(t[n-1],n-1,t);var n,a=(n-1)*r,o=Math.floor(a),l=+s(t[o],o,t),i=+s(t[o+1],o+1,t);return l+(i-l)*(a-o)}}function c9t(t,r,s){t=+t,r=+r,s=(a=arguments.length)<2?(r=t,t=0,1):a<3?1:+s;for(var n=-1,a=Math.max(0,Math.ceil((r-t)/s))|0,o=new Array(a);++n>8&15|r>>4&240,r>>4&15|r&240,(r&15)<<4|r&15,1):s===8?Z8(r>>24&255,r>>16&255,r>>8&255,(r&255)/255):s===4?Z8(r>>12&15|r>>8&240,r>>8&15|r>>4&240,r>>4&15|r&240,((r&15)<<4|r&15)/255):null):(r=u9t.exec(t))?new Oh(r[1],r[2],r[3],1):(r=h9t.exec(t))?new Oh(r[1]*255/100,r[2]*255/100,r[3]*255/100,1):(r=m9t.exec(t))?Z8(r[1],r[2],r[3],r[4]):(r=p9t.exec(t))?Z8(r[1]*255/100,r[2]*255/100,r[3]*255/100,r[4]):(r=f9t.exec(t))?m5e(r[1],r[2]/100,r[3]/100,1):(r=g9t.exec(t))?m5e(r[1],r[2]/100,r[3]/100,r[4]):o5e.hasOwnProperty(t)?d5e(o5e[t]):t==="transparent"?new Oh(NaN,NaN,NaN,0):null}function d5e(t){return new Oh(t>>16&255,t>>8&255,t&255,1)}function Z8(t,r,s,n){return n<=0&&(t=r=s=NaN),new Oh(t,r,s,n)}function v9t(t){return t instanceof qP||(t=CI(t)),t?(t=t.rgb(),new Oh(t.r,t.g,t.b,t.opacity)):new Oh}function cfe(t,r,s,n){return arguments.length===1?v9t(t):new Oh(t,r,s,n??1)}function Oh(t,r,s,n){this.r=+t,this.g=+r,this.b=+s,this.opacity=+n}D1e(Oh,cfe,wUe(qP,{brighter(t){return t=t==null?wse:Math.pow(wse,t),new Oh(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?NI:Math.pow(NI,t),new Oh(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Oh(lk(this.r),lk(this.g),lk(this.b),jse(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:u5e,formatHex:u5e,formatHex8:_9t,formatRgb:h5e,toString:h5e}));function u5e(){return`#${vj(this.r)}${vj(this.g)}${vj(this.b)}`}function _9t(){return`#${vj(this.r)}${vj(this.g)}${vj(this.b)}${vj((isNaN(this.opacity)?1:this.opacity)*255)}`}function h5e(){const t=jse(this.opacity);return`${t===1?"rgb(":"rgba("}${lk(this.r)}, ${lk(this.g)}, ${lk(this.b)}${t===1?")":`, ${t})`}`}function jse(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function lk(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function vj(t){return t=lk(t),(t<16?"0":"")+t.toString(16)}function m5e(t,r,s,n){return n<=0?t=r=s=NaN:s<=0||s>=1?t=r=NaN:r<=0&&(t=NaN),new Mf(t,r,s,n)}function jUe(t){if(t instanceof Mf)return new Mf(t.h,t.s,t.l,t.opacity);if(t instanceof qP||(t=CI(t)),!t)return new Mf;if(t instanceof Mf)return t;t=t.rgb();var r=t.r/255,s=t.g/255,n=t.b/255,a=Math.min(r,s,n),o=Math.max(r,s,n),l=NaN,i=o-a,d=(o+a)/2;return i?(r===o?l=(s-n)/i+(s0&&d<1?0:l,new Mf(l,i,d,t.opacity)}function b9t(t,r,s,n){return arguments.length===1?jUe(t):new Mf(t,r,s,n??1)}function Mf(t,r,s,n){this.h=+t,this.s=+r,this.l=+s,this.opacity=+n}D1e(Mf,b9t,wUe(qP,{brighter(t){return t=t==null?wse:Math.pow(wse,t),new Mf(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?NI:Math.pow(NI,t),new Mf(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,r=isNaN(t)||isNaN(this.s)?0:this.s,s=this.l,n=s+(s<.5?s:1-s)*r,a=2*s-n;return new Oh(oue(t>=240?t-240:t+120,a,n),oue(t,a,n),oue(t<120?t+240:t-120,a,n),this.opacity)},clamp(){return new Mf(p5e(this.h),Y8(this.s),Y8(this.l),jse(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=jse(this.opacity);return`${t===1?"hsl(":"hsla("}${p5e(this.h)}, ${Y8(this.s)*100}%, ${Y8(this.l)*100}%${t===1?")":`, ${t})`}`}}));function p5e(t){return t=(t||0)%360,t<0?t+360:t}function Y8(t){return Math.max(0,Math.min(1,t||0))}function oue(t,r,s){return(t<60?r+(s-r)*t/60:t<180?s:t<240?r+(s-r)*(240-t)/60:r)*255}const R1e=t=>()=>t;function w9t(t,r){return function(s){return t+s*r}}function j9t(t,r,s){return t=Math.pow(t,s),r=Math.pow(r,s)-t,s=1/s,function(n){return Math.pow(t+n*r,s)}}function k9t(t){return(t=+t)==1?kUe:function(r,s){return s-r?j9t(r,s,t):R1e(isNaN(r)?s:r)}}function kUe(t,r){var s=r-t;return s?w9t(t,s):R1e(isNaN(t)?r:t)}const f5e=function t(r){var s=k9t(r);function n(a,o){var l=s((a=cfe(a)).r,(o=cfe(o)).r),i=s(a.g,o.g),d=s(a.b,o.b),m=kUe(a.opacity,o.opacity);return function(g){return a.r=l(g),a.g=i(g),a.b=d(g),a.opacity=m(g),a+""}}return n.gamma=t,n}(1);function N9t(t,r){r||(r=[]);var s=t?Math.min(r.length,t.length):0,n=r.slice(),a;return function(o){for(a=0;as&&(o=r.slice(s,o),i[l]?i[l]+=o:i[++l]=o),(n=n[0])===(a=a[0])?i[l]?i[l]+=a:i[++l]=a:(i[++l]=null,d.push({i:l,x:kse(n,a)})),s=lue.lastIndex;return sr&&(s=t,t=r,r=s),function(n){return Math.max(t,Math.min(r,n))}}function D9t(t,r,s){var n=t[0],a=t[1],o=r[0],l=r[1];return a2?R9t:D9t,d=m=null,y}function y(v){return v==null||isNaN(v=+v)?o:(d||(d=i(t.map(n),r,s)))(n(l(v)))}return y.invert=function(v){return l(a((m||(m=i(r,t.map(n),kse)))(v)))},y.domain=function(v){return arguments.length?(t=Array.from(v,Nse),g()):t.slice()},y.range=function(v){return arguments.length?(r=Array.from(v),g()):r.slice()},y.rangeRound=function(v){return r=Array.from(v),s=F1e,g()},y.clamp=function(v){return arguments.length?(l=v?!0:sh,g()):l!==sh},y.interpolate=function(v){return arguments.length?(s=v,g()):s},y.unknown=function(v){return arguments.length?(o=v,y):o},function(v,b){return n=v,a=b,g()}}function z1e(){return _ie()(sh,sh)}function F9t(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Sse(t,r){if((s=(t=r?t.toExponential(r-1):t.toExponential()).indexOf("e"))<0)return null;var s,n=t.slice(0,s);return[n.length>1?n[0]+n.slice(2):n,+t.slice(s+1)]}function i3(t){return t=Sse(Math.abs(t)),t?t[1]:NaN}function z9t(t,r){return function(s,n){for(var a=s.length,o=[],l=0,i=t[0],d=0;a>0&&i>0&&(d+i+1>n&&(i=Math.max(1,n-d)),o.push(s.substring(a-=i,a+i)),!((d+=i+1)>n));)i=t[l=(l+1)%t.length];return o.reverse().join(r)}}function B9t(t){return function(r){return r.replace(/[0-9]/g,function(s){return t[+s]})}}var $9t=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function MI(t){if(!(r=$9t.exec(t)))throw new Error("invalid format: "+t);var r;return new B1e({fill:r[1],align:r[2],sign:r[3],symbol:r[4],zero:r[5],width:r[6],comma:r[7],precision:r[8]&&r[8].slice(1),trim:r[9],type:r[10]})}MI.prototype=B1e.prototype;function B1e(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}B1e.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 U9t(t){e:for(var r=t.length,s=1,n=-1,a;s0&&(n=0);break}return n>0?t.slice(0,n)+t.slice(a+1):t}var NUe;function q9t(t,r){var s=Sse(t,r);if(!s)return t+"";var n=s[0],a=s[1],o=a-(NUe=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,l=n.length;return o===l?n:o>l?n+new Array(o-l+1).join("0"):o>0?n.slice(0,o)+"."+n.slice(o):"0."+new Array(1-o).join("0")+Sse(t,Math.max(0,r+o-1))[0]}function x5e(t,r){var s=Sse(t,r);if(!s)return t+"";var n=s[0],a=s[1];return a<0?"0."+new Array(-a).join("0")+n:n.length>a+1?n.slice(0,a+1)+"."+n.slice(a+1):n+new Array(a-n.length+2).join("0")}const y5e={"%":(t,r)=>(t*100).toFixed(r),b:t=>Math.round(t).toString(2),c:t=>t+"",d:F9t,e:(t,r)=>t.toExponential(r),f:(t,r)=>t.toFixed(r),g:(t,r)=>t.toPrecision(r),o:t=>Math.round(t).toString(8),p:(t,r)=>x5e(t*100,r),r:x5e,s:q9t,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function v5e(t){return t}var _5e=Array.prototype.map,b5e=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function V9t(t){var r=t.grouping===void 0||t.thousands===void 0?v5e:z9t(_5e.call(t.grouping,Number),t.thousands+""),s=t.currency===void 0?"":t.currency[0]+"",n=t.currency===void 0?"":t.currency[1]+"",a=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?v5e:B9t(_5e.call(t.numerals,String)),l=t.percent===void 0?"%":t.percent+"",i=t.minus===void 0?"−":t.minus+"",d=t.nan===void 0?"NaN":t.nan+"";function m(y){y=MI(y);var v=y.fill,b=y.align,N=y.sign,j=y.symbol,S=y.zero,A=y.width,M=y.comma,I=y.precision,F=y.trim,O=y.type;O==="n"?(M=!0,O="g"):y5e[O]||(I===void 0&&(I=12),F=!0,O="g"),(S||v==="0"&&b==="=")&&(S=!0,v="0",b="=");var B=j==="$"?s:j==="#"&&/[boxX]/.test(O)?"0"+O.toLowerCase():"",$=j==="$"?n:/[%p]/.test(O)?l:"",H=y5e[O],W=/[defgprs%]/.test(O);I=I===void 0?6:/[gprs]/.test(O)?Math.max(1,Math.min(21,I)):Math.max(0,Math.min(20,I));function X(se){var ae=B,le=$,ne,fe,oe;if(O==="c")le=H(se)+le,se="";else{se=+se;var de=se<0||1/se<0;if(se=isNaN(se)?d:H(Math.abs(se),I),F&&(se=U9t(se)),de&&+se==0&&N!=="+"&&(de=!1),ae=(de?N==="("?N:i:N==="-"||N==="("?"":N)+ae,le=(O==="s"?b5e[8+NUe/3]:"")+le+(de&&N==="("?")":""),W){for(ne=-1,fe=se.length;++neoe||oe>57){le=(oe===46?a+se.slice(ne+1):se.slice(ne))+le,se=se.slice(0,ne);break}}}M&&!S&&(se=r(se,1/0));var ue=ae.length+se.length+le.length,xe=ue>1)+ae+se+le+xe.slice(ue);break;default:se=xe+ae+se+le;break}return o(se)}return X.toString=function(){return y+""},X}function g(y,v){var b=m((y=MI(y),y.type="f",y)),N=Math.max(-8,Math.min(8,Math.floor(i3(v)/3)))*3,j=Math.pow(10,-N),S=b5e[8+N/3];return function(A){return b(j*A)+S}}return{format:m,formatPrefix:g}}var X8,$1e,SUe;H9t({thousands:",",grouping:[3],currency:["$",""]});function H9t(t){return X8=V9t(t),$1e=X8.format,SUe=X8.formatPrefix,X8}function W9t(t){return Math.max(0,-i3(Math.abs(t)))}function G9t(t,r){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(i3(r)/3)))*3-i3(Math.abs(t)))}function K9t(t,r){return t=Math.abs(t),r=Math.abs(r)-t,Math.max(0,i3(r)-i3(t))+1}function CUe(t,r,s,n){var a=ofe(t,r,s),o;switch(n=MI(n??",f"),n.type){case"s":{var l=Math.max(Math.abs(t),Math.abs(r));return n.precision==null&&!isNaN(o=G9t(a,l))&&(n.precision=o),SUe(n,l)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(o=K9t(a,Math.max(Math.abs(t),Math.abs(r))))&&(n.precision=o-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(o=W9t(a))&&(n.precision=o-(n.type==="%")*2);break}}return $1e(n)}function Bv(t){var r=t.domain;return t.ticks=function(s){var n=r();return afe(n[0],n[n.length-1],s??10)},t.tickFormat=function(s,n){var a=r();return CUe(a[0],a[a.length-1],s??10,n)},t.nice=function(s){s==null&&(s=10);var n=r(),a=0,o=n.length-1,l=n[a],i=n[o],d,m,g=10;for(i0;){if(m=ife(l,i,s),m===d)return n[a]=l,n[o]=i,r(n);if(m>0)l=Math.floor(l/m)*m,i=Math.ceil(i/m)*m;else if(m<0)l=Math.ceil(l*m)/m,i=Math.floor(i*m)/m;else break;d=m}return t},t}function Cse(){var t=z1e();return t.copy=function(){return VP(t,Cse())},Lp.apply(t,arguments),Bv(t)}function MUe(t){var r;function s(n){return n==null||isNaN(n=+n)?r:n}return s.invert=s,s.domain=s.range=function(n){return arguments.length?(t=Array.from(n,Nse),s):t.slice()},s.unknown=function(n){return arguments.length?(r=n,s):r},s.copy=function(){return MUe(t).unknown(r)},t=arguments.length?Array.from(t,Nse):[0,1],Bv(s)}function TUe(t,r){t=t.slice();var s=0,n=t.length-1,a=t[s],o=t[n],l;return oMath.pow(t,r)}function J9t(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),r=>Math.log(r)/t)}function k5e(t){return(r,s)=>-t(-r,s)}function U1e(t){const r=t(w5e,j5e),s=r.domain;let n=10,a,o;function l(){return a=J9t(n),o=Q9t(n),s()[0]<0?(a=k5e(a),o=k5e(o),t(Z9t,Y9t)):t(w5e,j5e),r}return r.base=function(i){return arguments.length?(n=+i,l()):n},r.domain=function(i){return arguments.length?(s(i),l()):s()},r.ticks=i=>{const d=s();let m=d[0],g=d[d.length-1];const y=g0){for(;v<=b;++v)for(N=1;Ng)break;A.push(j)}}else for(;v<=b;++v)for(N=n-1;N>=1;--N)if(j=v>0?N/o(-v):N*o(v),!(jg)break;A.push(j)}A.length*2{if(i==null&&(i=10),d==null&&(d=n===10?"s":","),typeof d!="function"&&(!(n%1)&&(d=MI(d)).precision==null&&(d.trim=!0),d=$1e(d)),i===1/0)return d;const m=Math.max(1,n*i/r.ticks().length);return g=>{let y=g/o(Math.round(a(g)));return y*ns(TUe(s(),{floor:i=>o(Math.floor(a(i))),ceil:i=>o(Math.ceil(a(i)))})),r}function AUe(){const t=U1e(_ie()).domain([1,10]);return t.copy=()=>VP(t,AUe()).base(t.base()),Lp.apply(t,arguments),t}function N5e(t){return function(r){return Math.sign(r)*Math.log1p(Math.abs(r/t))}}function S5e(t){return function(r){return Math.sign(r)*Math.expm1(Math.abs(r))*t}}function q1e(t){var r=1,s=t(N5e(r),S5e(r));return s.constant=function(n){return arguments.length?t(N5e(r=+n),S5e(r)):r},Bv(s)}function EUe(){var t=q1e(_ie());return t.copy=function(){return VP(t,EUe()).constant(t.constant())},Lp.apply(t,arguments)}function C5e(t){return function(r){return r<0?-Math.pow(-r,t):Math.pow(r,t)}}function eBt(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function tBt(t){return t<0?-t*t:t*t}function V1e(t){var r=t(sh,sh),s=1;function n(){return s===1?t(sh,sh):s===.5?t(eBt,tBt):t(C5e(s),C5e(1/s))}return r.exponent=function(a){return arguments.length?(s=+a,n()):s},Bv(r)}function H1e(){var t=V1e(_ie());return t.copy=function(){return VP(t,H1e()).exponent(t.exponent())},Lp.apply(t,arguments),t}function rBt(){return H1e.apply(null,arguments).exponent(.5)}function M5e(t){return Math.sign(t)*t*t}function sBt(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function IUe(){var t=z1e(),r=[0,1],s=!1,n;function a(o){var l=sBt(t(o));return isNaN(l)?n:s?Math.round(l):l}return a.invert=function(o){return t.invert(M5e(o))},a.domain=function(o){return arguments.length?(t.domain(o),a):t.domain()},a.range=function(o){return arguments.length?(t.range((r=Array.from(o,Nse)).map(M5e)),a):r.slice()},a.rangeRound=function(o){return a.range(o).round(!0)},a.round=function(o){return arguments.length?(s=!!o,a):s},a.clamp=function(o){return arguments.length?(t.clamp(o),a):t.clamp()},a.unknown=function(o){return arguments.length?(n=o,a):n},a.copy=function(){return IUe(t.domain(),r).round(s).clamp(t.clamp()).unknown(n)},Lp.apply(a,arguments),Bv(a)}function PUe(){var t=[],r=[],s=[],n;function a(){var l=0,i=Math.max(1,r.length);for(s=new Array(i-1);++l0?s[i-1]:t[0],i=s?[n[s-1],r]:[n[m-1],n[m]]},l.unknown=function(d){return arguments.length&&(o=d),l},l.thresholds=function(){return n.slice()},l.copy=function(){return LUe().domain([t,r]).range(a).unknown(o)},Lp.apply(Bv(l),arguments)}function OUe(){var t=[.5],r=[0,1],s,n=1;function a(o){return o!=null&&o<=o?r[UP(t,o,0,n)]:s}return a.domain=function(o){return arguments.length?(t=Array.from(o),n=Math.min(t.length,r.length-1),a):t.slice()},a.range=function(o){return arguments.length?(r=Array.from(o),n=Math.min(t.length,r.length-1),a):r.slice()},a.invertExtent=function(o){var l=r.indexOf(o);return[t[l-1],t[l]]},a.unknown=function(o){return arguments.length?(s=o,a):s},a.copy=function(){return OUe().domain(t).range(r).unknown(s)},Lp.apply(a,arguments)}const cue=new Date,due=new Date;function jd(t,r,s,n){function a(o){return t(o=arguments.length===0?new Date:new Date(+o)),o}return a.floor=o=>(t(o=new Date(+o)),o),a.ceil=o=>(t(o=new Date(o-1)),r(o,1),t(o),o),a.round=o=>{const l=a(o),i=a.ceil(o);return o-l(r(o=new Date(+o),l==null?1:Math.floor(l)),o),a.range=(o,l,i)=>{const d=[];if(o=a.ceil(o),i=i==null?1:Math.floor(i),!(o0))return d;let m;do d.push(m=new Date(+o)),r(o,i),t(o);while(mjd(l=>{if(l>=l)for(;t(l),!o(l);)l.setTime(l-1)},(l,i)=>{if(l>=l)if(i<0)for(;++i<=0;)for(;r(l,-1),!o(l););else for(;--i>=0;)for(;r(l,1),!o(l););}),s&&(a.count=(o,l)=>(cue.setTime(+o),due.setTime(+l),t(cue),t(due),Math.floor(s(cue,due))),a.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?a.filter(n?l=>n(l)%o===0:l=>a.count(0,l)%o===0):a)),a}const Mse=jd(()=>{},(t,r)=>{t.setTime(+t+r)},(t,r)=>r-t);Mse.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?jd(r=>{r.setTime(Math.floor(r/t)*t)},(r,s)=>{r.setTime(+r+s*t)},(r,s)=>(s-r)/t):Mse);Mse.range;const cy=1e3,mp=cy*60,dy=mp*60,qy=dy*24,W1e=qy*7,T5e=qy*30,uue=qy*365,_j=jd(t=>{t.setTime(t-t.getMilliseconds())},(t,r)=>{t.setTime(+t+r*cy)},(t,r)=>(r-t)/cy,t=>t.getUTCSeconds());_j.range;const G1e=jd(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*cy)},(t,r)=>{t.setTime(+t+r*mp)},(t,r)=>(r-t)/mp,t=>t.getMinutes());G1e.range;const K1e=jd(t=>{t.setUTCSeconds(0,0)},(t,r)=>{t.setTime(+t+r*mp)},(t,r)=>(r-t)/mp,t=>t.getUTCMinutes());K1e.range;const Z1e=jd(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*cy-t.getMinutes()*mp)},(t,r)=>{t.setTime(+t+r*dy)},(t,r)=>(r-t)/dy,t=>t.getHours());Z1e.range;const Y1e=jd(t=>{t.setUTCMinutes(0,0,0)},(t,r)=>{t.setTime(+t+r*dy)},(t,r)=>(r-t)/dy,t=>t.getUTCHours());Y1e.range;const HP=jd(t=>t.setHours(0,0,0,0),(t,r)=>t.setDate(t.getDate()+r),(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*mp)/qy,t=>t.getDate()-1);HP.range;const bie=jd(t=>{t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r)},(t,r)=>(r-t)/qy,t=>t.getUTCDate()-1);bie.range;const DUe=jd(t=>{t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r)},(t,r)=>(r-t)/qy,t=>Math.floor(t/qy));DUe.range;function Wk(t){return jd(r=>{r.setDate(r.getDate()-(r.getDay()+7-t)%7),r.setHours(0,0,0,0)},(r,s)=>{r.setDate(r.getDate()+s*7)},(r,s)=>(s-r-(s.getTimezoneOffset()-r.getTimezoneOffset())*mp)/W1e)}const wie=Wk(0),Tse=Wk(1),nBt=Wk(2),aBt=Wk(3),o3=Wk(4),iBt=Wk(5),oBt=Wk(6);wie.range;Tse.range;nBt.range;aBt.range;o3.range;iBt.range;oBt.range;function Gk(t){return jd(r=>{r.setUTCDate(r.getUTCDate()-(r.getUTCDay()+7-t)%7),r.setUTCHours(0,0,0,0)},(r,s)=>{r.setUTCDate(r.getUTCDate()+s*7)},(r,s)=>(s-r)/W1e)}const jie=Gk(0),Ase=Gk(1),lBt=Gk(2),cBt=Gk(3),l3=Gk(4),dBt=Gk(5),uBt=Gk(6);jie.range;Ase.range;lBt.range;cBt.range;l3.range;dBt.range;uBt.range;const X1e=jd(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,r)=>{t.setMonth(t.getMonth()+r)},(t,r)=>r.getMonth()-t.getMonth()+(r.getFullYear()-t.getFullYear())*12,t=>t.getMonth());X1e.range;const Q1e=jd(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCMonth(t.getUTCMonth()+r)},(t,r)=>r.getUTCMonth()-t.getUTCMonth()+(r.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());Q1e.range;const Vy=jd(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r)},(t,r)=>r.getFullYear()-t.getFullYear(),t=>t.getFullYear());Vy.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:jd(r=>{r.setFullYear(Math.floor(r.getFullYear()/t)*t),r.setMonth(0,1),r.setHours(0,0,0,0)},(r,s)=>{r.setFullYear(r.getFullYear()+s*t)});Vy.range;const Hy=jd(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r)},(t,r)=>r.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Hy.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:jd(r=>{r.setUTCFullYear(Math.floor(r.getUTCFullYear()/t)*t),r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0)},(r,s)=>{r.setUTCFullYear(r.getUTCFullYear()+s*t)});Hy.range;function RUe(t,r,s,n,a,o){const l=[[_j,1,cy],[_j,5,5*cy],[_j,15,15*cy],[_j,30,30*cy],[o,1,mp],[o,5,5*mp],[o,15,15*mp],[o,30,30*mp],[a,1,dy],[a,3,3*dy],[a,6,6*dy],[a,12,12*dy],[n,1,qy],[n,2,2*qy],[s,1,W1e],[r,1,T5e],[r,3,3*T5e],[t,1,uue]];function i(m,g,y){const v=gS).right(l,v);if(b===l.length)return t.every(ofe(m/uue,g/uue,y));if(b===0)return Mse.every(Math.max(ofe(m,g,y),1));const[N,j]=l[v/l[b-1][2]53)return null;"w"in Pe||(Pe.w=1),"Z"in Pe?(ce=mue(PT(Pe.y,0,1)),$e=ce.getUTCDay(),ce=$e>4||$e===0?Ase.ceil(ce):Ase(ce),ce=bie.offset(ce,(Pe.V-1)*7),Pe.y=ce.getUTCFullYear(),Pe.m=ce.getUTCMonth(),Pe.d=ce.getUTCDate()+(Pe.w+6)%7):(ce=hue(PT(Pe.y,0,1)),$e=ce.getDay(),ce=$e>4||$e===0?Tse.ceil(ce):Tse(ce),ce=HP.offset(ce,(Pe.V-1)*7),Pe.y=ce.getFullYear(),Pe.m=ce.getMonth(),Pe.d=ce.getDate()+(Pe.w+6)%7)}else("W"in Pe||"U"in Pe)&&("w"in Pe||(Pe.w="u"in Pe?Pe.u%7:"W"in Pe?1:0),$e="Z"in Pe?mue(PT(Pe.y,0,1)).getUTCDay():hue(PT(Pe.y,0,1)).getDay(),Pe.m=0,Pe.d="W"in Pe?(Pe.w+6)%7+Pe.W*7-($e+5)%7:Pe.w+Pe.U*7-($e+6)%7);return"Z"in Pe?(Pe.H+=Pe.Z/100|0,Pe.M+=Pe.Z%100,mue(Pe)):hue(Pe)}}function H(Ie,et,It,Pe){for(var at=0,ce=et.length,$e=It.length,Ge,rt;at=$e)return-1;if(Ge=et.charCodeAt(at++),Ge===37){if(Ge=et.charAt(at++),rt=O[Ge in A5e?et.charAt(at++):Ge],!rt||(Pe=rt(Ie,It,Pe))<0)return-1}else if(Ge!=It.charCodeAt(Pe++))return-1}return Pe}function W(Ie,et,It){var Pe=m.exec(et.slice(It));return Pe?(Ie.p=g.get(Pe[0].toLowerCase()),It+Pe[0].length):-1}function X(Ie,et,It){var Pe=b.exec(et.slice(It));return Pe?(Ie.w=N.get(Pe[0].toLowerCase()),It+Pe[0].length):-1}function se(Ie,et,It){var Pe=y.exec(et.slice(It));return Pe?(Ie.w=v.get(Pe[0].toLowerCase()),It+Pe[0].length):-1}function ae(Ie,et,It){var Pe=A.exec(et.slice(It));return Pe?(Ie.m=M.get(Pe[0].toLowerCase()),It+Pe[0].length):-1}function le(Ie,et,It){var Pe=j.exec(et.slice(It));return Pe?(Ie.m=S.get(Pe[0].toLowerCase()),It+Pe[0].length):-1}function ne(Ie,et,It){return H(Ie,r,et,It)}function fe(Ie,et,It){return H(Ie,s,et,It)}function oe(Ie,et,It){return H(Ie,n,et,It)}function de(Ie){return l[Ie.getDay()]}function ue(Ie){return o[Ie.getDay()]}function xe(Ie){return d[Ie.getMonth()]}function Te(Ie){return i[Ie.getMonth()]}function be(Ie){return a[+(Ie.getHours()>=12)]}function we(Ie){return 1+~~(Ie.getMonth()/3)}function ve(Ie){return l[Ie.getUTCDay()]}function tt(Ie){return o[Ie.getUTCDay()]}function Ae(Ie){return d[Ie.getUTCMonth()]}function Le(Ie){return i[Ie.getUTCMonth()]}function Ue(Ie){return a[+(Ie.getUTCHours()>=12)]}function Ye(Ie){return 1+~~(Ie.getUTCMonth()/3)}return{format:function(Ie){var et=B(Ie+="",I);return et.toString=function(){return Ie},et},parse:function(Ie){var et=$(Ie+="",!1);return et.toString=function(){return Ie},et},utcFormat:function(Ie){var et=B(Ie+="",F);return et.toString=function(){return Ie},et},utcParse:function(Ie){var et=$(Ie+="",!0);return et.toString=function(){return Ie},et}}}var A5e={"-":"",_:" ",0:"0"},Hd=/^\s*\d+/,xBt=/^%/,yBt=/[\\^$*+?|[\]().{}]/g;function wo(t,r,s){var n=t<0?"-":"",a=(n?-t:t)+"",o=a.length;return n+(o[r.toLowerCase(),s]))}function _Bt(t,r,s){var n=Hd.exec(r.slice(s,s+1));return n?(t.w=+n[0],s+n[0].length):-1}function bBt(t,r,s){var n=Hd.exec(r.slice(s,s+1));return n?(t.u=+n[0],s+n[0].length):-1}function wBt(t,r,s){var n=Hd.exec(r.slice(s,s+2));return n?(t.U=+n[0],s+n[0].length):-1}function jBt(t,r,s){var n=Hd.exec(r.slice(s,s+2));return n?(t.V=+n[0],s+n[0].length):-1}function kBt(t,r,s){var n=Hd.exec(r.slice(s,s+2));return n?(t.W=+n[0],s+n[0].length):-1}function E5e(t,r,s){var n=Hd.exec(r.slice(s,s+4));return n?(t.y=+n[0],s+n[0].length):-1}function I5e(t,r,s){var n=Hd.exec(r.slice(s,s+2));return n?(t.y=+n[0]+(+n[0]>68?1900:2e3),s+n[0].length):-1}function NBt(t,r,s){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(r.slice(s,s+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),s+n[0].length):-1}function SBt(t,r,s){var n=Hd.exec(r.slice(s,s+1));return n?(t.q=n[0]*3-3,s+n[0].length):-1}function CBt(t,r,s){var n=Hd.exec(r.slice(s,s+2));return n?(t.m=n[0]-1,s+n[0].length):-1}function P5e(t,r,s){var n=Hd.exec(r.slice(s,s+2));return n?(t.d=+n[0],s+n[0].length):-1}function MBt(t,r,s){var n=Hd.exec(r.slice(s,s+3));return n?(t.m=0,t.d=+n[0],s+n[0].length):-1}function L5e(t,r,s){var n=Hd.exec(r.slice(s,s+2));return n?(t.H=+n[0],s+n[0].length):-1}function TBt(t,r,s){var n=Hd.exec(r.slice(s,s+2));return n?(t.M=+n[0],s+n[0].length):-1}function ABt(t,r,s){var n=Hd.exec(r.slice(s,s+2));return n?(t.S=+n[0],s+n[0].length):-1}function EBt(t,r,s){var n=Hd.exec(r.slice(s,s+3));return n?(t.L=+n[0],s+n[0].length):-1}function IBt(t,r,s){var n=Hd.exec(r.slice(s,s+6));return n?(t.L=Math.floor(n[0]/1e3),s+n[0].length):-1}function PBt(t,r,s){var n=xBt.exec(r.slice(s,s+1));return n?s+n[0].length:-1}function LBt(t,r,s){var n=Hd.exec(r.slice(s));return n?(t.Q=+n[0],s+n[0].length):-1}function OBt(t,r,s){var n=Hd.exec(r.slice(s));return n?(t.s=+n[0],s+n[0].length):-1}function O5e(t,r){return wo(t.getDate(),r,2)}function DBt(t,r){return wo(t.getHours(),r,2)}function RBt(t,r){return wo(t.getHours()%12||12,r,2)}function FBt(t,r){return wo(1+HP.count(Vy(t),t),r,3)}function FUe(t,r){return wo(t.getMilliseconds(),r,3)}function zBt(t,r){return FUe(t,r)+"000"}function BBt(t,r){return wo(t.getMonth()+1,r,2)}function $Bt(t,r){return wo(t.getMinutes(),r,2)}function UBt(t,r){return wo(t.getSeconds(),r,2)}function qBt(t){var r=t.getDay();return r===0?7:r}function VBt(t,r){return wo(wie.count(Vy(t)-1,t),r,2)}function zUe(t){var r=t.getDay();return r>=4||r===0?o3(t):o3.ceil(t)}function HBt(t,r){return t=zUe(t),wo(o3.count(Vy(t),t)+(Vy(t).getDay()===4),r,2)}function WBt(t){return t.getDay()}function GBt(t,r){return wo(Tse.count(Vy(t)-1,t),r,2)}function KBt(t,r){return wo(t.getFullYear()%100,r,2)}function ZBt(t,r){return t=zUe(t),wo(t.getFullYear()%100,r,2)}function YBt(t,r){return wo(t.getFullYear()%1e4,r,4)}function XBt(t,r){var s=t.getDay();return t=s>=4||s===0?o3(t):o3.ceil(t),wo(t.getFullYear()%1e4,r,4)}function QBt(t){var r=t.getTimezoneOffset();return(r>0?"-":(r*=-1,"+"))+wo(r/60|0,"0",2)+wo(r%60,"0",2)}function D5e(t,r){return wo(t.getUTCDate(),r,2)}function JBt(t,r){return wo(t.getUTCHours(),r,2)}function e$t(t,r){return wo(t.getUTCHours()%12||12,r,2)}function t$t(t,r){return wo(1+bie.count(Hy(t),t),r,3)}function BUe(t,r){return wo(t.getUTCMilliseconds(),r,3)}function r$t(t,r){return BUe(t,r)+"000"}function s$t(t,r){return wo(t.getUTCMonth()+1,r,2)}function n$t(t,r){return wo(t.getUTCMinutes(),r,2)}function a$t(t,r){return wo(t.getUTCSeconds(),r,2)}function i$t(t){var r=t.getUTCDay();return r===0?7:r}function o$t(t,r){return wo(jie.count(Hy(t)-1,t),r,2)}function $Ue(t){var r=t.getUTCDay();return r>=4||r===0?l3(t):l3.ceil(t)}function l$t(t,r){return t=$Ue(t),wo(l3.count(Hy(t),t)+(Hy(t).getUTCDay()===4),r,2)}function c$t(t){return t.getUTCDay()}function d$t(t,r){return wo(Ase.count(Hy(t)-1,t),r,2)}function u$t(t,r){return wo(t.getUTCFullYear()%100,r,2)}function h$t(t,r){return t=$Ue(t),wo(t.getUTCFullYear()%100,r,2)}function m$t(t,r){return wo(t.getUTCFullYear()%1e4,r,4)}function p$t(t,r){var s=t.getUTCDay();return t=s>=4||s===0?l3(t):l3.ceil(t),wo(t.getUTCFullYear()%1e4,r,4)}function f$t(){return"+0000"}function R5e(){return"%"}function F5e(t){return+t}function z5e(t){return Math.floor(+t/1e3)}var Z4,UUe,qUe;g$t({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 g$t(t){return Z4=gBt(t),UUe=Z4.format,Z4.parse,qUe=Z4.utcFormat,Z4.utcParse,Z4}function x$t(t){return new Date(t)}function y$t(t){return t instanceof Date?+t:+new Date(+t)}function J1e(t,r,s,n,a,o,l,i,d,m){var g=z1e(),y=g.invert,v=g.domain,b=m(".%L"),N=m(":%S"),j=m("%I:%M"),S=m("%I %p"),A=m("%a %d"),M=m("%b %d"),I=m("%B"),F=m("%Y");function O(B){return(d(B)r(a/(t.length-1)))},s.quantiles=function(n){return Array.from({length:n+1},(a,o)=>o9t(t,o/n))},s.copy=function(){return GUe(r).domain(t)},Xy.apply(s,arguments)}function Nie(){var t=0,r=.5,s=1,n=1,a,o,l,i,d,m=sh,g,y=!1,v;function b(j){return isNaN(j=+j)?v:(j=.5+((j=+g(j))-o)*(n*jr}var XUe=N$t,S$t=Sie,C$t=XUe,M$t=l5;function T$t(t){return t&&t.length?S$t(t,M$t,C$t):void 0}var A$t=T$t;const Cie=oo(A$t);function E$t(t,r){return tt.e^o.s<0?1:-1;for(n=o.d.length,a=t.d.length,r=0,s=nt.d[r]^o.s<0?1:-1;return n===a?0:n>a^o.s<0?1:-1};On.decimalPlaces=On.dp=function(){var t=this,r=t.d.length-1,s=(r-t.e)*vl;if(r=t.d[r],r)for(;r%10==0;r/=10)s--;return s<0?0:s};On.dividedBy=On.div=function(t){return Sy(this,new this.constructor(t))};On.dividedToIntegerBy=On.idiv=function(t){var r=this,s=r.constructor;return Xo(Sy(r,new s(t),0,1),s.precision)};On.equals=On.eq=function(t){return!this.cmp(t)};On.exponent=function(){return nd(this)};On.greaterThan=On.gt=function(t){return this.cmp(t)>0};On.greaterThanOrEqualTo=On.gte=function(t){return this.cmp(t)>=0};On.isInteger=On.isint=function(){return this.e>this.d.length-2};On.isNegative=On.isneg=function(){return this.s<0};On.isPositive=On.ispos=function(){return this.s>0};On.isZero=function(){return this.s===0};On.lessThan=On.lt=function(t){return this.cmp(t)<0};On.lessThanOrEqualTo=On.lte=function(t){return this.cmp(t)<1};On.logarithm=On.log=function(t){var r,s=this,n=s.constructor,a=n.precision,o=a+5;if(t===void 0)t=new n(10);else if(t=new n(t),t.s<1||t.eq(fm))throw Error(Tp+"NaN");if(s.s<1)throw Error(Tp+(s.s?"NaN":"-Infinity"));return s.eq(fm)?new n(0):(Il=!1,r=Sy(TI(s,o),TI(t,o),o),Il=!0,Xo(r,a))};On.minus=On.sub=function(t){var r=this;return t=new r.constructor(t),r.s==t.s?rqe(r,t):eqe(r,(t.s=-t.s,t))};On.modulo=On.mod=function(t){var r,s=this,n=s.constructor,a=n.precision;if(t=new n(t),!t.s)throw Error(Tp+"NaN");return s.s?(Il=!1,r=Sy(s,t,0,1).times(t),Il=!0,s.minus(r)):Xo(new n(s),a)};On.naturalExponential=On.exp=function(){return tqe(this)};On.naturalLogarithm=On.ln=function(){return TI(this)};On.negated=On.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};On.plus=On.add=function(t){var r=this;return t=new r.constructor(t),r.s==t.s?eqe(r,t):rqe(r,(t.s=-t.s,t))};On.precision=On.sd=function(t){var r,s,n,a=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(ck+t);if(r=nd(a)+1,n=a.d.length-1,s=n*vl+1,n=a.d[n],n){for(;n%10==0;n/=10)s--;for(n=a.d[0];n>=10;n/=10)s++}return t&&r>s?r:s};On.squareRoot=On.sqrt=function(){var t,r,s,n,a,o,l,i=this,d=i.constructor;if(i.s<1){if(!i.s)return new d(0);throw Error(Tp+"NaN")}for(t=nd(i),Il=!1,a=Math.sqrt(+i),a==0||a==1/0?(r=Bg(i.d),(r.length+t)%2==0&&(r+="0"),a=Math.sqrt(r),t=h5((t+1)/2)-(t<0||t%2),a==1/0?r="5e"+t:(r=a.toExponential(),r=r.slice(0,r.indexOf("e")+1)+t),n=new d(r)):n=new d(a.toString()),s=d.precision,a=l=s+3;;)if(o=n,n=o.plus(Sy(i,o,l+2)).times(.5),Bg(o.d).slice(0,l)===(r=Bg(n.d)).slice(0,l)){if(r=r.slice(l-3,l+1),a==l&&r=="4999"){if(Xo(o,s+1,0),o.times(o).eq(i)){n=o;break}}else if(r!="9999")break;l+=4}return Il=!0,Xo(n,s)};On.times=On.mul=function(t){var r,s,n,a,o,l,i,d,m,g=this,y=g.constructor,v=g.d,b=(t=new y(t)).d;if(!g.s||!t.s)return new y(0);for(t.s*=g.s,s=g.e+t.e,d=v.length,m=b.length,d=0;){for(r=0,a=d+n;a>n;)i=o[a]+b[n]*v[a-n-1]+r,o[a--]=i%Pd|0,r=i/Pd|0;o[a]=(o[a]+r)%Pd|0}for(;!o[--l];)o.pop();return r?++s:o.shift(),t.d=o,t.e=s,Il?Xo(t,y.precision):t};On.toDecimalPlaces=On.todp=function(t,r){var s=this,n=s.constructor;return s=new n(s),t===void 0?s:(cx(t,0,u5),r===void 0?r=n.rounding:cx(r,0,8),Xo(s,t+nd(s)+1,r))};On.toExponential=function(t,r){var s,n=this,a=n.constructor;return t===void 0?s=Pk(n,!0):(cx(t,0,u5),r===void 0?r=a.rounding:cx(r,0,8),n=Xo(new a(n),t+1,r),s=Pk(n,!0,t+1)),s};On.toFixed=function(t,r){var s,n,a=this,o=a.constructor;return t===void 0?Pk(a):(cx(t,0,u5),r===void 0?r=o.rounding:cx(r,0,8),n=Xo(new o(a),t+nd(a)+1,r),s=Pk(n.abs(),!1,t+nd(n)+1),a.isneg()&&!a.isZero()?"-"+s:s)};On.toInteger=On.toint=function(){var t=this,r=t.constructor;return Xo(new r(t),nd(t)+1,r.rounding)};On.toNumber=function(){return+this};On.toPower=On.pow=function(t){var r,s,n,a,o,l,i=this,d=i.constructor,m=12,g=+(t=new d(t));if(!t.s)return new d(fm);if(i=new d(i),!i.s){if(t.s<1)throw Error(Tp+"Infinity");return i}if(i.eq(fm))return i;if(n=d.precision,t.eq(fm))return Xo(i,n);if(r=t.e,s=t.d.length-1,l=r>=s,o=i.s,l){if((s=g<0?-g:g)<=JUe){for(a=new d(fm),r=Math.ceil(n/vl+4),Il=!1;s%2&&(a=a.times(i),U5e(a.d,r)),s=h5(s/2),s!==0;)i=i.times(i),U5e(i.d,r);return Il=!0,t.s<0?new d(fm).div(a):Xo(a,n)}}else if(o<0)throw Error(Tp+"NaN");return o=o<0&&t.d[Math.max(r,s)]&1?-1:1,i.s=1,Il=!1,a=t.times(TI(i,n+m)),Il=!0,a=tqe(a),a.s=o,a};On.toPrecision=function(t,r){var s,n,a=this,o=a.constructor;return t===void 0?(s=nd(a),n=Pk(a,s<=o.toExpNeg||s>=o.toExpPos)):(cx(t,1,u5),r===void 0?r=o.rounding:cx(r,0,8),a=Xo(new o(a),t,r),s=nd(a),n=Pk(a,t<=s||s<=o.toExpNeg,t)),n};On.toSignificantDigits=On.tosd=function(t,r){var s=this,n=s.constructor;return t===void 0?(t=n.precision,r=n.rounding):(cx(t,1,u5),r===void 0?r=n.rounding:cx(r,0,8)),Xo(new n(s),t,r)};On.toString=On.valueOf=On.val=On.toJSON=On[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,r=nd(t),s=t.constructor;return Pk(t,r<=s.toExpNeg||r>=s.toExpPos)};function eqe(t,r){var s,n,a,o,l,i,d,m,g=t.constructor,y=g.precision;if(!t.s||!r.s)return r.s||(r=new g(t)),Il?Xo(r,y):r;if(d=t.d,m=r.d,l=t.e,a=r.e,d=d.slice(),o=l-a,o){for(o<0?(n=d,o=-o,i=m.length):(n=m,a=l,i=d.length),l=Math.ceil(y/vl),i=l>i?l+1:i+1,o>i&&(o=i,n.length=1),n.reverse();o--;)n.push(0);n.reverse()}for(i=d.length,o=m.length,i-o<0&&(o=i,n=m,m=d,d=n),s=0;o;)s=(d[--o]=d[o]+m[o]+s)/Pd|0,d[o]%=Pd;for(s&&(d.unshift(s),++a),i=d.length;d[--i]==0;)d.pop();return r.d=d,r.e=a,Il?Xo(r,y):r}function cx(t,r,s){if(t!==~~t||ts)throw Error(ck+t)}function Bg(t){var r,s,n,a=t.length-1,o="",l=t[0];if(a>0){for(o+=l,r=1;rl?1:-1;else for(i=d=0;ia[i]?1:-1;break}return d}function s(n,a,o){for(var l=0;o--;)n[o]-=l,l=n[o]1;)n.shift()}return function(n,a,o,l){var i,d,m,g,y,v,b,N,j,S,A,M,I,F,O,B,$,H,W=n.constructor,X=n.s==a.s?1:-1,se=n.d,ae=a.d;if(!n.s)return new W(n);if(!a.s)throw Error(Tp+"Division by zero");for(d=n.e-a.e,$=ae.length,O=se.length,b=new W(X),N=b.d=[],m=0;ae[m]==(se[m]||0);)++m;if(ae[m]>(se[m]||0)&&--d,o==null?M=o=W.precision:l?M=o+(nd(n)-nd(a))+1:M=o,M<0)return new W(0);if(M=M/vl+2|0,m=0,$==1)for(g=0,ae=ae[0],M++;(m1&&(ae=t(ae,g),se=t(se,g),$=ae.length,O=se.length),F=$,j=se.slice(0,$),S=j.length;S<$;)j[S++]=0;H=ae.slice(),H.unshift(0),B=ae[0],ae[1]>=Pd/2&&++B;do g=0,i=r(ae,j,$,S),i<0?(A=j[0],$!=S&&(A=A*Pd+(j[1]||0)),g=A/B|0,g>1?(g>=Pd&&(g=Pd-1),y=t(ae,g),v=y.length,S=j.length,i=r(y,j,v,S),i==1&&(g--,s(y,$16)throw Error(rve+nd(t));if(!t.s)return new g(fm);for(Il=!1,i=y,l=new g(.03125);t.abs().gte(.1);)t=t.times(l),m+=5;for(n=Math.log(rj(2,m))/Math.LN10*2+5|0,i+=n,s=a=o=new g(fm),g.precision=i;;){if(a=Xo(a.times(t),i),s=s.times(++d),l=o.plus(Sy(a,s,i)),Bg(l.d).slice(0,i)===Bg(o.d).slice(0,i)){for(;m--;)o=Xo(o.times(o),i);return g.precision=y,r==null?(Il=!0,Xo(o,y)):o}o=l}}function nd(t){for(var r=t.e*vl,s=t.d[0];s>=10;s/=10)r++;return r}function pue(t,r,s){if(r>t.LN10.sd())throw Il=!0,s&&(t.precision=s),Error(Tp+"LN10 precision limit exceeded");return Xo(new t(t.LN10),r)}function c1(t){for(var r="";t--;)r+="0";return r}function TI(t,r){var s,n,a,o,l,i,d,m,g,y=1,v=10,b=t,N=b.d,j=b.constructor,S=j.precision;if(b.s<1)throw Error(Tp+(b.s?"NaN":"-Infinity"));if(b.eq(fm))return new j(0);if(r==null?(Il=!1,m=S):m=r,b.eq(10))return r==null&&(Il=!0),pue(j,m);if(m+=v,j.precision=m,s=Bg(N),n=s.charAt(0),o=nd(b),Math.abs(o)<15e14){for(;n<7&&n!=1||n==1&&s.charAt(1)>3;)b=b.times(t),s=Bg(b.d),n=s.charAt(0),y++;o=nd(b),n>1?(b=new j("0."+s),o++):b=new j(n+"."+s.slice(1))}else return d=pue(j,m+2,S).times(o+""),b=TI(new j(n+"."+s.slice(1)),m-v).plus(d),j.precision=S,r==null?(Il=!0,Xo(b,S)):b;for(i=l=b=Sy(b.minus(fm),b.plus(fm),m),g=Xo(b.times(b),m),a=3;;){if(l=Xo(l.times(g),m),d=i.plus(Sy(l,new j(a),m)),Bg(d.d).slice(0,m)===Bg(i.d).slice(0,m))return i=i.times(2),o!==0&&(i=i.plus(pue(j,m+2,S).times(o+""))),i=Sy(i,new j(y),m),j.precision=S,r==null?(Il=!0,Xo(i,S)):i;i=d,a+=2}}function $5e(t,r){var s,n,a;for((s=r.indexOf("."))>-1&&(r=r.replace(".","")),(n=r.search(/e/i))>0?(s<0&&(s=n),s+=+r.slice(n+1),r=r.substring(0,n)):s<0&&(s=r.length),n=0;r.charCodeAt(n)===48;)++n;for(a=r.length;r.charCodeAt(a-1)===48;)--a;if(r=r.slice(n,a),r){if(a-=n,s=s-n-1,t.e=h5(s/vl),t.d=[],n=(s+1)%vl,s<0&&(n+=vl),nEse||t.e<-Ese))throw Error(rve+s)}else t.s=0,t.e=0,t.d=[0];return t}function Xo(t,r,s){var n,a,o,l,i,d,m,g,y=t.d;for(l=1,o=y[0];o>=10;o/=10)l++;if(n=r-l,n<0)n+=vl,a=r,m=y[g=0];else{if(g=Math.ceil((n+1)/vl),o=y.length,g>=o)return t;for(m=o=y[g],l=1;o>=10;o/=10)l++;n%=vl,a=n-vl+l}if(s!==void 0&&(o=rj(10,l-a-1),i=m/o%10|0,d=r<0||y[g+1]!==void 0||m%o,d=s<4?(i||d)&&(s==0||s==(t.s<0?3:2)):i>5||i==5&&(s==4||d||s==6&&(n>0?a>0?m/rj(10,l-a):0:y[g-1])%10&1||s==(t.s<0?8:7))),r<1||!y[0])return d?(o=nd(t),y.length=1,r=r-o-1,y[0]=rj(10,(vl-r%vl)%vl),t.e=h5(-r/vl)||0):(y.length=1,y[0]=t.e=t.s=0),t;if(n==0?(y.length=g,o=1,g--):(y.length=g+1,o=rj(10,vl-n),y[g]=a>0?(m/rj(10,l-a)%rj(10,a)|0)*o:0),d)for(;;)if(g==0){(y[0]+=o)==Pd&&(y[0]=1,++t.e);break}else{if(y[g]+=o,y[g]!=Pd)break;y[g--]=0,o=1}for(n=y.length;y[--n]===0;)y.pop();if(Il&&(t.e>Ese||t.e<-Ese))throw Error(rve+nd(t));return t}function rqe(t,r){var s,n,a,o,l,i,d,m,g,y,v=t.constructor,b=v.precision;if(!t.s||!r.s)return r.s?r.s=-r.s:r=new v(t),Il?Xo(r,b):r;if(d=t.d,y=r.d,n=r.e,m=t.e,d=d.slice(),l=m-n,l){for(g=l<0,g?(s=d,l=-l,i=y.length):(s=y,n=m,i=d.length),a=Math.max(Math.ceil(b/vl),i)+2,l>a&&(l=a,s.length=1),s.reverse(),a=l;a--;)s.push(0);s.reverse()}else{for(a=d.length,i=y.length,g=a0;--a)d[i++]=0;for(a=y.length;a>l;){if(d[--a]0?o=o.charAt(0)+"."+o.slice(1)+c1(n):l>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(a<0?"e":"e+")+a):a<0?(o="0."+c1(-a-1)+o,s&&(n=s-l)>0&&(o+=c1(n))):a>=l?(o+=c1(a+1-l),s&&(n=s-a-1)>0&&(o=o+"."+c1(n))):((n=a+1)0&&(a+1===l&&(o+="."),o+=c1(n))),t.s<0?"-"+o:o}function U5e(t,r){if(t.length>r)return t.length=r,!0}function sqe(t){var r,s,n;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(ck+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 $5e(l,o.toString())}else if(typeof o!="string")throw Error(ck+o);if(o.charCodeAt(0)===45?(o=o.slice(1),l.s=-1):l.s=1,Q$t.test(o))$5e(l,o);else throw Error(ck+o)}if(a.prototype=On,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=sqe,a.config=a.set=J$t,t===void 0&&(t={}),t)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],r=0;r=a[r+1]&&n<=a[r+2])this[s]=n;else throw Error(ck+s+": "+n);if((n=t[s="LN10"])!==void 0)if(n==Math.LN10)this[s]=new this(n);else throw Error(ck+s+": "+n);return this}var sve=sqe(X$t);fm=new sve(1);const Wo=sve;function eUt(t){return nUt(t)||sUt(t)||rUt(t)||tUt()}function tUt(){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 rUt(t,r){if(t){if(typeof t=="string")return hfe(t,r);var s=Object.prototype.toString.call(t).slice(8,-1);if(s==="Object"&&t.constructor&&(s=t.constructor.name),s==="Map"||s==="Set")return Array.from(t);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return hfe(t,r)}}function sUt(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function nUt(t){if(Array.isArray(t))return hfe(t)}function hfe(t,r){(r==null||r>t.length)&&(r=t.length);for(var s=0,n=new Array(r);s=r?s.apply(void 0,a):t(r-l,q5e(function(){for(var i=arguments.length,d=new Array(i),m=0;mt.length)&&(r=t.length);for(var s=0,n=new Array(r);s"u"||!(Symbol.iterator in Object(t)))){var s=[],n=!0,a=!1,o=void 0;try{for(var l=t[Symbol.iterator](),i;!(n=(i=l.next()).done)&&(s.push(i.value),!(r&&s.length===r));n=!0);}catch(d){a=!0,o=d}finally{try{!n&&l.return!=null&&l.return()}finally{if(a)throw o}}return s}}function vUt(t){if(Array.isArray(t))return t}function lqe(t){var r=AI(t,2),s=r[0],n=r[1],a=s,o=n;return s>n&&(a=n,o=s),[a,o]}function cqe(t,r,s){if(t.lte(0))return new Wo(0);var n=Eie.getDigitCount(t.toNumber()),a=new Wo(10).pow(n),o=t.div(a),l=n!==1?.05:.1,i=new Wo(Math.ceil(o.div(l).toNumber())).add(s).mul(l),d=i.mul(a);return r?d:new Wo(Math.ceil(d))}function _Ut(t,r,s){var n=1,a=new Wo(t);if(!a.isint()&&s){var o=Math.abs(t);o<1?(n=new Wo(10).pow(Eie.getDigitCount(t)-1),a=new Wo(Math.floor(a.div(n).toNumber())).mul(n)):o>1&&(a=new Wo(Math.floor(t)))}else t===0?a=new Wo(Math.floor((r-1)/2)):s||(a=new Wo(Math.floor(t)));var l=Math.floor((r-1)/2),i=lUt(oUt(function(d){return a.add(new Wo(d-l).mul(n)).toNumber()}),mfe);return i(0,r)}function dqe(t,r,s,n){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((r-t)/(s-1)))return{step:new Wo(0),tickMin:new Wo(0),tickMax:new Wo(0)};var o=cqe(new Wo(r).sub(t).div(s-1),n,a),l;t<=0&&r>=0?l=new Wo(0):(l=new Wo(t).add(r).div(2),l=l.sub(new Wo(l).mod(o)));var i=Math.ceil(l.sub(t).div(o).toNumber()),d=Math.ceil(new Wo(r).sub(l).div(o).toNumber()),m=i+d+1;return m>s?dqe(t,r,s,n,a+1):(m0?d+(s-m):d,i=r>0?i:i+(s-m)),{step:o,tickMin:l.sub(new Wo(i).mul(o)),tickMax:l.add(new Wo(d).mul(o))})}function bUt(t){var r=AI(t,2),s=r[0],n=r[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=lqe([s,n]),d=AI(i,2),m=d[0],g=d[1];if(m===-1/0||g===1/0){var y=g===1/0?[m].concat(ffe(mfe(0,a-1).map(function(){return 1/0}))):[].concat(ffe(mfe(0,a-1).map(function(){return-1/0})),[g]);return s>n?pfe(y):y}if(m===g)return _Ut(m,a,o);var v=dqe(m,g,l,o),b=v.step,N=v.tickMin,j=v.tickMax,S=Eie.rangeStep(N,j.add(new Wo(.1).mul(b)),b);return s>n?pfe(S):S}function wUt(t,r){var s=AI(t,2),n=s[0],a=s[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=lqe([n,a]),i=AI(l,2),d=i[0],m=i[1];if(d===-1/0||m===1/0)return[n,a];if(d===m)return[d];var g=Math.max(r,2),y=cqe(new Wo(m).sub(d).div(g-1),o,0),v=[].concat(ffe(Eie.rangeStep(new Wo(d),new Wo(m).sub(new Wo(.99).mul(y)),y)),[m]);return n>a?pfe(v):v}var jUt=iqe(bUt),kUt=iqe(wUt),NUt="Invariant failed";function Lk(t,r){throw new Error(NUt)}var SUt=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function c3(t){"@babel/helpers - typeof";return c3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},c3(t)}function Ise(){return Ise=Object.assign?Object.assign.bind():function(t){for(var r=1;rt.length)&&(r=t.length);for(var s=0,n=new Array(r);s=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function PUt(t,r){if(t==null)return{};var s={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(r.indexOf(n)>=0)continue;s[n]=t[n]}return s}function LUt(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function OUt(t,r){for(var s=0;st.length)&&(r=t.length);for(var s=0,n=new Array(r);s1&&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=(s=n==null?void 0:n.length)!==null&&s!==void 0?s: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 d=o.range,m=0;m0?a[m-1].coordinate:a[i-1].coordinate,y=a[m].coordinate,v=m>=i-1?a[0].coordinate:a[m+1].coordinate,b=void 0;if(th(y-g)!==th(v-y)){var N=[];if(th(v-y)===th(d[1]-d[0])){b=v;var j=y+d[1]-d[0];N[0]=Math.min(j,(j+g)/2),N[1]=Math.max(j,(j+g)/2)}else{b=g;var S=v+d[1]-d[0];N[0]=Math.min(y,(S+y)/2),N[1]=Math.max(y,(S+y)/2)}var A=[Math.min(y,(b+y)/2),Math.max(y,(b+y)/2)];if(r>A[0]&&r<=A[1]||r>=N[0]&&r<=N[1]){l=a[m].index;break}}else{var M=Math.min(g,v),I=Math.max(g,v);if(r>(M+y)/2&&r<=(I+y)/2){l=a[m].index;break}}}else for(var F=0;F0&&F(n[F].coordinate+n[F-1].coordinate)/2&&r<=(n[F].coordinate+n[F+1].coordinate)/2||F===i-1&&r>(n[F].coordinate+n[F-1].coordinate)/2){l=n[F].index;break}return l},nve=function(r){var s,n=r,a=n.type.displayName,o=(s=r.type)!==null&&s!==void 0&&s.defaultProps?nc(nc({},r.type.defaultProps),r.props):r.props,l=o.stroke,i=o.fill,d;switch(a){case"Line":d=l;break;case"Area":case"Radar":d=l&&l!=="none"?l:i;break;default:d=i;break}return d},QUt=function(r){var s=r.barSize,n=r.totalSize,a=r.stackGroups,o=a===void 0?{}:a;if(!o)return{};for(var l={},i=Object.keys(o),d=0,m=i.length;d=0});if(A&&A.length){var M=A[0].type.defaultProps,I=M!==void 0?nc(nc({},M),A[0].props):A[0].props,F=I.barSize,O=I[S];l[O]||(l[O]=[]);var B=Ri(F)?s:F;l[O].push({item:A[0],stackList:A.slice(1),barSize:Ri(B)?void 0:rh(B,n,0)})}}return l},JUt=function(r){var s=r.barGap,n=r.barCategoryGap,a=r.bandSize,o=r.sizeList,l=o===void 0?[]:o,i=r.maxBarSize,d=l.length;if(d<1)return null;var m=rh(s,a,0,!0),g,y=[];if(l[0].barSize===+l[0].barSize){var v=!1,b=a/d,N=l.reduce(function(F,O){return F+O.barSize||0},0);N+=(d-1)*m,N>=a&&(N-=(d-1)*m,m=0),N>=a&&b>0&&(v=!0,b*=.9,N=d*b);var j=(a-N)/2>>0,S={offset:j-m,size:0};g=l.reduce(function(F,O){var B={item:O.item,position:{offset:S.offset+S.size+m,size:v?b:O.barSize}},$=[].concat(W5e(F),[B]);return S=$[$.length-1].position,O.stackList&&O.stackList.length&&O.stackList.forEach(function(H){$.push({item:H,position:S})}),$},y)}else{var A=rh(n,a,0,!0);a-2*A-(d-1)*m<=0&&(m=0);var M=(a-2*A-(d-1)*m)/d;M>1&&(M>>=0);var I=i===+i?Math.min(M,i):M;g=l.reduce(function(F,O,B){var $=[].concat(W5e(F),[{item:O.item,position:{offset:A+(M+m)*B+(M-I)/2,size:I}}]);return O.stackList&&O.stackList.length&&O.stackList.forEach(function(H){$.push({item:H,position:$[$.length-1].position})}),$},y)}return g},eqt=function(r,s,n,a){var o=n.children,l=n.width,i=n.margin,d=l-(i.left||0)-(i.right||0),m=pqe({children:o,legendWidth:d});if(m){var g=a||{},y=g.width,v=g.height,b=m.align,N=m.verticalAlign,j=m.layout;if((j==="vertical"||j==="horizontal"&&N==="middle")&&b!=="center"&&Us(r[b]))return nc(nc({},r),{},fC({},b,r[b]+(y||0)));if((j==="horizontal"||j==="vertical"&&b==="center")&&N!=="middle"&&Us(r[N]))return nc(nc({},r),{},fC({},N,r[N]+(v||0)))}return r},tqt=function(r,s,n){return Ri(s)?!0:r==="horizontal"?s==="yAxis":r==="vertical"||n==="x"?s==="xAxis":n==="y"?s==="yAxis":!0},fqe=function(r,s,n,a,o){var l=s.props.children,i=Sp(l,Iie).filter(function(m){return tqt(a,o,m.props.direction)});if(i&&i.length){var d=i.map(function(m){return m.props.dataKey});return r.reduce(function(m,g){var y=bu(g,n);if(Ri(y))return m;var v=Array.isArray(y)?[Mie(y),Cie(y)]:[y,y],b=d.reduce(function(N,j){var S=bu(g,j,0),A=v[0]-Math.abs(Array.isArray(S)?S[0]:S),M=v[1]+Math.abs(Array.isArray(S)?S[1]:S);return[Math.min(A,N[0]),Math.max(M,N[1])]},[1/0,-1/0]);return[Math.min(b[0],m[0]),Math.max(b[1],m[1])]},[1/0,-1/0])}return null},rqt=function(r,s,n,a,o){var l=s.map(function(i){return fqe(r,i,n,o,a)}).filter(function(i){return!Ri(i)});return l&&l.length?l.reduce(function(i,d){return[Math.min(i[0],d[0]),Math.max(i[1],d[1])]},[1/0,-1/0]):null},gqe=function(r,s,n,a,o){var l=s.map(function(d){var m=d.props.dataKey;return n==="number"&&m&&fqe(r,d,m,a)||xE(r,m,n,o)});if(n==="number")return l.reduce(function(d,m){return[Math.min(d[0],m[0]),Math.max(d[1],m[1])]},[1/0,-1/0]);var i={};return l.reduce(function(d,m){for(var g=0,y=m.length;g=2?th(i[0]-i[1])*2*m:m,s&&(r.ticks||r.niceTicks)){var g=(r.ticks||r.niceTicks).map(function(y){var v=o?o.indexOf(y):y;return{coordinate:a(v)+m,value:y,offset:m}});return g.filter(function(y){return!zP(y.coordinate)})}return r.isCategorical&&r.categoricalDomain?r.categoricalDomain.map(function(y,v){return{coordinate:a(y)+m,value:y,index:v,offset:m}}):a.ticks&&!n?a.ticks(r.tickCount).map(function(y){return{coordinate:a(y)+m,value:y,offset:m}}):a.domain().map(function(y,v){return{coordinate:a(y)+m,value:o?o[y]:y,index:v,offset:m}})},fue=new WeakMap,Q8=function(r,s){if(typeof s!="function")return r;fue.has(r)||fue.set(r,new WeakMap);var n=fue.get(r);if(n.has(s))return n.get(s);var a=function(){r.apply(void 0,arguments),s.apply(void 0,arguments)};return n.set(s,a),a},vqe=function(r,s,n){var a=r.scale,o=r.type,l=r.layout,i=r.axisType;if(a==="auto")return l==="radial"&&i==="radiusAxis"?{scale:kI(),realScaleType:"band"}:l==="radial"&&i==="angleAxis"?{scale:Cse(),realScaleType:"linear"}:o==="category"&&s&&(s.indexOf("LineChart")>=0||s.indexOf("AreaChart")>=0||s.indexOf("ComposedChart")>=0&&!n)?{scale:gE(),realScaleType:"point"}:o==="category"?{scale:kI(),realScaleType:"band"}:{scale:Cse(),realScaleType:"linear"};if(Ak(a)){var d="scale".concat(hie(a));return{scale:(B5e[d]||gE)(),realScaleType:B5e[d]?d:"point"}}return Ja(a)?{scale:a}:{scale:gE(),realScaleType:"point"}},K5e=1e-4,_qe=function(r){var s=r.domain();if(!(!s||s.length<=2)){var n=s.length,a=r.range(),o=Math.min(a[0],a[1])-K5e,l=Math.max(a[0],a[1])+K5e,i=r(s[0]),d=r(s[n-1]);(il||dl)&&r.domain([s[0],s[n-1]])}},sqt=function(r,s){if(!r)return null;for(var n=0,a=r.length;na)&&(o[1]=a),o[0]>a&&(o[0]=a),o[1]=0?(r[i][n][0]=o,r[i][n][1]=o+d,o=r[i][n][1]):(r[i][n][0]=l,r[i][n][1]=l+d,l=r[i][n][1])}},iqt=function(r){var s=r.length;if(!(s<=0))for(var n=0,a=r[0].length;n=0?(r[l][n][0]=o,r[l][n][1]=o+i,o=r[l][n][1]):(r[l][n][0]=0,r[l][n][1]=0)}},oqt={sign:aqt,expand:SPt,none:t3,silhouette:CPt,wiggle:MPt,positive:iqt},lqt=function(r,s,n){var a=s.map(function(i){return i.props.dataKey}),o=oqt[n],l=NPt().keys(a).value(function(i,d){return+bu(i,d,0)}).order(Upe).offset(o);return l(r)},cqt=function(r,s,n,a,o,l){if(!r)return null;var i=l?s.reverse():s,d={},m=i.reduce(function(y,v){var b,N=(b=v.type)!==null&&b!==void 0&&b.defaultProps?nc(nc({},v.type.defaultProps),v.props):v.props,j=N.stackId,S=N.hide;if(S)return y;var A=N[n],M=y[A]||{hasStack:!1,stackGroups:{}};if(xd(j)){var I=M.stackGroups[j]||{numericAxisId:n,cateAxisId:a,items:[]};I.items.push(v),M.hasStack=!0,M.stackGroups[j]=I}else M.stackGroups[BP("_stackId_")]={numericAxisId:n,cateAxisId:a,items:[v]};return nc(nc({},y),{},fC({},A,M))},d),g={};return Object.keys(m).reduce(function(y,v){var b=m[v];if(b.hasStack){var N={};b.stackGroups=Object.keys(b.stackGroups).reduce(function(j,S){var A=b.stackGroups[S];return nc(nc({},j),{},fC({},S,{numericAxisId:n,cateAxisId:a,items:A.items,stackedData:lqt(r,A.items,o)}))},N)}return nc(nc({},y),{},fC({},v,b))},g)},bqe=function(r,s){var n=s.realScaleType,a=s.type,o=s.tickCount,l=s.originalDomain,i=s.allowDecimals,d=n||s.scale;if(d!=="auto"&&d!=="linear")return null;if(o&&a==="number"&&l&&(l[0]==="auto"||l[1]==="auto")){var m=r.domain();if(!m.length)return null;var g=jUt(m,o,i);return r.domain([Mie(g),Cie(g)]),{niceTicks:g}}if(o&&a==="number"){var y=r.domain(),v=kUt(y,o,i);return{niceTicks:v}}return null},Z5e=function(r){var s=r.axis,n=r.ticks,a=r.offset,o=r.bandSize,l=r.entry,i=r.index;if(s.type==="category")return n[i]?n[i].coordinate+a:null;var d=bu(l,s.dataKey,s.domain[i]);return Ri(d)?null:s.scale(d)-o/2+a},dqt=function(r){var s=r.numericAxis,n=s.scale.domain();if(s.type==="number"){var a=Math.min(n[0],n[1]),o=Math.max(n[0],n[1]);return a<=0&&o>=0?0:o<0?o:a}return n[0]},uqt=function(r,s){var n,a=(n=r.type)!==null&&n!==void 0&&n.defaultProps?nc(nc({},r.type.defaultProps),r.props):r.props,o=a.stackId;if(xd(o)){var l=s[o];if(l){var i=l.items.indexOf(r);return i>=0?l.stackedData[i]:null}}return null},hqt=function(r){return r.reduce(function(s,n){return[Mie(n.concat([s[0]]).filter(Us)),Cie(n.concat([s[1]]).filter(Us))]},[1/0,-1/0])},wqe=function(r,s,n){return Object.keys(r).reduce(function(a,o){var l=r[o],i=l.stackedData,d=i.reduce(function(m,g){var y=hqt(g.slice(s,n+1));return[Math.min(m[0],y[0]),Math.max(m[1],y[1])]},[1/0,-1/0]);return[Math.min(d[0],a[0]),Math.max(d[1],a[1])]},[1/0,-1/0]).map(function(a){return a===1/0||a===-1/0?0:a})},Y5e=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,X5e=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,vfe=function(r,s,n){if(Ja(r))return r(s,n);if(!Array.isArray(r))return s;var a=[];if(Us(r[0]))a[0]=n?r[0]:Math.min(r[0],s[0]);else if(Y5e.test(r[0])){var o=+Y5e.exec(r[0])[1];a[0]=s[0]-o}else Ja(r[0])?a[0]=r[0](s[0]):a[0]=s[0];if(Us(r[1]))a[1]=n?r[1]:Math.max(r[1],s[1]);else if(X5e.test(r[1])){var l=+X5e.exec(r[1])[1];a[1]=s[1]+l}else Ja(r[1])?a[1]=r[1](s[1]):a[1]=s[1];return a},Lse=function(r,s,n){if(r&&r.scale&&r.scale.bandwidth){var a=r.scale.bandwidth();if(!n||a>0)return a}if(r&&s&&s.length>=2){for(var o=I1e(s,function(y){return y.coordinate}),l=1/0,i=1,d=o.length;it.length)&&(r=t.length);for(var s=0,n=new Array(r);s2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(r-(n.left||0)-(n.right||0)),Math.abs(s-(n.top||0)-(n.bottom||0)))/2},bqt=function(r,s,n,a,o){var l=r.width,i=r.height,d=r.startAngle,m=r.endAngle,g=rh(r.cx,l,l/2),y=rh(r.cy,i,i/2),v=Nqe(l,i,n),b=rh(r.innerRadius,v,0),N=rh(r.outerRadius,v,v*.8),j=Object.keys(s);return j.reduce(function(S,A){var M=s[A],I=M.domain,F=M.reversed,O;if(Ri(M.range))a==="angleAxis"?O=[d,m]:a==="radiusAxis"&&(O=[b,N]),F&&(O=[O[1],O[0]]);else{O=M.range;var B=O,$=fqt(B,2);d=$[0],m=$[1]}var H=vqe(M,o),W=H.realScaleType,X=H.scale;X.domain(I).range(O),_qe(X);var se=bqe(X,Qx(Qx({},M),{},{realScaleType:W})),ae=Qx(Qx(Qx({},M),se),{},{range:O,radius:N,realScaleType:W,scale:X,cx:g,cy:y,innerRadius:b,outerRadius:N,startAngle:d,endAngle:m});return Qx(Qx({},S),{},kqe({},A,ae))},{})},wqt=function(r,s){var n=r.x,a=r.y,o=s.x,l=s.y;return Math.sqrt(Math.pow(n-o,2)+Math.pow(a-l,2))},jqt=function(r,s){var n=r.x,a=r.y,o=s.cx,l=s.cy,i=wqt({x:n,y:a},{x:o,y:l});if(i<=0)return{radius:i};var d=(n-o)/i,m=Math.acos(d);return a>l&&(m=2*Math.PI-m),{radius:i,angle:_qt(m),angleInRadian:m}},kqt=function(r){var s=r.startAngle,n=r.endAngle,a=Math.floor(s/360),o=Math.floor(n/360),l=Math.min(a,o);return{startAngle:s-l*360,endAngle:n-l*360}},Nqt=function(r,s){var n=s.startAngle,a=s.endAngle,o=Math.floor(n/360),l=Math.floor(a/360),i=Math.min(o,l);return r+i*360},tMe=function(r,s){var n=r.x,a=r.y,o=jqt({x:n,y:a},s),l=o.radius,i=o.angle,d=s.innerRadius,m=s.outerRadius;if(lm)return!1;if(l===0)return!0;var g=kqt(s),y=g.startAngle,v=g.endAngle,b=i,N;if(y<=v){for(;b>v;)b-=360;for(;b=y&&b<=v}else{for(;b>y;)b-=360;for(;b=v&&b<=y}return N?Qx(Qx({},s),{},{radius:l,angle:Nqt(b,s)}):null},Sqe=function(r){return!E.isValidElement(r)&&!Ja(r)&&typeof r!="boolean"?r.className:""};function LI(t){"@babel/helpers - typeof";return LI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},LI(t)}var Sqt=["offset"];function Cqt(t){return Eqt(t)||Aqt(t)||Tqt(t)||Mqt()}function Mqt(){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 Tqt(t,r){if(t){if(typeof t=="string")return _fe(t,r);var s=Object.prototype.toString.call(t).slice(8,-1);if(s==="Object"&&t.constructor&&(s=t.constructor.name),s==="Map"||s==="Set")return Array.from(t);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return _fe(t,r)}}function Aqt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Eqt(t){if(Array.isArray(t))return _fe(t)}function _fe(t,r){(r==null||r>t.length)&&(r=t.length);for(var s=0,n=new Array(r);s=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function Pqt(t,r){if(t==null)return{};var s={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(r.indexOf(n)>=0)continue;s[n]=t[n]}return s}function rMe(t,r){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),s.push.apply(s,n)}return s}function cd(t){for(var r=1;r=0?1:-1,I,F;a==="insideStart"?(I=b+M*l,F=j):a==="insideEnd"?(I=N-M*l,F=!j):a==="end"&&(I=N+M*l,F=j),F=A<=0?F:!F;var O=cl(m,g,S,I),B=cl(m,g,S,I+(F?1:-1)*359),$="M".concat(O.x,",").concat(O.y,` A`).concat(S,",").concat(S,",0,1,").concat(F?0:1,`, `).concat(B.x,",").concat(B.y),H=Ri(r.id)?BP("recharts-radial-line-"):r.id;return lt.createElement("text",OI({},n,{dominantBaseline:"central",className:vi("recharts-radial-bar-label",i)}),lt.createElement("defs",null,lt.createElement("path",{id:H,d:$})),lt.createElement("textPath",{xlinkHref:"#".concat(H)},s))},Bqt=function(r){var s=r.viewBox,n=r.offset,a=r.position,o=s,l=o.cx,i=o.cy,d=o.innerRadius,m=o.outerRadius,g=o.startAngle,y=o.endAngle,v=(g+y)/2;if(a==="outside"){var b=cl(l,i,m+n,v),N=b.x,j=b.y;return{x:N,y:j,textAnchor:N>=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 S=(d+m)/2,A=cl(l,i,S,v),M=A.x,I=A.y;return{x:M,y:I,textAnchor:"middle",verticalAnchor:"middle"}},$qt=function(r){var s=r.viewBox,n=r.parentViewBox,a=r.offset,o=r.position,l=s,i=l.x,d=l.y,m=l.width,g=l.height,y=g>=0?1:-1,v=y*a,b=y>0?"end":"start",N=y>0?"start":"end",j=m>=0?1:-1,S=j*a,A=j>0?"end":"start",M=j>0?"start":"end";if(o==="top"){var I={x:i+m/2,y:d-y*a,textAnchor:"middle",verticalAnchor:b};return cd(cd({},I),n?{height:Math.max(d-n.y,0),width:m}:{})}if(o==="bottom"){var F={x:i+m/2,y:d+g+v,textAnchor:"middle",verticalAnchor:N};return cd(cd({},F),n?{height:Math.max(n.y+n.height-(d+g),0),width:m}:{})}if(o==="left"){var O={x:i-S,y:d+g/2,textAnchor:A,verticalAnchor:"middle"};return cd(cd({},O),n?{width:Math.max(O.x-n.x,0),height:g}:{})}if(o==="right"){var B={x:i+m+S,y:d+g/2,textAnchor:M,verticalAnchor:"middle"};return cd(cd({},B),n?{width:Math.max(n.x+n.width-B.x,0),height:g}:{})}var $=n?{width:m,height:g}:{};return o==="insideLeft"?cd({x:i+S,y:d+g/2,textAnchor:M,verticalAnchor:"middle"},$):o==="insideRight"?cd({x:i+m-S,y:d+g/2,textAnchor:A,verticalAnchor:"middle"},$):o==="insideTop"?cd({x:i+m/2,y:d+v,textAnchor:"middle",verticalAnchor:N},$):o==="insideBottom"?cd({x:i+m/2,y:d+g-v,textAnchor:"middle",verticalAnchor:b},$):o==="insideTopLeft"?cd({x:i+S,y:d+v,textAnchor:M,verticalAnchor:N},$):o==="insideTopRight"?cd({x:i+m-S,y:d+v,textAnchor:A,verticalAnchor:N},$):o==="insideBottomLeft"?cd({x:i+S,y:d+g-v,textAnchor:M,verticalAnchor:b},$):o==="insideBottomRight"?cd({x:i+m-S,y:d+g-v,textAnchor:A,verticalAnchor:b},$):r5(o)&&(Us(o.x)||yj(o.x))&&(Us(o.y)||yj(o.y))?cd({x:i+rh(o.x,m),y:d+rh(o.y,g),textAnchor:"end",verticalAnchor:"end"},$):cd({x:i+m/2,y:d+g/2,textAnchor:"middle",verticalAnchor:"middle"},$)},Uqt=function(r){return"cx"in r&&Us(r.cx)};function Fd(t){var r=t.offset,s=r===void 0?5:r,n=Iqt(t,Sqt),a=cd({offset:s},n),o=a.viewBox,l=a.position,i=a.value,d=a.children,m=a.content,g=a.className,y=g===void 0?"":g,v=a.textBreakAll;if(!o||Ri(i)&&Ri(d)&&!E.isValidElement(m)&&!Ja(m))return null;if(E.isValidElement(m))return E.cloneElement(m,a);var b;if(Ja(m)){if(b=E.createElement(m,a),E.isValidElement(b))return b}else b=Rqt(a);var N=Uqt(o),j=Ga(a,!0);if(N&&(l==="insideStart"||l==="insideEnd"||l==="end"))return zqt(a,b,j);var S=N?Bqt(a):$qt(a);return lt.createElement(Ik,OI({className:vi("recharts-label",y)},j,S,{breakAll:v}),b)}Fd.displayName="Label";var Cqe=function(r){var s=r.cx,n=r.cy,a=r.angle,o=r.startAngle,l=r.endAngle,i=r.r,d=r.radius,m=r.innerRadius,g=r.outerRadius,y=r.x,v=r.y,b=r.top,N=r.left,j=r.width,S=r.height,A=r.clockWise,M=r.labelViewBox;if(M)return M;if(Us(j)&&Us(S)){if(Us(y)&&Us(v))return{x:y,y:v,width:j,height:S};if(Us(b)&&Us(N))return{x:b,y:N,width:j,height:S}}return Us(y)&&Us(v)?{x:y,y:v,width:0,height:0}:Us(s)&&Us(n)?{cx:s,cy:n,startAngle:o||a||0,endAngle:l||a||0,innerRadius:m||0,outerRadius:g||d||i||0,clockWise:A}:r.viewBox?r.viewBox:{}},qqt=function(r,s){return r?r===!0?lt.createElement(Fd,{key:"label-implicit",viewBox:s}):xd(r)?lt.createElement(Fd,{key:"label-implicit",viewBox:s,value:r}):E.isValidElement(r)?r.type===Fd?E.cloneElement(r,{key:"label-implicit",viewBox:s}):lt.createElement(Fd,{key:"label-implicit",content:r,viewBox:s}):Ja(r)?lt.createElement(Fd,{key:"label-implicit",content:r,viewBox:s}):r5(r)?lt.createElement(Fd,OI({viewBox:s},r,{key:"label-implicit"})):null:null},Vqt=function(r,s){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!r||!r.children&&n&&!r.label)return null;var a=r.children,o=Cqe(r),l=Sp(a,Fd).map(function(d,m){return E.cloneElement(d,{viewBox:s||o,key:"label-".concat(m)})});if(!n)return l;var i=qqt(r.label,s||o);return[i].concat(Cqt(l))};Fd.parseViewBox=Cqe;Fd.renderCallByParent=Vqt;function Hqt(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}var Wqt=Hqt;const Gqt=oo(Wqt);function DI(t){"@babel/helpers - typeof";return DI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},DI(t)}var Kqt=["valueAccessor"],Zqt=["data","dataKey","clockWise","id","textBreakAll"];function Yqt(t){return eVt(t)||Jqt(t)||Qqt(t)||Xqt()}function Xqt(){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 Qqt(t,r){if(t){if(typeof t=="string")return bfe(t,r);var s=Object.prototype.toString.call(t).slice(8,-1);if(s==="Object"&&t.constructor&&(s=t.constructor.name),s==="Map"||s==="Set")return Array.from(t);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return bfe(t,r)}}function Jqt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function eVt(t){if(Array.isArray(t))return bfe(t)}function bfe(t,r){(r==null||r>t.length)&&(r=t.length);for(var s=0,n=new Array(r);s=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function nVt(t,r){if(t==null)return{};var s={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(r.indexOf(n)>=0)continue;s[n]=t[n]}return s}var aVt=function(r){return Array.isArray(r.value)?Gqt(r.value):r.value};function hv(t){var r=t.valueAccessor,s=r===void 0?aVt:r,n=aMe(t,Kqt),a=n.data,o=n.dataKey,l=n.clockWise,i=n.id,d=n.textBreakAll,m=aMe(n,Zqt);return!a||!a.length?null:lt.createElement(Fo,{className:"recharts-label-list"},a.map(function(g,y){var v=Ri(o)?s(g,y):bu(g&&g.payload,o),b=Ri(i)?{}:{id:"".concat(i,"-").concat(y)};return lt.createElement(Fd,Dse({},Ga(g,!0),m,b,{parentViewBox:g.parentViewBox,value:v,textBreakAll:d,viewBox:Fd.parseViewBox(Ri(l)?g:nMe(nMe({},g),{},{clockWise:l})),key:"label-".concat(y),index:y}))}))}hv.displayName="LabelList";function iVt(t,r){return t?t===!0?lt.createElement(hv,{key:"labelList-implicit",data:r}):lt.isValidElement(t)||Ja(t)?lt.createElement(hv,{key:"labelList-implicit",data:r,content:t}):r5(t)?lt.createElement(hv,Dse({data:r},t,{key:"labelList-implicit"})):null:null}function oVt(t,r){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&s&&!t.label)return null;var n=t.children,a=Sp(n,hv).map(function(l,i){return E.cloneElement(l,{data:r,key:"labelList-".concat(i)})});if(!s)return a;var o=iVt(t.label,r);return[o].concat(Yqt(a))}hv.renderCallByParent=oVt;function RI(t){"@babel/helpers - typeof";return RI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},RI(t)}function wfe(){return wfe=Object.assign?Object.assign.bind():function(t){for(var r=1;r180),",").concat(+(l>m),`, `).concat(y.x,",").concat(y.y,` `);if(a>0){var b=cl(s,n,a,l),N=cl(s,n,a,m);v+="L ".concat(N.x,",").concat(N.y,` A `).concat(a,",").concat(a,`,0, `).concat(+(Math.abs(d)>180),",").concat(+(l<=m),`, `).concat(b.x,",").concat(b.y," Z")}else v+="L ".concat(s,",").concat(n," Z");return v},hVt=function(r){var s=r.cx,n=r.cy,a=r.innerRadius,o=r.outerRadius,l=r.cornerRadius,i=r.forceCornerRadius,d=r.cornerIsExternal,m=r.startAngle,g=r.endAngle,y=th(g-m),v=J8({cx:s,cy:n,radius:o,angle:m,sign:y,cornerRadius:l,cornerIsExternal:d}),b=v.circleTangency,N=v.lineTangency,j=v.theta,S=J8({cx:s,cy:n,radius:o,angle:g,sign:-y,cornerRadius:l,cornerIsExternal:d}),A=S.circleTangency,M=S.lineTangency,I=S.theta,F=d?Math.abs(m-g):Math.abs(m-g)-j-I;if(F<0)return i?"M ".concat(N.x,",").concat(N.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 `):Mqe({cx:s,cy:n,innerRadius:a,outerRadius:o,startAngle:m,endAngle:g});var O="M ".concat(N.x,",").concat(N.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(b.x,",").concat(b.y,` A`).concat(o,",").concat(o,",0,").concat(+(F>180),",").concat(+(y<0),",").concat(A.x,",").concat(A.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(M.x,",").concat(M.y,` `);if(a>0){var B=J8({cx:s,cy:n,radius:a,angle:m,sign:y,isExternal:!0,cornerRadius:l,cornerIsExternal:d}),$=B.circleTangency,H=B.lineTangency,W=B.theta,X=J8({cx:s,cy:n,radius:a,angle:g,sign:-y,isExternal:!0,cornerRadius:l,cornerIsExternal:d}),se=X.circleTangency,ae=X.lineTangency,le=X.theta,ne=d?Math.abs(m-g):Math.abs(m-g)-W-le;if(ne<0&&l===0)return"".concat(O,"L").concat(s,",").concat(n,"Z");O+="L".concat(ae.x,",").concat(ae.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(se.x,",").concat(se.y,` A`).concat(a,",").concat(a,",0,").concat(+(ne>180),",").concat(+(y>0),",").concat($.x,",").concat($.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(H.x,",").concat(H.y,"Z")}else O+="L".concat(s,",").concat(n,"Z");return O},mVt={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Tqe=function(r){var s=oMe(oMe({},mVt),r),n=s.cx,a=s.cy,o=s.innerRadius,l=s.outerRadius,i=s.cornerRadius,d=s.forceCornerRadius,m=s.cornerIsExternal,g=s.startAngle,y=s.endAngle,v=s.className;if(l0&&Math.abs(g-y)<360?S=hVt({cx:n,cy:a,innerRadius:o,outerRadius:l,cornerRadius:Math.min(j,N/2),forceCornerRadius:d,cornerIsExternal:m,startAngle:g,endAngle:y}):S=Mqe({cx:n,cy:a,innerRadius:o,outerRadius:l,startAngle:g,endAngle:y}),lt.createElement("path",wfe({},Ga(s,!0),{className:b,d:S,role:"img"}))};function FI(t){"@babel/helpers - typeof";return FI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},FI(t)}function jfe(){return jfe=Object.assign?Object.assign.bind():function(t){for(var r=1;r0;)if(!s.equals(t[n],r[n],n,n,t,r,s))return!1;return!0}function IVt(t,r){return Kk(t.getTime(),r.getTime())}function PVt(t,r){return t.name===r.name&&t.message===r.message&&t.cause===r.cause&&t.stack===r.stack}function LVt(t,r){return t===r}function fMe(t,r,s){var n=t.size;if(n!==r.size)return!1;if(!n)return!0;for(var a=new Array(n),o=t.entries(),l,i,d=0;(l=o.next())&&!l.done;){for(var m=r.entries(),g=!1,y=0;(i=m.next())&&!i.done;){if(a[y]){y++;continue}var v=l.value,b=i.value;if(s.equals(v[0],b[0],d,y,t,r,s)&&s.equals(v[1],b[1],v[0],b[0],t,r,s)){g=a[y]=!0;break}y++}if(!g)return!1;d++}return!0}var OVt=Kk;function DVt(t,r,s){var n=pMe(t),a=n.length;if(pMe(r).length!==a)return!1;for(;a-- >0;)if(!Pqe(t,r,s,n[a]))return!1;return!0}function FT(t,r,s){var n=hMe(t),a=n.length;if(hMe(r).length!==a)return!1;for(var o,l,i;a-- >0;)if(o=n[a],!Pqe(t,r,s,o)||(l=mMe(t,o),i=mMe(r,o),(l||i)&&(!l||!i||l.configurable!==i.configurable||l.enumerable!==i.enumerable||l.writable!==i.writable)))return!1;return!0}function RVt(t,r){return Kk(t.valueOf(),r.valueOf())}function FVt(t,r){return t.source===r.source&&t.flags===r.flags}function gMe(t,r,s){var n=t.size;if(n!==r.size)return!1;if(!n)return!0;for(var a=new Array(n),o=t.values(),l,i;(l=o.next())&&!l.done;){for(var d=r.values(),m=!1,g=0;(i=d.next())&&!i.done;){if(!a[g]&&s.equals(l.value,i.value,l.value,i.value,t,r,s)){m=a[g]=!0;break}g++}if(!m)return!1}return!0}function zVt(t,r){var s=t.length;if(r.length!==s)return!1;for(;s-- >0;)if(t[s]!==r[s])return!1;return!0}function BVt(t,r){return t.hostname===r.hostname&&t.pathname===r.pathname&&t.protocol===r.protocol&&t.port===r.port&&t.hash===r.hash&&t.username===r.username&&t.password===r.password}function Pqe(t,r,s,n){return(n===AVt||n===TVt||n===MVt)&&(t.$$typeof||r.$$typeof)?!0:CVt(r,n)&&s.equals(t[n],r[n],n,n,t,r,s)}var $Vt="[object Arguments]",UVt="[object Boolean]",qVt="[object Date]",VVt="[object Error]",HVt="[object Map]",WVt="[object Number]",GVt="[object Object]",KVt="[object RegExp]",ZVt="[object Set]",YVt="[object String]",XVt="[object URL]",QVt=Array.isArray,xMe=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,yMe=Object.assign,JVt=Object.prototype.toString.call.bind(Object.prototype.toString);function eHt(t){var r=t.areArraysEqual,s=t.areDatesEqual,n=t.areErrorsEqual,a=t.areFunctionsEqual,o=t.areMapsEqual,l=t.areNumbersEqual,i=t.areObjectsEqual,d=t.arePrimitiveWrappersEqual,m=t.areRegExpsEqual,g=t.areSetsEqual,y=t.areTypedArraysEqual,v=t.areUrlsEqual;return function(N,j,S){if(N===j)return!0;if(N==null||j==null)return!1;var A=typeof N;if(A!==typeof j)return!1;if(A!=="object")return A==="number"?l(N,j,S):A==="function"?a(N,j,S):!1;var M=N.constructor;if(M!==j.constructor)return!1;if(M===Object)return i(N,j,S);if(QVt(N))return r(N,j,S);if(xMe!=null&&xMe(N))return y(N,j,S);if(M===Date)return s(N,j,S);if(M===RegExp)return m(N,j,S);if(M===Map)return o(N,j,S);if(M===Set)return g(N,j,S);var I=JVt(N);return I===qVt?s(N,j,S):I===KVt?m(N,j,S):I===HVt?o(N,j,S):I===ZVt?g(N,j,S):I===GVt?typeof N.then!="function"&&typeof j.then!="function"&&i(N,j,S):I===XVt?v(N,j,S):I===VVt?n(N,j,S):I===$Vt?i(N,j,S):I===UVt||I===WVt||I===YVt?d(N,j,S):!1}}function tHt(t){var r=t.circular,s=t.createCustomConfig,n=t.strict,a={areArraysEqual:n?FT:EVt,areDatesEqual:IVt,areErrorsEqual:PVt,areFunctionsEqual:LVt,areMapsEqual:n?uMe(fMe,FT):fMe,areNumbersEqual:OVt,areObjectsEqual:n?FT:DVt,arePrimitiveWrappersEqual:RVt,areRegExpsEqual:FVt,areSetsEqual:n?uMe(gMe,FT):gMe,areTypedArraysEqual:n?FT:zVt,areUrlsEqual:BVt};if(s&&(a=yMe({},a,s(a))),r){var o=tO(a.areArraysEqual),l=tO(a.areMapsEqual),i=tO(a.areObjectsEqual),d=tO(a.areSetsEqual);a=yMe({},a,{areArraysEqual:o,areMapsEqual:l,areObjectsEqual:i,areSetsEqual:d})}return a}function rHt(t){return function(r,s,n,a,o,l,i){return t(r,s,i)}}function sHt(t){var r=t.circular,s=t.comparator,n=t.createState,a=t.equals,o=t.strict;if(n)return function(d,m){var g=n(),y=g.cache,v=y===void 0?r?new WeakMap:void 0:y,b=g.meta;return s(d,m,{cache:v,equals:a,meta:b,strict:o})};if(r)return function(d,m){return s(d,m,{cache:new WeakMap,equals:a,meta:void 0,strict:o})};var l={cache:void 0,equals:a,meta:void 0,strict:o};return function(d,m){return s(d,m,l)}}var nHt=Uv();Uv({strict:!0});Uv({circular:!0});Uv({circular:!0,strict:!0});Uv({createInternalComparator:function(){return Kk}});Uv({strict:!0,createInternalComparator:function(){return Kk}});Uv({circular:!0,createInternalComparator:function(){return Kk}});Uv({circular:!0,createInternalComparator:function(){return Kk},strict:!0});function Uv(t){t===void 0&&(t={});var r=t.circular,s=r===void 0?!1:r,n=t.createInternalComparator,a=t.createState,o=t.strict,l=o===void 0?!1:o,i=tHt(t),d=eHt(i),m=n?n(d):rHt(d);return sHt({circular:s,comparator:d,createState:a,equals:m,strict:l})}function aHt(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function vMe(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=-1,n=function a(o){s<0&&(s=o),o-s>r?(t(o),s=-1):aHt(a)};requestAnimationFrame(n)}function Nfe(t){"@babel/helpers - typeof";return Nfe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Nfe(t)}function iHt(t){return dHt(t)||cHt(t)||lHt(t)||oHt()}function oHt(){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 lHt(t,r){if(t){if(typeof t=="string")return _Me(t,r);var s=Object.prototype.toString.call(t).slice(8,-1);if(s==="Object"&&t.constructor&&(s=t.constructor.name),s==="Map"||s==="Set")return Array.from(t);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return _Me(t,r)}}function _Me(t,r){(r==null||r>t.length)&&(r=t.length);for(var s=0,n=new Array(r);st.length)&&(r=t.length);for(var s=0,n=new Array(r);s1?1:A<0?0:A},j=function(A){for(var M=A>1?1:A,I=M,F=0;F<8;++F){var O=y(I)-M,B=b(I);if(Math.abs(O-M)0&&arguments[0]!==void 0?arguments[0]:{},s=r.stiff,n=s===void 0?100:s,a=r.damping,o=a===void 0?8:a,l=r.dt,i=l===void 0?17:l,d=function(g,y,v){var b=-(g-y)*n,N=v*o,j=v+(b-N)*i/1e3,S=v*i/1e3+g;return Math.abs(S-y)t.length)&&(r=t.length);for(var s=0,n=new Array(r);s=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function $Ht(t,r){if(t==null)return{};var s={},n=Object.keys(t),a,o;for(o=0;o=0)&&(s[a]=t[a]);return s}function gue(t){return HHt(t)||VHt(t)||qHt(t)||UHt()}function UHt(){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 qHt(t,r){if(t){if(typeof t=="string")return Afe(t,r);var s=Object.prototype.toString.call(t).slice(8,-1);if(s==="Object"&&t.constructor&&(s=t.constructor.name),s==="Map"||s==="Set")return Array.from(t);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return Afe(t,r)}}function VHt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function HHt(t){if(Array.isArray(t))return Afe(t)}function Afe(t,r){(r==null||r>t.length)&&(r=t.length);for(var s=0,n=new Array(r);s"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 zse(t){return zse=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(s){return s.__proto__||Object.getPrototypeOf(s)},zse(t)}var Wy=function(t){YHt(s,t);var r=XHt(s);function s(n,a){var o;WHt(this,s),o=r.call(this,n,a);var l=o.props,i=l.isActive,d=l.attributeName,m=l.from,g=l.to,y=l.steps,v=l.children,b=l.duration;if(o.handleStyleChange=o.handleStyleChange.bind(Pfe(o)),o.changeStyle=o.changeStyle.bind(Pfe(o)),!i||b<=0)return o.state={style:{}},typeof v=="function"&&(o.state={style:g}),Ife(o);if(y&&y.length)o.state={style:y[0].style};else if(m){if(typeof v=="function")return o.state={style:m},Ife(o);o.state={style:d?tA({},d,m):m}}else o.state={style:{}};return o}return KHt(s,[{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,d=o.attributeName,m=o.shouldReAnimate,g=o.to,y=o.from,v=this.state.style;if(i){if(!l){var b={style:d?tA({},d,g):g};this.state&&v&&(d&&v[d]!==g||!d&&v!==g)&&this.setState(b);return}if(!(nHt(a.to,g)&&a.canBegin&&a.isActive)){var N=!a.canBegin||!a.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var j=N||m?y:a.to;if(this.state&&v){var S={style:d?tA({},d,j):j};(d&&v[d]!==j||!d&&v!==j)&&this.setState(S)}this.runAnimation(df(df({},this.props),{},{from:j,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,d=a.duration,m=a.easing,g=a.begin,y=a.onAnimationEnd,v=a.onAnimationStart,b=FHt(l,i,CHt(m),d,this.changeStyle),N=function(){o.stopJSAnimation=b()};this.manager.start([v,g,N,d,y])}},{key:"runStepAnimation",value:function(a){var o=this,l=a.steps,i=a.begin,d=a.onAnimationStart,m=l[0],g=m.style,y=m.duration,v=y===void 0?0:y,b=function(j,S,A){if(A===0)return j;var M=S.duration,I=S.easing,F=I===void 0?"ease":I,O=S.style,B=S.properties,$=S.onAnimationEnd,H=A>0?l[A-1]:S,W=B||Object.keys(O);if(typeof F=="function"||F==="spring")return[].concat(gue(j),[o.runJSAnimation.bind(o,{from:H.style,to:O,duration:M,easing:F}),M]);var X=jMe(W,M,F),se=df(df(df({},H.style),O),{},{transition:X});return[].concat(gue(j),[se,M,$]).filter(fHt)};return this.manager.start([d].concat(gue(l.reduce(b,[g,Math.max(v,i)])),[a.onAnimationEnd]))}},{key:"runAnimation",value:function(a){this.manager||(this.manager=uHt());var o=a.begin,l=a.duration,i=a.attributeName,d=a.to,m=a.easing,g=a.onAnimationStart,y=a.onAnimationEnd,v=a.steps,b=a.children,N=this.manager;if(this.unSubscribe=N.subscribe(this.handleStyleChange),typeof m=="function"||typeof b=="function"||m==="spring"){this.runJSAnimation(a);return}if(v.length>1){this.runStepAnimation(a);return}var j=i?tA({},i,d):d,S=jMe(Object.keys(j),l,m);N.start([g,o,df(df({},j),{},{transition:S}),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 d=BHt(a,zHt),m=E.Children.count(o),g=this.state.style;if(typeof o=="function")return o(g);if(!i||m===0||l<=0)return o;var y=function(b){var N=b.props,j=N.style,S=j===void 0?{}:j,A=N.className,M=E.cloneElement(b,df(df({},d),{},{style:df(df({},S),g),className:A}));return M};return m===1?y(E.Children.only(o)):lt.createElement("div",null,E.Children.map(o,function(v){return y(v)}))}}]),s}(E.PureComponent);Wy.displayName="Animate";Wy.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Wy.propTypes={from:To.oneOfType([To.object,To.string]),to:To.oneOfType([To.object,To.string]),attributeName:To.string,duration:To.number,begin:To.number,easing:To.oneOfType([To.string,To.func]),steps:To.arrayOf(To.shape({duration:To.number.isRequired,style:To.object.isRequired,easing:To.oneOfType([To.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),To.func]),properties:To.arrayOf("string"),onAnimationEnd:To.func})),children:To.oneOfType([To.node,To.func]),isActive:To.bool,canBegin:To.bool,onAnimationEnd:To.func,shouldReAnimate:To.bool,onAnimationStart:To.func,onAnimationReStart:To.func};function $I(t){"@babel/helpers - typeof";return $I=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},$I(t)}function Bse(){return Bse=Object.assign?Object.assign.bind():function(t){for(var r=1;rt.length)&&(r=t.length);for(var s=0,n=new Array(r);s=0?1:-1,d=n>=0?1:-1,m=a>=0&&n>=0||a<0&&n<0?1:0,g;if(l>0&&o instanceof Array){for(var y=[0,0,0,0],v=0,b=4;vl?l:o[v];g="M".concat(r,",").concat(s+i*y[0]),y[0]>0&&(g+="A ".concat(y[0],",").concat(y[0],",0,0,").concat(m,",").concat(r+d*y[0],",").concat(s)),g+="L ".concat(r+n-d*y[1],",").concat(s),y[1]>0&&(g+="A ".concat(y[1],",").concat(y[1],",0,0,").concat(m,`, `).concat(r+n,",").concat(s+i*y[1])),g+="L ".concat(r+n,",").concat(s+a-i*y[2]),y[2]>0&&(g+="A ".concat(y[2],",").concat(y[2],",0,0,").concat(m,`, `).concat(r+n-d*y[2],",").concat(s+a)),g+="L ".concat(r+d*y[3],",").concat(s+a),y[3]>0&&(g+="A ".concat(y[3],",").concat(y[3],",0,0,").concat(m,`, `).concat(r,",").concat(s+a-i*y[3])),g+="Z"}else if(l>0&&o===+o&&o>0){var N=Math.min(l,o);g="M ".concat(r,",").concat(s+i*N,` A `).concat(N,",").concat(N,",0,0,").concat(m,",").concat(r+d*N,",").concat(s,` L `).concat(r+n-d*N,",").concat(s,` A `).concat(N,",").concat(N,",0,0,").concat(m,",").concat(r+n,",").concat(s+i*N,` L `).concat(r+n,",").concat(s+a-i*N,` A `).concat(N,",").concat(N,",0,0,").concat(m,",").concat(r+n-d*N,",").concat(s+a,` L `).concat(r+d*N,",").concat(s+a,` A `).concat(N,",").concat(N,",0,0,").concat(m,",").concat(r,",").concat(s+a-i*N," Z")}else g="M ".concat(r,",").concat(s," h ").concat(n," v ").concat(a," h ").concat(-n," Z");return g},oWt=function(r,s){if(!r||!s)return!1;var n=r.x,a=r.y,o=s.x,l=s.y,i=s.width,d=s.height;if(Math.abs(i)>0&&Math.abs(d)>0){var m=Math.min(o,o+i),g=Math.max(o,o+i),y=Math.min(l,l+d),v=Math.max(l,l+d);return n>=m&&n<=g&&a>=y&&a<=v}return!1},lWt={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},ave=function(r){var s=EMe(EMe({},lWt),r),n=E.useRef(),a=E.useState(-1),o=JHt(a,2),l=o[0],i=o[1];E.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var F=n.current.getTotalLength();F&&i(F)}catch{}},[]);var d=s.x,m=s.y,g=s.width,y=s.height,v=s.radius,b=s.className,N=s.animationEasing,j=s.animationDuration,S=s.animationBegin,A=s.isAnimationActive,M=s.isUpdateAnimationActive;if(d!==+d||m!==+m||g!==+g||y!==+y||g===0||y===0)return null;var I=vi("recharts-rectangle",b);return M?lt.createElement(Wy,{canBegin:l>0,from:{width:g,height:y,x:d,y:m},to:{width:g,height:y,x:d,y:m},duration:j,animationEasing:N,isActive:M},function(F){var O=F.width,B=F.height,$=F.x,H=F.y;return lt.createElement(Wy,{canBegin:l>0,from:"0px ".concat(l===-1?1:l,"px"),to:"".concat(l,"px 0px"),attributeName:"strokeDasharray",begin:S,duration:j,isActive:A,easing:N},lt.createElement("path",Bse({},Ga(s,!0),{className:I,d:IMe($,H,O,B,v),ref:n})))}):lt.createElement("path",Bse({},Ga(s,!0),{className:I,d:IMe(d,m,g,y,v)}))},cWt=["points","className","baseLinePoints","connectNulls"];function _S(){return _S=Object.assign?Object.assign.bind():function(t){for(var r=1;r=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function uWt(t,r){if(t==null)return{};var s={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(r.indexOf(n)>=0)continue;s[n]=t[n]}return s}function PMe(t){return fWt(t)||pWt(t)||mWt(t)||hWt()}function hWt(){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 mWt(t,r){if(t){if(typeof t=="string")return Lfe(t,r);var s=Object.prototype.toString.call(t).slice(8,-1);if(s==="Object"&&t.constructor&&(s=t.constructor.name),s==="Map"||s==="Set")return Array.from(t);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return Lfe(t,r)}}function pWt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function fWt(t){if(Array.isArray(t))return Lfe(t)}function Lfe(t,r){(r==null||r>t.length)&&(r=t.length);for(var s=0,n=new Array(r);s0&&arguments[0]!==void 0?arguments[0]:[],s=[[]];return r.forEach(function(n){LMe(n)?s[s.length-1].push(n):s[s.length-1].length>0&&s.push([])}),LMe(r[0])&&s[s.length-1].push(r[0]),s[s.length-1].length<=0&&(s=s.slice(0,-1)),s},vE=function(r,s){var n=gWt(r);s&&(n=[n.reduce(function(o,l){return[].concat(PMe(o),PMe(l))},[])]);var a=n.map(function(o){return o.reduce(function(l,i,d){return"".concat(l).concat(d===0?"M":"L").concat(i.x,",").concat(i.y)},"")}).join("");return n.length===1?"".concat(a,"Z"):a},xWt=function(r,s,n){var a=vE(r,n);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(vE(s.reverse(),n).slice(1))},yWt=function(r){var s=r.points,n=r.className,a=r.baseLinePoints,o=r.connectNulls,l=dWt(r,cWt);if(!s||!s.length)return null;var i=vi("recharts-polygon",n);if(a&&a.length){var d=l.stroke&&l.stroke!=="none",m=xWt(s,a,o);return lt.createElement("g",{className:i},lt.createElement("path",_S({},Ga(l,!0),{fill:m.slice(-1)==="Z"?l.fill:"none",stroke:"none",d:m})),d?lt.createElement("path",_S({},Ga(l,!0),{fill:"none",d:vE(s,o)})):null,d?lt.createElement("path",_S({},Ga(l,!0),{fill:"none",d:vE(a,o)})):null)}var g=vE(s,o);return lt.createElement("path",_S({},Ga(l,!0),{fill:g.slice(-1)==="Z"?l.fill:"none",className:i,d:g}))};function Ofe(){return Ofe=Object.assign?Object.assign.bind():function(t){for(var r=1;r=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function NWt(t,r){if(t==null)return{};var s={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(r.indexOf(n)>=0)continue;s[n]=t[n]}return s}var SWt=function(r,s,n,a,o,l){return"M".concat(r,",").concat(o,"v").concat(a,"M").concat(l,",").concat(s,"h").concat(n)},CWt=function(r){var s=r.x,n=s===void 0?0:s,a=r.y,o=a===void 0?0:a,l=r.top,i=l===void 0?0:l,d=r.left,m=d===void 0?0:d,g=r.width,y=g===void 0?0:g,v=r.height,b=v===void 0?0:v,N=r.className,j=kWt(r,vWt),S=_Wt({x:n,y:o,top:i,left:m,width:y,height:b},j);return!Us(n)||!Us(o)||!Us(y)||!Us(b)||!Us(i)||!Us(m)?null:lt.createElement("path",Dfe({},Ga(S,!0),{className:vi("recharts-cross",N),d:SWt(n,o,y,b,i,m)}))},MWt=Sie,TWt=XUe,AWt=gx;function EWt(t,r){return t&&t.length?MWt(t,AWt(r),TWt):void 0}var IWt=EWt;const PWt=oo(IWt);var LWt=Sie,OWt=gx,DWt=QUe;function RWt(t,r){return t&&t.length?LWt(t,OWt(r),DWt):void 0}var FWt=RWt;const zWt=oo(FWt);var BWt=["cx","cy","angle","ticks","axisLine"],$Wt=["ticks","tick","angle","tickFormatter","stroke"];function u3(t){"@babel/helpers - typeof";return u3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},u3(t)}function _E(){return _E=Object.assign?Object.assign.bind():function(t){for(var r=1;r=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function UWt(t,r){if(t==null)return{};var s={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(r.indexOf(n)>=0)continue;s[n]=t[n]}return s}function qWt(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function FMe(t,r){for(var s=0;s$Me?l=a==="outer"?"start":"end":o<-$Me?l=a==="outer"?"end":"start":l="middle",l}},{key:"renderAxisLine",value:function(){var n=this.props,a=n.cx,o=n.cy,l=n.radius,i=n.axisLine,d=n.axisLineType,m=R_(R_({},Ga(this.props,!1)),{},{fill:"none"},Ga(i,!1));if(d==="circle")return lt.createElement(ive,oj({className:"recharts-polar-angle-axis-line"},m,{cx:a,cy:o,r:l}));var g=this.props.ticks,y=g.map(function(v){return cl(a,o,l,v.coordinate)});return lt.createElement(yWt,oj({className:"recharts-polar-angle-axis-line"},m,{points:y}))}},{key:"renderTicks",value:function(){var n=this,a=this.props,o=a.ticks,l=a.tick,i=a.tickLine,d=a.tickFormatter,m=a.stroke,g=Ga(this.props,!1),y=Ga(l,!1),v=R_(R_({},g),{},{fill:"none"},Ga(i,!1)),b=o.map(function(N,j){var S=n.getTickLineCoord(N),A=n.getTickTextAnchor(N),M=R_(R_(R_({textAnchor:A},g),{},{stroke:"none",fill:m},y),{},{index:j,payload:N,x:S.x2,y:S.y2});return lt.createElement(Fo,oj({className:vi("recharts-polar-angle-axis-tick",Sqe(l)),key:"tick-".concat(N.coordinate)},Ek(n.props,N,j)),i&<.createElement("line",oj({className:"recharts-polar-angle-axis-tick-line"},v,S)),l&&r.renderTickItem(l,M,d?d(N.value,j):N.value))});return lt.createElement(Fo,{className:"recharts-polar-angle-axis-ticks"},b)}},{key:"render",value:function(){var n=this.props,a=n.ticks,o=n.radius,l=n.axisLine;return o<=0||!a||!a.length?null:lt.createElement(Fo,{className:vi("recharts-polar-angle-axis",this.props.className)},l&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(n,a,o){var l;return lt.isValidElement(n)?l=lt.cloneElement(n,a):Ja(n)?l=n(a):l=lt.createElement(Ik,oj({},a,{className:"recharts-polar-angle-axis-tick-value"}),o),l}}])}(E.PureComponent);Oie(Die,"displayName","PolarAngleAxis");Oie(Die,"axisType","angleAxis");Oie(Die,"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 nGt=G$e,aGt=nGt(Object.getPrototypeOf,Object),iGt=aGt,oGt=Zy,lGt=iGt,cGt=Yy,dGt="[object Object]",uGt=Function.prototype,hGt=Object.prototype,Vqe=uGt.toString,mGt=hGt.hasOwnProperty,pGt=Vqe.call(Object);function fGt(t){if(!cGt(t)||oGt(t)!=dGt)return!1;var r=lGt(t);if(r===null)return!0;var s=mGt.call(r,"constructor")&&r.constructor;return typeof s=="function"&&s instanceof s&&Vqe.call(s)==pGt}var gGt=fGt;const xGt=oo(gGt);var yGt=Zy,vGt=Yy,_Gt="[object Boolean]";function bGt(t){return t===!0||t===!1||vGt(t)&&yGt(t)==_Gt}var wGt=bGt;const jGt=oo(wGt);function qI(t){"@babel/helpers - typeof";return qI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},qI(t)}function qse(){return qse=Object.assign?Object.assign.bind():function(t){for(var r=1;rt.length)&&(r=t.length);for(var s=0,n=new Array(r);s0,from:{upperWidth:0,lowerWidth:0,height:v,x:d,y:m},to:{upperWidth:g,lowerWidth:y,height:v,x:d,y:m},duration:j,animationEasing:N,isActive:A},function(I){var F=I.upperWidth,O=I.lowerWidth,B=I.height,$=I.x,H=I.y;return lt.createElement(Wy,{canBegin:l>0,from:"0px ".concat(l===-1?1:l,"px"),to:"".concat(l,"px 0px"),attributeName:"strokeDasharray",begin:S,duration:j,easing:N},lt.createElement("path",qse({},Ga(s,!0),{className:M,d:HMe($,H,F,O,B),ref:n})))}):lt.createElement("g",null,lt.createElement("path",qse({},Ga(s,!0),{className:M,d:HMe(d,m,g,y,v)})))},LGt=["option","shapeType","propTransformer","activeClassName","isActive"];function VI(t){"@babel/helpers - typeof";return VI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},VI(t)}function OGt(t,r){if(t==null)return{};var s=DGt(t,r),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function DGt(t,r){if(t==null)return{};var s={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(r.indexOf(n)>=0)continue;s[n]=t[n]}return s}function WMe(t,r){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),s.push.apply(s,n)}return s}function Vse(t){for(var r=1;r0?Mm(I,"paddingAngle",0):0;if(O){var $=l1(O.endAngle-O.startAngle,I.endAngle-I.startAngle),H=il(il({},I),{},{startAngle:M+B,endAngle:M+$(j)+B});S.push(H),M=H.endAngle}else{var W=I.endAngle,X=I.startAngle,se=l1(0,W-X),ae=se(j),le=il(il({},I),{},{startAngle:M+B,endAngle:M+ae+B});S.push(le),M=le.endAngle}}),lt.createElement(Fo,null,n.renderSectorsStatically(S))})}},{key:"attachKeyboardHandlers",value:function(n){var a=this;n.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 n=this.props,a=n.sectors,o=n.isAnimationActive,l=this.state.prevSectors;return o&&a&&a.length&&(!l||!Tie(l,a))?this.renderSectorsWithAnimation():this.renderSectorsStatically(a)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var n=this,a=this.props,o=a.hide,l=a.sectors,i=a.className,d=a.label,m=a.cx,g=a.cy,y=a.innerRadius,v=a.outerRadius,b=a.isAnimationActive,N=this.state.isAnimationFinished;if(o||!l||!l.length||!Us(m)||!Us(g)||!Us(y)||!Us(v))return null;var j=vi("recharts-pie",i);return lt.createElement(Fo,{tabIndex:this.props.rootTabIndex,className:j,ref:function(A){n.pieRef=A}},this.renderSectors(),d&&this.renderLabels(l),Fd.renderCallByParent(this.props,null,!1),(!b||N)&&hv.renderCallByParent(this.props,l,!1))}}],[{key:"getDerivedStateFromProps",value:function(n,a){return a.prevIsAnimationActive!==n.isAnimationActive?{prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:[],isAnimationFinished:!0}:n.isAnimationActive&&n.animationId!==a.prevAnimationId?{prevAnimationId:n.animationId,curSectors:n.sectors,prevSectors:a.curSectors,isAnimationFinished:!0}:n.sectors!==a.curSectors?{curSectors:n.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(n,a){return n>a?"start":n=360?M:M-1)*d,F=S-M*b-I,O=a.reduce(function(H,W){var X=bu(W,A,0);return H+(Us(X)?X:0)},0),B;if(O>0){var $;B=a.map(function(H,W){var X=bu(H,A,0),se=bu(H,g,W),ae=(Us(X)?X:0)/O,le;W?le=$.endAngle+th(j)*d*(X!==0?1:0):le=l;var ne=le+th(j)*((X!==0?b:0)+ae*F),fe=(le+ne)/2,oe=(N.innerRadius+N.outerRadius)/2,de=[{name:se,value:X,payload:H,dataKey:A,type:v}],ue=cl(N.cx,N.cy,oe,fe);return $=il(il(il({percent:ae,cornerRadius:o,name:se,tooltipPayload:de,midAngle:fe,middleRadius:oe,tooltipPosition:ue},H),N),{},{value:bu(H,A),startAngle:le,endAngle:ne,payload:H,paddingAngle:th(j)*d}),$})}return il(il({},N),{},{sectors:B,data:a})});var sKt=Math.ceil,nKt=Math.max;function aKt(t,r,s,n){for(var a=-1,o=nKt(sKt((r-t)/(s||1)),0),l=Array(o);o--;)l[n?o:++a]=t,t+=s;return l}var iKt=aKt,oKt=hUe,YMe=1/0,lKt=17976931348623157e292;function cKt(t){if(!t)return t===0?t:0;if(t=oKt(t),t===YMe||t===-YMe){var r=t<0?-1:1;return r*lKt}return t===t?t:0}var Kqe=cKt,dKt=iKt,uKt=yie,xue=Kqe;function hKt(t){return function(r,s,n){return n&&typeof n!="number"&&uKt(r,s,n)&&(s=n=void 0),r=xue(r),s===void 0?(s=r,r=0):s=xue(s),n=n===void 0?r0&&n.handleDrag(a.changedTouches[0])}),am(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var a=n.props,o=a.endIndex,l=a.onDragEnd,i=a.startIndex;l==null||l({endIndex:o,startIndex:i})}),n.detachDragEndListener()}),am(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),am(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),am(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),am(n,"handleSlideDragStart",function(a){var o=tTe(a)?a.changedTouches[0]:a;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:o.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return SKt(r,t),wKt(r,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var a=n.startX,o=n.endX,l=this.state.scaleValues,i=this.props,d=i.gap,m=i.data,g=m.length-1,y=Math.min(a,o),v=Math.max(a,o),b=r.getIndexInRange(l,y),N=r.getIndexInRange(l,v);return{startIndex:b-b%d,endIndex:N===g?g:N-N%d}}},{key:"getTextOfTick",value:function(n){var a=this.props,o=a.data,l=a.tickFormatter,i=a.dataKey,d=bu(o[n],i,n);return Ja(l)?l(d,n):d}},{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(n){var a=this.state,o=a.slideMoveStartX,l=a.startX,i=a.endX,d=this.props,m=d.x,g=d.width,y=d.travellerWidth,v=d.startIndex,b=d.endIndex,N=d.onChange,j=n.pageX-o;j>0?j=Math.min(j,m+g-y-i,m+g-y-l):j<0&&(j=Math.max(j,m-l,m-i));var S=this.getIndex({startX:l+j,endX:i+j});(S.startIndex!==v||S.endIndex!==b)&&N&&N(S),this.setState({startX:l+j,endX:i+j,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,a){var o=tTe(a)?a.changedTouches[0]:a;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:o.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var a=this.state,o=a.brushMoveStartX,l=a.movingTravellerId,i=a.endX,d=a.startX,m=this.state[l],g=this.props,y=g.x,v=g.width,b=g.travellerWidth,N=g.onChange,j=g.gap,S=g.data,A={startX:this.state.startX,endX:this.state.endX},M=n.pageX-o;M>0?M=Math.min(M,y+v-b-m):M<0&&(M=Math.max(M,y-m)),A[l]=m+M;var I=this.getIndex(A),F=I.startIndex,O=I.endIndex,B=function(){var H=S.length-1;return l==="startX"&&(i>d?F%j===0:O%j===0)||id?O%j===0:F%j===0)||i>d&&O===H};this.setState(am(am({},l,m+M),"brushMoveStartX",n.pageX),function(){N&&B()&&N(I)})}},{key:"handleTravellerMoveKeyboard",value:function(n,a){var o=this,l=this.state,i=l.scaleValues,d=l.startX,m=l.endX,g=this.state[a],y=i.indexOf(g);if(y!==-1){var v=y+n;if(!(v===-1||v>=i.length)){var b=i[v];a==="startX"&&b>=m||a==="endX"&&b<=d||this.setState(am({},a,b),function(){o.props.onChange(o.getIndex({startX:o.state.startX,endX:o.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,a=n.x,o=n.y,l=n.width,i=n.height,d=n.fill,m=n.stroke;return lt.createElement("rect",{stroke:m,fill:d,x:a,y:o,width:l,height:i})}},{key:"renderPanorama",value:function(){var n=this.props,a=n.x,o=n.y,l=n.width,i=n.height,d=n.data,m=n.children,g=n.padding,y=E.Children.only(m);return y?lt.cloneElement(y,{x:a,y:o,width:l,height:i,margin:g,compact:!0,data:d}):null}},{key:"renderTravellerLayer",value:function(n,a){var o,l,i=this,d=this.props,m=d.y,g=d.travellerWidth,y=d.height,v=d.traveller,b=d.ariaLabel,N=d.data,j=d.startIndex,S=d.endIndex,A=Math.max(n,this.props.x),M=yue(yue({},Ga(this.props,!1)),{},{x:A,y:m,width:g,height:y}),I=b||"Min value: ".concat((o=N[j])===null||o===void 0?void 0:o.name,", Max value: ").concat((l=N[S])===null||l===void 0?void 0:l.name);return lt.createElement(Fo,{tabIndex:0,role:"slider","aria-label":I,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[a],onTouchStart:this.travellerDragStartHandlers[a],onKeyDown:function(O){["ArrowLeft","ArrowRight"].includes(O.key)&&(O.preventDefault(),O.stopPropagation(),i.handleTravellerMoveKeyboard(O.key==="ArrowRight"?1:-1,a))},onFocus:function(){i.setState({isTravellerFocused:!0})},onBlur:function(){i.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},r.renderTraveller(v,M))}},{key:"renderSlide",value:function(n,a){var o=this.props,l=o.y,i=o.height,d=o.stroke,m=o.travellerWidth,g=Math.min(n,a)+m,y=Math.max(Math.abs(a-n)-m,0);return lt.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:d,fillOpacity:.2,x:g,y:l,width:y,height:i})}},{key:"renderText",value:function(){var n=this.props,a=n.startIndex,o=n.endIndex,l=n.y,i=n.height,d=n.travellerWidth,m=n.stroke,g=this.state,y=g.startX,v=g.endX,b=5,N={pointerEvents:"none",fill:m};return lt.createElement(Fo,{className:"recharts-brush-texts"},lt.createElement(Ik,Gse({textAnchor:"end",verticalAnchor:"middle",x:Math.min(y,v)-b,y:l+i/2},N),this.getTextOfTick(a)),lt.createElement(Ik,Gse({textAnchor:"start",verticalAnchor:"middle",x:Math.max(y,v)+d+b,y:l+i/2},N),this.getTextOfTick(o)))}},{key:"render",value:function(){var n=this.props,a=n.data,o=n.className,l=n.children,i=n.x,d=n.y,m=n.width,g=n.height,y=n.alwaysShowText,v=this.state,b=v.startX,N=v.endX,j=v.isTextActive,S=v.isSlideMoving,A=v.isTravellerMoving,M=v.isTravellerFocused;if(!a||!a.length||!Us(i)||!Us(d)||!Us(m)||!Us(g)||m<=0||g<=0)return null;var I=vi("recharts-brush",o),F=lt.Children.count(l)===1,O=_Kt("userSelect","none");return lt.createElement(Fo,{className:I,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:O},this.renderBackground(),F&&this.renderPanorama(),this.renderSlide(b,N),this.renderTravellerLayer(b,"startX"),this.renderTravellerLayer(N,"endX"),(j||S||A||M||y)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var a=n.x,o=n.y,l=n.width,i=n.height,d=n.stroke,m=Math.floor(o+i/2)-1;return lt.createElement(lt.Fragment,null,lt.createElement("rect",{x:a,y:o,width:l,height:i,fill:d,stroke:"none"}),lt.createElement("line",{x1:a+1,y1:m,x2:a+l-1,y2:m,fill:"none",stroke:"#fff"}),lt.createElement("line",{x1:a+1,y1:m+2,x2:a+l-1,y2:m+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,a){var o;return lt.isValidElement(n)?o=lt.cloneElement(n,a):Ja(n)?o=n(a):o=r.renderDefaultTraveller(a),o}},{key:"getDerivedStateFromProps",value:function(n,a){var o=n.data,l=n.width,i=n.x,d=n.travellerWidth,m=n.updateId,g=n.startIndex,y=n.endIndex;if(o!==a.prevData||m!==a.prevUpdateId)return yue({prevData:o,prevTravellerWidth:d,prevUpdateId:m,prevX:i,prevWidth:l},o&&o.length?MKt({data:o,width:l,x:i,travellerWidth:d,startIndex:g,endIndex:y}):{scale:null,scaleValues:null});if(a.scale&&(l!==a.prevWidth||i!==a.prevX||d!==a.prevTravellerWidth)){a.scale.range([i,i+l-d]);var v=a.scale.domain().map(function(b){return a.scale(b)});return{prevData:o,prevTravellerWidth:d,prevUpdateId:m,prevX:i,prevWidth:l,startX:a.scale(n.startIndex),endX:a.scale(n.endIndex),scaleValues:v}}return null}},{key:"getIndexInRange",value:function(n,a){for(var o=n.length,l=0,i=o-1;i-l>1;){var d=Math.floor((l+i)/2);n[d]>a?i=d:l=d}return a>=n[i]?i:l}}])}(E.PureComponent);am(f3,"displayName","Brush");am(f3,"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 TKt=E1e;function AKt(t,r){var s;return TKt(t,function(n,a,o){return s=r(n,a,o),!s}),!!s}var EKt=AKt,IKt=z$e,PKt=gx,LKt=EKt,OKt=Wh,DKt=yie;function RKt(t,r,s){var n=OKt(t)?IKt:LKt;return s&&DKt(t,r,s)&&(r=void 0),n(t,PKt(r))}var FKt=RKt;const zKt=oo(FKt);var rx=function(r,s){var n=r.alwaysShow,a=r.ifOverflow;return n&&(a="extendDomain"),a===s},rTe=oUe;function BKt(t,r,s){r=="__proto__"&&rTe?rTe(t,r,{configurable:!0,enumerable:!0,value:s,writable:!0}):t[r]=s}var $Kt=BKt,UKt=$Kt,qKt=aUe,VKt=gx;function HKt(t,r){var s={};return r=VKt(r),qKt(t,function(n,a,o){UKt(s,a,r(n,a,o))}),s}var WKt=HKt;const GKt=oo(WKt);function KKt(t,r){for(var s=-1,n=t==null?0:t.length;++s=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function uZt(t,r){if(t==null)return{};var s={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(r.indexOf(n)>=0)continue;s[n]=t[n]}return s}function hZt(t,r){var s=t.x,n=t.y,a=dZt(t,iZt),o="".concat(s),l=parseInt(o,10),i="".concat(n),d=parseInt(i,10),m="".concat(r.height||a.height),g=parseInt(m,10),y="".concat(r.width||a.width),v=parseInt(y,10);return zT(zT(zT(zT(zT({},r),a),l?{x:l}:{}),d?{y:d}:{}),{},{height:g,width:v,name:r.name,radius:r.radius})}function nTe(t){return lt.createElement(Hqe,$fe({shapeType:"rectangle",propTransformer:hZt,activeClassName:"recharts-active-bar"},t))}var mZt=function(r){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,a){if(typeof r=="number")return r;var o=Us(n)||zEt(n);return o?r(n,a):(o||Lk(),s)}},pZt=["value","background"],Jqe;function g3(t){"@babel/helpers - typeof";return g3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},g3(t)}function fZt(t,r){if(t==null)return{};var s=gZt(t,r),n,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function gZt(t,r){if(t==null)return{};var s={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(r.indexOf(n)>=0)continue;s[n]=t[n]}return s}function Zse(){return Zse=Object.assign?Object.assign.bind():function(t){for(var r=1;r0&&Math.abs(fe)0&&Math.abs(ne)0&&(le=Math.min((tt||0)-(ne[Ae-1]||0),le))}),Number.isFinite(le)){var fe=le/ae,oe=j.layout==="vertical"?n.height:n.width;if(j.padding==="gap"&&($=fe*oe/2),j.padding==="no-gap"){var de=rh(r.barCategoryGap,fe*oe),ue=fe*oe/2;$=ue-de-(ue-de)/oe*de}}}a==="xAxis"?H=[n.left+(I.left||0)+($||0),n.left+n.width-(I.right||0)-($||0)]:a==="yAxis"?H=d==="horizontal"?[n.top+n.height-(I.bottom||0),n.top+(I.top||0)]:[n.top+(I.top||0)+($||0),n.top+n.height-(I.bottom||0)-($||0)]:H=j.range,O&&(H=[H[1],H[0]]);var xe=vqe(j,o,v),Te=xe.scale,be=xe.realScaleType;Te.domain(A).range(H),_qe(Te);var we=bqe(Te,wf(wf({},j),{},{realScaleType:be}));a==="xAxis"?(se=S==="top"&&!F||S==="bottom"&&F,W=n.left,X=y[B]-se*j.height):a==="yAxis"&&(se=S==="left"&&!F||S==="right"&&F,W=y[B]-se*j.width,X=n.top);var ve=wf(wf(wf({},j),we),{},{realScaleType:be,x:W,y:X,scale:Te,width:a==="xAxis"?n.width:j.width,height:a==="yAxis"?n.height:j.height});return ve.bandSize=Lse(ve,we),!j.hide&&a==="xAxis"?y[B]+=(se?-1:1)*ve.height:j.hide||(y[B]+=(se?-1:1)*ve.width),wf(wf({},b),{},zie({},N,ve))},{})},sVe=function(r,s){var n=r.x,a=r.y,o=s.x,l=s.y;return{x:Math.min(n,o),y:Math.min(a,l),width:Math.abs(o-n),height:Math.abs(l-a)}},MZt=function(r){var s=r.x1,n=r.y1,a=r.x2,o=r.y2;return sVe({x:s,y:n},{x:a,y:o})},nVe=function(){function t(r){kZt(this,t),this.scale=r}return NZt(t,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(s){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=n.bandAware,o=n.position;if(s!==void 0){if(o)switch(o){case"start":return this.scale(s);case"middle":{var l=this.bandwidth?this.bandwidth()/2:0;return this.scale(s)+l}case"end":{var i=this.bandwidth?this.bandwidth():0;return this.scale(s)+i}default:return this.scale(s)}if(a){var d=this.bandwidth?this.bandwidth()/2:0;return this.scale(s)+d}return this.scale(s)}}},{key:"isInRange",value:function(s){var n=this.range(),a=n[0],o=n[n.length-1];return a<=o?s>=a&&s<=o:s>=o&&s<=a}}],[{key:"create",value:function(s){return new t(s)}}])}();zie(nVe,"EPS",1e-4);var ove=function(r){var s=Object.keys(r).reduce(function(n,a){return wf(wf({},n),{},zie({},a,nVe.create(r[a])))},{});return wf(wf({},s),{},{apply:function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=o.bandAware,i=o.position;return GKt(a,function(d,m){return s[m].apply(d,{bandAware:l,position:i})})},isInRange:function(a){return Qqe(a,function(o,l){return s[l].isInRange(o)})}})};function TZt(t){return(t%180+180)%180}var AZt=function(r){var s=r.width,n=r.height,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=TZt(a),l=o*Math.PI/180,i=Math.atan(n/s),d=l>i&&l-1?a[o?r[l]:l]:void 0}}var OZt=LZt,DZt=Kqe;function RZt(t){var r=DZt(t),s=r%1;return r===r?s?r-s:r:0}var FZt=RZt,zZt=J$e,BZt=gx,$Zt=FZt,UZt=Math.max;function qZt(t,r,s){var n=t==null?0:t.length;if(!n)return-1;var a=s==null?0:$Zt(s);return a<0&&(a=UZt(n+a,0)),zZt(t,BZt(r),a)}var VZt=qZt,HZt=OZt,WZt=VZt,GZt=HZt(WZt),KZt=GZt;const ZZt=oo(KZt);var YZt=HAt(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),lve=E.createContext(void 0),cve=E.createContext(void 0),aVe=E.createContext(void 0),iVe=E.createContext({}),oVe=E.createContext(void 0),lVe=E.createContext(0),cVe=E.createContext(0),cTe=function(r){var s=r.state,n=s.xAxisMap,a=s.yAxisMap,o=s.offset,l=r.clipPathId,i=r.children,d=r.width,m=r.height,g=YZt(o);return lt.createElement(lve.Provider,{value:n},lt.createElement(cve.Provider,{value:a},lt.createElement(iVe.Provider,{value:o},lt.createElement(aVe.Provider,{value:g},lt.createElement(oVe.Provider,{value:l},lt.createElement(lVe.Provider,{value:m},lt.createElement(cVe.Provider,{value:d},i)))))))},XZt=function(){return E.useContext(oVe)},dVe=function(r){var s=E.useContext(lve);s==null&&Lk();var n=s[r];return n==null&&Lk(),n},QZt=function(){var r=E.useContext(lve);return g1(r)},JZt=function(){var r=E.useContext(cve),s=ZZt(r,function(n){return Qqe(n.domain,Number.isFinite)});return s||g1(r)},uVe=function(r){var s=E.useContext(cve);s==null&&Lk();var n=s[r];return n==null&&Lk(),n},eYt=function(){var r=E.useContext(aVe);return r},tYt=function(){return E.useContext(iVe)},dve=function(){return E.useContext(cVe)},uve=function(){return E.useContext(lVe)};function x3(t){"@babel/helpers - typeof";return x3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},x3(t)}function rYt(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function sYt(t,r){for(var s=0;st.length)&&(r=t.length);for(var s=0,n=new Array(r);st*a)return!1;var o=s();return t*(r-t*o/2-n)>=0&&t*(r+t*o/2-a)<=0}function FYt(t,r){return yVe(t,r+1)}function zYt(t,r,s,n,a){for(var o=(n||[]).slice(),l=r.start,i=r.end,d=0,m=1,g=l,y=function(){var N=n==null?void 0:n[d];if(N===void 0)return{v:yVe(n,m)};var j=d,S,A=function(){return S===void 0&&(S=s(N,j)),S},M=N.coordinate,I=d===0||ene(t,M,A,g,i);I||(d=0,g=l,m+=1),I&&(g=M+t*(A()/2+a),d+=m)},v;m<=o.length;)if(v=y(),v)return v.v;return[]}function ZI(t){"@babel/helpers - typeof";return ZI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ZI(t)}function xTe(t,r){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),s.push.apply(s,n)}return s}function yu(t){for(var r=1;r0?b.coordinate-S*t:b.coordinate})}else o[v]=b=yu(yu({},b),{},{tickCoord:b.coordinate});var A=ene(t,b.tickCoord,j,i,d);A&&(d=b.tickCoord-t*(j()/2+a),o[v]=yu(yu({},b),{},{isShow:!0}))},g=l-1;g>=0;g--)m(g);return o}function VYt(t,r,s,n,a,o){var l=(n||[]).slice(),i=l.length,d=r.start,m=r.end;if(o){var g=n[i-1],y=s(g,i-1),v=t*(g.coordinate+t*y/2-m);l[i-1]=g=yu(yu({},g),{},{tickCoord:v>0?g.coordinate-v*t:g.coordinate});var b=ene(t,g.tickCoord,function(){return y},d,m);b&&(m=g.tickCoord-t*(y/2+a),l[i-1]=yu(yu({},g),{},{isShow:!0}))}for(var N=o?i-1:i,j=function(M){var I=l[M],F,O=function(){return F===void 0&&(F=s(I,M)),F};if(M===0){var B=t*(I.coordinate-t*O()/2-d);l[M]=I=yu(yu({},I),{},{tickCoord:B<0?I.coordinate-B*t:I.coordinate})}else l[M]=I=yu(yu({},I),{},{tickCoord:I.coordinate});var $=ene(t,I.tickCoord,O,d,m);$&&(d=I.tickCoord+t*(O()/2+a),l[M]=yu(yu({},I),{},{isShow:!0}))},S=0;S=2?th(a[1].coordinate-a[0].coordinate):1,A=RYt(o,S,b);return d==="equidistantPreserveStart"?zYt(S,A,j,a,l):(d==="preserveStart"||d==="preserveStartEnd"?v=VYt(S,A,j,a,l,d==="preserveStartEnd"):v=qYt(S,A,j,a,l),v.filter(function(M){return M.isShow}))}var HYt=["viewBox"],WYt=["viewBox"],GYt=["ticks"];function _3(t){"@babel/helpers - typeof";return _3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},_3(t)}function wS(){return wS=Object.assign?Object.assign.bind():function(t){for(var r=1;r=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function KYt(t,r){if(t==null)return{};var s={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(r.indexOf(n)>=0)continue;s[n]=t[n]}return s}function ZYt(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function vTe(t,r){for(var s=0;s0?d(this.props):d(b)),l<=0||i<=0||!N||!N.length?null:lt.createElement(Fo,{className:vi("recharts-cartesian-axis",m),ref:function(S){n.layerReference=S}},o&&this.renderAxisLine(),this.renderTicks(N,this.state.fontSize,this.state.letterSpacing),Fd.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,a,o){var l,i=vi(a.className,"recharts-cartesian-axis-tick-value");return lt.isValidElement(n)?l=lt.cloneElement(n,ld(ld({},a),{},{className:i})):Ja(n)?l=n(ld(ld({},a),{},{className:i})):l=lt.createElement(Ik,wS({},a,{className:"recharts-cartesian-axis-tick-value"}),o),l}}])}(E.Component);fve(m5,"displayName","CartesianAxis");fve(m5,"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 rXt=["x1","y1","x2","y2","key"],sXt=["offset"];function Ok(t){"@babel/helpers - typeof";return Ok=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ok(t)}function _Te(t,r){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),s.push.apply(s,n)}return s}function _u(t){for(var r=1;r=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function oXt(t,r){if(t==null)return{};var s={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(r.indexOf(n)>=0)continue;s[n]=t[n]}return s}var lXt=function(r){var s=r.fill;if(!s||s==="none")return null;var n=r.fillOpacity,a=r.x,o=r.y,l=r.width,i=r.height,d=r.ry;return lt.createElement("rect",{x:a,y:o,ry:d,width:l,height:i,stroke:"none",fill:s,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function bVe(t,r){var s;if(lt.isValidElement(t))s=lt.cloneElement(t,r);else if(Ja(t))s=t(r);else{var n=r.x1,a=r.y1,o=r.x2,l=r.y2,i=r.key,d=bTe(r,rXt),m=Ga(d,!1);m.offset;var g=bTe(m,sXt);s=lt.createElement("line",bj({},g,{x1:n,y1:a,x2:o,y2:l,fill:"none",key:i}))}return s}function cXt(t){var r=t.x,s=t.width,n=t.horizontal,a=n===void 0?!0:n,o=t.horizontalPoints;if(!a||!o||!o.length)return null;var l=o.map(function(i,d){var m=_u(_u({},t),{},{x1:r,y1:i,x2:r+s,y2:i,key:"line-".concat(d),index:d});return bVe(a,m)});return lt.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function dXt(t){var r=t.y,s=t.height,n=t.vertical,a=n===void 0?!0:n,o=t.verticalPoints;if(!a||!o||!o.length)return null;var l=o.map(function(i,d){var m=_u(_u({},t),{},{x1:i,y1:r,x2:i,y2:r+s,key:"line-".concat(d),index:d});return bVe(a,m)});return lt.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function uXt(t){var r=t.horizontalFill,s=t.fillOpacity,n=t.x,a=t.y,o=t.width,l=t.height,i=t.horizontalPoints,d=t.horizontal,m=d===void 0?!0:d;if(!m||!r||!r.length)return null;var g=i.map(function(v){return Math.round(v+a-a)}).sort(function(v,b){return v-b});a!==g[0]&&g.unshift(0);var y=g.map(function(v,b){var N=!g[b+1],j=N?a+l-v:g[b+1]-v;if(j<=0)return null;var S=b%r.length;return lt.createElement("rect",{key:"react-".concat(b),y:v,x:n,height:j,width:o,stroke:"none",fill:r[S],fillOpacity:s,className:"recharts-cartesian-grid-bg"})});return lt.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},y)}function hXt(t){var r=t.vertical,s=r===void 0?!0:r,n=t.verticalFill,a=t.fillOpacity,o=t.x,l=t.y,i=t.width,d=t.height,m=t.verticalPoints;if(!s||!n||!n.length)return null;var g=m.map(function(v){return Math.round(v+o-o)}).sort(function(v,b){return v-b});o!==g[0]&&g.unshift(0);var y=g.map(function(v,b){var N=!g[b+1],j=N?o+i-v:g[b+1]-v;if(j<=0)return null;var S=b%n.length;return lt.createElement("rect",{key:"react-".concat(b),x:v,y:l,width:j,height:d,stroke:"none",fill:n[S],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return lt.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},y)}var mXt=function(r,s){var n=r.xAxis,a=r.width,o=r.height,l=r.offset;return yqe(pve(_u(_u(_u({},m5.defaultProps),n),{},{ticks:uy(n,!0),viewBox:{x:0,y:0,width:a,height:o}})),l.left,l.left+l.width,s)},pXt=function(r,s){var n=r.yAxis,a=r.width,o=r.height,l=r.offset;return yqe(pve(_u(_u(_u({},m5.defaultProps),n),{},{ticks:uy(n,!0),viewBox:{x:0,y:0,width:a,height:o}})),l.top,l.top+l.height,s)},Y4={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function wVe(t){var r,s,n,a,o,l,i=dve(),d=uve(),m=tYt(),g=_u(_u({},t),{},{stroke:(r=t.stroke)!==null&&r!==void 0?r:Y4.stroke,fill:(s=t.fill)!==null&&s!==void 0?s:Y4.fill,horizontal:(n=t.horizontal)!==null&&n!==void 0?n:Y4.horizontal,horizontalFill:(a=t.horizontalFill)!==null&&a!==void 0?a:Y4.horizontalFill,vertical:(o=t.vertical)!==null&&o!==void 0?o:Y4.vertical,verticalFill:(l=t.verticalFill)!==null&&l!==void 0?l:Y4.verticalFill,x:Us(t.x)?t.x:m.left,y:Us(t.y)?t.y:m.top,width:Us(t.width)?t.width:m.width,height:Us(t.height)?t.height:m.height}),y=g.x,v=g.y,b=g.width,N=g.height,j=g.syncWithTicks,S=g.horizontalValues,A=g.verticalValues,M=QZt(),I=JZt();if(!Us(b)||b<=0||!Us(N)||N<=0||!Us(y)||y!==+y||!Us(v)||v!==+v)return null;var F=g.verticalCoordinatesGenerator||mXt,O=g.horizontalCoordinatesGenerator||pXt,B=g.horizontalPoints,$=g.verticalPoints;if((!B||!B.length)&&Ja(O)){var H=S&&S.length,W=O({yAxis:I?_u(_u({},I),{},{ticks:H?S:I.ticks}):void 0,width:i,height:d,offset:m},H?!0:j);Hf(Array.isArray(W),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Ok(W),"]")),Array.isArray(W)&&(B=W)}if((!$||!$.length)&&Ja(F)){var X=A&&A.length,se=F({xAxis:M?_u(_u({},M),{},{ticks:X?A:M.ticks}):void 0,width:i,height:d,offset:m},X?!0:j);Hf(Array.isArray(se),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Ok(se),"]")),Array.isArray(se)&&($=se)}return lt.createElement("g",{className:"recharts-cartesian-grid"},lt.createElement(lXt,{fill:g.fill,fillOpacity:g.fillOpacity,x:g.x,y:g.y,width:g.width,height:g.height,ry:g.ry}),lt.createElement(cXt,bj({},g,{offset:m,horizontalPoints:B,xAxis:M,yAxis:I})),lt.createElement(dXt,bj({},g,{offset:m,verticalPoints:$,xAxis:M,yAxis:I})),lt.createElement(uXt,bj({},g,{horizontalPoints:B})),lt.createElement(hXt,bj({},g,{verticalPoints:$})))}wVe.displayName="CartesianGrid";function b3(t){"@babel/helpers - typeof";return b3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},b3(t)}function fXt(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function gXt(t,r){for(var s=0;st.length)&&(r=t.length);for(var s=0,n=new Array(r);s=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function rQt(t,r){if(t==null)return{};var s={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(r.indexOf(n)>=0)continue;s[n]=t[n]}return s}function sQt(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function nQt(t,r){for(var s=0;st.length)&&(r=t.length);for(var s=0,n=new Array(r);s0?l:r&&r.length&&Us(a)&&Us(o)?r.slice(a,o+1):[]};function DVe(t){return t==="number"?[0,"auto"]:void 0}var nge=function(r,s,n,a){var o=r.graphicalItems,l=r.tooltipAxis,i=Wie(s,r);return n<0||!o||!o.length||n>=i.length?null:o.reduce(function(d,m){var g,y=(g=m.props.data)!==null&&g!==void 0?g:s;y&&r.dataStartIndex+r.dataEndIndex!==0&&r.dataEndIndex-r.dataStartIndex>=n&&(y=y.slice(r.dataStartIndex,r.dataEndIndex+1));var v;if(l.dataKey&&!l.allowDuplicatedCategory){var b=y===void 0?i:y;v=Epe(b,l.dataKey,a)}else v=y&&y[n]||i[n];return v?[].concat(k3(d),[jqe(m,v)]):d},[])},CTe=function(r,s,n,a){var o=a||{x:r.chartX,y:r.chartY},l=gQt(o,n),i=r.orderedTooltipTicks,d=r.tooltipAxis,m=r.tooltipTicks,g=XUt(l,i,m,d);if(g>=0&&m){var y=m[g]&&m[g].value,v=nge(r,s,g,y),b=xQt(n,i,g,o);return{activeTooltipIndex:g,activeLabel:y,activePayload:v,activeCoordinate:b}}return null},yQt=function(r,s){var n=s.axes,a=s.graphicalItems,o=s.axisType,l=s.axisIdKey,i=s.stackGroups,d=s.dataStartIndex,m=s.dataEndIndex,g=r.layout,y=r.children,v=r.stackOffset,b=xqe(g,o);return n.reduce(function(N,j){var S,A=j.type.defaultProps!==void 0?is(is({},j.type.defaultProps),j.props):j.props,M=A.type,I=A.dataKey,F=A.allowDataOverflow,O=A.allowDuplicatedCategory,B=A.scale,$=A.ticks,H=A.includeHidden,W=A[l];if(N[W])return N;var X=Wie(r.data,{graphicalItems:a.filter(function(we){var ve,tt=l in we.props?we.props[l]:(ve=we.type.defaultProps)===null||ve===void 0?void 0:ve[l];return tt===W}),dataStartIndex:d,dataEndIndex:m}),se=X.length,ae,le,ne;VXt(A.domain,F,M)&&(ae=vfe(A.domain,null,F),b&&(M==="number"||B!=="auto")&&(ne=xE(X,I,"category")));var fe=DVe(M);if(!ae||ae.length===0){var oe,de=(oe=A.domain)!==null&&oe!==void 0?oe:fe;if(I){if(ae=xE(X,I,M),M==="category"&&b){var ue=$Et(ae);O&&ue?(le=ae,ae=Wse(0,se)):O||(ae=Q5e(de,ae,j).reduce(function(we,ve){return we.indexOf(ve)>=0?we:[].concat(k3(we),[ve])},[]))}else if(M==="category")O?ae=ae.filter(function(we){return we!==""&&!Ri(we)}):ae=Q5e(de,ae,j).reduce(function(we,ve){return we.indexOf(ve)>=0||ve===""||Ri(ve)?we:[].concat(k3(we),[ve])},[]);else if(M==="number"){var xe=rqt(X,a.filter(function(we){var ve,tt,Ae=l in we.props?we.props[l]:(ve=we.type.defaultProps)===null||ve===void 0?void 0:ve[l],Le="hide"in we.props?we.props.hide:(tt=we.type.defaultProps)===null||tt===void 0?void 0:tt.hide;return Ae===W&&(H||!Le)}),I,o,g);xe&&(ae=xe)}b&&(M==="number"||B!=="auto")&&(ne=xE(X,I,"category"))}else b?ae=Wse(0,se):i&&i[W]&&i[W].hasStack&&M==="number"?ae=v==="expand"?[0,1]:wqe(i[W].stackGroups,d,m):ae=gqe(X,a.filter(function(we){var ve=l in we.props?we.props[l]:we.type.defaultProps[l],tt="hide"in we.props?we.props.hide:we.type.defaultProps.hide;return ve===W&&(H||!tt)}),M,g,!0);if(M==="number")ae=tge(y,ae,W,o,$),de&&(ae=vfe(de,ae,F));else if(M==="category"&&de){var Te=de,be=ae.every(function(we){return Te.indexOf(we)>=0});be&&(ae=Te)}}return is(is({},N),{},Ra({},W,is(is({},A),{},{axisType:o,domain:ae,categoricalDomain:ne,duplicateDomain:le,originalDomain:(S=A.domain)!==null&&S!==void 0?S:fe,isCategorical:b,layout:g})))},{})},vQt=function(r,s){var n=s.graphicalItems,a=s.Axis,o=s.axisType,l=s.axisIdKey,i=s.stackGroups,d=s.dataStartIndex,m=s.dataEndIndex,g=r.layout,y=r.children,v=Wie(r.data,{graphicalItems:n,dataStartIndex:d,dataEndIndex:m}),b=v.length,N=xqe(g,o),j=-1;return n.reduce(function(S,A){var M=A.type.defaultProps!==void 0?is(is({},A.type.defaultProps),A.props):A.props,I=M[l],F=DVe("number");if(!S[I]){j++;var O;return N?O=Wse(0,b):i&&i[I]&&i[I].hasStack?(O=wqe(i[I].stackGroups,d,m),O=tge(y,O,I,o)):(O=vfe(F,gqe(v,n.filter(function(B){var $,H,W=l in B.props?B.props[l]:($=B.type.defaultProps)===null||$===void 0?void 0:$[l],X="hide"in B.props?B.props.hide:(H=B.type.defaultProps)===null||H===void 0?void 0:H.hide;return W===I&&!X}),"number",g),a.defaultProps.allowDataOverflow),O=tge(y,O,I,o)),is(is({},S),{},Ra({},I,is(is({axisType:o},a.defaultProps),{},{hide:!0,orientation:Mm(pQt,"".concat(o,".").concat(j%2),null),domain:O,originalDomain:F,isCategorical:N,layout:g})))}return S},{})},_Qt=function(r,s){var n=s.axisType,a=n===void 0?"xAxis":n,o=s.AxisComp,l=s.graphicalItems,i=s.stackGroups,d=s.dataStartIndex,m=s.dataEndIndex,g=r.children,y="".concat(a,"Id"),v=Sp(g,o),b={};return v&&v.length?b=yQt(r,{axes:v,graphicalItems:l,axisType:a,axisIdKey:y,stackGroups:i,dataStartIndex:d,dataEndIndex:m}):l&&l.length&&(b=vQt(r,{Axis:o,graphicalItems:l,axisType:a,axisIdKey:y,stackGroups:i,dataStartIndex:d,dataEndIndex:m})),b},bQt=function(r){var s=g1(r),n=uy(s,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:I1e(n,function(a){return a.coordinate}),tooltipAxis:s,tooltipAxisBandSize:Lse(s,n)}},MTe=function(r){var s=r.children,n=r.defaultShowTooltip,a=lm(s,f3),o=0,l=0;return r.data&&r.data.length!==0&&(l=r.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:!!n}},wQt=function(r){return!r||!r.length?!1:r.some(function(s){var n=Ny(s&&s.type);return n&&n.indexOf("Bar")>=0})},TTe=function(r){return r==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:r==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:r==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},jQt=function(r,s){var n=r.props,a=r.graphicalItems,o=r.xAxisMap,l=o===void 0?{}:o,i=r.yAxisMap,d=i===void 0?{}:i,m=n.width,g=n.height,y=n.children,v=n.margin||{},b=lm(y,f3),N=lm(y,mC),j=Object.keys(d).reduce(function(O,B){var $=d[B],H=$.orientation;return!$.mirror&&!$.hide?is(is({},O),{},Ra({},H,O[H]+$.width)):O},{left:v.left||0,right:v.right||0}),S=Object.keys(l).reduce(function(O,B){var $=l[B],H=$.orientation;return!$.mirror&&!$.hide?is(is({},O),{},Ra({},H,Mm(O,"".concat(H))+$.height)):O},{top:v.top||0,bottom:v.bottom||0}),A=is(is({},S),j),M=A.bottom;b&&(A.bottom+=b.props.height||f3.defaultProps.height),N&&s&&(A=eqt(A,a,n,s));var I=m-A.left-A.right,F=g-A.top-A.bottom;return is(is({brushBottom:M},A),{},{width:Math.max(I,0),height:Math.max(F,0)})},kQt=function(r,s){if(s==="xAxis")return r[s].width;if(s==="yAxis")return r[s].height},RVe=function(r){var s=r.chartName,n=r.GraphicalChild,a=r.defaultTooltipEventType,o=a===void 0?"axis":a,l=r.validateTooltipEventTypes,i=l===void 0?["axis"]:l,d=r.axisComponents,m=r.legendContent,g=r.formatAxisMap,y=r.defaultProps,v=function(A,M){var I=M.graphicalItems,F=M.stackGroups,O=M.offset,B=M.updateId,$=M.dataStartIndex,H=M.dataEndIndex,W=A.barSize,X=A.layout,se=A.barGap,ae=A.barCategoryGap,le=A.maxBarSize,ne=TTe(X),fe=ne.numericAxisName,oe=ne.cateAxisName,de=wQt(I),ue=[];return I.forEach(function(xe,Te){var be=Wie(A.data,{graphicalItems:[xe],dataStartIndex:$,dataEndIndex:H}),we=xe.type.defaultProps!==void 0?is(is({},xe.type.defaultProps),xe.props):xe.props,ve=we.dataKey,tt=we.maxBarSize,Ae=we["".concat(fe,"Id")],Le=we["".concat(oe,"Id")],Ue={},Ye=d.reduce(function(Je,Xe){var Ve=M["".concat(Xe.axisType,"Map")],ot=we["".concat(Xe.axisType,"Id")];Ve&&Ve[ot]||Xe.axisType==="zAxis"||Lk();var mt=Ve[ot];return is(is({},Je),{},Ra(Ra({},Xe.axisType,mt),"".concat(Xe.axisType,"Ticks"),uy(mt)))},Ue),Ie=Ye[oe],et=Ye["".concat(oe,"Ticks")],It=F&&F[Ae]&&F[Ae].hasStack&&uqt(xe,F[Ae].stackGroups),Pe=Ny(xe.type).indexOf("Bar")>=0,at=Lse(Ie,et),ce=[],$e=de&&QUt({barSize:W,stackGroups:F,totalSize:kQt(Ye,oe)});if(Pe){var Ge,rt,je=Ri(tt)?le:tt,it=(Ge=(rt=Lse(Ie,et,!0))!==null&&rt!==void 0?rt:je)!==null&&Ge!==void 0?Ge:0;ce=JUt({barGap:se,barCategoryGap:ae,bandSize:it!==at?it:at,sizeList:$e[Le],maxBarSize:je}),it!==at&&(ce=ce.map(function(Je){return is(is({},Je),{},{position:is(is({},Je.position),{},{offset:Je.position.offset-it/2})})}))}var Me=xe&&xe.type&&xe.type.getComposedData;Me&&ue.push({props:is(is({},Me(is(is({},Ye),{},{displayedData:be,props:A,dataKey:ve,item:xe,bandSize:at,barPosition:ce,offset:O,stackedData:It,layout:X,dataStartIndex:$,dataEndIndex:H}))),{},Ra(Ra(Ra({key:xe.key||"item-".concat(Te)},fe,Ye[fe]),oe,Ye[oe]),"animationId",B)),childIndex:JEt(xe,A.children),item:xe})}),ue},b=function(A,M){var I=A.props,F=A.dataStartIndex,O=A.dataEndIndex,B=A.updateId;if(!WCe({props:I}))return null;var $=I.children,H=I.layout,W=I.stackOffset,X=I.data,se=I.reverseStackOrder,ae=TTe(H),le=ae.numericAxisName,ne=ae.cateAxisName,fe=Sp($,n),oe=cqt(X,fe,"".concat(le,"Id"),"".concat(ne,"Id"),W,se),de=d.reduce(function(we,ve){var tt="".concat(ve.axisType,"Map");return is(is({},we),{},Ra({},tt,_Qt(I,is(is({},ve),{},{graphicalItems:fe,stackGroups:ve.axisType===le&&oe,dataStartIndex:F,dataEndIndex:O}))))},{}),ue=jQt(is(is({},de),{},{props:I,graphicalItems:fe}),M==null?void 0:M.legendBBox);Object.keys(de).forEach(function(we){de[we]=g(I,de[we],ue,we.replace("Map",""),s)});var xe=de["".concat(ne,"Map")],Te=bQt(xe),be=v(I,is(is({},de),{},{dataStartIndex:F,dataEndIndex:O,updateId:B,graphicalItems:fe,stackGroups:oe,offset:ue}));return is(is({formattedGraphicalItems:be,graphicalItems:fe,offset:ue,stackGroups:oe},Te),de)},N=function(S){function A(M){var I,F,O;return sQt(this,A),O=iQt(this,A,[M]),Ra(O,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Ra(O,"accessibilityManager",new qXt),Ra(O,"handleLegendBBoxUpdate",function(B){if(B){var $=O.state,H=$.dataStartIndex,W=$.dataEndIndex,X=$.updateId;O.setState(is({legendBBox:B},b({props:O.props,dataStartIndex:H,dataEndIndex:W,updateId:X},is(is({},O.state),{},{legendBBox:B}))))}}),Ra(O,"handleReceiveSyncEvent",function(B,$,H){if(O.props.syncId===B){if(H===O.eventEmitterSymbol&&typeof O.props.syncMethod!="function")return;O.applySyncEvent($)}}),Ra(O,"handleBrushChange",function(B){var $=B.startIndex,H=B.endIndex;if($!==O.state.dataStartIndex||H!==O.state.dataEndIndex){var W=O.state.updateId;O.setState(function(){return is({dataStartIndex:$,dataEndIndex:H},b({props:O.props,dataStartIndex:$,dataEndIndex:H,updateId:W},O.state))}),O.triggerSyncEvent({dataStartIndex:$,dataEndIndex:H})}}),Ra(O,"handleMouseEnter",function(B){var $=O.getMouseInfo(B);if($){var H=is(is({},$),{},{isTooltipActive:!0});O.setState(H),O.triggerSyncEvent(H);var W=O.props.onMouseEnter;Ja(W)&&W(H,B)}}),Ra(O,"triggeredAfterMouseMove",function(B){var $=O.getMouseInfo(B),H=$?is(is({},$),{},{isTooltipActive:!0}):{isTooltipActive:!1};O.setState(H),O.triggerSyncEvent(H);var W=O.props.onMouseMove;Ja(W)&&W(H,B)}),Ra(O,"handleItemMouseEnter",function(B){O.setState(function(){return{isTooltipActive:!0,activeItem:B,activePayload:B.tooltipPayload,activeCoordinate:B.tooltipPosition||{x:B.cx,y:B.cy}}})}),Ra(O,"handleItemMouseLeave",function(){O.setState(function(){return{isTooltipActive:!1}})}),Ra(O,"handleMouseMove",function(B){B.persist(),O.throttleTriggeredAfterMouseMove(B)}),Ra(O,"handleMouseLeave",function(B){O.throttleTriggeredAfterMouseMove.cancel();var $={isTooltipActive:!1};O.setState($),O.triggerSyncEvent($);var H=O.props.onMouseLeave;Ja(H)&&H($,B)}),Ra(O,"handleOuterEvent",function(B){var $=QEt(B),H=Mm(O.props,"".concat($));if($&&Ja(H)){var W,X;/.*touch.*/i.test($)?X=O.getMouseInfo(B.changedTouches[0]):X=O.getMouseInfo(B),H((W=X)!==null&&W!==void 0?W:{},B)}}),Ra(O,"handleClick",function(B){var $=O.getMouseInfo(B);if($){var H=is(is({},$),{},{isTooltipActive:!0});O.setState(H),O.triggerSyncEvent(H);var W=O.props.onClick;Ja(W)&&W(H,B)}}),Ra(O,"handleMouseDown",function(B){var $=O.props.onMouseDown;if(Ja($)){var H=O.getMouseInfo(B);$(H,B)}}),Ra(O,"handleMouseUp",function(B){var $=O.props.onMouseUp;if(Ja($)){var H=O.getMouseInfo(B);$(H,B)}}),Ra(O,"handleTouchMove",function(B){B.changedTouches!=null&&B.changedTouches.length>0&&O.throttleTriggeredAfterMouseMove(B.changedTouches[0])}),Ra(O,"handleTouchStart",function(B){B.changedTouches!=null&&B.changedTouches.length>0&&O.handleMouseDown(B.changedTouches[0])}),Ra(O,"handleTouchEnd",function(B){B.changedTouches!=null&&B.changedTouches.length>0&&O.handleMouseUp(B.changedTouches[0])}),Ra(O,"handleDoubleClick",function(B){var $=O.props.onDoubleClick;if(Ja($)){var H=O.getMouseInfo(B);$(H,B)}}),Ra(O,"handleContextMenu",function(B){var $=O.props.onContextMenu;if(Ja($)){var H=O.getMouseInfo(B);$(H,B)}}),Ra(O,"triggerSyncEvent",function(B){O.props.syncId!==void 0&&_ue.emit(bue,O.props.syncId,B,O.eventEmitterSymbol)}),Ra(O,"applySyncEvent",function(B){var $=O.props,H=$.layout,W=$.syncMethod,X=O.state.updateId,se=B.dataStartIndex,ae=B.dataEndIndex;if(B.dataStartIndex!==void 0||B.dataEndIndex!==void 0)O.setState(is({dataStartIndex:se,dataEndIndex:ae},b({props:O.props,dataStartIndex:se,dataEndIndex:ae,updateId:X},O.state)));else if(B.activeTooltipIndex!==void 0){var le=B.chartX,ne=B.chartY,fe=B.activeTooltipIndex,oe=O.state,de=oe.offset,ue=oe.tooltipTicks;if(!de)return;if(typeof W=="function")fe=W(ue,B);else if(W==="value"){fe=-1;for(var xe=0;xe=0){var It,Pe;if(le.dataKey&&!le.allowDuplicatedCategory){var at=typeof le.dataKey=="function"?et:"payload.".concat(le.dataKey.toString());It=Epe(xe,at,fe),Pe=Te&&be&&Epe(be,at,fe)}else It=xe==null?void 0:xe[ne],Pe=Te&&be&&be[ne];if(Le||Ae){var ce=B.props.activeIndex!==void 0?B.props.activeIndex:ne;return[E.cloneElement(B,is(is(is({},W.props),Ye),{},{activeIndex:ce})),null,null]}if(!Ri(It))return[Ie].concat(k3(O.renderActivePoints({item:W,activePoint:It,basePoint:Pe,childIndex:ne,isRange:Te})))}else{var $e,Ge=($e=O.getItemByXY(O.state.activeCoordinate))!==null&&$e!==void 0?$e:{graphicalItem:Ie},rt=Ge.graphicalItem,je=rt.item,it=je===void 0?B:je,Me=rt.childIndex,Je=is(is(is({},W.props),Ye),{},{activeIndex:Me});return[E.cloneElement(it,Je),null,null]}return Te?[Ie,null,null]:[Ie,null]}),Ra(O,"renderCustomized",function(B,$,H){return E.cloneElement(B,is(is({key:"recharts-customized-".concat(H)},O.props),O.state))}),Ra(O,"renderMap",{CartesianGrid:{handler:sO,once:!0},ReferenceArea:{handler:O.renderReferenceElement},ReferenceLine:{handler:sO},ReferenceDot:{handler:O.renderReferenceElement},XAxis:{handler:sO},YAxis:{handler:sO},Brush:{handler:O.renderBrush,once:!0},Bar:{handler:O.renderGraphicChild},Line:{handler:O.renderGraphicChild},Area:{handler:O.renderGraphicChild},Radar:{handler:O.renderGraphicChild},RadialBar:{handler:O.renderGraphicChild},Scatter:{handler:O.renderGraphicChild},Pie:{handler:O.renderGraphicChild},Funnel:{handler:O.renderGraphicChild},Tooltip:{handler:O.renderCursor,once:!0},PolarGrid:{handler:O.renderPolarGrid,once:!0},PolarAngleAxis:{handler:O.renderPolarAxis},PolarRadiusAxis:{handler:O.renderPolarAxis},Customized:{handler:O.renderCustomized}}),O.clipPathId="".concat((I=M.id)!==null&&I!==void 0?I:BP("recharts"),"-clip"),O.throttleTriggeredAfterMouseMove=mUe(O.triggeredAfterMouseMove,(F=M.throttleDelay)!==null&&F!==void 0?F:1e3/60),O.state={},O}return cQt(A,S),aQt(A,[{key:"componentDidMount",value:function(){var I,F;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(I=this.props.margin.left)!==null&&I!==void 0?I:0,top:(F=this.props.margin.top)!==null&&F!==void 0?F:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var I=this.props,F=I.children,O=I.data,B=I.height,$=I.layout,H=lm(F,bf);if(H){var W=H.props.defaultIndex;if(!(typeof W!="number"||W<0||W>this.state.tooltipTicks.length-1)){var X=this.state.tooltipTicks[W]&&this.state.tooltipTicks[W].value,se=nge(this.state,O,W,X),ae=this.state.tooltipTicks[W].coordinate,le=(this.state.offset.top+B)/2,ne=$==="horizontal",fe=ne?{x:ae,y:le}:{y:ae,x:le},oe=this.state.formattedGraphicalItems.find(function(ue){var xe=ue.item;return xe.type.name==="Scatter"});oe&&(fe=is(is({},fe),oe.props.points[W].tooltipPosition),se=oe.props.points[W].tooltipPayload);var de={activeTooltipIndex:W,isTooltipActive:!0,activeLabel:X,activePayload:se,activeCoordinate:fe};this.setState(de),this.renderCursor(H),this.accessibilityManager.setIndex(W)}}}},{key:"getSnapshotBeforeUpdate",value:function(I,F){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==F.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 O,B;this.accessibilityManager.setDetails({offset:{left:(O=this.props.margin.left)!==null&&O!==void 0?O:0,top:(B=this.props.margin.top)!==null&&B!==void 0?B:0}})}return null}},{key:"componentDidUpdate",value:function(I){Ppe([lm(I.children,bf)],[lm(this.props.children,bf)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var I=lm(this.props.children,bf);if(I&&typeof I.props.shared=="boolean"){var F=I.props.shared?"axis":"item";return i.indexOf(F)>=0?F:o}return o}},{key:"getMouseInfo",value:function(I){if(!this.container)return null;var F=this.container,O=F.getBoundingClientRect(),B=N7t(O),$={chartX:Math.round(I.pageX-B.left),chartY:Math.round(I.pageY-B.top)},H=O.width/F.offsetWidth||1,W=this.inRange($.chartX,$.chartY,H);if(!W)return null;var X=this.state,se=X.xAxisMap,ae=X.yAxisMap,le=this.getTooltipEventType(),ne=CTe(this.state,this.props.data,this.props.layout,W);if(le!=="axis"&&se&&ae){var fe=g1(se).scale,oe=g1(ae).scale,de=fe&&fe.invert?fe.invert($.chartX):null,ue=oe&&oe.invert?oe.invert($.chartY):null;return is(is({},$),{},{xValue:de,yValue:ue},ne)}return ne?is(is({},$),ne):null}},{key:"inRange",value:function(I,F){var O=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,B=this.props.layout,$=I/O,H=F/O;if(B==="horizontal"||B==="vertical"){var W=this.state.offset,X=$>=W.left&&$<=W.left+W.width&&H>=W.top&&H<=W.top+W.height;return X?{x:$,y:H}:null}var se=this.state,ae=se.angleAxisMap,le=se.radiusAxisMap;if(ae&&le){var ne=g1(ae);return tMe({x:$,y:H},ne)}return null}},{key:"parseEventsOfWrapper",value:function(){var I=this.props.children,F=this.getTooltipEventType(),O=lm(I,bf),B={};O&&F==="axis"&&(O.props.trigger==="click"?B={onClick:this.handleClick}:B={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 $=ose(this.props,this.handleOuterEvent);return is(is({},$),B)}},{key:"addListener",value:function(){_ue.on(bue,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){_ue.removeListener(bue,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(I,F,O){for(var B=this.state.formattedGraphicalItems,$=0,H=B.length;$");return t}const BVe=E.forwardRef(({id:t,className:r,children:s,config:n,...a},o)=>{const l=E.useId(),i=`chart-${t||l.replace(/:/g,"")}`;return e.jsx(FVe.Provider,{value:{config:n},children:e.jsxs("div",{"data-chart":i,ref:o,className:qt("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",r),...a,children:[e.jsx(MQt,{id:i,config:n}),e.jsx(rfe,{children:s})]})})});BVe.displayName="Chart";const MQt=({id:t,config:r})=>{const s=Object.entries(r).filter(([n,a])=>a.theme||a.color);return s.length?e.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(CQt).map(([n,a])=>` ${a} [data-chart=${t}] { ${s.map(([o,l])=>{var d;const i=((d=l.theme)==null?void 0:d[n])||l.color;return i?` --color-${o}: ${i};`:null}).join(` `)} } `).join(` `)}}):null},$Ve=E.forwardRef(({active:t,payload:r,className:s,indicator:n="dot",hideLabel:a=!1,hideIndicator:o=!1,label:l,labelFormatter:i,labelClassName:d,formatter:m,color:g,nameKey:y,labelKey:v},b)=>{const{config:N}=zVe(),j=E.useMemo(()=>{var O;if(a||!(r!=null&&r.length))return null;const[A]=r,M=`${v||A.dataKey||A.name||"value"}`,I=age(N,A,M),F=!v&&typeof l=="string"?((O=N[l])==null?void 0:O.label)||l:I==null?void 0:I.label;return i?e.jsx("div",{className:qt("font-medium",d),children:i(F,r)}):F?e.jsx("div",{className:qt("font-medium",d),children:F}):null},[l,i,r,a,d,N,v]);if(!t||!(r!=null&&r.length))return null;const S=r.length===1&&n!=="dot";return e.jsxs("div",{ref:b,className:qt("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",s),children:[S?null:j,e.jsx("div",{className:"grid gap-1.5",children:r.map((A,M)=>{const I=`${y||A.name||A.dataKey||"value"}`,F=age(N,A,I),O=g||A.payload.fill||A.color;return e.jsx("div",{className:qt("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",n==="dot"&&"items-center"),children:m&&(A==null?void 0:A.value)!==void 0&&A.name?m(A.value,A.name,A,M,A.payload):e.jsxs(e.Fragment,{children:[F!=null&&F.icon?e.jsx(F.icon,{}):!o&&e.jsx("div",{className:qt("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":n==="dot","w-1":n==="line","w-0 border-[1.5px] border-dashed bg-transparent":n==="dashed","my-0.5":S&&n==="dashed"}),style:{"--color-bg":O,"--color-border":O}}),e.jsxs("div",{className:qt("flex flex-1 justify-between leading-none",S?"items-end":"items-center"),children:[e.jsxs("div",{className:"grid gap-1.5",children:[S?j:null,e.jsx("span",{className:"text-muted-foreground",children:(F==null?void 0:F.label)||A.name})]}),A.value&&e.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:A.value.toLocaleString()})]})]})},A.dataKey)})})]})});$Ve.displayName="ChartTooltip";const TQt=E.forwardRef(({className:t,hideIcon:r=!1,payload:s,verticalAlign:n="bottom",nameKey:a},o)=>{const{config:l}=zVe();return s!=null&&s.length?e.jsx("div",{ref:o,className:qt("flex items-center justify-center gap-4",n==="top"?"pb-3":"pt-3",t),children:s.map(i=>{const d=`${a||i.dataKey||"value"}`,m=age(l,i,d);return e.jsxs("div",{className:qt("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[m!=null&&m.icon&&!r?e.jsx(m.icon,{}):e.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:i.color}}),m==null?void 0:m.label]},i.value)})}):null});TQt.displayName="ChartLegend";function age(t,r,s){if(typeof r!="object"||r===null)return;const n="payload"in r&&typeof r.payload=="object"&&r.payload!==null?r.payload:void 0;let a=s;return s in r&&typeof r[s]=="string"?a=r[s]:n&&s in n&&typeof n[s]=="string"&&(a=n[s]),a in t?t[a]:t[s]}const nO=["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 UVe({stats:t,year:r}){const s=t.transactionsByMonth.some(a=>a.count>0),n=t.leadSourceBreakdown.length>0;return!s&&!n?e.jsx(ze,{children:e.jsx(qe,{className:"py-12 text-center text-muted-foreground",children:"Add transactions to see your performance charts"})}):e.jsxs("div",{className:"grid gap-6",children:[s&&e.jsxs(ze,{className:"overflow-hidden",children:[e.jsx(Wt,{children:e.jsx(Zt,{className:"text-base",children:"Transactions by Month"})}),e.jsx(qe,{className:"overflow-hidden",children:e.jsx(BVe,{config:{count:{label:"Transactions",color:"hsl(var(--primary))"}},className:"h-[250px]",children:e.jsx(rfe,{width:"100%",height:"100%",children:e.jsxs(NQt,{data:t.transactionsByMonth,margin:{top:5,right:10,left:0,bottom:5},children:[e.jsx(wVe,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(Vie,{dataKey:"month",tick:{fontSize:11},className:"fill-muted-foreground",interval:0}),e.jsx(Hie,{allowDecimals:!1,tick:{fontSize:12},className:"fill-muted-foreground",width:30}),e.jsx(bf,{content:e.jsx($Ve,{})}),e.jsx(Zk,{dataKey:"count",fill:"hsl(var(--primary))",radius:[4,4,0,0],name:"Transactions"})]})})})})]}),n&&e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{className:"text-base",children:"Lead Sources"})}),e.jsxs(qe,{children:[e.jsx("div",{className:"h-[250px]",children:e.jsx(rfe,{width:"100%",height:"100%",children:e.jsxs(SQt,{children:[e.jsx(Qy,{data:t.leadSourceBreakdown,dataKey:"count",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:a,percent:o})=>o>.05?`${a} (${(o*100).toFixed(0)}%)`:"",labelLine:!1,children:t.leadSourceBreakdown.map((a,o)=>e.jsx(vie,{fill:nO[o%nO.length]},`cell-${o}`))}),e.jsx(bf,{formatter:(a,o)=>[`${a} deals`,o]})]})})}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2 justify-center",children:t.leadSourceBreakdown.slice(0,6).map((a,o)=>e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx("div",{className:"w-3 h-3 rounded-sm",style:{backgroundColor:nO[o%nO.length]}}),e.jsx("span",{className:"text-muted-foreground",children:a.name})]},a.name))})]})]})]})}function AQt(t){if(!t||!t.trim())return null;const r=t.trim(),s=["yyyy-MM-dd","M/d/yyyy","MM/dd/yyyy","M-d-yyyy","MM-dd-yyyy","MM/dd/yy","M/d/yy"];for(const n of s)try{const a=xye(r,n,new Date);if(bme(a))return Xr(a,"yyyy-MM-dd")}catch{}try{const n=new Date(r);if(bme(n))return Xr(n,"yyyy-MM-dd")}catch{}return null}const EQt=["property_address","city","state","zip","transaction_type","close_date","sale_price","commission_amount","lead_source","client_type","is_win","notes"];function IQt({open:t,onOpenChange:r}){const[s,n]=E.useState([]),[a,o]=E.useState(!1),[l,i]=E.useState(0),{data:d}=xae(),{data:m}=Qf(),g=yae(),y=()=>{const A=EQt.join(","),M=["123 Main St","Dallas","TX","75001","buyer","2024-06-15","450000","13500","Referral","Past Client","yes","Great transaction!"].join(","),I=`${A} ${M}`,F=new Blob([I],{type:"text/csv"}),O=URL.createObjectURL(F),B=document.createElement("a");B.href=O,B.download="transaction-import-template.csv",B.click(),URL.revokeObjectURL(O)},v=A=>{const M=A.split(` `).filter(F=>F.trim());if(M.length<2)return[];const I=M[0].split(",").map(F=>F.trim().toLowerCase().replace(/['"]/g,""));return M.slice(1).map((F,O)=>{var de,ue,xe,Te;const B=[];let $="",H=!1;for(const be of F)be==='"'?H=!H:be===","&&!H?(B.push($.trim()),$=""):$+=be;B.push($.trim());const W=be=>{var ve;const we=I.indexOf(be);return we>=0?(ve=B[we])==null?void 0:ve.replace(/^["']|["']$/g,"").trim():""},X=(de=W("transaction_type"))==null?void 0:de.toLowerCase(),se=(ue=W("sale_price"))==null?void 0:ue.replace(/[$,]/g,""),ae=(xe=W("commission_amount"))==null?void 0:xe.replace(/[$,]/g,""),le=(Te=W("is_win"))==null?void 0:Te.toLowerCase(),ne=W("close_date"),fe=AQt(ne);let oe;return W("property_address")?["buyer","seller"].includes(X)?fe?(!se||isNaN(Number(se)))&&(oe="Invalid sale price"):oe=`Invalid date format: "${ne}" - use MM/DD/YYYY or YYYY-MM-DD`:oe='Transaction type must be "buyer" or "seller"':oe="Missing property address",{property_address:W("property_address"),city:W("city"),state:W("state"),zip:W("zip"),transaction_type:X==="seller"?"seller":"buyer",close_date:fe||"",sale_price:Number(se)||0,commission_amount:ae?Number(ae):null,lead_source_name:W("lead_source"),client_type_name:W("client_type"),is_win:["yes","true","1"].includes(le),notes:W("notes"),error:oe}})},b=A=>{var F;const M=(F=A.target.files)==null?void 0:F[0];if(!M)return;const I=new FileReader;I.onload=O=>{var H;const B=(H=O.target)==null?void 0:H.result,$=v(B);n($)},I.readAsText(M)},N=async()=>{const A=s.filter(F=>!F.error);if(A.length===0){Se.error("No valid transactions to import");return}o(!0),i(0);let M=0,I=0;for(let F=0;FH.name.toLowerCase()===O.lead_source_name.toLowerCase()),$=m==null?void 0:m.find(H=>H.name.toLowerCase()===O.client_type_name.toLowerCase());await g.mutateAsync({property_address:O.property_address,city:O.city||null,state:O.state||null,zip:O.zip||null,transaction_type:O.transaction_type,close_date:O.close_date,sale_price:O.sale_price,commission_amount:O.commission_amount,lead_source_id:(B==null?void 0:B.id)||null,client_type_id:($==null?void 0:$.id)||null,contact_id:null,notes:O.notes||null,is_win:O.is_win}),M++}catch(B){I++,console.error("Failed to import transaction:",B)}i(Math.round((F+1)/A.length*100))}o(!1),M>0&&Se.success(`Imported ${M} transaction${M>1?"s":""}`),I>0&&Se.error(`Failed to import ${I} transaction${I>1?"s":""}`),n([]),r(!1)},j=s.filter(A=>!A.error).length,S=s.filter(A=>A.error).length;return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"max-w-2xl max-h-[90vh]",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Import Transactions"}),e.jsx(Gs,{children:"Upload a CSV file with your past transactions"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg bg-muted/50",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Download Template"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Get a CSV template with the correct format"})]}),e.jsxs(Q,{variant:"outline",onClick:y,children:[e.jsx(Oi,{className:"h-4 w-4 mr-2"}),"Template"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"csv-file",children:"Upload CSV File"}),e.jsx(Qe,{id:"csv-file",type:"file",accept:".csv",onChange:b})]}),s.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(bt,{variant:"outline",children:[s.length," rows found"]}),j>0&&e.jsxs(bt,{className:"bg-green-500 text-white",children:[e.jsx(li,{className:"h-3 w-3 mr-1"}),j," valid"]}),S>0&&e.jsxs(bt,{variant:"destructive",children:[e.jsx(_l,{className:"h-3 w-3 mr-1"}),S," errors"]})]}),e.jsx(Eo,{className:"h-[200px] border rounded-lg",children:e.jsxs("div",{className:"p-2 space-y-2",children:[s.slice(0,10).map((A,M)=>e.jsxs("div",{className:`p-2 rounded text-sm ${A.error?"bg-destructive/10":"bg-muted/50"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:A.property_address||"(no address)"}),e.jsx(bt,{variant:A.transaction_type==="buyer"?"default":"secondary",children:A.transaction_type})]}),e.jsxs("div",{className:"text-muted-foreground",children:[A.close_date," • $",A.sale_price.toLocaleString()]}),A.error&&e.jsx(W0e,{variant:"destructive",className:"mt-1 py-1",children:e.jsx(G0e,{className:"text-xs",children:A.error})})]},M)),s.length>10&&e.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["...and ",s.length-10," more"]})]})}),a&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:e.jsx("div",{className:"bg-primary h-2 rounded-full transition-all",style:{width:`${l}%`}})}),e.jsxs("p",{className:"text-sm text-center text-muted-foreground",children:["Importing... ",l,"%"]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(Q,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsxs(Q,{onClick:N,disabled:j===0||a,children:[e.jsx(to,{className:"h-4 w-4 mr-2"}),"Import ",j," Transaction",j!==1?"s":""]})]})]})]})})}const PQt=Pv({transactions_goal:QA().min(0).optional(),volume_goal:QA().min(0).optional(),gci_goal:QA().min(0).optional()});function LQt({open:t,onOpenChange:r,year:s,existingGoals:n}){const a=eyt(),{data:o}=vae(),l=(o==null?void 0:o.show_commission)??!0,i=lae({resolver:cae(PQt),defaultValues:{transactions_goal:void 0,volume_goal:void 0,gci_goal:void 0}});E.useEffect(()=>{n?i.reset({transactions_goal:n.transactions_goal??void 0,volume_goal:n.volume_goal?Number(n.volume_goal):void 0,gci_goal:n.gci_goal?Number(n.gci_goal):void 0}):i.reset({transactions_goal:void 0,volume_goal:void 0,gci_goal:void 0})},[n,i,t]);const d=async m=>{await a.mutateAsync({year:s,transactions_goal:m.transactions_goal??null,volume_goal:m.volume_goal??null,gci_goal:l?m.gci_goal??null:null}),r(!1)};return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"max-w-md",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{children:[s," Goals"]}),e.jsx(Gs,{children:"Set your annual targets to track your progress throughout the year."})]}),e.jsx(dae,{...i,children:e.jsxs("form",{onSubmit:i.handleSubmit(d),className:"space-y-4",children:[e.jsx(zl,{control:i.control,name:"transactions_goal",render:({field:m})=>e.jsxs(Cl,{children:[e.jsx(Ml,{children:"Transactions Goal"}),e.jsx(Tl,{children:e.jsx(Qe,{type:"number",placeholder:"e.g., 24",...m,value:m.value??"",onChange:g=>m.onChange(g.target.value?Number(g.target.value):void 0)})}),e.jsx(Zee,{children:"Total number of deals you want to close"}),e.jsx(Ju,{})]})}),e.jsx(zl,{control:i.control,name:"volume_goal",render:({field:m})=>e.jsxs(Cl,{children:[e.jsx(Ml,{children:"Volume Goal ($)"}),e.jsx(Tl,{children:e.jsx(Qe,{type:"number",placeholder:"e.g., 5000000",...m,value:m.value??"",onChange:g=>m.onChange(g.target.value?Number(g.target.value):void 0)})}),e.jsx(Zee,{children:"Total sales volume you want to achieve"}),e.jsx(Ju,{})]})}),l&&e.jsx(zl,{control:i.control,name:"gci_goal",render:({field:m})=>e.jsxs(Cl,{children:[e.jsx(Ml,{children:"GCI Goal ($)"}),e.jsx(Tl,{children:e.jsx(Qe,{type:"number",placeholder:"e.g., 150000",...m,value:m.value??"",onChange:g=>m.onChange(g.target.value?Number(g.target.value):void 0)})}),e.jsx(Zee,{children:"Gross commission income target"}),e.jsx(Ju,{})]})}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsx(Q,{type:"submit",disabled:a.isPending,children:"Save Goals"})]})]})})]})})}function qVe({transactions:t,isLoading:r}){const s=E.useRef(null),n=E.useRef(null),a=E.useRef([]),o=E.useRef(null),{isAdmin:l}=Gr(),[i,d]=E.useState(""),[m,g]=E.useState(!0),[y,v]=E.useState(0),[b,N]=E.useState(!1),j=t.filter(A=>A.latitude!=null&&A.longitude!=null),S=t.filter(A=>A.latitude==null||A.longitude==null);return E.useEffect(()=>{(async()=>{g(!0);try{const{data:M}=await Z.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();M!=null&&M.value&&d(M.value)}catch(M){console.error("Error fetching mapbox token:",M)}g(!1)})()},[]),E.useEffect(()=>{if(!i||S.length===0||b)return;(async()=>{var I;N(!0);let M=0;for(const F of S){const O=[F.property_address,F.city,F.state,F.zip].filter(Boolean).join(", ");if(O)try{const $=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(O)}.json?access_token=${i}&limit=1`)).json();if((I=$.features)!=null&&I[0]){const[H,W]=$.features[0].center;await Z.from("scorecard_transactions").update({latitude:W,longitude:H}).eq("id",F.id),F.latitude=W,F.longitude=H,M++}}catch(B){console.error("Geocode error:",B)}}v(M),N(!1)})()},[i,t]),E.useEffect(()=>{if(!s.current||!i||n.current)return;oc.accessToken=i;const A=t.filter(F=>F.latitude!=null&&F.longitude!=null);let M=[-98.5795,39.8283],I=4;if(A.length>0){const F=A.reduce((B,$)=>B+$.longitude,0)/A.length,O=A.reduce((B,$)=>B+$.latitude,0)/A.length;M=[F,O],I=A.length===1?12:10}return n.current=new oc.Map({container:s.current,style:"mapbox://styles/mapbox/light-v11",zoom:I,center:M}),n.current.addControl(new oc.NavigationControl,"top-right"),()=>{var F;(F=n.current)==null||F.remove(),n.current=null}},[i]),E.useEffect(()=>{var M;if(!n.current||!i)return;a.current.forEach(I=>I.remove()),a.current=[],(M=o.current)==null||M.remove();const A=t.filter(I=>I.latitude!=null&&I.longitude!=null);if(A.forEach(I=>{var W;const F=I.transaction_type==="buyer",O=F?"#3B82F6":"#10B981",B=document.createElement("div");B.className="cursor-pointer",B.innerHTML=`
${F?'':''}
`;const $=new oc.Popup({offset:25,closeButton:!0}).setHTML(`
${I.property_address}
${I.city?`
${I.city}${I.state?", "+I.state:""} ${I.zip||""}
`:""}
${F?"Buyer":"Seller"} $${Number(I.sale_price).toLocaleString()}
Closed: ${new Date(I.close_date).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})} ${(W=I.lead_source)!=null&&W.name?" · "+I.lead_source.name:""}
${I.contact?`
Client: ${I.contact.first_name} ${I.contact.last_name||""}
`:""}
`),H=new oc.Marker(B).setLngLat([I.longitude,I.latitude]).setPopup($).addTo(n.current);a.current.push(H)}),A.length>1){const I=new oc.LngLatBounds;A.forEach(F=>I.extend([F.longitude,F.latitude])),n.current.fitBounds(I,{padding:60,maxZoom:13})}else A.length===1&&n.current.flyTo({center:[A[0].longitude,A[0].latitude],zoom:12})},[t,i,b]),m||r?e.jsx(ze,{children:e.jsx(qe,{className:"flex items-center justify-center h-[50vh]",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})}):i?t.length===0?e.jsx(ze,{children:e.jsxs(qe,{className:"flex flex-col items-center justify-center h-[50vh] text-center gap-3",children:[e.jsx(eo,{className:"h-12 w-12 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:"No Transactions Yet"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Add transactions to see them plotted on the map."})]})]})}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-white shadow",style:{background:"#3B82F6"}}),e.jsx("span",{children:"Buyer"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-white shadow",style:{background:"#10B981"}}),e.jsx("span",{children:"Seller"})]}),e.jsxs("span",{className:"text-muted-foreground ml-auto text-xs",children:[j.length," of ",t.length," mapped",b&&" · Geocoding..."]})]}),e.jsx("div",{ref:s,className:"w-full h-[55vh] rounded-lg shadow-lg border"})]}):e.jsx(ze,{children:e.jsxs(qe,{className:"flex flex-col items-center justify-center h-[50vh] text-center gap-3",children:[e.jsx(_l,{className:"h-12 w-12 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:"Map Not Configured"}),e.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 VVe=new Date().getFullYear(),OQt=Array.from({length:10},(t,r)=>VVe-r);function DQt(){var O;const[t,r]=E.useState(VVe),[s,n]=E.useState(!1),[a,o]=E.useState(!1),[l,i]=E.useState(!1),[d,m]=E.useState(!1),{data:g,isLoading:y}=Gye(t),{yearStats:v,lifetimeStats:b,showCommission:N}=oFe(t),{data:j,isLoading:S}=iFe(t),{data:A}=vae(),M=tyt(),I=()=>{if(!g||g.length===0)return;const B=["Property Address","City","State","Zip","Transaction Type","Close Date","Sale Price",...N?["Commission"]:[],"Lead Source","Client Type","Contact Name","Is Win","Notes"],$=g.map(ae=>{var le,ne;return[ae.property_address,ae.city||"",ae.state||"",ae.zip||"",ae.transaction_type,ae.close_date,ae.sale_price,...N?[ae.commission_amount||""]:[],((le=ae.lead_source)==null?void 0:le.name)||"",((ne=ae.client_type)==null?void 0:ne.name)||"",ae.contact?`${ae.contact.first_name} ${ae.contact.last_name||""}`.trim():"",ae.is_win?"Yes":"No",ae.notes||""]}),H=[B,...$].map(ae=>ae.map(le=>`"${String(le).replace(/"/g,'""')}"`).join(",")).join(` `),W=new Blob([H],{type:"text/csv"}),X=URL.createObjectURL(W),se=document.createElement("a");se.href=X,se.download=`transactions-${t}.csv`,se.click(),URL.revokeObjectURL(X)},F=!g||g.length===0;return e.jsxs(Fr,{title:"Scorecard",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Scorecard"}),e.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"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Business Scorecard"}),e.jsx("p",{className:"text-muted-foreground",children:"Track your transactions, goals, and performance"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(ds,{value:String(t),onValueChange:B=>r(Number(B)),children:[e.jsx(ls,{className:"w-[120px]",children:e.jsx(us,{})}),e.jsx(cs,{children:OQt.map(B=>e.jsx(Ut,{value:String(B),children:B},B))})]}),e.jsx(Q,{variant:"outline",size:"icon",onClick:()=>m(!d),children:e.jsx(vd,{className:"h-4 w-4"})})]})]}),d&&e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-3",children:e.jsx(Zt,{className:"text-lg",children:"Settings"})}),e.jsx(qe,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(Ee,{children:"Show Commission"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Display commission fields and include in stats"})]}),e.jsx(xn,{checked:(A==null?void 0:A.show_commission)??!0,onCheckedChange:B=>M.mutate({show_commission:B})})]})})]}),F&&!y?e.jsx(ze,{className:"py-12",children:e.jsxs(qe,{className:"text-center space-y-4",children:[e.jsx("div",{className:"w-16 h-16 mx-auto rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(Nc,{className:"h-8 w-8 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Start Tracking Your Success"}),e.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."})]}),e.jsxs("div",{className:"flex flex-wrap justify-center gap-2 pt-2",children:[e.jsxs(Q,{onClick:()=>n(!0),children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Your First Transaction"]}),e.jsxs(Q,{variant:"outline",onClick:()=>o(!0),children:[e.jsx(to,{className:"h-4 w-4 mr-2"}),"Import CSV"]})]}),e.jsxs("div",{className:"pt-4 border-t mt-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Need help formatting your data?"}),e.jsx(Q,{variant:"link",className:"h-auto p-0",asChild:!0,children:e.jsxs("a",{href:"/templates/transaction-import-template.csv",download:!0,children:[e.jsx(Oi,{className:"h-4 w-4 mr-2"}),"Download CSV Template"]})})]})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(Q,{onClick:()=>n(!0),children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Transaction"]}),e.jsxs(Q,{variant:"outline",onClick:()=>i(!0),children:[e.jsx(bp,{className:"h-4 w-4 mr-2"}),"Set Goals"]}),e.jsxs(Q,{variant:"outline",onClick:()=>o(!0),children:[e.jsx(to,{className:"h-4 w-4 mr-2"}),"Import"]}),e.jsxs(Q,{variant:"outline",onClick:I,disabled:F,children:[e.jsx(Oi,{className:"h-4 w-4 mr-2"}),"Export"]}),e.jsx(Q,{variant:"ghost",size:"sm",asChild:!0,children:e.jsxs("a",{href:"/templates/transaction-import-template.csv",download:!0,children:[e.jsx(Oi,{className:"h-4 w-4 mr-2"}),"CSV Template"]})})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:[e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(Wn,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs font-medium",children:"Transactions"})]}),e.jsx("p",{className:"text-2xl font-bold",children:v.totalTransactions}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[b.totalTransactions," lifetime"]})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(ws,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs font-medium",children:"Buyer/Seller"})]}),e.jsxs("p",{className:"text-2xl font-bold",children:[v.buyerCount,"/",v.sellerCount]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"B/S split"})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(yd,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs font-medium",children:"Volume"})]}),e.jsx("p",{className:"text-2xl font-bold",children:ru(v.totalVolume,!0)}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[ru(b.totalVolume,!0)," lifetime"]})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(ou,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs font-medium",children:"Avg Price"})]}),e.jsx("p",{className:"text-2xl font-bold",children:ru(v.averagePrice,!0)})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(ql,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs font-medium",children:"Top Source"})]}),e.jsx("p",{className:"text-lg font-bold truncate",children:((O=v.topLeadSource)==null?void 0:O.name)||"-"}),v.topLeadSource&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[v.topLeadSource.count," deals"]})]})}),N&&e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(yd,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs font-medium",children:"Commission"})]}),e.jsx("p",{className:"text-2xl font-bold",children:ru(v.totalCommission,!0)}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[ru(b.totalCommission,!0)," lifetime"]})]})})]}),j&&e.jsx(QBe,{goals:j,stats:v,year:t,showCommission:N}),e.jsxs(ci,{defaultValue:"transactions",className:"space-y-4",children:[e.jsxs(ri,{children:[e.jsx(Kr,{value:"transactions",children:"Transactions"}),e.jsx(Kr,{value:"charts",children:"Charts"}),e.jsxs(Kr,{value:"map",children:[e.jsx(eo,{className:"h-4 w-4 mr-1"}),"Map"]})]}),e.jsx(ms,{value:"transactions",children:e.jsx(XBe,{transactions:g||[],showCommission:N,isLoading:y})}),e.jsx(ms,{value:"charts",children:e.jsx(UVe,{stats:v,year:t})}),e.jsx(ms,{value:"map",children:e.jsx(qVe,{transactions:g||[],isLoading:y})})]})]})]}),e.jsx(YBe,{open:s,onOpenChange:n}),e.jsx(IQt,{open:a,onOpenChange:o}),e.jsx(LQt,{open:l,onOpenChange:i,year:t,existingGoals:j})]})}function HVe({open:t,onOpenChange:r,listingId:s,listingSlug:n,listingTitle:a}){const{user:o}=Gr(),[l,i]=E.useState(null),[d,m]=E.useState(!1),[g,y]=E.useState(!1);E.useEffect(()=>{(async()=>{if(!(!t||!o)){m(!0);try{const{data:S,error:A}=await Z.from("listing_shares").select("id, share_token, click_count, lead_count").eq("listing_id",s).eq("sharing_agent_id",o.id).order("created_at",{ascending:!1}).limit(1).maybeSingle();if(A)throw A;if(S&&S.share_token)i(S);else if(S&&!S.share_token){const{data:M,error:I}=await Z.from("listing_shares").update({share_type:"referral_link"}).eq("id",S.id).select("id, share_token, click_count, lead_count").single();if(I)throw I;i(M)}else{const{data:M,error:I}=await Z.from("listing_shares").insert({listing_id:s,sharing_agent_id:o.id,share_type:"referral_link"}).select("id, share_token, click_count, lead_count").single();if(I)throw I;i(M)}}catch(S){console.error("Error creating share link:",S),Se.error("Failed to generate share link")}finally{m(!1)}}})()},[t,o,s]);const v=l!=null&&l.share_token?`https://listings.relevelup.com/${n||s}?ref=${l.share_token}`:"",b=async()=>{try{await navigator.clipboard.writeText(v),y(!0),Se.success("Link copied to clipboard!"),setTimeout(()=>y(!1),2e3)}catch{Se.error("Failed to copy link")}},N=j=>{const S=encodeURIComponent(v),A=encodeURIComponent(`Check out this listing: ${a}`);switch(j){case"email":window.open(`mailto:?subject=${A}&body=${S}`);break;case"text":window.open(`sms:?body=${A}%20${S}`);break;case"facebook":window.open(`https://www.facebook.com/sharer/sharer.php?u=${S}`,"_blank");break}};return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"sm:max-w-md",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{className:"flex items-center gap-2",children:[e.jsx(An,{className:"h-5 w-5 text-amber-500"}),"Share & Earn Leads"]}),e.jsx(Gs,{children:"Share this listing with your network. When someone submits a lead through your link, they'll become your contact!"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg p-3",children:e.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-200",children:[e.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!"]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Your Referral Link"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Qe,{value:d?"Generating...":v,readOnly:!0,className:"font-mono text-sm"}),e.jsx(Q,{onClick:b,disabled:d||!v,variant:g?"default":"outline",children:g?e.jsx(li,{className:"h-4 w-4"}):e.jsx(fo,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Share via"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Q,{variant:"outline",className:"flex-1",onClick:()=>N("email"),disabled:d,children:[e.jsx(mn,{className:"h-4 w-4 mr-2"}),"Email"]}),e.jsxs(Q,{variant:"outline",className:"flex-1",onClick:()=>N("text"),disabled:d,children:[e.jsx($o,{className:"h-4 w-4 mr-2"}),"Text"]}),e.jsxs(Q,{variant:"outline",className:"flex-1",onClick:()=>N("facebook"),disabled:d,children:[e.jsx(iu,{className:"h-4 w-4 mr-2"}),"Facebook"]})]})]}),l&&(l.click_count>0||l.lead_count>0)&&e.jsxs("div",{className:"pt-4 border-t",children:[e.jsx(Ee,{className:"mb-2 block",children:"Your Share Performance"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"bg-muted rounded-lg p-3 text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1 text-muted-foreground mb-1",children:[e.jsx(Gi,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs",children:"Clicks"})]}),e.jsx("p",{className:"text-2xl font-bold",children:l.click_count})]}),e.jsxs("div",{className:"bg-primary/10 rounded-lg p-3 text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1 text-primary mb-1",children:[e.jsx(ws,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs",children:"Leads"})]}),e.jsx("p",{className:"text-2xl font-bold text-primary",children:l.lead_count})]})]})]})]})]})})}const RQt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},FQt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},zQt={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function aO({listing:t,onClick:r,onEdit:s,onDelete:n,showActions:a}){var j,S;const{user:o}=Gr(),{data:l}=JRe(t.id),i=QRe(),[d,m]=E.useState(!1),g=A=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(A),y=((j=t.photos)==null?void 0:j.find(A=>A.is_primary))||((S=t.photos)==null?void 0:S[0]),v=(o==null?void 0:o.id)===t.agent_id,b=async A=>{A.stopPropagation();try{const M=await i.mutateAsync(t.id);Se.success(M.saved?"Listing saved!":"Listing removed from saved")}catch{Se.error("Failed to save listing")}},N=A=>{if(A.stopPropagation(),o)m(!0);else{const M=`https://listings.relevelup.com/${t.slug||t.id}`;navigator.clipboard.writeText(M),Se.success("Link copied to clipboard!")}};return e.jsxs(ze,{className:"overflow-hidden hover:shadow-lg transition-shadow cursor-pointer group",onClick:r,children:[e.jsxs("div",{className:"relative aspect-[4/3] bg-muted",children:[y?e.jsx("img",{src:y.photo_url,alt:t.property_address||t.city,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:e.jsx(Yg,{className:"h-12 w-12"})}),e.jsx(bt,{className:`absolute top-2 left-2 ${RQt[t.status]} text-white border-0`,children:FQt[t.status]}),t.is_featured&&e.jsx("div",{className:"absolute top-2 right-2 p-1.5 bg-amber-500 rounded-full",children:e.jsx(Ln,{className:"h-4 w-4 text-white fill-white"})}),e.jsxs("div",{className:"absolute bottom-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx(Q,{size:"icon",variant:"secondary",className:"h-8 w-8",onClick:b,children:e.jsx(Ci,{className:`h-4 w-4 ${l?"fill-pink-500 text-pink-500":""}`})}),e.jsx(Q,{size:"icon",variant:"secondary",className:"h-8 w-8",onClick:N,title:v?"Copy link":"Share & earn leads",children:v?e.jsx(Oc,{className:"h-4 w-4"}):e.jsx(An,{className:"h-4 w-4 text-amber-500"})})]})]}),e.jsx(HVe,{open:d,onOpenChange:m,listingId:t.id,listingSlug:t.slug||null,listingTitle:t.property_address||`${t.city}, ${t.state}`}),e.jsxs(qe,{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-xl font-bold text-primary",children:g(t.price)}),t.open_to_referrals&&e.jsxs(bt,{variant:"outline",className:"text-xs",children:[e.jsx(ws,{className:"h-3 w-3 mr-1"}),"Referrals"]})]}),e.jsxs("div",{children:[t.property_address&&e.jsx("p",{className:"font-medium truncate",children:t.property_address}),e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(eo,{className:"h-3 w-3"}),t.city,", ",t.state,t.neighborhood&&` • ${t.neighborhood}`]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[t.bedrooms&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(H1,{className:"h-4 w-4"}),t.bedrooms," bd"]}),t.bathrooms&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(V1,{className:"h-4 w-4"}),t.bathrooms," ba"]}),t.square_footage&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Yg,{className:"h-4 w-4"}),t.square_footage.toLocaleString()," sqft"]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsx(bt,{variant:"secondary",className:"text-xs",children:zQt[t.property_type]}),t.agent&&e.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[120px]",children:t.agent.name})]}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Gi,{className:"h-3 w-3"}),t.view_count]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Oc,{className:"h-3 w-3"}),t.share_count]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ci,{className:"h-3 w-3"}),t.save_count]})]}),a&&(s||n)&&e.jsxs("div",{className:"flex gap-2",children:[s&&e.jsxs(Q,{variant:"outline",size:"sm",className:"flex-1",onClick:A=>{A.stopPropagation(),s()},children:[e.jsx(wc,{className:"h-4 w-4 mr-2"}),"Edit"]}),n&&e.jsx(Q,{variant:"destructive",size:"sm",onClick:A=>{A.stopPropagation(),n()},children:e.jsx(Rs,{className:"h-4 w-4"})})]})]})]})}const BQt=[{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"}],$Qt=[{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 UQt({filters:t,onFiltersChange:r,onClose:s}){const n=()=>{r({sortBy:"newest"})};return e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between pb-3",children:[e.jsx(Zt,{className:"text-lg",children:"Filters"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q,{variant:"ghost",size:"sm",onClick:n,children:"Clear All"}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:s,children:e.jsx(rn,{className:"h-4 w-4"})})]})]}),e.jsxs(qe,{children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Status"}),e.jsxs(ds,{value:t.status||"all",onValueChange:a=>r({...t,status:a==="all"?void 0:a}),children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"All statuses"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Statuses"}),BQt.map(a=>e.jsx(Ut,{value:a.value,children:a.label},a.value))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Property Type"}),e.jsxs(ds,{value:t.propertyType||"all",onValueChange:a=>r({...t,propertyType:a==="all"?void 0:a}),children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"All types"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Types"}),$Qt.map(a=>e.jsx(Ut,{value:a.value,children:a.label},a.value))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Min Price"}),e.jsx(Qe,{type:"number",placeholder:"No minimum",value:t.minPrice||"",onChange:a=>r({...t,minPrice:a.target.value?Number(a.target.value):void 0})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Max Price"}),e.jsx(Qe,{type:"number",placeholder:"No maximum",value:t.maxPrice||"",onChange:a=>r({...t,maxPrice:a.target.value?Number(a.target.value):void 0})})]})]}),e.jsxs("div",{className:"flex items-center justify-between mt-4 pt-4 border-t",children:[e.jsxs("div",{children:[e.jsx(Ee,{children:"Open to Referrals Only"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Show only listings accepting buyer referrals"})]}),e.jsx(xn,{checked:t.openToReferrals||!1,onCheckedChange:a=>r({...t,openToReferrals:a||void 0})})]})]})]})}function qQt({leaderboard:t}){const r=n=>{switch(n){case 0:return e.jsx(ho,{className:"h-5 w-5 text-amber-500"});case 1:return e.jsx(vy,{className:"h-5 w-5 text-gray-400"});case 2:return e.jsx(ql,{className:"h-5 w-5 text-amber-700"});default:return e.jsx("span",{className:"text-sm font-medium text-muted-foreground w-5 text-center",children:n+1})}},s=(n,a)=>!n||n.length===0?e.jsx("div",{className:"py-8 text-center text-muted-foreground",children:"No data yet. Start sharing to climb the leaderboard!"}):e.jsx("div",{className:"space-y-2",children:n.map((o,l)=>e.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:[e.jsx("div",{className:"flex items-center justify-center w-8",children:r(l)}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("p",{className:"font-medium truncate",children:o.name})}),e.jsxs(bt,{variant:l===0?"default":"secondary",children:[o.count," ",a]})]},o.agentId))});return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(ho,{className:"h-5 w-5 text-amber-500"}),"Community Badges"]})}),e.jsx(qe,{children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.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:[e.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-emerald-500/20 flex items-center justify-center",children:e.jsx(Oc,{className:"h-6 w-6 text-emerald-500"})}),e.jsx("p",{className:"font-medium text-sm",children:"Listing Amplifier"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Share 10+ listings"})]}),e.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:[e.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-sky-500/20 flex items-center justify-center",children:e.jsx(Wn,{className:"h-6 w-6 text-sky-500"})}),e.jsx("p",{className:"font-medium text-sm",children:"Top Contributor"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Add 5+ listings"})]}),e.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:[e.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-purple-500/20 flex items-center justify-center",children:e.jsx(vy,{className:"h-6 w-6 text-purple-500"})}),e.jsx("p",{className:"font-medium text-sm",children:"Referral Connector"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Send 3+ referrals"})]}),e.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:[e.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-amber-500/20 flex items-center justify-center",children:e.jsx(ho,{className:"h-6 w-6 text-amber-500"})}),e.jsx("p",{className:"font-medium text-sm",children:"Community MVP"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Top performer"})]})]})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{children:"Community Leaderboard"})}),e.jsx(qe,{children:e.jsxs(ci,{defaultValue:"sharers",children:[e.jsxs(ri,{className:"w-full",children:[e.jsxs(Kr,{value:"sharers",className:"flex-1",children:[e.jsx(Oc,{className:"h-4 w-4 mr-2"}),"Top Sharers"]}),e.jsxs(Kr,{value:"listers",className:"flex-1",children:[e.jsx(Wn,{className:"h-4 w-4 mr-2"}),"Top Contributors"]})]}),e.jsx(ms,{value:"sharers",className:"mt-4",children:s(t==null?void 0:t.topSharers,"shares")}),e.jsx(ms,{value:"listers",className:"mt-4",children:s(t==null?void 0:t.topListers,"listings")})]})})]})]})}const ATe={coming_soon:"#F59E0B",active:"#10B981",price_improvement:"#8B5CF6",under_contract:"#3B82F6",sold:"#A855F7"},ETe={coming_soon:"Coming Soon",active:"Active",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"};function VQt(t){return t>=1e6?`$${(t/1e6).toFixed(1)}M`:`$${(t/1e3).toFixed(0)}K`}function HQt({listings:t,isLoading:r}){const s=Ws(),n=E.useRef(null),a=E.useRef(null),o=E.useRef([]),{isAdmin:l}=Gr(),[i,d]=E.useState(""),[m,g]=E.useState(!0),[y,v]=E.useState(!1),b=t.filter(j=>j.latitude!=null&&j.longitude!=null),N=t.filter(j=>(j.latitude==null||j.longitude==null)&&(j.property_address||j.city));return E.useEffect(()=>{(async()=>{g(!0);try{const{data:S}=await Z.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();S!=null&&S.value&&d(S.value)}catch(S){console.error("Error fetching mapbox token:",S)}g(!1)})()},[]),E.useEffect(()=>{if(!i||N.length===0||y)return;(async()=>{var S;v(!0);for(const A of N){const M=[A.property_address,A.city,A.state].filter(Boolean).join(", ");if(M)try{const F=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(M)}.json?access_token=${i}&limit=1`)).json();if((S=F.features)!=null&&S[0]){const[O,B]=F.features[0].center;await Z.from("listings").update({latitude:B,longitude:O}).eq("id",A.id),A.latitude=B,A.longitude=O}}catch(I){console.error("Geocode error:",I)}}v(!1)})()},[i,t]),E.useEffect(()=>{if(!n.current||!i||a.current)return;oc.accessToken=i;const j=t.filter(M=>M.latitude!=null&&M.longitude!=null);let S=[-98.5795,39.8283],A=4;if(j.length>0){const M=j.reduce((F,O)=>F+O.longitude,0)/j.length,I=j.reduce((F,O)=>F+O.latitude,0)/j.length;S=[M,I],A=j.length===1?12:10}return a.current=new oc.Map({container:n.current,style:"mapbox://styles/mapbox/light-v11",zoom:A,center:S}),a.current.addControl(new oc.NavigationControl,"top-right"),()=>{var M;(M=a.current)==null||M.remove(),a.current=null}},[i]),E.useEffect(()=>{if(!a.current||!i)return;o.current.forEach(S=>S.remove()),o.current=[];const j=t.filter(S=>S.latitude!=null&&S.longitude!=null);if(j.forEach(S=>{var B,$,H;const A=ATe[S.status]||"#10B981",M=((B=S.photos)==null?void 0:B.find(W=>W.is_primary))||(($=S.photos)==null?void 0:$[0]),I=document.createElement("div");I.className="cursor-pointer",I.innerHTML=`
`;const F=new oc.Popup({offset:25,closeButton:!0,maxWidth:"280px"}).setHTML(`
${M!=null&&M.photo_url?``:""}
${VQt(S.price)}
${S.property_address||""}
${S.city}, ${S.state}
${ETe[S.status]||S.status} ${S.bedrooms?`${S.bedrooms} bed`:""} ${S.bathrooms?`${S.bathrooms} bath`:""}
${(H=S.agent)!=null&&H.name?`
Listed by ${S.agent.name}
`:""}
Click to view details →
`),O=new oc.Marker(I).setLngLat([S.longitude,S.latitude]).setPopup(F).addTo(a.current);o.current.push(O)}),j.length>1){const S=new oc.LngLatBounds;j.forEach(A=>S.extend([A.longitude,A.latitude])),a.current.fitBounds(S,{padding:60,maxZoom:13})}else j.length===1&&a.current.flyTo({center:[j[0].longitude,j[0].latitude],zoom:12})},[t,i,y]),E.useEffect(()=>(window.__navigateToListing__=j=>{s(`/mission-control/listings/${j}`)},()=>{delete window.__navigateToListing__}),[s]),m||r?e.jsx(ze,{children:e.jsx(qe,{className:"flex items-center justify-center h-[60vh]",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})}):i?t.length===0?e.jsx(ze,{children:e.jsxs(qe,{className:"flex flex-col items-center justify-center h-[60vh] text-center gap-3",children:[e.jsx(eo,{className:"h-12 w-12 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:"No Listings Yet"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Add listings to see them on the map."})]})]})}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm",children:[Object.entries(ATe).map(([j,S])=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-3 h-3 rounded-full border-2 border-white shadow",style:{background:S}}),e.jsx("span",{className:"text-xs",children:ETe[j]})]},j)),e.jsxs("span",{className:"text-muted-foreground ml-auto text-xs",children:[b.length," of ",t.length," mapped",y&&" · Geocoding..."]})]}),e.jsx("div",{ref:n,className:"w-full h-[60vh] rounded-lg shadow-lg border"})]}):e.jsx(ze,{children:e.jsxs(qe,{className:"flex flex-col items-center justify-center h-[60vh] text-center gap-3",children:[e.jsx(_l,{className:"h-12 w-12 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:"Map Not Configured"}),e.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 WQt(){var W,X,se,ae,le,ne,fe,oe;const t=Ws(),{brokerageId:r}=Gr(),{data:s,isLoading:n}=GRe(),[a,o]=E.useState("feed"),[l,i]=E.useState(!1),[d,m]=E.useState(""),[g,y]=E.useState({sortBy:"newest"}),{data:v,isLoading:b}=KRe({...g,city:d||g.city}),{data:N,isLoading:j}=Fxt(),{data:S,isLoading:A}=ZRe(),{data:M,isLoading:I}=Uxt(),{data:F,isLoading:O}=Hxt(),{data:B}=Vxt(),$=XRe(),H=async de=>{if(confirm("Are you sure you want to delete this listing? This action cannot be undone."))try{await $.mutateAsync(de),Se.success("Listing deleted successfully")}catch{Se.error("Failed to delete listing")}};return n?e.jsx(Fr,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})})}):s?e.jsx(Fr,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Listing Exchange"}),e.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"})]}),e.jsxs(Q,{onClick:()=>t("/mission-control/listings/new"),children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsx(ze,{children:e.jsxs(qe,{className:"p-4 flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:e.jsx(Wn,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:(v==null?void 0:v.length)||0}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Active Listings"})]})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"p-4 flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-pink-500/10 rounded-lg",children:e.jsx(Ci,{className:"h-5 w-5 text-pink-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:(N==null?void 0:N.length)||0}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Saved"})]})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"p-4 flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-emerald-500/10 rounded-lg",children:e.jsx(Oj,{className:"h-5 w-5 text-emerald-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:(S==null?void 0:S.length)||0}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"My Listings"})]})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"p-4 flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-sky-500/10 rounded-lg",children:e.jsx(ws,{className:"h-5 w-5 text-sky-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:(((W=M==null?void 0:M.sent)==null?void 0:W.length)||0)+(((X=M==null?void 0:M.received)==null?void 0:X.length)||0)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Referrals"})]})]})})]}),e.jsxs(ci,{value:a,onValueChange:o,children:[e.jsxs(ri,{className:"w-full justify-start overflow-x-auto",children:[e.jsx(Kr,{value:"feed",children:"Community Feed"}),r&&e.jsx(Kr,{value:"brokerage",children:"Brokerage"}),e.jsx(Kr,{value:"my-listings",children:"My Listings"}),e.jsx(Kr,{value:"saved",children:"Saved"}),e.jsx(Kr,{value:"referrals",children:"Referrals"}),e.jsx(Kr,{value:"map",children:"Map"}),e.jsx(Kr,{value:"leaderboard",children:"Leaderboard"})]}),e.jsxs(ms,{value:"feed",className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search by city or neighborhood...",value:d,onChange:de=>m(de.target.value),className:"pl-9"})]}),e.jsxs(ds,{value:g.sortBy,onValueChange:de=>y({...g,sortBy:de}),children:[e.jsx(ls,{className:"w-[180px]",children:e.jsx(us,{placeholder:"Sort by"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"newest",children:"Newest First"}),e.jsx(Ut,{value:"updated",children:"Recently Updated"}),e.jsx(Ut,{value:"price_asc",children:"Price: Low to High"}),e.jsx(Ut,{value:"price_desc",children:"Price: High to Low"})]})]}),e.jsxs(Q,{variant:"outline",onClick:()=>i(!l),children:[e.jsx(Z1,{className:"h-4 w-4 mr-2"}),"Filters"]})]}),l&&e.jsx(UQt,{filters:g,onFiltersChange:y,onClose:()=>i(!1)}),b?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(6)].map((de,ue)=>e.jsxs(ze,{children:[e.jsx(fr,{className:"h-48 w-full"}),e.jsxs(qe,{className:"p-4 space-y-2",children:[e.jsx(fr,{className:"h-5 w-3/4"}),e.jsx(fr,{className:"h-4 w-1/2"}),e.jsx(fr,{className:"h-4 w-1/4"})]})]},ue))}):(v==null?void 0:v.length)===0?e.jsx(ze,{children:e.jsxs(qe,{className:"py-12 text-center",children:[e.jsx(Wn,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No listings found"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Be the first to share a listing with the community!"}),e.jsxs(Q,{onClick:()=>t("/mission-control/listings/new"),children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:v==null?void 0:v.map(de=>e.jsx(aO,{listing:de,onClick:()=>t(`/mission-control/listings/${de.id}`)},de.id))})]}),e.jsx(ms,{value:"my-listings",className:"space-y-4",children:A?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((de,ue)=>e.jsxs(ze,{children:[e.jsx(fr,{className:"h-48 w-full"}),e.jsxs(qe,{className:"p-4 space-y-2",children:[e.jsx(fr,{className:"h-5 w-3/4"}),e.jsx(fr,{className:"h-4 w-1/2"})]})]},ue))}):(S==null?void 0:S.length)===0?e.jsx(ze,{children:e.jsxs(qe,{className:"py-12 text-center",children:[e.jsx(Oj,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No listings yet"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Share your listings with the LevelUp community!"}),e.jsxs(Q,{onClick:()=>t("/mission-control/listings/new"),children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Your First Listing"]})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:S==null?void 0:S.map(de=>e.jsx(aO,{listing:de,showActions:!0,onClick:()=>t(`/mission-control/listings/${de.id}`),onEdit:()=>t(`/mission-control/listings/${de.id}/edit`),onDelete:()=>H(de.id)},de.id))})}),e.jsx(ms,{value:"saved",className:"space-y-4",children:j?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((de,ue)=>e.jsxs(ze,{children:[e.jsx(fr,{className:"h-48 w-full"}),e.jsxs(qe,{className:"p-4 space-y-2",children:[e.jsx(fr,{className:"h-5 w-3/4"}),e.jsx(fr,{className:"h-4 w-1/2"})]})]},ue))}):(N==null?void 0:N.length)===0?e.jsx(ze,{children:e.jsxs(qe,{className:"py-12 text-center",children:[e.jsx(Ci,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No saved listings"}),e.jsx("p",{className:"text-muted-foreground",children:"Save listings to quickly access them later"})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:N==null?void 0:N.map(de=>e.jsx(aO,{listing:de.listing,onClick:()=>t(`/mission-control/listings/${de.listing.id}`)},de.id))})}),e.jsx(ms,{value:"referrals",className:"space-y-6",children:e.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"font-semibold mb-3 flex items-center gap-2",children:[e.jsx(Oc,{className:"h-4 w-4"}),"Referrals Sent (",((se=M==null?void 0:M.sent)==null?void 0:se.length)||0,")"]}),((ae=M==null?void 0:M.sent)==null?void 0:ae.length)===0?e.jsx(ze,{children:e.jsx(qe,{className:"py-8 text-center text-muted-foreground",children:"No referrals sent yet"})}):e.jsx("div",{className:"space-y-3",children:(le=M==null?void 0:M.sent)==null?void 0:le.map(de=>{var ue,xe;return e.jsx(ze,{children:e.jsx(qe,{className:"p-4",children:e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:de.buyer_name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:((ue=de.listing)==null?void 0:ue.property_address)||((xe=de.listing)==null?void 0:xe.city)})]}),e.jsx(bt,{variant:de.status==="closed"?"default":"secondary",children:de.status.replace("_"," ")})]})})},de.id)})})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"font-semibold mb-3 flex items-center gap-2",children:[e.jsx(ws,{className:"h-4 w-4"}),"Referrals Received (",((ne=M==null?void 0:M.received)==null?void 0:ne.length)||0,")"]}),((fe=M==null?void 0:M.received)==null?void 0:fe.length)===0?e.jsx(ze,{children:e.jsx(qe,{className:"py-8 text-center text-muted-foreground",children:"No referrals received yet"})}):e.jsx("div",{className:"space-y-3",children:(oe=M==null?void 0:M.received)==null?void 0:oe.map(de=>{var ue;return e.jsx(ze,{children:e.jsxs(qe,{className:"p-4",children:[e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:de.buyer_name}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["From: ",(ue=de.sender)==null?void 0:ue.name]})]}),e.jsx(bt,{variant:de.status==="closed"?"default":"secondary",children:de.status.replace("_"," ")})]}),e.jsx(Q,{size:"sm",variant:"outline",className:"w-full mt-2",onClick:()=>t(`/mission-control/listings/${de.listing_id}`),children:"View Listing"})]})},de.id)})})]})]})}),r&&e.jsx(ms,{value:"brokerage",className:"space-y-4",children:O?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((de,ue)=>e.jsxs(ze,{children:[e.jsx(fr,{className:"h-48 w-full"}),e.jsxs(qe,{className:"p-4 space-y-2",children:[e.jsx(fr,{className:"h-5 w-3/4"}),e.jsx(fr,{className:"h-4 w-1/2"})]})]},ue))}):(F==null?void 0:F.length)===0?e.jsx(ze,{children:e.jsxs(qe,{className:"py-12 text-center",children:[e.jsx(Oj,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No brokerage listings yet"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"No agents in your brokerage have added listings yet."}),e.jsxs(Q,{onClick:()=>t("/mission-control/listings/new"),children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add a Listing"]})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:F==null?void 0:F.map(de=>e.jsx(aO,{listing:de,onClick:()=>t(`/mission-control/listings/${de.id}`)},de.id))})}),e.jsx(ms,{value:"map",children:e.jsx(HQt,{listings:v||[],isLoading:b})}),e.jsx(ms,{value:"leaderboard",children:e.jsx(qQt,{leaderboard:B})})]})]})}):e.jsx(Fr,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:e.jsx(ze,{children:e.jsxs(qe,{className:"py-12 text-center",children:[e.jsx(Wn,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Coming Soon"}),e.jsx("p",{className:"text-muted-foreground",children:"Listing Exchange is currently in development. Check back soon!"})]})})})}function gve(){const t=Ll();return Ht({queryKey:["deal-pipeline-stages",t],queryFn:async()=>{if(!t)return[];const{data:r,error:s}=await Z.from("deal_pipeline_stages").select("*").eq("owner_user_id",t).order("sort_order",{ascending:!0});if(s)throw s;return r},enabled:!!t})}function WVe(){const t=Ll(),r=qr();return Jt({mutationFn:async()=>{if(!t)throw new Error("Not authenticated");const{error:s}=await Z.rpc("initialize_deal_pipeline_stages",{p_user_id:t});if(s)throw s},onSuccess:()=>{r.invalidateQueries({queryKey:["deal-pipeline-stages"]})}})}function GVe(){const t=Ll();return Ht({queryKey:["deal-pipeline-deals",t],queryFn:async()=>{if(!t)return[];const{data:r,error:s}=await Z.from("deal_pipeline").select(` *, contact:innercircle_contacts(id, first_name, last_name, email, phone), listing:listings(id, property_address, city, state, price, status, created_at) `).eq("owner_user_id",t).order("updated_at",{ascending:!1});if(s)throw s;return r},enabled:!!t})}function KVe(){const t=Ll(),r=qr();return Jt({mutationFn:async s=>{if(!t)throw new Error("Not authenticated");const{data:n,error:a}=await Z.from("deal_pipeline").insert({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||null,expected_commission:s.expected_commission||null,commission_percentage:s.commission_percentage||3,target_close_date:s.target_close_date||null,contract_date:s.contract_date||null,listing_date:s.listing_date||null,priority:s.priority||"medium",probability:s.probability||50,notes:s.notes||null,owner_user_id:t}).select().single();if(a)throw a;return await Z.from("deal_activities").insert([{deal_id:n.id,activity_type:"system",title:"Deal created",description:`Deal "${s.deal_name}" was created`}]),n},onSuccess:()=>{r.invalidateQueries({queryKey:["deal-pipeline-deals"]}),r.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function ZVe(){const t=qr();return Jt({mutationFn:async({id:r,...s})=>{const{data:n,error:a}=await Z.from("deal_pipeline").update(s).eq("id",r).select().single();if(a)throw a;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function GQt(){const t=qr();return Jt({mutationFn:async({dealId:r,stageId:s,stageName:n})=>{const{data:a,error:o}=await Z.from("deal_pipeline").update({stage_id:s}).eq("id",r).select().single();if(o)throw o;return await Z.from("deal_activities").insert({deal_id:r,activity_type:"stage_change",title:`Moved to ${n}`,metadata:{new_stage_id:s,new_stage_name:n}}),a},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-activities"]})}})}function KQt(){const t=qr();return Jt({mutationFn:async r=>{const{error:s}=await Z.from("deal_pipeline").delete().eq("id",r);if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function ZQt(t){return Ht({queryKey:["deal-activities",t],queryFn:async()=>{const{data:r,error:s}=await Z.from("deal_activities").select("*").eq("deal_id",t).order("created_at",{ascending:!1});if(s)throw s;return r},enabled:!!t})}function YQt(){const t=qr();return Jt({mutationFn:async r=>{const{data:s,error:n}=await Z.from("deal_activities").insert([{deal_id:r.deal_id,activity_type:r.activity_type,title:r.title,description:r.description||null}]).select().single();if(n)throw n;return s},onSuccess:(r,s)=>{t.invalidateQueries({queryKey:["deal-activities",s.deal_id]})}})}function XQt(t){return Ht({queryKey:["deal-checklist",t],queryFn:async()=>{const{data:r,error:s}=await Z.from("deal_checklist_items").select("*").eq("deal_id",t).order("sort_order",{ascending:!0});if(s)throw s;return r},enabled:!!t})}function QQt(){const t=qr();return Jt({mutationFn:async({id:r,is_completed:s,deal_id:n})=>{const{data:a,error:o}=await Z.from("deal_checklist_items").update({is_completed:s,completed_at:s?new Date().toISOString():null}).eq("id",r).select().single();if(o)throw o;return a},onSuccess:(r,s)=>{t.invalidateQueries({queryKey:["deal-checklist",s.deal_id]})}})}function JQt(){const t=qr();return Jt({mutationFn:async r=>{const{data:s,error:n}=await Z.from("deal_checklist_items").insert([{deal_id:r.deal_id,title:r.title,description:r.description||null,due_date:r.due_date||null,sort_order:r.sort_order||0}]).select().single();if(n)throw n;return s},onSuccess:(r,s)=>{t.invalidateQueries({queryKey:["deal-checklist",s.deal_id]})}})}function eJt(){const t=Ll();return Ht({queryKey:["deal-pipeline-stats",t],queryFn:async()=>{if(!t)return null;const{data:r,error:s}=await Z.from("deal_pipeline").select("expected_price, expected_commission, stage_id, deal_pipeline_stages(name, is_won_stage, is_lost_stage)").eq("owner_user_id",t);if(s)throw s;const n=(r==null?void 0:r.filter(o=>{var l,i,d;return!((l=o.deal_pipeline_stages)!=null&&l.is_won_stage)&&!((i=o.deal_pipeline_stages)!=null&&i.is_lost_stage)&&((d=o.deal_pipeline_stages)==null?void 0:d.name)!=="Cancelled"}))||[],a=(r==null?void 0:r.filter(o=>{var l;return(l=o.deal_pipeline_stages)==null?void 0:l.is_won_stage}))||[];return{totalDeals:(r==null?void 0:r.length)||0,activeDeals:n.length,wonDeals:a.length,pipelineValue:n.reduce((o,l)=>o+(l.expected_price||0),0),expectedCommission:n.reduce((o,l)=>o+(l.expected_commission||0),0),wonValue:a.reduce((o,l)=>o+(l.expected_price||0),0)}},enabled:!!t})}function tJt(t){const r=Ll();return Ht({queryKey:["deal-by-listing",t,r],queryFn:async()=>{if(!r||!t)return null;const{data:s,error:n}=await Z.from("deal_pipeline").select(` *, deal_pipeline_stages(id, name, color) `).eq("owner_user_id",r).eq("listing_id",t).maybeSingle();if(n)throw n;return s},enabled:!!r&&!!t})}function rJt(){const t=qr();return Jt({mutationFn:async({dealId:r,listingId:s})=>{const{data:n,error:a}=await Z.from("deal_pipeline").update({listing_id:s}).eq("id",r).select().single();if(a)throw a;return await Z.from("deal_activities").insert({deal_id:r,activity_type:"system",title:"Linked to Listing Exchange",description:"This deal is now synced with Listing Exchange",metadata:{listing_id:s}}),n},onSuccess:(r,s)=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-by-listing",s.listingId]})}})}function sJt(){const t=qr();return Jt({mutationFn:async({dealId:r,listingId:s})=>{const{data:n,error:a}=await Z.from("deal_pipeline").update({listing_id:null}).eq("id",r).select().single();if(a)throw a;return{data:n,listingId:s}},onSuccess:r=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-by-listing",r.listingId]})}})}function nJt({listing:t}){const r=Ws(),[s,n]=E.useState(""),[a,o]=E.useState(!1),{data:l,isLoading:i}=tJt(t.id),{data:d,isLoading:m}=gve(),{data:g,isLoading:y}=GVe(),v=WVe(),b=rJt(),N=sJt(),j=KVe(),S=(g==null?void 0:g.filter(O=>!O.listing_id))||[],A=O=>{if(!(d!=null&&d.length))return null;switch(O){case"coming_soon":case"active":case"price_improvement":return d.find(B=>B.name==="Active");case"under_contract":return d.find(B=>B.name==="Under Contract");case"sold":return d.find(B=>B.is_won_stage);default:return d.find(B=>B.name==="Active")}},M=async()=>{o(!0);try{d!=null&&d.length||await v.mutateAsync();const O=A(t.status);await j.mutateAsync({deal_name:t.property_address?`${t.property_address}, ${t.city}`:`${t.city}, ${t.state}`,deal_type:"seller",stage_id:(O==null?void 0:O.id)||null,listing_id:t.id,property_address:t.property_address,city:t.city,state:t.state,expected_price:t.price,expected_commission:t.price*.03,commission_percentage:3,priority:"medium",probability:50}),Se.success("Deal created and linked to listing!")}catch(O){console.error("Failed to create deal:",O),Se.error("Failed to create deal")}finally{o(!1)}},I=async()=>{if(!s){Se.error("Please select a deal");return}try{await b.mutateAsync({dealId:s,listingId:t.id}),Se.success("Listing linked to deal!"),n("")}catch{Se.error("Failed to link listing")}},F=async()=>{if(l)try{await N.mutateAsync({dealId:l.id,listingId:t.id}),Se.success("Listing unlinked from deal")}catch{Se.error("Failed to unlink listing")}};return i||m?e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"flex items-center gap-2 text-base",children:[e.jsx(xy,{className:"h-4 w-4"}),"Deal Pipeline"]})}),e.jsx(qe,{children:e.jsx("div",{className:"flex items-center justify-center py-4",children:e.jsx(Hr,{className:"h-5 w-5 animate-spin text-muted-foreground"})})})]}):l?e.jsxs(ze,{className:"border-primary/20 bg-primary/5",children:[e.jsx(Wt,{className:"pb-2",children:e.jsxs(Zt,{className:"flex items-center gap-2 text-base",children:[e.jsx(jm,{className:"h-4 w-4 text-primary"}),"Linked to Pipeline"]})}),e.jsxs(qe,{className:"space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:l.deal_name}),e.jsx("div",{className:"flex items-center gap-2 mt-1",children:l.deal_pipeline_stages&&e.jsx(bt,{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})})]})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Status changes sync automatically between the listing and pipeline."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Q,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>r("/mission-control/pipeline"),children:["View Pipeline",e.jsx(Hi,{className:"h-3 w-3 ml-1"})]}),e.jsx(Q,{variant:"ghost",size:"sm",onClick:F,disabled:N.isPending,children:N.isPending?e.jsx(Hr,{className:"h-4 w-4 animate-spin"}):e.jsx(VA,{className:"h-4 w-4"})})]})]})]}):e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-2",children:e.jsxs(Zt,{className:"flex items-center gap-2 text-base",children:[e.jsx(xy,{className:"h-4 w-4"}),"Deal Pipeline"]})}),e.jsxs(qe,{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Link this listing to your pipeline to track the deal and sync status changes."}),e.jsxs(Q,{onClick:M,disabled:a||j.isPending,className:"w-full",size:"sm",children:[a||j.isPending?e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Create New Deal"]}),S.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-card px-2 text-muted-foreground",children:"or"})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(ds,{value:s,onValueChange:n,children:[e.jsx(ls,{className:"flex-1 text-sm",children:e.jsx(us,{placeholder:"Link to existing deal..."})}),e.jsx(cs,{children:S.map(O=>e.jsx(Ut,{value:O.id,children:O.deal_name},O.id))})]}),e.jsx(Q,{variant:"secondary",size:"icon",onClick:I,disabled:!s||b.isPending,children:b.isPending?e.jsx(Hr,{className:"h-4 w-4 animate-spin"}):e.jsx(jm,{className:"h-4 w-4"})})]})]})]})]})}const aJt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},iJt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},ITe={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function oJt(){var le,ne,fe,oe,de,ue,xe,Te,be;const{listingId:t}=Xl(),r=Ws(),{user:s}=Gr(),{data:n,isLoading:a}=YRe(t||""),{data:o}=JRe(t||""),{data:l}=Bxt(t||""),i=QRe(),d=zxt(),m=$xt(),g=XRe(),y=qxt(),[v,b]=E.useState(!1),[N,j]=E.useState(!1),[S,A]=E.useState(!1),[M,I]=E.useState(null),[F,O]=E.useState({buyerName:"",buyerType:"",notes:""}),B=(s==null?void 0:s.id)===(n==null?void 0:n.agent_id),$=we=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(we),H=async we=>{const ve=`https://listings.relevelup.com/${(n==null?void 0:n.slug)||(n==null?void 0:n.id)}`,tt=`Check out this listing: ${(n==null?void 0:n.property_address)||(n==null?void 0:n.city)}`;m.mutate({listingId:n.id,shareType:we});try{switch(we){case"facebook":window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(ve)}`,"_blank");break;case"copy":await navigator.clipboard.writeText(ve),Se.success("Link copied to clipboard!");break;case"text":window.open(`sms:?body=${encodeURIComponent(`${tt} ${ve}`)}`);break;case"email":window.open(`mailto:?subject=${encodeURIComponent(tt)}&body=${encodeURIComponent(`Check out this listing: ${ve}`)}`);break}}catch(Ae){console.error("Share error:",Ae),Se.error("Failed to share")}},W=async()=>{try{await g.mutateAsync(n.id),Se.success("Listing deleted"),r("/mission-control/listings")}catch{Se.error("Failed to delete listing")}},X=async()=>{if(!F.buyerName.trim()){Se.error("Please enter buyer name");return}try{await y.mutateAsync({listingId:n.id,listingAgentId:n.agent_id,buyerName:F.buyerName,buyerType:F.buyerType||void 0,notes:F.notes||void 0}),Se.success("Referral sent successfully!"),j(!1),O({buyerName:"",buyerType:"",notes:""})}catch{Se.error("Failed to send referral")}},se=we=>{var Ie,et;const ve=(n==null?void 0:n.property_address)||`${n==null?void 0:n.city}, ${n==null?void 0:n.state}`,tt=$((n==null?void 0:n.price)||0),Ae=n!=null&&n.bedrooms?`${n.bedrooms}BD`:"",Le=n!=null&&n.bathrooms?`${n.bathrooms}BA`:"",Ue=n!=null&&n.square_footage?`${n.square_footage.toLocaleString()}SF`:"",Ye=[Ae,Le,Ue].filter(Boolean).join(" | ");switch(we){case"just_listed":return`🏡 JUST LISTED! ${ve} ${tt} ${Ye} ${(n==null?void 0:n.description)||"Schedule your showing today!"} #JustListed #RealEstate #HomeForSale #${(Ie=n==null?void 0:n.city)==null?void 0:Ie.replace(/\s/g,"")}`;case"price_improvement":return`📣 PRICE IMPROVEMENT! ${ve} Now ${tt}! ${Ye} Don't miss this opportunity! #PriceReduced #RealEstate #HomeForSale`;case"teaser":return`Looking for a ${ITe[(n==null?void 0:n.property_type)||"single_family"].toLowerCase()} in ${n==null?void 0:n.city}? 👀 I've got just the one for you! ${Ye} DM me for details! 📩 #ComingSoon #RealEstate #${(et=n==null?void 0:n.city)==null?void 0:et.replace(/\s/g,"")}`;default:return""}};if(a)return e.jsx(Fr,{title:"Listing",description:"",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(fr,{className:"h-10 w-32"}),e.jsx(fr,{className:"h-[400px] w-full"}),e.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[e.jsx(fr,{className:"h-48"}),e.jsx(fr,{className:"h-48"}),e.jsx(fr,{className:"h-48"})]})]})});if(!n)return e.jsx(Fr,{title:"Listing Not Found",description:"",children:e.jsx(ze,{children:e.jsxs(qe,{className:"py-12 text-center",children:[e.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing could not be found."}),e.jsx(Q,{onClick:()=>r("/mission-control/listings"),children:"Back to Listings"})]})})});const ae=((le=n.photos)==null?void 0:le.find(we=>we.is_primary))||((ne=n.photos)==null?void 0:ne[0]);return e.jsxs(Fr,{title:"",description:"",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs(Q,{variant:"ghost",onClick:()=>r("/mission-control/listings"),children:[e.jsx(_i,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsx("div",{className:"md:col-span-2",children:e.jsx("div",{className:"aspect-[16/10] rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>ae&&I(ae.photo_url),children:ae?e.jsx("img",{src:ae.photo_url,alt:"Primary",className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No photos"})})}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:(fe=n.photos)==null?void 0:fe.slice(1,5).map((we,ve)=>e.jsx("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>I(we.photo_url),children:e.jsx("img",{src:we.photo_url,alt:`Photo ${ve+2}`,className:"w-full h-full object-cover"})},we.id))})]}),e.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"md:col-span-2 space-y-6",children:[e.jsx(ze,{children:e.jsxs(qe,{className:"p-6",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 mb-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(bt,{className:`${aJt[n.status]} text-white border-0`,children:iJt[n.status]}),n.is_featured&&e.jsxs(bt,{variant:"outline",className:"border-amber-500 text-amber-500",children:[e.jsx(Ln,{className:"h-3 w-3 mr-1 fill-amber-500"}),"Featured"]}),n.open_to_referrals&&e.jsxs(bt,{variant:"outline",children:[e.jsx(ws,{className:"h-3 w-3 mr-1"}),"Open to Referrals"]})]}),e.jsx("h1",{className:"text-3xl font-bold text-primary mb-2",children:$(n.price)}),n.property_address&&e.jsx("p",{className:"text-xl font-medium",children:n.property_address}),e.jsxs("p",{className:"text-muted-foreground flex items-center gap-1",children:[e.jsx(eo,{className:"h-4 w-4"}),n.city,", ",n.state,n.neighborhood&&` • ${n.neighborhood}`]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Q,{variant:"outline",size:"icon",onClick:()=>i.mutate(n.id),children:e.jsx(Ci,{className:`h-4 w-4 ${o?"fill-pink-500 text-pink-500":""}`})}),e.jsx(Q,{variant:"outline",size:"icon",onClick:()=>d.mutate(n.id),children:l?e.jsx(Lj,{className:"h-4 w-4"}):e.jsx(Df,{className:"h-4 w-4"})}),!B&&e.jsxs(Q,{variant:"outline",className:"border-amber-500 text-amber-600 hover:bg-amber-50",onClick:()=>A(!0),children:[e.jsx(An,{className:"h-4 w-4 mr-2"}),"Share & Earn Leads"]}),e.jsxs(mh,{children:[e.jsx(ph,{asChild:!0,children:e.jsxs(Q,{variant:"outline",children:[e.jsx(Oc,{className:"h-4 w-4 mr-2"}),"Share"]})}),e.jsxs(Au,{children:[e.jsxs(Ba,{onClick:()=>H("copy"),children:[e.jsx(fo,{className:"h-4 w-4 mr-2"}),"Copy Link"]}),e.jsxs(Ba,{onClick:()=>H("facebook"),children:[e.jsx(iu,{className:"h-4 w-4 mr-2"}),"Facebook"]}),e.jsxs(Ba,{onClick:()=>H("text"),children:[e.jsx($o,{className:"h-4 w-4 mr-2"}),"Text"]}),e.jsxs(Ba,{onClick:()=>H("email"),children:[e.jsx(mn,{className:"h-4 w-4 mr-2"}),"Email"]})]})]}),B&&e.jsxs(e.Fragment,{children:[e.jsxs(Q,{variant:"outline",onClick:()=>r(`/mission-control/listings/${n.id}/edit`),children:[e.jsx(wc,{className:"h-4 w-4 mr-2"}),"Edit"]}),e.jsx(Q,{variant:"destructive",size:"icon",onClick:()=>b(!0),children:e.jsx(Rs,{className:"h-4 w-4"})})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 py-4 border-y",children:[n.bedrooms&&e.jsxs("div",{className:"text-center",children:[e.jsx(H1,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),e.jsx("p",{className:"font-semibold",children:n.bedrooms}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Beds"})]}),n.bathrooms&&e.jsxs("div",{className:"text-center",children:[e.jsx(V1,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),e.jsx("p",{className:"font-semibold",children:n.bathrooms}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Baths"})]}),n.square_footage&&e.jsxs("div",{className:"text-center",children:[e.jsx(Yg,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),e.jsx("p",{className:"font-semibold",children:n.square_footage.toLocaleString()}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Sq Ft"})]}),n.year_built&&e.jsxs("div",{className:"text-center",children:[e.jsx(Mn,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),e.jsx("p",{className:"font-semibold",children:n.year_built}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Built"})]})]}),e.jsxs("div",{className:"pt-4 space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(bt,{variant:"secondary",children:[e.jsx(bi,{className:"h-3 w-3 mr-1"}),ITe[n.property_type]]}),n.lot_size&&e.jsxs(bt,{variant:"secondary",children:["Lot: ",n.lot_size]}),n.has_hoa&&e.jsx(bt,{variant:"secondary",children:"HOA"})]}),n.description&&e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium mb-2",children:"Description"}),e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})]}),n.agent_notes&&n.agent_notes_public&&e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium mb-2",children:"Agent Notes"}),e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.agent_notes})]}),n.mls_link&&e.jsx(Q,{variant:"outline",asChild:!0,children:e.jsxs("a",{href:n.mls_link,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(En,{className:"h-4 w-4 mr-2"}),"View on MLS"]})})]}),e.jsxs("div",{className:"flex items-center gap-4 pt-4 mt-4 border-t text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Gi,{className:"h-4 w-4"}),n.view_count," views"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Oc,{className:"h-4 w-4"}),n.share_count," shares"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ci,{className:"h-4 w-4"}),n.save_count," saves"]})]})]})}),n.allow_sharing&&e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{className:"text-lg",children:"Share Content"})}),e.jsx(qe,{className:"space-y-4",children:["just_listed","price_improvement","teaser"].map(we=>e.jsxs("div",{className:"p-3 bg-muted rounded-lg",children:[e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsxs("p",{className:"font-medium text-sm capitalize",children:[we.replace("_"," ")," Caption"]}),e.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>{navigator.clipboard.writeText(se(we)),Se.success("Caption copied!")},children:e.jsx(fo,{className:"h-3 w-3"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:se(we)})]},we))})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{className:"text-lg",children:"Listing Agent"})}),e.jsxs(qe,{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx("span",{className:"text-lg font-semibold text-primary",children:((de=(oe=n.agent)==null?void 0:oe.name)==null?void 0:de.charAt(0))||"?"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:((ue=n.agent)==null?void 0:ue.name)||"Unknown"}),((Te=(xe=n.agent)==null?void 0:xe.brokerage)==null?void 0:Te.name)&&e.jsx("p",{className:"text-sm text-muted-foreground",children:n.agent.brokerage.name})]})]}),!B&&e.jsx("div",{className:"space-y-2",children:((be=n.agent)==null?void 0:be.email)&&e.jsx(Q,{variant:"outline",className:"w-full",asChild:!0,children:e.jsxs("a",{href:`mailto:${n.agent.email}`,children:[e.jsx(mn,{className:"h-4 w-4 mr-2"}),"Email Agent"]})})})]})]}),B&&e.jsx(nJt,{listing:n}),!B&&n.open_to_referrals&&e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:[e.jsx(ws,{className:"h-5 w-5"}),"Send a Buyer"]})}),e.jsxs(qe,{children:[e.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."}),e.jsx(Q,{className:"w-full",onClick:()=>j(!0),children:"Send Referral"})]})]})]})]})]}),e.jsx(Dr,{open:!!M,onOpenChange:()=>I(null),children:e.jsx(Lr,{className:"max-w-4xl",children:e.jsx("img",{src:M||"",alt:"Full size",className:"w-full h-auto"})})}),e.jsx(Dr,{open:v,onOpenChange:b,children:e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Delete Listing"}),e.jsx(Gs,{children:"Are you sure you want to delete this listing? This action cannot be undone."})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>b(!1),children:"Cancel"}),e.jsx(Q,{variant:"destructive",onClick:W,disabled:g.isPending,children:g.isPending?"Deleting...":"Delete"})]})]})}),e.jsx(Dr,{open:N,onOpenChange:j,children:e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Send Buyer Referral"}),e.jsx(Gs,{children:"Submit buyer information to the listing agent"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Buyer Name *"}),e.jsx(Qe,{value:F.buyerName,onChange:we=>O({...F,buyerName:we.target.value}),placeholder:"Enter buyer's name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Buyer Type"}),e.jsxs(ds,{value:F.buyerType,onValueChange:we=>O({...F,buyerType:we}),children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Select type"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"first_time",children:"First-Time Buyer"}),e.jsx(Ut,{value:"investor",children:"Investor"}),e.jsx(Ut,{value:"relocating",children:"Relocating"}),e.jsx(Ut,{value:"upgrade",children:"Upgrading"}),e.jsx(Ut,{value:"downsize",children:"Downsizing"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Notes"}),e.jsx(Ks,{value:F.notes,onChange:we=>O({...F,notes:we.target.value}),placeholder:"Any additional information..."})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),e.jsx(Q,{onClick:X,disabled:y.isPending,children:y.isPending?"Sending...":"Send Referral"})]})]})}),e.jsx(HVe,{open:S,onOpenChange:A,listingId:(n==null?void 0:n.id)||"",listingSlug:(n==null?void 0:n.slug)||null,listingTitle:(n==null?void 0:n.property_address)||`${n==null?void 0:n.city}, ${n==null?void 0:n.state}`})]})}function lJt({selectedVideoId:t,onVideoSelect:r,listingId:s}){const n=Ws(),{user:a}=Gr(),[o,l]=E.useState(!1),[i,d]=E.useState([]),[m,g]=E.useState(!1),[y,v]=E.useState(null),[b,N]=E.useState({});E.useEffect(()=>{t&&a?j():v(null)},[t,a]);const j=async()=>{if(!t)return;const{data:W,error:X}=await Z.from("agent_videos").select("id, bunny_video_id, title, thumbnail_url, preview_url, playback_url, duration_seconds, status, created_at").eq("id",t).eq("is_deleted",!1).single();!X&&W&&(v(W),S(W))},S=async W=>{try{const{data:X,error:se}=await Z.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:W.bunny_video_id,isAgentVideo:!0}});!se&&(X!=null&&X.thumbnailUrl)&&N(ae=>({...ae,[W.id]:{thumbnailUrl:X.thumbnailUrl}}))}catch(X){console.warn("Failed to get signed URL",X)}},A=async()=>{if(a){g(!0);try{const{data:W,error:X}=await Z.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(X)throw X;d(W||[]),W!=null&&W.length&&M(W)}catch(W){console.error("Error fetching videos:",W),Se.error("Failed to load videos")}finally{g(!1)}}},M=async W=>{var X;try{const se=W.map(oe=>oe.bunny_video_id),{data:ae,error:le}=await Z.functions.invoke("bunny-upload",{body:{action:"bulk-asset-urls",videoIds:se,isAgentVideo:!0}});if(le)throw le;const ne=(ae==null?void 0:ae.assets)||{},fe={};for(const oe of W)(X=ne[oe.bunny_video_id])!=null&&X.thumbnailUrl&&(fe[oe.id]={thumbnailUrl:ne[oe.bunny_video_id].thumbnailUrl});N(oe=>({...oe,...fe}))}catch(se){console.warn("Failed to bulk-fetch signed URLs",se)}},I=()=>{l(!0),A()},F=W=>{r(W.id),v(W),l(!1),Se.success("Video selected")},O=()=>{r(null),v(null)},B=()=>{const W=s?`/mission-control/listings/${s}/edit`:"/mission-control/listings/new";n(`/mission-control/video?returnUrl=${encodeURIComponent(W)}`)},$=W=>{if(!W)return"0:00";const X=Math.floor(W/60),se=W%60;return`${X}:${se.toString().padStart(2,"0")}`},H=W=>{var X;return((X=b[W.id])==null?void 0:X.thumbnailUrl)||W.thumbnail_url};return e.jsxs("div",{className:"space-y-3",children:[y?e.jsx(ze,{className:"overflow-hidden",children:e.jsx(qe,{className:"p-0",children:e.jsxs("div",{className:"flex items-start gap-4 p-4",children:[e.jsxs("div",{className:"relative w-32 h-20 bg-muted rounded-lg overflow-hidden flex-shrink-0",children:[H(y)?e.jsx("img",{src:H(y),alt:y.title||"Video thumbnail",className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(ya,{className:"h-8 w-8 text-muted-foreground"})}),e.jsx("div",{className:"absolute inset-0 bg-black/30 flex items-center justify-center",children:e.jsx(Gl,{className:"h-6 w-6 text-white fill-white"})}),y.duration_seconds&&e.jsx("div",{className:"absolute bottom-1 right-1 bg-black/70 text-white text-[10px] px-1.5 py-0.5 rounded",children:$(y.duration_seconds)})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-sm truncate",children:y.title||"Untitled Video"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Property Video Tour"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Q,{type:"button",variant:"outline",size:"sm",onClick:I,children:"Change"}),e.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:O,className:"text-destructive hover:text-destructive",children:e.jsx(rn,{className:"h-4 w-4"})})]})]})})}):e.jsx(ze,{className:"border-dashed",children:e.jsx(qe,{className:"p-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(ya,{className:"h-10 w-10 mx-auto text-muted-foreground mb-3"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Add a video walkthrough to showcase this property"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 justify-center",children:[e.jsxs(Q,{type:"button",variant:"outline",onClick:I,className:"gap-2",children:[e.jsx(US,{className:"h-4 w-4"}),"Select from Library"]}),e.jsxs(Q,{type:"button",variant:"outline",onClick:B,className:"gap-2",children:[e.jsx(Vg,{className:"h-4 w-4"}),"Record New Video"]})]})]})})}),e.jsx(Dr,{open:o,onOpenChange:l,children:e.jsxs(Lr,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsx(Ur,{children:e.jsxs(Br,{className:"flex items-center gap-2",children:[e.jsx(US,{className:"h-5 w-5"}),"Select a Video"]})}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:m?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Hr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):i.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(ya,{className:"h-12 w-12 mx-auto text-muted-foreground mb-3"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"No videos in your library yet"}),e.jsxs(Q,{onClick:B,className:"gap-2",children:[e.jsx(Vg,{className:"h-4 w-4"}),"Record Your First Video"]})]}):e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3 p-1",children:i.map(W=>e.jsxs("button",{type:"button",onClick:()=>F(W),className:`group relative rounded-lg overflow-hidden border-2 transition-all text-left ${t===W.id?"border-primary ring-2 ring-primary/20":"border-transparent hover:border-muted-foreground/30"}`,children:[e.jsxs("div",{className:"aspect-video bg-muted relative",children:[H(W)?e.jsx("img",{src:H(W),alt:W.title||"Video",className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(ya,{className:"h-8 w-8 text-muted-foreground"})}),e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/30 transition-colors flex items-center justify-center",children:e.jsx(Gl,{className:"h-8 w-8 text-white opacity-0 group-hover:opacity-100 transition-opacity"})}),W.duration_seconds&&e.jsx("div",{className:"absolute bottom-1 right-1 bg-black/70 text-white text-[10px] px-1.5 py-0.5 rounded",children:$(W.duration_seconds)})]}),e.jsx("div",{className:"p-2 bg-card",children:e.jsx("p",{className:"text-xs font-medium truncate",children:W.title||"Untitled Video"})})]},W.id))})}),e.jsxs("div",{className:"flex justify-between items-center pt-4 border-t",children:[e.jsxs(Q,{type:"button",variant:"ghost",onClick:B,className:"gap-2",children:[e.jsx(Vg,{className:"h-4 w-4"}),"Record New Video"]}),e.jsx(Q,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"})]})]})})]})}const cJt=[{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"}],dJt=[{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 PTe(){var fe;const{listingId:t}=Xl(),[r]=Bc(),s=r.get("brokerage"),n=Ws(),{user:a}=Gr(),o=!!t&&t!=="new",l=!!s&&!o,{data:i,isLoading:d}=YRe(o?t:""),m=Pxt(),g=Lxt(),y=Oxt(),v=Dxt(),b=Rxt(),{data:N=[]}=Ht({queryKey:["brokerage-agents",s],queryFn:async()=>{if(!s)return[];const{data:oe,error:de}=await Z.from("profiles").select("id, name, email").eq("brokerage_id",s).order("name");if(de)throw de;return oe||[]},enabled:l}),[j,S]=E.useState(""),[A,M]=E.useState(!1),[I,F]=E.useState([]),[O,B]=E.useState([]),[$,H]=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 oe,de,ue,xe,Te;i&&o&&H({property_address:i.property_address||"",city:i.city||"",state:i.state||"",neighborhood:i.neighborhood||"",price:((oe=i.price)==null?void 0:oe.toString())||"",property_type:i.property_type,status:i.status,bedrooms:((de=i.bedrooms)==null?void 0:de.toString())||"",bathrooms:((ue=i.bathrooms)==null?void 0:ue.toString())||"",square_footage:((xe=i.square_footage)==null?void 0:xe.toString())||"",lot_size:i.lot_size||"",year_built:((Te=i.year_built)==null?void 0:Te.toString())||"",has_hoa:i.has_hoa,description:i.description||"",agent_notes:i.agent_notes||"",agent_notes_public:i.agent_notes_public,mls_link:i.mls_link||"",video_link:i.video_link||"",video_id:i.video_id||null,allow_sharing:i.allow_sharing,open_to_referrals:i.open_to_referrals,open_to_social_promotion:i.open_to_social_promotion,share_with_brokerage:i.share_with_brokerage??!1,is_public:i.is_public})},[i,o]);const W=oe=>{if(!oe)return;const de=Array.from(oe);F(xe=>[...xe,...de]);const ue=de.map(xe=>URL.createObjectURL(xe));B(xe=>[...xe,...ue])},X=oe=>{URL.revokeObjectURL(O[oe]),F(de=>de.filter((ue,xe)=>xe!==oe)),B(de=>de.filter((ue,xe)=>xe!==oe))},se=async oe=>{var de;if(!(!oe||!i)){M(!0);try{for(const ue of Array.from(oe)){const xe=ue.name.split(".").pop(),Te=`${a==null?void 0:a.id}/${i.id}/${Date.now()}.${xe}`,{error:be}=await Z.storage.from("listing-photos").upload(Te,ue);if(be)throw be;const{data:{publicUrl:we}}=Z.storage.from("listing-photos").getPublicUrl(Te);await v.mutateAsync({listingId:i.id,photoUrl:we,isPrimary:!((de=i.photos)!=null&&de.length)})}Se.success("Photos uploaded!")}catch(ue){console.error("Upload error:",ue),Se.error("Failed to upload photos")}finally{M(!1)}}},ae=async oe=>{for(let de=0;de{if(i)try{await b.mutateAsync({photoId:oe,listingId:i.id}),Se.success("Photo removed")}catch{Se.error("Failed to remove photo")}},ne=async oe=>{if(oe.preventDefault(),!$.city.trim()||!$.state.trim()||!$.price){Se.error("Please fill in required fields (City, State, Price)");return}if(l&&!j){Se.error("Please select an agent to assign this listing to");return}try{const de={property_address:$.property_address||null,city:$.city,state:$.state,neighborhood:$.neighborhood||null,price:Number($.price),property_type:$.property_type,status:$.status,bedrooms:$.bedrooms?Number($.bedrooms):null,bathrooms:$.bathrooms?Number($.bathrooms):null,square_footage:$.square_footage?Number($.square_footage):null,lot_size:$.lot_size||null,year_built:$.year_built?Number($.year_built):null,has_hoa:$.has_hoa,description:$.description||null,agent_notes:$.agent_notes||null,agent_notes_public:$.agent_notes_public,mls_link:$.mls_link||null,video_link:$.video_link||null,video_id:$.video_id||null,allow_sharing:$.allow_sharing,open_to_referrals:$.open_to_referrals,open_to_social_promotion:$.open_to_social_promotion,share_with_brokerage:$.share_with_brokerage,is_public:$.is_public};if(o)await y.mutateAsync({id:t,...de}),Se.success("Listing updated!"),n(`/mission-control/listings/${t}`);else{M(!0);let ue;if(l&&j?ue=await g.mutateAsync({agentId:j,...de}):ue=await m.mutateAsync(de),I.length>0)try{await ae(ue.id),O.forEach(xe=>URL.revokeObjectURL(xe)),F([]),B([])}catch(xe){console.error("Photo upload error:",xe),Se.error("Listing created but some photos failed to upload")}M(!1),Se.success("Listing created!"),n(l?"/my-brokerage":`/mission-control/listings/${ue.id}`)}}catch(de){console.error("Save error:",de),Se.error("Failed to save listing"),M(!1)}};return o&&d?e.jsx(Fr,{title:"Loading...",description:"",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(fr,{className:"h-10 w-32"}),e.jsx(fr,{className:"h-[600px] w-full"})]})}):e.jsx(Fr,{title:o?"Edit Listing":l?"Add Listing for Agent":"Add Listing",description:"",children:e.jsxs("form",{onSubmit:ne,className:"space-y-6",children:[e.jsxs(Q,{type:"button",variant:"ghost",onClick:()=>n(l?"/my-brokerage":"/mission-control/listings"),children:[e.jsx(_i,{className:"h-4 w-4 mr-2"}),l?"Back to Brokerage":"Back to Listings"]}),e.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"md:col-span-2 space-y-6",children:[l&&e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{children:"Assign to Agent *"})}),e.jsxs(qe,{children:[e.jsxs(ds,{value:j,onValueChange:S,children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Select an agent..."})}),e.jsx(cs,{children:N.map(oe=>e.jsx(Ut,{value:oe.id,children:oe.name||oe.email},oe.id))})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"This listing will appear on the selected agent's Listing Exchange."})]})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{children:"Property Details"})}),e.jsx(qe,{className:"space-y-4",children:e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"sm:col-span-2 space-y-2",children:[e.jsx(Ee,{children:"Property Address"}),e.jsx(Qe,{value:$.property_address,onChange:oe=>H({...$,property_address:oe.target.value}),placeholder:"123 Main St"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"City *"}),e.jsx(Qe,{value:$.city,onChange:oe=>H({...$,city:oe.target.value}),placeholder:"City",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"State *"}),e.jsx(Qe,{value:$.state,onChange:oe=>H({...$,state:oe.target.value}),placeholder:"State",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Neighborhood"}),e.jsx(Qe,{value:$.neighborhood,onChange:oe=>H({...$,neighborhood:oe.target.value}),placeholder:"Neighborhood"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Price *"}),e.jsx(Qe,{type:"number",value:$.price,onChange:oe=>H({...$,price:oe.target.value}),placeholder:"500000",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Property Type"}),e.jsxs(ds,{value:$.property_type,onValueChange:oe=>H({...$,property_type:oe}),children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsx(cs,{children:dJt.map(oe=>e.jsx(Ut,{value:oe.value,children:oe.label},oe.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Status"}),e.jsxs(ds,{value:$.status,onValueChange:oe=>H({...$,status:oe}),children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsx(cs,{children:cJt.map(oe=>e.jsx(Ut,{value:oe.value,children:oe.label},oe.value))})]})]})]})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{children:"Property Specs (Optional)"})}),e.jsx(qe,{children:e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Bedrooms"}),e.jsx(Qe,{type:"number",value:$.bedrooms,onChange:oe=>H({...$,bedrooms:oe.target.value}),placeholder:"3"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Bathrooms"}),e.jsx(Qe,{type:"number",step:"0.5",value:$.bathrooms,onChange:oe=>H({...$,bathrooms:oe.target.value}),placeholder:"2"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Sq Ft"}),e.jsx(Qe,{type:"number",value:$.square_footage,onChange:oe=>H({...$,square_footage:oe.target.value}),placeholder:"2000"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Lot Size"}),e.jsx(Qe,{value:$.lot_size,onChange:oe=>H({...$,lot_size:oe.target.value}),placeholder:"0.25 acres"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Year Built"}),e.jsx(Qe,{type:"number",value:$.year_built,onChange:oe=>H({...$,year_built:oe.target.value}),placeholder:"2005"})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-6",children:[e.jsx(xn,{checked:$.has_hoa,onCheckedChange:oe=>H({...$,has_hoa:oe})}),e.jsx(Ee,{children:"Has HOA"})]})]})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{children:"Description & Links"})}),e.jsxs(qe,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Description"}),e.jsx(Ks,{value:$.description,onChange:oe=>H({...$,description:oe.target.value}),placeholder:"Tell the story of this property...",rows:4})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Agent Notes"}),e.jsx(Ks,{value:$.agent_notes,onChange:oe=>H({...$,agent_notes:oe.target.value}),placeholder:"Notes for other agents...",rows:2}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xn,{checked:$.agent_notes_public,onCheckedChange:oe=>H({...$,agent_notes_public:oe})}),e.jsx(Ee,{className:"text-sm text-muted-foreground",children:"Make notes visible to other agents"})]})]}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"MLS Link"}),e.jsx(Qe,{value:$.mls_link,onChange:oe=>H({...$,mls_link:oe.target.value}),placeholder:"https://..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Video Link"}),e.jsx(Qe,{value:$.video_link,onChange:oe=>H({...$,video_link:oe.target.value}),placeholder:"YouTube or Vimeo URL"})]})]})]})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(ya,{className:"h-5 w-5"}),"Property Video"]})}),e.jsx(qe,{children:e.jsx(lJt,{selectedVideoId:$.video_id,onVideoSelect:oe=>H({...$,video_id:oe}),listingId:o?t:void 0})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{children:"Photos"})}),e.jsxs(qe,{children:[e.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-4",children:[o&&((fe=i==null?void 0:i.photos)==null?void 0:fe.map(oe=>e.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[e.jsx("img",{src:oe.photo_url,alt:"",className:"w-full h-full object-cover"}),e.jsx("button",{type:"button",onClick:()=>le(oe.id),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:e.jsx(rn,{className:"h-3 w-3"})}),oe.is_primary&&e.jsx("span",{className:"absolute bottom-1 left-1 text-[10px] bg-primary text-primary-foreground px-1.5 py-0.5 rounded",children:"Primary"})]},oe.id))),!o&&O.map((oe,de)=>e.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[e.jsx("img",{src:oe,alt:"",className:"w-full h-full object-cover"}),e.jsx("button",{type:"button",onClick:()=>X(de),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:e.jsx(rn,{className:"h-3 w-3"})}),de===0&&e.jsx("span",{className:"absolute bottom-1 left-1 text-[10px] bg-primary text-primary-foreground px-1.5 py-0.5 rounded",children:"Primary"})]},de)),e.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:[A?e.jsx(Hr,{className:"h-8 w-8 animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(to,{className:"h-8 w-8"}),e.jsx("span",{className:"text-xs",children:"Upload"})]}),e.jsx("input",{type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:oe=>o?se(oe.target.files):W(oe.target.files),disabled:A})]})]}),!o&&I.length>0&&e.jsxs("p",{className:"text-sm text-muted-foreground mt-4",children:[I.length," photo",I.length!==1?"s":""," will be uploaded when you save."]})]})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{children:"Sharing & Collaboration"})}),e.jsxs(qe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Ee,{children:"Allow Sharing"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Other agents can share this listing"})]}),e.jsx(xn,{checked:$.allow_sharing,onCheckedChange:oe=>H({...$,allow_sharing:oe})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Ee,{children:"Open to Referrals"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Accept buyer referrals"})]}),e.jsx(xn,{checked:$.open_to_referrals,onCheckedChange:oe=>H({...$,open_to_referrals:oe})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Ee,{children:"Social Promotion"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Can be promoted on social media"})]}),e.jsx(xn,{checked:$.open_to_social_promotion,onCheckedChange:oe=>H({...$,open_to_social_promotion:oe})})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsxs("div",{children:[e.jsx(Ee,{children:"Share with Brokerage"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Visible to agents in your brokerage"})]}),e.jsx(xn,{checked:$.share_with_brokerage,onCheckedChange:oe=>H({...$,share_with_brokerage:oe})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Ee,{children:"Make Public"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Publish on listings.relevelup.com to get leads"})]}),e.jsx(xn,{checked:$.is_public,onCheckedChange:oe=>H({...$,is_public:oe})})]})]})]}),e.jsx(Q,{type:"submit",className:"w-full",size:"lg",disabled:m.isPending||y.isPending,children:m.isPending||y.isPending?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):o?"Update Listing":"Create Listing"})]})]})]})})}function YVe({maxDurationSeconds:t=30,onRecordingComplete:r,onError:s,onRecordingStateChange:n,className:a,teleprompterContent:o}){const l=E.useRef(null),i=E.useRef(null),d=E.useRef(null),m=E.useRef([]),g=E.useRef(null),y=E.useRef(null),v=E.useRef(null),b=E.useRef(null),N=e5(),[j,S]=E.useState(!0),[A,M]=E.useState(!0),[I,F]=E.useState(null),[O,B]=E.useState(!1),[$,H]=E.useState(!1),[W,X]=E.useState(null),[se,ae]=E.useState(null),[le,ne]=E.useState(0),[fe,oe]=E.useState("user"),[de,ue]=E.useState(0),[xe,Te]=E.useState(!1),[be,we]=E.useState(!0),[ve,tt]=E.useState(null),[Ae,Le]=E.useState(!1),[Ue,Ye]=E.useState(null),Ie=E.useRef(null),et=E.useRef(s);et.current=s;const It=E.useCallback(ft=>{S(ft)},[]),Pe=E.useRef(j),at=E.useCallback(async()=>{var ct,Mt;M(!0),tt(null);const ft=N&&j;console.log("[VideoRecorder] initCamera start",{isMobile:N,usePortraitMode:j,shouldBePortrait:ft,facingMode:fe});try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Error("Camera not available in this browser or context. Try opening in a new tab.");d.current&&(console.log("[VideoRecorder] stopping existing stream"),d.current.getTracks().forEach(Mr=>Mr.stop()));const Ot=N&&ft?{facingMode:{ideal:fe},width:{ideal:720},height:{ideal:1280}}:{facingMode:{ideal:fe},width:{ideal:1280},height:{ideal:720}};console.log("[VideoRecorder] requesting getUserMedia",Ot);const rr=await navigator.mediaDevices.getUserMedia({video:Ot,audio:{echoCancellation:!0,noiseSuppression:!0}});if(console.log("[VideoRecorder] getUserMedia success"),rr.getVideoTracks().length===0)throw new Error("Camera stream started but no video track was provided.");d.current=rr,F(!0);const cr=rr.getVideoTracks()[0].getSettings();if(console.log("[VideoRecorder] Camera initialized with dimensions:",cr.width,"x",cr.height),l.current){const Mr=l.current;Mr.srcObject=rr,Mr.muted=!0,Mr.playsInline=!0,Mr.autoplay=!0,Mr.setAttribute("muted",""),Mr.setAttribute("playsinline",""),Mr.setAttribute("autoplay","");try{(ct=Mr.load)==null||ct.call(Mr)}catch(At){console.warn("[VideoRecorder] videoEl.load failed",At)}const As=async()=>{try{return await Mr.play(),console.log("[VideoRecorder] preview play ok"),Le(!1),setTimeout(()=>{console.debug("[VideoRecorder] preview metrics",{readyState:Mr.readyState,videoWidth:Mr.videoWidth,videoHeight:Mr.videoHeight})},300),!0}catch(At){return console.warn("[VideoRecorder] preview play blocked",At),Le(!0),!1}};await new Promise(At=>{let Rt=!1;const Cr=()=>{Rt||(Rt=!0,At())},fs=()=>{As().finally(Cr)};Mr.onloadedmetadata=fs,Mr.onloadeddata=fs,setTimeout(Cr,1500)})}try{y.current=new AudioContext;const Mr=y.current.createMediaStreamSource(rr);v.current=y.current.createAnalyser(),v.current.fftSize=256,Mr.connect(v.current);const As=()=>{if(v.current){const At=new Uint8Array(v.current.frequencyBinCount);v.current.getByteFrequencyData(At);const Rt=At.reduce((Cr,fs)=>Cr+fs)/At.length;ue(Math.min(100,Rt/128*100))}b.current=requestAnimationFrame(As)};As()}catch(Mr){console.warn("Audio context not available:",Mr)}}catch(Ot){console.error("Camera initialization error:",Ot),F(!1);let rr="Failed to access camera or microphone.";Ot.name==="NotAllowedError"?rr="Camera permission denied. Please allow camera access in your browser settings.":Ot.name==="NotFoundError"?rr="No camera found. Please connect a camera and try again.":Ot.name==="NotReadableError"?rr="Camera is in use by another application. Please close other apps using the camera.":Ot.message&&(rr=Ot.message),tt(rr),(Mt=et.current)==null||Mt.call(et,rr)}finally{M(!1)}},[fe,N,j]);E.useEffect(()=>{Pe.current!==j&&I&&!O&&!se&&(Pe.current=j,at())},[j,I,O,se,at]),E.useEffect(()=>(at(),()=>{d.current&&d.current.getTracks().forEach(ft=>ft.stop()),g.current&&clearInterval(g.current),b.current&&cancelAnimationFrame(b.current),y.current&&y.current.close(),Ie.current&&clearInterval(Ie.current),se&&URL.revokeObjectURL(se)}),[at,se]),E.useEffect(()=>{if(A||I!==!0||se)return;const ft=d.current,ct=l.current;!ft||!ct||(ct.srcObject!==ft&&(ct.srcObject=ft,ct.muted=!0,ct.playsInline=!0,ct.autoplay=!0,ct.setAttribute("muted",""),ct.setAttribute("playsinline",""),ct.setAttribute("autoplay","")),ct.play().then(()=>Le(!1)).catch(Mt=>{Le(!0),console.warn("Live preview play blocked on mount:",Mt)}))},[I,A,se]),E.useEffect(()=>{n==null||n(O)},[O,n]);const ce=E.useCallback(async()=>{if(se)return;const ft=l.current;if(ft)try{await ft.play(),Le(!1)}catch(ct){Le(!0),console.warn("Live preview still blocked (needs user gesture):",ct)}},[se]),$e=E.useCallback(()=>{i.current&&i.current.state!=="inactive"&&i.current.stop(),g.current&&(clearInterval(g.current),g.current=null),B(!1),H(!1)},[]),Ge=E.useCallback(()=>{if(!d.current)return;ce(),m.current=[],ne(0);const ct=["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm","video/mp4"].find(Ot=>MediaRecorder.isTypeSupported(Ot)),Mt=new MediaRecorder(d.current,ct?{mimeType:ct,videoBitsPerSecond:25e5}:{videoBitsPerSecond:25e5});Mt.ondataavailable=Ot=>{Ot.data.size>0&&m.current.push(Ot.data)},Mt.onstop=()=>{var cr;const Ot=Mt.mimeType||ct||((cr=m.current[0])==null?void 0:cr.type)||"video/webm",rr=new Blob(m.current,{type:Ot});X(rr);const Ir=URL.createObjectURL(rr);ae(Ir)},i.current=Mt,Mt.start(100),B(!0),g.current=setInterval(()=>{ne(Ot=>Ot>=t-1?($e(),t):Ot+1)},1e3)},[ce,t,$e]),rt=E.useCallback(()=>{if(Ue!==null)return;Ye(3);let ft=3;Ie.current=setInterval(()=>{ft-=1,ft<=0?(Ie.current&&clearInterval(Ie.current),Ie.current=null,Ye(null),Ge()):Ye(ft)},1e3)},[Ue,Ge]),je=E.useCallback(()=>{i.current&&i.current.state==="recording"&&(i.current.pause(),H(!0),g.current&&clearInterval(g.current))},[]),it=E.useCallback(()=>{i.current&&i.current.state==="paused"&&(i.current.resume(),H(!1),g.current=setInterval(()=>{ne(ft=>ft>=t-1?($e(),t):ft+1)},1e3))},[t,$e]),Me=E.useCallback(()=>{se&&URL.revokeObjectURL(se),X(null),ae(null),ne(0),Te(!1),we(!0),l.current&&d.current&&(l.current.srcObject=d.current,l.current.muted=!0,ce())},[ce,se]),Je=E.useCallback(()=>{oe(ft=>ft==="user"?"environment":"user")},[]),Xe=E.useCallback(()=>{W&&r(W,le)},[W,le,r]),Ve=E.useCallback(()=>{l.current&&se&&(xe?l.current.pause():(we(!1),l.current.muted=!1,l.current.play()),Te(!xe))},[se,xe]);E.useEffect(()=>{if(!se)return;const ft=l.current;if(!ft)return;we(!1),ft.pause(),ft.removeAttribute("src"),ft.srcObject=null,ft.load(),ft.src=se,ft.currentTime=0,ft.playsInline=!0,ft.muted=!1,ft.onended=()=>Te(!1);const ct=()=>{var rr;const Mt=ft.error,Ot=Mt?`Recorded video failed to play (code ${Mt.code}). Likely unsupported format/codec in this browser.`:"Recorded video failed to play.";console.warn("[VideoRecorder] recorded playback error",Mt),(rr=et.current)==null||rr.call(et,Ot)};return ft.addEventListener("error",ct),ft.load(),()=>{ft.removeEventListener("error",ct)}},[se]);const ot=ft=>{const ct=Math.floor(ft/60),Mt=ft%60;return`${ct}:${Mt.toString().padStart(2,"0")}`},mt=N&&j?"aspect-[9/16]":"aspect-video";return A?e.jsx("div",{className:qt("flex items-center justify-center bg-black rounded-lg",mt,a),children:e.jsxs("div",{className:"text-center text-white",children:[e.jsx(Hr,{className:"h-12 w-12 animate-spin mx-auto mb-4"}),e.jsx("p",{children:"Initializing camera..."})]})}):I===!1?e.jsx("div",{className:qt("flex items-center justify-center bg-black rounded-lg",mt,a),children:e.jsxs("div",{className:"text-center text-white p-8 max-w-md",children:[e.jsx(_l,{className:"h-12 w-12 mx-auto mb-4 text-destructive"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Camera Access Required"}),e.jsx("p",{className:"text-gray-400 mb-4 text-sm",children:ve||"Please allow camera and microphone access to record videos."}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Q,{onClick:()=>at(),variant:"secondary",className:"w-full",children:[e.jsx(Ko,{className:"h-4 w-4 mr-2"}),"Try Again"]}),e.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."})]})]})}):e.jsxs("div",{className:qt("flex flex-col gap-2",a),children:[N&&!O&&!se&&e.jsxs("div",{className:"flex items-center justify-center gap-3 py-2 bg-muted/50 rounded-lg",children:[e.jsx(Wj,{className:qt("h-4 w-4",j?"text-muted-foreground":"text-primary")}),e.jsx(Ee,{htmlFor:"orientation-toggle",className:"text-sm text-muted-foreground",children:"Landscape"}),e.jsx(xn,{id:"orientation-toggle",checked:j,onCheckedChange:It}),e.jsx(Ee,{htmlFor:"orientation-toggle",className:"text-sm text-muted-foreground",children:"Portrait"}),e.jsx(by,{className:qt("h-4 w-4",j?"text-primary":"text-muted-foreground")})]}),e.jsxs("div",{className:qt("relative bg-black rounded-lg overflow-hidden"),onPointerDown:()=>{ce()},children:[e.jsx("video",{ref:l,src:se??void 0,className:qt("w-full bg-black",j&&!se?"object-contain":"object-cover",mt,fe==="user"&&!se&&"scale-x-[-1]"),playsInline:!0,controls:!!se,muted:se?be:!0,autoPlay:!se},se??"live"),!se&&Ae&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40",children:e.jsx(Q,{type:"button",variant:"secondary",onClick:()=>void ce(),className:"bg-white/20 hover:bg-white/30 text-white",children:"Tap to enable preview"})}),o&&!se&&e.jsx("div",{className:"absolute inset-0 pointer-events-none",children:o}),Ue!==null&&!se&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-30 pointer-events-none",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.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:Ue},Ue),e.jsx("p",{className:"text-white/80 text-lg font-medium drop-shadow-md",children:"Get ready…"})]})}),O&&e.jsxs("div",{className:"absolute top-4 left-4 flex items-center gap-2 bg-black/50 px-3 py-1.5 rounded-full",children:[e.jsx("div",{className:qt("w-3 h-3 rounded-full",$?"bg-yellow-500":"bg-red-500 animate-pulse")}),e.jsxs("span",{className:"text-white text-sm font-medium",children:[ot(le)," / ",ot(t)]})]}),O&&e.jsx("div",{className:"absolute top-0 left-0 right-0",children:e.jsx(hc,{value:le/t*100,className:"h-1 rounded-none"})}),!se&&e.jsxs("div",{className:"absolute bottom-20 left-4 flex items-center gap-2 bg-black/50 px-3 py-1.5 rounded-full",children:[e.jsx(TA,{className:"h-4 w-4 text-white"}),e.jsx("div",{className:"w-20 h-2 bg-white/20 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-green-500 transition-all duration-75",style:{width:`${de}%`}})})]}),e.jsx("div",{className:"absolute bottom-4 left-0 right-0 flex justify-center gap-3 px-4",children:se?e.jsxs(e.Fragment,{children:[e.jsxs(Q,{variant:"secondary",size:"lg",className:"bg-white/20 hover:bg-white/30 text-white",onClick:Me,children:[e.jsx(Ko,{className:"h-5 w-5 mr-2"}),"Re-record"]}),e.jsx(Q,{variant:"secondary",size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:Ve,children:xe?e.jsx(Nm,{className:"h-5 w-5"}):e.jsx(Gl,{className:"h-5 w-5"})}),e.jsxs(Q,{size:"lg",className:"bg-green-500 hover:bg-green-600 text-white",onClick:Xe,children:[e.jsx(li,{className:"h-5 w-5 mr-2"}),"Use This Video"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Q,{variant:"secondary",size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:Je,disabled:O||Ue!==null,children:e.jsx(Xj,{className:"h-5 w-5"})}),!O&&Ue===null?e.jsx(Q,{size:"icon",className:"h-16 w-16 rounded-full bg-red-500 hover:bg-red-600 text-white",onClick:rt,children:e.jsx(ya,{className:"h-6 w-6"})}):e.jsxs(e.Fragment,{children:[e.jsx(Q,{size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:$?it:je,children:$?e.jsx(Gl,{className:"h-5 w-5"}):e.jsx(Nm,{className:"h-5 w-5"})}),e.jsx(Q,{size:"icon",className:"h-16 w-16 rounded-full bg-red-500 hover:bg-red-600 text-white",onClick:$e,children:e.jsx(Yg,{className:"h-6 w-6 fill-current"})})]}),e.jsx("div",{className:"h-12 w-12"})]})})]})]})}const XVe="teleprompter_settings",jue={scrollSpeed:30,fontSize:24,lineHeight:1.6,opacity:.85,position:"top",isMirrored:!1};function uJt(){try{const t=localStorage.getItem(XVe);return t?{...jue,...JSON.parse(t)}:jue}catch{return jue}}function hJt(t){try{localStorage.setItem(XVe,JSON.stringify(t))}catch{}}function QVe({text:t,isVisible:r,onToggleVisibility:s,isRecording:n=!1,startCountdown:a=!1,onCountdownComplete:o,className:l}){const i=E.useRef(null),d=E.useRef(null),m=E.useRef(0),g=E.useRef(0),[y,v]=E.useState(uJt),{scrollSpeed:b,fontSize:N,lineHeight:j,opacity:S,position:A,isMirrored:M}=y,I=E.useCallback((ae,le)=>{v(ne=>{const fe={...ne,[ae]:le};return hJt(fe),fe})},[]),[F,O]=E.useState(!1),[B,$]=E.useState(null),H=E.useCallback(ae=>{if(!i.current)return;m.current===0&&(m.current=ae);const le=ae-m.current;m.current=ae,g.current+=b*le/1e3;const ne=Math.floor(g.current);ne>0&&(i.current.scrollTop+=ne,g.current-=ne);const{scrollTop:fe,scrollHeight:oe,clientHeight:de}=i.current;if(fe+de>=oe){O(!1);return}d.current=requestAnimationFrame(H)},[b]);E.useEffect(()=>(F?(m.current=0,g.current=0,d.current=requestAnimationFrame(H)):d.current&&cancelAnimationFrame(d.current),()=>{d.current&&cancelAnimationFrame(d.current)}),[F,H]),E.useEffect(()=>{if(n&&r)if(i.current&&(i.current.scrollTop=0),a){$(3);let ae=3;const le=setInterval(()=>{ae-=1,ae<=0?(clearInterval(le),$(null),o==null||o(),O(!0)):$(ae)},1e3);return()=>clearInterval(le)}else setTimeout(()=>O(!0),100);else n||(O(!1),$(null))},[n,r,a,o]);const W=E.useCallback(()=>{i.current&&(i.current.scrollTop=0),O(!1)},[]),X=E.useCallback(()=>{O(ae=>!ae)},[]);if(!r)return e.jsx("div",{className:qt("absolute top-4 right-4 pointer-events-auto z-10",l),children:e.jsxs(Q,{variant:"secondary",size:"sm",onClick:s,className:"bg-black/50 hover:bg-black/70 text-white border-0",children:[e.jsx(Gi,{className:"h-4 w-4 mr-2"}),"Show Script"]})});const se={top:"top-0 pt-16",center:"top-1/2 -translate-y-1/2",bottom:"bottom-0 pb-24"};return e.jsxs("div",{className:qt("absolute inset-0 pointer-events-none",l),children:[B!==null&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-20 pointer-events-none",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.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:B},B),e.jsx("p",{className:"text-white/80 text-lg font-medium drop-shadow-md",children:"Get ready…"})]})}),e.jsx("div",{className:qt("absolute left-0 right-0 h-[60%] overflow-hidden pointer-events-auto",se[A],B!==null&&"opacity-30"),style:{opacity:B!==null?.3:S},children:e.jsxs("div",{ref:i,className:qt("mx-auto max-w-2xl px-6 overflow-y-auto scrollbar-hide h-full",M&&"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:[e.jsx("div",{className:"h-full",style:{minHeight:"100%"}}),e.jsx("p",{className:"text-white text-center font-medium drop-shadow-lg",style:{fontSize:`${N}px`,lineHeight:j,textShadow:"0 2px 4px rgba(0,0,0,0.8)"},children:t}),e.jsx("div",{className:"h-full"})]})}),e.jsxs("div",{className:"absolute top-4 right-4 flex items-center gap-2 pointer-events-auto",children:[e.jsxs(rd,{children:[e.jsx(sd,{asChild:!0,children:e.jsx(Q,{variant:"secondary",size:"icon",className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:e.jsx(vd,{className:"h-4 w-4"})})}),e.jsx(Fc,{className:"w-72",side:"left",align:"start",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-medium",children:"Teleprompter Settings"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ee,{className:"text-xs",children:"Scroll Speed"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:b})]}),e.jsx(If,{value:[b],onValueChange:([ae])=>I("scrollSpeed",ae),min:1,max:100,step:1})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ee,{className:"text-xs",children:"Font Size"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[N,"px"]})]}),e.jsx(If,{value:[N],onValueChange:([ae])=>I("fontSize",ae),min:16,max:48,step:2})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ee,{className:"text-xs",children:"Line Spacing"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:j.toFixed(1)})]}),e.jsx(If,{value:[j*10],onValueChange:([ae])=>I("lineHeight",ae/10),min:12,max:24,step:1})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ee,{className:"text-xs",children:"Opacity"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[Math.round(S*100),"%"]})]}),e.jsx(If,{value:[S*100],onValueChange:([ae])=>I("opacity",ae/100),min:30,max:100,step:5})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{className:"text-xs",children:"Position"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(Q,{variant:A==="top"?"default":"outline",size:"sm",onClick:()=>I("position","top"),children:e.jsx(Hg,{className:"h-4 w-4"})}),e.jsx(Q,{variant:A==="center"?"default":"outline",size:"sm",onClick:()=>I("position","center"),children:e.jsx(Q1,{className:"h-4 w-4"})}),e.jsx(Q,{variant:A==="bottom"?"default":"outline",size:"sm",onClick:()=>I("position","bottom"),children:e.jsx(Jc,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ee,{className:"text-xs",children:"Mirror Mode"}),e.jsx(xn,{checked:M,onCheckedChange:ae=>I("isMirrored",ae)})]})]})})]}),e.jsx(Q,{variant:"secondary",size:"icon",onClick:X,className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:F?e.jsx(Nm,{className:"h-4 w-4"}):e.jsx(Gl,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"secondary",size:"icon",onClick:W,className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:e.jsx(Xj,{className:"h-4 w-4"})}),e.jsxs(Q,{variant:"secondary",size:"sm",onClick:s,className:"bg-black/50 hover:bg-black/70 text-white border-0",children:[e.jsx(zf,{className:"h-4 w-4 mr-2"}),"Hide"]})]})]})}function mJt({onSelectScript:t,onCreateNew:r,selectedScriptId:s,className:n}){const{toast:a}=fi(),[o,l]=E.useState(""),[i,d]=E.useState(null),[m,g]=E.useState("levelup"),{data:y,isLoading:v}=V5t(),{data:b,isLoading:N}=H5t(),{data:j,isLoading:S}=W5t(),A=G5t(),M=E.useMemo(()=>b?b.filter($=>{const H=!o||$.title.toLowerCase().includes(o.toLowerCase())||$.script_text.toLowerCase().includes(o.toLowerCase())||$.tags.some(X=>X.toLowerCase().includes(o.toLowerCase())),W=!i||$.category_id===i;return H&&W}):[],[b,o,i]),I=E.useMemo(()=>j?j.filter($=>!o||$.title.toLowerCase().includes(o.toLowerCase())||$.script_text.toLowerCase().includes(o.toLowerCase())):[],[j,o]),F=$=>{t({title:$.title,text:$.script_text})},O=async $=>{try{await A.mutateAsync($),a({title:"Script saved to My Scripts"})}catch{a({title:"Failed to save script",variant:"destructive"})}},B=v||N||S;return e.jsxs("div",{className:qt("flex flex-col h-full",n),children:[e.jsx("div",{className:"p-4 border-b",children:e.jsxs("div",{className:"relative",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search scripts...",value:o,onChange:$=>l($.target.value),className:"pl-9"})]})}),e.jsxs(ci,{value:m,onValueChange:$=>g($),className:"flex-1 flex flex-col",children:[e.jsxs(ri,{className:"mx-4 mt-4 grid grid-cols-2",children:[e.jsxs(Kr,{value:"levelup",children:[e.jsx(fa,{className:"h-4 w-4 mr-2"}),"LevelUp Scripts"]}),e.jsxs(Kr,{value:"my-scripts",children:[e.jsx(Rf,{className:"h-4 w-4 mr-2"}),"My Scripts"]})]}),e.jsxs(ms,{value:"levelup",className:"flex-1 flex flex-col mt-0 p-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[e.jsx(bt,{variant:i?"outline":"default",className:"cursor-pointer",onClick:()=>d(null),children:"All"}),y==null?void 0:y.map($=>e.jsx(bt,{variant:i===$.id?"default":"outline",className:"cursor-pointer",onClick:()=>d($.id),children:$.name},$.id))]}),e.jsx(Eo,{className:"flex-1 max-h-[50vh]",children:B?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Hr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):M.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(fa,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"No scripts found"})]}):e.jsx("div",{className:"space-y-2",children:M.map($=>e.jsxs(ze,{className:qt("cursor-pointer hover:bg-accent/50 transition-colors",s===$.id&&"ring-2 ring-primary"),onClick:()=>F($),children:[e.jsx(Wt,{className:"p-3",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(Zt,{className:"text-sm font-medium truncate",children:$.title}),$.category&&e.jsx(bt,{variant:"secondary",className:"mt-1 text-xs",children:$.category.name})]}),e.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[e.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:H=>{H.stopPropagation(),O($)},children:e.jsx(Rf,{className:"h-4 w-4"})}),e.jsx(Wi,{className:"h-4 w-4 text-muted-foreground"})]})]})}),e.jsx(qe,{className:"p-3 pt-0",children:e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:$.script_text})})]},$.id))})})]}),e.jsxs(ms,{value:"my-scripts",className:"flex-1 flex flex-col mt-0 p-4",children:[r&&e.jsxs(Q,{variant:"outline",className:"mb-4",onClick:r,children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Create New Script"]}),e.jsx(Eo,{className:"flex-1 max-h-[50vh]",children:S?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Hr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):I.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(Rf,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"No saved scripts"}),e.jsx("p",{className:"text-sm mt-1",children:"Save LevelUp scripts or create your own"})]}):e.jsx("div",{className:"space-y-2",children:I.map($=>e.jsxs(ze,{className:qt("cursor-pointer hover:bg-accent/50 transition-colors",s===$.id&&"ring-2 ring-primary"),onClick:()=>F($),children:[e.jsx(Wt,{className:"p-3",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(Zt,{className:"text-sm font-medium truncate",children:$.title}),e.jsx("div",{className:"flex items-center gap-2 mt-1",children:$.is_custom?e.jsx(bt,{variant:"outline",className:"text-xs",children:"Custom"}):e.jsx(bt,{variant:"secondary",className:"text-xs",children:"Saved"})})]}),e.jsx(Wi,{className:"h-4 w-4 text-muted-foreground ml-2"})]})}),e.jsx(qe,{className:"p-3 pt-0",children:e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:$.script_text})})]},$.id))})})]})]})]})}function pJt({selectedTemplate:t,onSelect:r,contactName:s,saving:n=!1}){const[a,o]=E.useState(()=>{const i=iC(t);return new Set([i.category])}),l=i=>{o(d=>{const m=new Set(d);return m.has(i)?m.delete(i):m.add(i),m})};return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Share Page Template"}),n&&e.jsx(Hr,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),e.jsx("div",{className:"space-y-3",children:Ygt.map(i=>{const d=Xgt(i.id),m=a.has(i.id),g=d.some(y=>y.id===t);return e.jsxs(ek,{open:m,onOpenChange:()=>l(i.id),children:[e.jsxs(tk,{className:"flex items-center justify-between w-full p-2.5 rounded-lg bg-muted/50 hover:bg-muted transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm",children:i.name}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",d.length,")"]}),g&&!m&&e.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:"✓"})]}),e.jsx(Jc,{className:qt("h-4 w-4 text-muted-foreground transition-transform",m&&"rotate-180")})]}),e.jsx(rk,{className:"pt-2",children:e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:d.map(y=>{const v=t===y.id;return e.jsxs("button",{type:"button",onClick:()=>r(y.id),disabled:n,className:qt("relative rounded-lg border-2 p-2.5 text-left transition-all hover:shadow-sm disabled:opacity-50 disabled:cursor-not-allowed",v?"border-primary ring-1 ring-primary/20 bg-primary/5":"border-muted hover:border-muted-foreground/30"),children:[v&&e.jsx("div",{className:"absolute top-1 right-1 w-4 h-4 rounded-full bg-primary flex items-center justify-center",children:e.jsx(li,{className:"h-2.5 w-2.5 text-primary-foreground"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"opacity-70 shrink-0",children:y.icon}),e.jsx("span",{className:"text-sm font-medium truncate",children:y.name})]})]},y.id)})})})]},i.id)})}),s&&t!=="default"&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:['Will show: "',iC(t).headerText(s),'"']})]})}function JVe({open:t,onOpenChange:r,video:s,contactName:n,onTemplateUpdated:a}){const[o,l]=E.useState(s.page_template||"default"),[i,d]=E.useState(!1),[m,g]=E.useState(!1),[y,v]=E.useState(s.page_template||"default"),[b,N]=E.useState([]),[j,S]=E.useState(s.contact_id&&n?{id:s.contact_id,name:n,email:null}:null),[A,M]=E.useState(!1),[I,F]=E.useState(!1),O=s.share_token?`https://video.relevelup.com/${s.share_token}`:"";E.useEffect(()=>{t&&b.length===0&&B()},[t]);const B=async()=>{F(!0);try{const{data:fe,error:oe}=await Z.from("innercircle_contacts").select("id, first_name, last_name, email").order("first_name",{ascending:!0}).limit(500);if(oe)throw oe;const de=(fe||[]).map(ue=>({id:ue.id,name:[ue.first_name,ue.last_name].filter(Boolean).join(" ")||"Unnamed",email:ue.email||null}));N(de)}catch(fe){console.error("Failed to fetch contacts:",fe)}finally{F(!1)}},$=async fe=>{S(fe),M(!1),d(!0);try{const{error:oe}=await Z.from("agent_videos").update({contact_id:(fe==null?void 0:fe.id)||null,recipient_name:(fe==null?void 0:fe.name)||null}).eq("id",s.id);if(oe)throw oe;Se.success(fe?`Assigned to ${fe.name}`:"Contact removed"),a==null||a()}catch(oe){console.error("Failed to update contact:",oe),Se.error("Failed to update contact")}finally{d(!1)}},H=async fe=>{l(fe),d(!0);try{const{error:oe}=await Z.from("agent_videos").update({page_template:fe}).eq("id",s.id);if(oe)throw oe;v(fe),Se.success("Template saved!"),a==null||a()}catch(oe){console.error("Failed to save template:",oe),Se.error("Failed to save template"),l(y)}finally{d(!1)}},W=(j==null?void 0:j.name)||null,X=()=>{const fe=s.title||"Video Message",oe=s.share_token?`https://video.relevelup.com/thumb/${s.share_token}`:s.thumbnail_url||"";return``},se=async()=>{if(!s.thumbnail_url){Se.error("Video thumbnail not available yet");return}const fe=X(),oe=`Watch: ${s.title||"Video Message"} ${O}`;try{const de=new Blob([fe],{type:"text/html"}),ue=new Blob([oe],{type:"text/plain"}),xe=new ClipboardItem({"text/html":de,"text/plain":ue});await navigator.clipboard.write([xe]),Se.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(oe+` `+fe),Se.success("Copied! Paste into your email.")}},ae=async()=>{await navigator.clipboard.writeText(O),g(!0),Se.success("Share link copied!"),setTimeout(()=>g(!1),2e3)},le=()=>{const oe=iC(o).headerText(W),de=o==="default"?`Check out this video: ${O}`:`${oe} Check out this special video: ${O}`;window.open(`sms:?body=${encodeURIComponent(de)}`,"_self")},ne=()=>{const fe=iC(o),oe=fe.headerText(W),de=o==="default"?s.title||"Video Message":oe,ue=`${fe.subText} Watch the video: ${O}`,xe=j!=null&&j.email?encodeURIComponent(j.email):"";window.open(`mailto:${xe}?subject=${encodeURIComponent(de)}&body=${encodeURIComponent(ue)}`,"_self")};return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{className:"flex items-center gap-2",children:[e.jsx(Bo,{className:"h-5 w-5"}),"Share Video"]}),e.jsx(Gs,{children:"Choose a themed page template and share your video"})]}),e.jsxs("div",{className:"space-y-6 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Personalize for Contact (Optional)"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(rd,{open:A,onOpenChange:M,children:[e.jsx(sd,{asChild:!0,children:e.jsxs(Q,{variant:"outline",role:"combobox","aria-expanded":A,className:"flex-1 justify-between",disabled:i,children:[j?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Kl,{className:"h-4 w-4 text-muted-foreground"}),j.name]}):e.jsx("span",{className:"text-muted-foreground",children:"Select a contact..."}),e.jsx(fy,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Fc,{className:"w-[300px] p-0",align:"start",children:e.jsxs(Ry,{children:[e.jsx(Fy,{placeholder:"Search contacts..."}),e.jsxs(zy,{children:[e.jsx(By,{children:I?"Loading...":"No contacts found."}),e.jsx($y,{children:b.map(fe=>e.jsxs(Uy,{value:fe.name,onSelect:()=>$(fe),children:[e.jsx(li,{className:qt("mr-2 h-4 w-4",(j==null?void 0:j.id)===fe.id?"opacity-100":"opacity-0")}),fe.name]},fe.id))})]})]})})]}),j&&e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>$(null),disabled:i,className:"shrink-0",children:e.jsx(rn,{className:"h-4 w-4"})})]}),j&&o!=="default"&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:['Page will show: "',iC(o).headerText(j.name),'"']})]}),e.jsx(pJt,{selectedTemplate:o,onSelect:H,contactName:W,saving:i}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Share Link"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Qe,{value:O,readOnly:!0,className:"font-mono text-sm"}),e.jsx(Q,{onClick:ae,variant:m?"default":"outline",className:"shrink-0 gap-2",children:m?e.jsxs(e.Fragment,{children:[e.jsx(li,{className:"h-4 w-4"}),"Copied"]}):e.jsxs(e.Fragment,{children:[e.jsx(fo,{className:"h-4 w-4"}),"Copy"]})})]})]}),s.thumbnail_url&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Share for Email"}),e.jsxs(Q,{variant:"outline",className:"w-full gap-2",onClick:se,children:[e.jsx(El,{className:"h-4 w-4"}),"Copy with Thumbnail (for Gmail)"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Paste into Gmail to embed a clickable video thumbnail"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Quick Share"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Q,{variant:"outline",className:"flex-1 gap-2",onClick:le,children:[e.jsx($o,{className:"h-4 w-4"}),"Text"]}),e.jsxs(Q,{variant:"outline",className:"flex-1 gap-2",onClick:ne,children:[e.jsx(mn,{className:"h-4 w-4"}),"Email"]})]})]})]}),e.jsx(Dn,{children:e.jsx(Q,{variant:"outline",onClick:()=>r(!1),children:"Done"})})]})})}function fJt(){var rt;const t=Ws(),[r]=Bc(),{toast:s}=fi(),n=r.get("contact_id"),a=r.get("task_id"),{canRecord:o,remainingMb:l,usagePercent:i,isNearLimit:d}=WBe(),{data:m}=Ip(),g=Zae(),y=Q5t(),[v,b]=E.useState("record"),[N,j]=E.useState(""),[S,A]=E.useState(!1),[M,I]=E.useState(!1),[F,O]=E.useState(!1),[B,$]=E.useState(null),[H,W]=E.useState(0),[X,se]=E.useState(0),[ae,le]=E.useState(null),[ne,fe]=E.useState(null),[oe,de]=E.useState(n||""),[ue,xe]=E.useState(""),[Te,be]=E.useState(""),[we,ve]=E.useState(null),[tt,Ae]=E.useState(null),[Le,Ue]=E.useState(null),[Ye,Ie]=E.useState(!1),et=E.useCallback(async(je,it)=>{$(je),b("uploading");try{const{videoId:Me,uploadUrl:Je}=await GBe(ue||"Quick Video Touch");le(Me);const{apiKey:Xe}=await KBe(Me),Ve=new XMLHttpRequest;Ve.upload.onprogress=ct=>{ct.lengthComputable&&W(ct.loaded/ct.total*100)},await new Promise((ct,Mt)=>{Ve.onload=()=>{Ve.status>=200&&Ve.status<300?ct():Mt(new Error(`Upload failed: ${Ve.status}`))},Ve.onerror=()=>Mt(new Error("Upload failed")),Ve.open("PUT",Je),Ve.setRequestHeader("AccessKey",Xe),Ve.send(je)}),b("processing");let ot=0;const mt=Date.now(),ft=90*1e3;for(;ot<4;){if(await new Promise(Mt=>setTimeout(Mt,3e3)),Date.now()-mt>ft){const Mt=je.size/1048576,Ot=`https://iframe.mediadelivery.net/play/${Me}/${Me}`;await g.mutateAsync({bunny_video_id:Me,playback_url:Ot,file_size_mb:Mt,title:ue||"Quick Video Touch",notes:Te||void 0,contact_id:oe&&oe!=="none"?oe:void 0,status:"processing",touch_type:"video_touch"}),s({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}),t("/mission-control/video-library");return}const ct=await ZBe(Me);if(ot=ct.status,se(ct.encodeProgress||0),ot===4)fe({playbackUrl:ct.directPlayUrl,thumbnailUrl:ct.thumbnailUrl,previewUrl:ct.previewUrl||null,duration:ct.length||it,fileSizeMb:(ct.storageSize||je.size)/(1024*1024)});else if(ot===5||ot===6)throw new Error("Video processing failed")}b("details")}catch(Me){console.error("Upload error:",Me),s({title:"Upload failed",description:"Please try recording again.",variant:"destructive"}),b("record")}},[ue,s]),It=async()=>{if(!(!ae||!ne))try{const je=oe&&oe!=="none"?oe:null,it=await g.mutateAsync({bunny_video_id:ae,contact_id:je,playback_url:ne.playbackUrl,thumbnail_url:ne.thumbnailUrl,preview_url:ne.previewUrl,duration_seconds:ne.duration,file_size_mb:ne.fileSizeMb,title:ue||"Quick Video Touch",notes:Te,task_id:a||null,status:"ready"});ve(it.id),Ae(it.share_token||null),je&&await y.mutateAsync({contactId:je,videoId:it.id,notes:Te}),s({title:"Video saved successfully!"}),b("share")}catch(je){console.error("Save video error:",je),s({title:"Failed to save video",description:(je==null?void 0:je.message)||"Please try again.",variant:"destructive"})}},Pe=(je,it)=>{navigator.clipboard.writeText(it),Ue(je),setTimeout(()=>Ue(null),2e3),s({title:"Copied to clipboard!"})},at=()=>tt?`https://video.relevelup.com/${tt}`:(ne==null?void 0:ne.playbackUrl)||"",ce=()=>{const je=m==null?void 0:m.find(Ve=>Ve.id===oe),it=je?`${je.first_name}`:"",Me=(je==null?void 0:je.phone)||"",Je=(je==null?void 0:je.email)||"",Xe=at();return{text:`Hey${it?` ${it}`:""}! I recorded a quick video for you: ${Xe}`,link:Xe,contactPhone:Me,contactEmail:Je}},$e=()=>{const{text:je,contactPhone:it}=ce(),Me=it?`sms:${it}?body=${encodeURIComponent(je)}`:`sms:?body=${encodeURIComponent(je)}`;window.open(Me,"_self")},Ge=()=>{const{link:je,contactEmail:it}=ce(),Me="Check out this video",Je=`I recorded a quick video for you: ${je}`,Xe=it?`mailto:${it}?subject=${encodeURIComponent(Me)}&body=${encodeURIComponent(Je)}`:`mailto:?subject=${encodeURIComponent(Me)}&body=${encodeURIComponent(Je)}`;window.open(Xe,"_self")};return o?e.jsx(Fr,{title:"Quick Video Touch",children:e.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>t(-1),children:e.jsx(_i,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Quick Video Touch"}),e.jsx("p",{className:"text-muted-foreground",children:"Record a personal video message"})]})]}),d&&e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"text-sm text-warning",children:["Storage: ",i.toFixed(0),"% used"]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[l.toFixed(0)," MB remaining"]})]})]}),v==="record"&&e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2",children:[e.jsx(YVe,{maxDurationSeconds:60,onRecordingComplete:et,onRecordingStateChange:O,className:"w-full",teleprompterContent:S&&N&&e.jsx(QVe,{text:N,isVisible:S,onToggleVisibility:()=>A(!1),isRecording:F,startCountdown:!0})}),!S&&N&&e.jsxs(Q,{variant:"outline",className:"mt-4",onClick:()=>A(!0),children:[e.jsx(fa,{className:"h-4 w-4 mr-2"}),"Show Teleprompter"]})]}),e.jsxs(ze,{className:"lg:col-span-1",children:[e.jsx(Wt,{className:"pb-2",children:e.jsx(Zt,{className:"text-lg",children:"Teleprompter Script"})}),e.jsxs(qe,{className:"space-y-4",children:[e.jsx(Ks,{placeholder:"Type or paste your script here...",value:N,onChange:je=>j(je.target.value),rows:6}),e.jsxs(eae,{open:M,onOpenChange:I,children:[e.jsx(_ye,{asChild:!0,children:e.jsxs(Q,{variant:"outline",className:"w-full",children:[e.jsx(fa,{className:"h-4 w-4 mr-2"}),"Browse Scripts"]})}),e.jsxs(jP,{side:"right",className:"w-[400px] sm:w-[540px] p-0",children:[e.jsx(tae,{className:"p-4 border-b",children:e.jsx(rae,{children:"Select a Script"})}),e.jsx(mJt,{onSelectScript:je=>{j(je.text),I(!1),A(!0)},className:"h-[calc(100vh-80px)]"})]})]}),N&&e.jsx(Q,{className:"w-full",onClick:()=>A(!0),children:"Use Script"})]})]})]}),v==="uploading"&&e.jsx(ze,{className:"max-w-md mx-auto",children:e.jsxs(qe,{className:"pt-6 text-center",children:[e.jsx(to,{className:"h-12 w-12 mx-auto mb-4 text-primary animate-pulse"}),e.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Uploading Video..."}),e.jsx(hc,{value:H,className:"mb-2"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[H.toFixed(0),"%"]})]})}),v==="processing"&&e.jsx(ze,{className:"max-w-md mx-auto",children:e.jsxs(qe,{className:"pt-6 text-center space-y-4",children:[e.jsx(Hr,{className:"h-12 w-12 mx-auto mb-4 text-primary animate-spin"}),e.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Processing Video..."}),e.jsx(hc,{value:X,className:"mb-2"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[X.toFixed(0),"%"]}),e.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.`})]})}),v==="details"&&e.jsxs(ze,{className:"max-w-lg mx-auto",children:[e.jsx(Wt,{children:e.jsx(Zt,{children:"Video Details"})}),e.jsxs(qe,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{children:"Title"}),e.jsx(Qe,{value:ue,onChange:je=>xe(je.target.value),placeholder:"Quick Video Touch"})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"Attach to Contact (Optional)"}),e.jsxs(ds,{value:oe,onValueChange:de,children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"No contact - use anywhere"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"none",children:e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(Bo,{className:"h-4 w-4"}),"No contact - use anywhere"]})}),m==null?void 0:m.map(je=>e.jsx(Ut,{value:je.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Kl,{className:"h-4 w-4"}),je.first_name," ",je.last_name]})},je.id))]})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"Notes"}),e.jsx(Ks,{value:Te,onChange:je=>be(je.target.value),placeholder:"Add notes about this video...",rows:3})]}),e.jsxs(Q,{className:"w-full",onClick:It,disabled:g.isPending,children:[g.isPending&&e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Video"]})]})]}),v==="share"&&e.jsxs(ze,{className:"max-w-lg mx-auto",children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(li,{className:"h-5 w-5 text-green-500"}),"Video Saved!"]})}),e.jsxs(qe,{className:"space-y-4",children:[e.jsx("p",{className:"text-muted-foreground",children:"Share your video with one click:"}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs(Q,{variant:"outline",className:"justify-start",onClick:$e,children:[e.jsx($o,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),e.jsxs(Q,{variant:"outline",className:"justify-start",onClick:Ge,children:[e.jsx(mn,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),e.jsxs(Q,{variant:"outline",className:"justify-start",onClick:()=>Pe("link",ce().link),children:[e.jsx(Bo,{className:"h-4 w-4 mr-2"}),"Copy Video Link",Le==="link"&&e.jsx(li,{className:"h-4 w-4 ml-auto text-green-500"})]}),e.jsxs(Q,{variant:"outline",className:"justify-start",onClick:()=>Ie(!0),children:[e.jsx(ed,{className:"h-4 w-4 mr-2"}),"Send with Page Template"]})]}),e.jsxs("div",{className:"flex gap-3 pt-4",children:[e.jsx(Q,{variant:"outline",onClick:()=>t("/mission-control/video-library"),children:"View Library"}),e.jsx(Q,{onClick:()=>{b("record"),$(null),le(null),fe(null)},children:"Record Another"})]})]})]}),we&&tt&&e.jsx(JVe,{open:Ye,onOpenChange:Ie,video:{id:we,share_token:tt,title:ue||null,contact_id:oe||null,thumbnail_url:(ne==null?void 0:ne.thumbnailUrl)||null},contactName:((rt=m==null?void 0:m.find(je=>je.id===oe))==null?void 0:rt.first_name)||null})]})}):e.jsx(Fr,{title:"Quick Video Touch",children:e.jsxs("div",{className:"max-w-2xl mx-auto text-center py-12",children:[e.jsx(Qu,{className:"h-16 w-16 text-destructive mx-auto mb-4"}),e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Storage Limit Reached"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"You've reached your video storage limit. Delete videos from your library to record more."}),e.jsx(Q,{onClick:()=>t("/mission-control/video-library"),children:"Open Video Library"})]})})}function gJt({open:t,onOpenChange:r}){const{data:s}=Ip(),{data:n}=Yae(),a=Zae(),o=E.useRef(null),[l,i]=E.useState(null),[d,m]=E.useState(""),[g,y]=E.useState(""),[v,b]=E.useState(""),[N,j]=E.useState(!1),[S,A]=E.useState(0),[M,I]=E.useState("idle"),F=(n==null?void 0:n.total_storage_mb)||0,B=((n==null?void 0:n.max_storage_mb)||1024)-F,$=se=>{var ne;const ae=(ne=se.target.files)==null?void 0:ne[0];if(!ae)return;if(!ae.type.startsWith("video/")){Se.error("Please select a video file");return}const le=ae.size/(1024*1024);if(le>500){Se.error("Video file must be less than 500MB");return}if(le>B){Se.error(`Not enough storage. You have ${B.toFixed(1)} MB remaining.`);return}i(ae),d||m(ae.name.replace(/\.[^/.]+$/,""))},H=async()=>{if(!l){Se.error("Please select a video file");return}j(!0),A(0),I("creating");try{const{data:se,error:ae}=await Z.functions.invoke("bunny-upload",{body:{action:"create",title:d||l.name,isAgentVideo:!0}});if(ae)throw new Error(ae.message);const{videoId:le,libraryId:ne}=se;I("uploading");const{data:fe,error:oe}=await Z.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:le,isAgentVideo:!0}});if(oe)throw new Error(oe.message);await new Promise((xe,Te)=>{const be=new XMLHttpRequest;be.upload.addEventListener("progress",we=>{if(we.lengthComputable){const ve=Math.round(we.loaded/we.total*100);A(ve)}}),be.addEventListener("load",()=>{be.status>=200&&be.status<300?xe():Te(new Error(`Upload failed with status ${be.status}`))}),be.addEventListener("error",()=>Te(new Error("Upload failed"))),be.open("PUT",fe.uploadUrl),be.setRequestHeader("AccessKey",fe.apiKey),be.send(l)}),I("processing");const de=l.size/(1024*1024),ue=`https://iframe.mediadelivery.net/embed/${ne}/${le}`;await a.mutateAsync({bunny_video_id:le,playback_url:ue,file_size_mb:de,title:d||l.name,notes:g||void 0,contact_id:v||void 0,status:"processing",touch_type:"video_upload"}),Se.success("Video uploaded successfully! Processing may take a few minutes."),W()}catch(se){console.error("Upload error:",se),Se.error(se instanceof Error?se.message:"Failed to upload video")}finally{j(!1),I("idle")}},W=()=>{N||(i(null),m(""),y(""),b(""),A(0),I("idle"),r(!1))},X=()=>{switch(M){case"creating":return"Preparing upload...";case"uploading":return`Uploading... ${S}%`;case"processing":return"Saving video...";default:return""}};return e.jsx(Dr,{open:t,onOpenChange:W,children:e.jsxs(Lr,{className:"sm:max-w-md",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Upload Video"}),e.jsx(Gs,{children:"Upload a video file from your device to your video library."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Video File"}),l?e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted rounded-lg",children:[e.jsx(ya,{className:"h-8 w-8 text-primary flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:l.name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[(l.size/(1024*1024)).toFixed(1)," MB"]})]}),!N&&e.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:se=>{se.stopPropagation(),i(null)},children:e.jsx(rn,{className:"h-4 w-4"})})]}):e.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 se;return(se=o.current)==null?void 0:se.click()},children:[e.jsx(to,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to select a video file"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"MP4, MOV, WebM (max 500MB)"})]}),e.jsx("input",{ref:o,type:"file",accept:"video/*",className:"hidden",onChange:$,disabled:N})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"title",children:"Title"}),e.jsx(Qe,{id:"title",value:d,onChange:se=>m(se.target.value),placeholder:"Enter video title",disabled:N})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Associate with Contact (optional)"}),e.jsxs(ds,{value:v||"__none__",onValueChange:se=>b(se==="__none__"?"":se),disabled:N,children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Select a contact"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"__none__",children:"No contact"}),s==null?void 0:s.map(se=>e.jsxs(Ut,{value:se.id,children:[se.first_name," ",se.last_name||""]},se.id))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"notes",children:"Notes (optional)"}),e.jsx(Ks,{id:"notes",value:g,onChange:se=>y(se.target.value),placeholder:"Add any notes about this video",rows:2,disabled:N})]}),N&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Hr,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{children:X()})]}),e.jsx(hc,{value:M==="uploading"?S:M==="processing"?100:10})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:W,disabled:N,children:"Cancel"}),e.jsx(Q,{onClick:H,disabled:!l||N,children:N?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):e.jsxs(e.Fragment,{children:[e.jsx(to,{className:"h-4 w-4 mr-2"}),"Upload Video"]})})]})]})})}function xJt({open:t,onOpenChange:r,video:s,gmailEmail:n,signedThumbnailUrl:a,onSendComplete:o}){const[l,i]=E.useState([]),[d,m]=E.useState(null),[g,y]=E.useState(!1),[v,b]=E.useState(!1),[N,j]=E.useState(""),[S,A]=E.useState(""),[M,I]=E.useState(""),[F,O]=E.useState(!1),B=s.share_token?`https://video.relevelup.com/${s.share_token}`:"",$=s.share_token?`https://video.relevelup.com/thumb/${s.share_token}`:a||s.thumbnail_url||"",H=s.title||"Video Message";E.useEffect(()=>{t&&l.length===0&&W()},[t]),E.useEffect(()=>{if(t&&(A(`I recorded a video for you — ${H}`),I("Hey! I recorded a quick video just for you. Click below to watch it:"),m(null),j(""),s.contact_id)){const fe=l.find(oe=>oe.id===s.contact_id);fe&&(m(fe),j(fe.email||""))}},[t,s.contact_id,l]);const W=async()=>{b(!0);try{const{data:fe,error:oe}=await Z.from("innercircle_contacts").select("id, first_name, last_name, email").order("first_name",{ascending:!0}).limit(500);if(oe)throw oe;i(fe||[])}catch{console.error("Failed to fetch contacts")}finally{b(!1)}},X=fe=>{m(fe),y(!1),j(fe.email||""),I(`Hey ${fe.first_name}! I recorded a quick video just for you. Click below to watch it:`),A(`I recorded a video for you — ${H}`)},se=()=>{m(null),j(""),I("Hey! I recorded a quick video just for you. Click below to watch it:")},ae=fe=>`${fe.first_name} ${fe.last_name||""}`.trim(),le=()=>`
${M.split(/\n\n+/).map(oe=>`

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

`).join("")}

▶ Watch Video

`,ne=async()=>{if(!N){Se.error("Please enter a recipient email");return}if(!B){Se.error("Video does not have a share link");return}O(!0);try{const fe=le(),{data:oe,error:de}=await Z.functions.invoke("gmail-send",{body:{to:N,subject:S,body:fe,contactId:(d==null?void 0:d.id)||null}});if(de)throw de;if(!(oe!=null&&oe.success))throw new Error((oe==null?void 0:oe.error)||"Failed to send");Se.success("Video email sent!"),r(!1),o==null||o()}catch(fe){console.error("Gmail send error:",fe),Se.error("Failed to send: "+(fe instanceof Error?fe.message:"Unknown error"))}finally{O(!1)}};return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"sm:max-w-[560px] max-h-[90vh] overflow-y-auto",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{className:"flex items-center gap-2",children:[e.jsx(mn,{className:"h-5 w-5 text-red-500"}),"Send Video via Gmail"]}),n&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sending from ",e.jsx("span",{className:"font-medium",children:n})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{children:"Send to Contact"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(rd,{open:g,onOpenChange:y,children:[e.jsx(sd,{asChild:!0,children:e.jsxs(Q,{variant:"outline",role:"combobox",className:"flex-1 justify-between",children:[d?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Kl,{className:"h-4 w-4 text-muted-foreground"}),ae(d),d.email&&e.jsxs("span",{className:"text-muted-foreground text-xs",children:["(",d.email,")"]})]}):e.jsx("span",{className:"text-muted-foreground",children:"Select a contact..."}),e.jsx(fy,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Fc,{className:"w-[350px] p-0",align:"start",children:e.jsxs(Ry,{children:[e.jsx(Fy,{placeholder:"Search contacts..."}),e.jsxs(zy,{children:[e.jsx(By,{children:v?"Loading...":"No contacts found."}),e.jsx($y,{children:l.filter(fe=>fe.email).map(fe=>e.jsxs(Uy,{value:`${fe.first_name} ${fe.last_name||""} ${fe.email||""}`,onSelect:()=>X(fe),children:[e.jsx(li,{className:qt("mr-2 h-4 w-4",(d==null?void 0:d.id)===fe.id?"opacity-100":"opacity-0")}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:ae(fe)}),e.jsx("div",{className:"text-xs text-muted-foreground",children:fe.email})]})]},fe.id))})]})]})})]}),d&&e.jsx(Q,{variant:"ghost",size:"icon",onClick:se,className:"shrink-0",children:e.jsx(rn,{className:"h-4 w-4"})})]})]}),!d&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{htmlFor:"video-to",children:"Or type email address"}),e.jsx(Qe,{id:"video-to",value:N,onChange:fe=>j(fe.target.value),placeholder:"recipient@example.com",type:"email"})]}),e.jsx(gd,{}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{htmlFor:"video-subject",children:"Subject"}),e.jsx(Qe,{id:"video-subject",value:S,onChange:fe=>A(fe.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{htmlFor:"video-message",children:"Personal Message"}),e.jsx(Ks,{id:"video-message",value:M,onChange:fe=>I(fe.target.value),rows:4,className:"resize-y"})]}),e.jsxs("div",{className:"rounded-lg border bg-muted/30 p-3 space-y-2",children:[e.jsx(Ee,{className:"text-xs text-muted-foreground",children:"Video Preview (embedded in email)"}),e.jsxs("div",{className:"relative rounded-lg overflow-hidden bg-black",style:{maxWidth:320},children:[$?e.jsx("img",{src:$,alt:H,className:"w-full aspect-video object-cover"}):e.jsx("div",{className:"w-full aspect-video flex items-center justify-center bg-muted",children:e.jsx(Gl,{className:"h-8 w-8 text-muted-foreground"})}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"w-10 h-10 rounded-full bg-white/80 flex items-center justify-center shadow",children:e.jsx(Gl,{className:"h-5 w-5 text-primary ml-0.5"})})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Recipients will see the thumbnail with a play button. Clicking opens the video page."})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(Q,{variant:"outline",onClick:()=>r(!1),disabled:F,children:"Cancel"}),e.jsxs(Q,{onClick:ne,disabled:F||!N||!S,className:"gap-2",children:[F?e.jsx(Hr,{className:"h-4 w-4 animate-spin"}):e.jsx(Mi,{className:"h-4 w-4"}),F?"Sending...":"Send Video Email"]})]})]})]})})}const yJt=()=>{const{user:t}=Gr();return Ht({queryKey:["team-videos",t==null?void 0:t.id],queryFn:async()=>{const{data:r,error:s}=await Z.rpc("get_team_videos",{_user_id:t.id});if(s)throw s;return r||[]},enabled:!!t})};function vJt({previewSrc:t,thumbnailSrc:r,alt:s,isHovered:n}){const[a,o]=E.useState(!1),[l,i]=E.useState(!1),d=n&&t&&!a,m=r&&!l;return!m&&!d?e.jsx("div",{className:"w-full h-full flex items-center justify-center absolute inset-0 bg-muted",children:e.jsx(ya,{className:"h-12 w-12 text-muted-foreground"})}):e.jsxs(e.Fragment,{children:[m&&e.jsx("img",{src:r,alt:s,loading:"lazy",className:`w-full h-full object-cover absolute inset-0 transition-opacity duration-200 ${d?"opacity-0":"opacity-100"}`,onError:()=>i(!0)}),d&&e.jsx("img",{src:t,alt:s,className:"w-full h-full object-cover absolute inset-0",onError:()=>o(!0)})]})}function _Jt({video:t,previewSrc:r,thumbnailSrc:s,onOpen:n,onDelete:a,onRename:o,onNavigateToContact:l,onGetEmbedCode:i,onCopyEmailHtml:d,onEmbedToCrm:m,onShareWithTemplate:g,onSendViaGmail:y,isGmailConnected:v,getContactName:b,getShareUrl:N,copyToClipboard:j,formatDuration:S}){const[A,M]=E.useState(!1);return e.jsxs(ze,{className:"overflow-hidden group cursor-pointer",onClick:n,onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1),children:[e.jsxs("div",{className:"relative aspect-video bg-muted overflow-hidden",children:[e.jsx(vJt,{previewSrc:r,thumbnailSrc:s,alt:t.title||"Video preview",isHovered:A}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx("div",{className:"w-12 h-12 rounded-full bg-white/90 flex items-center justify-center",children:e.jsx(Gl,{className:"h-6 w-6 text-primary ml-1"})})}),e.jsx("div",{className:"absolute bottom-2 right-2 bg-black/70 text-white text-xs px-1.5 py-0.5 rounded",children:S(t.duration_seconds)}),t.status!=="ready"&&e.jsx(bt,{variant:t.status==="processing"?"secondary":"destructive",className:"absolute top-2 left-2",children:t.status})]}),e.jsx(qe,{className:"p-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"font-medium truncate",children:t.title||"Untitled Video"}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mt-1",children:[e.jsx(Kl,{className:"h-3 w-3"}),e.jsx("span",{className:"truncate",children:b(t.contact_id)})]}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground mt-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Ea,{className:"h-3 w-3"}),e.jsx("span",{children:Xr(new Date(t.created_at),"MMM d, yyyy")})]}),(t.view_count??0)>0&&e.jsxs("div",{className:"flex items-center gap-1 text-primary",children:[e.jsx(Gi,{className:"h-3 w-3"}),e.jsxs("span",{children:[t.view_count," ",t.view_count===1?"view":"views"]})]})]}),v&&t.share_token&&e.jsxs(Q,{variant:"outline",size:"sm",className:"mt-2 gap-1.5 text-xs h-7",onClick:I=>{I.stopPropagation(),y==null||y()},children:[e.jsx(mn,{className:"h-3 w-3"}),"Send via Gmail"]}),e.jsx("h3",{className:"font-medium truncate",children:t.title||"Untitled Video"}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mt-1",children:[e.jsx(Kl,{className:"h-3 w-3"}),e.jsx("span",{className:"truncate",children:b(t.contact_id)})]}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground mt-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Ea,{className:"h-3 w-3"}),e.jsx("span",{children:Xr(new Date(t.created_at),"MMM d, yyyy")})]}),(t.view_count??0)>0&&e.jsxs("div",{className:"flex items-center gap-1 text-primary",children:[e.jsx(Gi,{className:"h-3 w-3"}),e.jsxs("span",{children:[t.view_count," ",t.view_count===1?"view":"views"]})]})]})]}),e.jsxs(mh,{children:[e.jsx(ph,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:I=>I.stopPropagation(),children:e.jsx(Pg,{className:"h-4 w-4"})})}),e.jsxs(Au,{align:"end",className:"bg-popover",children:[e.jsxs(Ba,{onClick:I=>{I.stopPropagation(),n()},children:[e.jsx(Gi,{className:"h-4 w-4 mr-2"}),"Watch"]}),e.jsx(yk,{}),e.jsxs(Ba,{onClick:I=>{I.stopPropagation(),g()},children:[e.jsx(ed,{className:"h-4 w-4 mr-2"}),"Share with Template"]}),e.jsxs(Ba,{onClick:I=>{I.stopPropagation(),j(N(t),"Share link")},children:[e.jsx(Bo,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),e.jsxs(Ba,{onClick:I=>{I.stopPropagation(),i()},children:[e.jsx(Rj,{className:"h-4 w-4 mr-2"}),"Get Embed Code"]}),e.jsxs(Ba,{onClick:I=>{I.stopPropagation(),d()},children:[e.jsx(mn,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),e.jsxs(Ba,{onClick:I=>{I.stopPropagation(),m()},children:[e.jsx(En,{className:"h-4 w-4 mr-2"}),"Embed to CRM"]}),v&&t.share_token&&e.jsxs(Ba,{onClick:I=>{I.stopPropagation(),y==null||y()},children:[e.jsx(Mi,{className:"h-4 w-4 mr-2"}),"Send via Gmail"]}),e.jsxs(Ba,{onClick:I=>{I.stopPropagation(),o()},children:[e.jsx(ei,{className:"h-4 w-4 mr-2"}),"Rename"]}),e.jsx(yk,{}),t.contact_id&&e.jsxs(Ba,{onClick:I=>{I.stopPropagation(),l()},children:[e.jsx(Kl,{className:"h-4 w-4 mr-2"}),"View Contact"]}),e.jsxs(Ba,{onClick:I=>{I.stopPropagation(),a()},className:"text-destructive",children:[e.jsx(Rs,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})})]})}function bJt(){var ct,Mt;const t=Ws(),{data:r,isLoading:s,refetch:n}=K5t(),{data:a}=Yae(),{data:o}=Ip(),l=X5t(),i=Y5t(),{isGmailConnected:d,gmailEmail:m}=J3(),{data:g}=Lv(),{data:y=[],isLoading:v}=yJt(),[b,N]=E.useState("my"),[j,S]=E.useState(""),[A,M]=E.useState(null),[I,F]=E.useState(!1),[O,B]=E.useState(!1),[$,H]=E.useState(!1),[W,X]=E.useState(!1),[se,ae]=E.useState(!1),[le,ne]=E.useState(""),[fe,oe]=E.useState(!1),[de,ue]=E.useState(!1),[xe,Te]=E.useState(!1),[be,we]=E.useState(!1),[ve,tt]=E.useState(""),[Ae,Le]=E.useState({}),Ue=Ot=>{if(!Ot)return"Unassigned";const rr=o==null?void 0:o.find(Ir=>Ir.id===Ot);return rr?`${rr.first_name} ${rr.last_name||""}`.trim():"Unknown"},Ye=Ot=>{if(!Ot)return"0:00";const rr=Math.floor(Ot/60),Ir=Ot%60;return`${rr}:${Ir.toString().padStart(2,"0")}`},Ie=r==null?void 0:r.filter(Ot=>{if(!j)return!0;const rr=Ue(Ot.contact_id).toLowerCase(),Ir=(Ot.title||"").toLowerCase(),cr=(Ot.notes||"").toLowerCase();return rr.includes(j.toLowerCase())||Ir.includes(j.toLowerCase())||cr.includes(j.toLowerCase())}),[et,It]=E.useState(!1);E.useEffect(()=>{if(et)return;(async()=>{if(!(r!=null&&r.length))return;const rr=r.filter(cr=>cr.status==="processing"&&cr.bunny_video_id);if(!rr.length)return;let Ir=!1;for(const cr of rr)try{const{data:Mr,error:As}=await Z.functions.invoke("bunny-upload",{body:{action:"status",videoId:cr.bunny_video_id,isAgentVideo:!0}});if(As||!Mr)continue;Mr.status===4&&(await Z.from("agent_videos").update({status:"ready",playback_url:Mr.directPlayUrl,thumbnail_url:Mr.thumbnailUrl,preview_url:Mr.previewUrl,duration_seconds:Mr.length||cr.duration_seconds,updated_at:new Date().toISOString()}).eq("id",cr.id),Ir=!0)}catch(Mr){console.warn("Reconcile check failed for video",cr.id,Mr)}It(!0),Ir&&n()})()},[r,et,n]),E.useEffect(()=>{(async()=>{if(!(r!=null&&r.length))return;const rr=r.filter(At=>(At==null?void 0:At.bunny_video_id)&&!Ae[At.id]);if(!rr.length)return;const Ir=rr.map(At=>At.bunny_video_id),{data:cr,error:Mr}=await Z.functions.invoke("bunny-upload",{body:{action:"bulk-asset-urls",videoIds:Ir,isAgentVideo:!0}});if(Mr)throw Mr;const As=(cr==null?void 0:cr.assets)||{};Le(At=>{const Rt={...At};for(const Cr of rr)As[Cr.bunny_video_id]&&(Rt[Cr.id]={previewUrl:As[Cr.bunny_video_id].previewUrl,thumbnailUrl:As[Cr.bunny_video_id].thumbnailUrl});return Rt})})().catch(rr=>console.warn("Failed to load signed Bunny asset URLs",rr))},[r,Ae]);const Pe=(a==null?void 0:a.total_storage_mb)||0,at=(a==null?void 0:a.max_storage_mb)||1024,ce=Pe/at*100,$e=ce>=80,Ge=ce>=100,rt=async(Ot,rr)=>{await navigator.clipboard.writeText(Ot),Se.success(`${rr} copied to clipboard`)},je=Ot=>Ot.share_token?`https://video.relevelup.com/${Ot.share_token}`:Ot.playback_url||"",it=Ot=>{const rr=je(Ot),Ir=o==null?void 0:o.find(Cr=>Cr.id===Ot.contact_id),cr=Ue(Ot.contact_id),Mr=cr!=="Unassigned"?cr.split(" ")[0]:"",As=(Ir==null?void 0:Ir.phone)||"",At=`Hey${Mr?` ${Mr}`:""}! I recorded a quick video message for you. Check it out: ${rr}`,Rt=As?`sms:${As}?body=${encodeURIComponent(At)}`:`sms:?body=${encodeURIComponent(At)}`;window.open(Rt,"_self")},Me=Ot=>{const rr=o==null?void 0:o.find(Rt=>Rt.id===Ot.contact_id),Ir=(rr==null?void 0:rr.email)||"",cr=je(Ot),Mr="Check out this video",As=`I recorded a quick video for you: ${cr}`,At=Ir?`mailto:${Ir}?subject=${encodeURIComponent(Mr)}&body=${encodeURIComponent(As)}`:`mailto:?subject=${encodeURIComponent(Mr)}&body=${encodeURIComponent(As)}`;window.open(At,"_self")},Je=Ot=>{var Mr;const rr=je(Ot),Ir=Ot.title||"Video Message",cr=Ot.share_token?`https://video.relevelup.com/thumb/${Ot.share_token}`:((Mr=Ae[Ot.id])==null?void 0:Mr.thumbnailUrl)||Ot.thumbnail_url||"";return``},Xe=async Ot=>{if(!Ot.thumbnail_url&&!Ot.share_token){Se.error("Video thumbnail not available yet");return}const rr=Je(Ot),Ir=je(Ot),cr=`Watch: ${Ot.title||"Video Message"} ${Ir}`;try{const Mr=new Blob([rr],{type:"text/html"}),As=new Blob([cr],{type:"text/plain"}),At=new ClipboardItem({"text/html":Mr,"text/plain":As});await navigator.clipboard.write([At]),Se.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(cr+` `+rr),Se.success("Copied! Paste into your email.")}},Ve=async Ot=>{try{Se.loading("Preparing download...",{id:"download"});const{data:rr,error:Ir}=await Z.functions.invoke("bunny-upload",{body:{action:"download-url",videoId:Ot.bunny_video_id,isAgentVideo:!0}});if(Ir||!(rr!=null&&rr.downloadUrl))throw new Error((Ir==null?void 0:Ir.message)||"Failed to get download URL");const Mr=`${((Ot.title||"video").toString().trim()||"video").replace(/[\\/:*?"<>|]+/g,"-")}.mp4`,As=await fetch(rr.downloadUrl);if(!As.ok)throw new Error("Failed to fetch video file");const At=await As.blob(),Rt=URL.createObjectURL(At),Cr=document.createElement("a");Cr.href=Rt,Cr.download=Mr,Cr.rel="noreferrer",document.body.appendChild(Cr),Cr.click(),Cr.remove(),URL.revokeObjectURL(Rt),Se.success("Download started",{id:"download"})}catch(rr){console.error("Download error:",rr),Se.error("Could not force download (your browser may block it).",{id:"download"})}},ot=async Ot=>{M(Ot),oe(!0),ne(""),ae(!0);try{const{data:rr,error:Ir}=await Z.functions.invoke("bunny-upload",{body:{action:"crm-embed",videoId:Ot.bunny_video_id,title:Ot.title,isAgentVideo:!0,shareToken:Ot.share_token}});if(Ir||!(rr!=null&&rr.html))throw new Error("Failed to generate CRM embed code");ne(rr.html)}catch(rr){console.error("CRM embed error:",rr),Se.error("Failed to generate CRM embed code"),ae(!1)}finally{oe(!1)}},mt=Ot=>{M(Ot),F(!0)},ft=async()=>{if(A)try{await l.mutateAsync({id:A.id,bunnyVideoId:A.bunny_video_id,hardDelete:!0}),B(!1),M(null),Se.success("Video deleted successfully")}catch{Se.error("Failed to delete video")}};return e.jsx(Fr,{title:"Video Library",description:"Manage your video touches",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Video Library"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage and share your video touches"})]}),g&&((ct=g.team)==null?void 0:ct.shared_videos_enabled)&&e.jsxs("div",{className:"flex bg-muted rounded-lg p-1 gap-0.5 ml-2",children:[e.jsx("button",{onClick:()=>N("my"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-colors ${b==="my"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"My Videos"}),e.jsxs("button",{onClick:()=>N("team"),className:`px-3 py-1.5 rounded-md text-sm font-medium transition-colors flex items-center gap-1.5 ${b==="team"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[e.jsx(ws,{className:"h-3.5 w-3.5"}),"Team"]})]})]}),b==="my"&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Q,{variant:"outline",onClick:()=>H(!0),children:[e.jsx(to,{className:"h-4 w-4 mr-2"}),"Upload Video"]}),e.jsxs(Q,{onClick:()=>t("/mission-control/video/record"),children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Record New Video"]})]})]}),b==="team"?e.jsx(wJt,{videos:y,isLoading:v,searchTerm:j,setSearchTerm:S}):e.jsxs(e.Fragment,{children:[e.jsx(ze,{className:$e?"border-amber-500":Ge?"border-destructive":"",children:e.jsxs(qe,{className:"py-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(vA,{className:`h-5 w-5 ${Ge?"text-destructive":$e?"text-amber-500":"text-muted-foreground"}`}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-sm font-medium",children:"Storage Used"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[Pe.toFixed(1)," MB / ",at>=1024?`${(at/1024).toFixed(0)} GB`:`${at} MB`]})]}),e.jsx(hc,{value:Math.min(ce,100),className:`h-2 ${Ge?"[&>div]:bg-destructive":$e?"[&>div]:bg-amber-500":""}`})]}),$e&&!Ge&&e.jsxs(bt,{variant:"outline",className:"border-amber-500 text-amber-600",children:[e.jsx(_l,{className:"h-3 w-3 mr-1"}),"Near Limit"]}),Ge&&e.jsxs(bt,{variant:"destructive",children:[e.jsx(_l,{className:"h-3 w-3 mr-1"}),"At Limit"]})]}),Ge&&e.jsx("p",{className:"text-sm text-destructive mt-2",children:"You've reached your storage limit. Delete videos to record more."})]})}),e.jsxs("div",{className:"relative",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search videos by contact, title, or notes...",value:j,onChange:Ot=>S(Ot.target.value),className:"pl-10"})]}),s?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})}):(Ie==null?void 0:Ie.length)===0?e.jsx(ze,{children:e.jsxs(qe,{className:"py-12 text-center",children:[e.jsx(ya,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("h3",{className:"font-semibold mb-2",children:"No videos yet"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Record your first video touch to get started"}),e.jsxs(Q,{onClick:()=>t("/mission-control/video/record"),children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Record Video"]})]})}):e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Ie==null?void 0:Ie.map(Ot=>{var rr,Ir;return e.jsx(_Jt,{video:Ot,previewSrc:(rr=Ae[Ot.id])==null?void 0:rr.previewUrl,thumbnailSrc:(Ir=Ae[Ot.id])==null?void 0:Ir.thumbnailUrl,onOpen:()=>mt(Ot),onDelete:()=>{M(Ot),B(!0)},onRename:()=>{M(Ot),tt(Ot.title||""),we(!0)},onNavigateToContact:()=>t(`/mission-control/contacts/${Ot.contact_id}`),onGetEmbedCode:()=>{M(Ot),X(!0)},onCopyEmailHtml:()=>Xe(Ot),onEmbedToCrm:()=>ot(Ot),onShareWithTemplate:()=>{M(Ot),ue(!0)},onSendViaGmail:()=>{M(Ot),Te(!0)},isGmailConnected:d,getContactName:Ue,getShareUrl:je,copyToClipboard:rt,formatDuration:Ye},Ot.id)})}),e.jsx(Dr,{open:I,onOpenChange:F,children:e.jsxs(Lr,{className:"max-w-2xl",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:(A==null?void 0:A.title)||"Video Preview"}),e.jsx(Gs,{children:(A==null?void 0:A.contact_id)&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Kl,{className:"h-3 w-3"}),Ue(A.contact_id)]})})]}),A&&e.jsxs("div",{className:"space-y-4",children:[A.status==="processing"?e.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:[e.jsx("div",{className:"relative",children:e.jsx("div",{className:"h-16 w-16 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(Hr,{className:"h-8 w-8 text-primary animate-spin"})})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"font-semibold text-lg",children:"Video is still processing"}),e.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!"})]}),e.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>{F(!1),n()},children:[e.jsx(Ko,{className:"h-4 w-4 mr-2"}),"Refresh Library"]})]}):e.jsx("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:A.playback_url?(()=>{let Ot=A.playback_url;return Ot.includes("iframe.mediadelivery.net/play/")&&(Ot=Ot.replace("/play/","/embed/"),Ot+=(Ot.includes("?")?"&":"?")+"autoplay=false&responsive=true"),Ot.includes("iframe.mediadelivery.net")?e.jsx("iframe",{src:Ot,title:A.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}):e.jsx("video",{src:A.playback_url,controls:!0,playsInline:!0,preload:"metadata",poster:A.thumbnail_url||void 0,className:"absolute top-0 left-0 w-full h-full rounded-lg object-cover",onError:()=>Se.error("Video preview failed to load")},A.playback_url)})():e.jsxs("div",{className:"absolute inset-0 flex items-center justify-center bg-muted rounded-lg",children:[e.jsx(ya,{className:"h-12 w-12 text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground ml-2",children:"Video not available"})]})}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs(Q,{variant:"outline",onClick:()=>it(A),children:[e.jsx($o,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),!d&&e.jsxs(Q,{variant:"outline",onClick:()=>Me(A),children:[e.jsx(mn,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),e.jsxs(Q,{variant:"outline",onClick:()=>rt(je(A),"Share link"),children:[e.jsx(fo,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),e.jsxs(Q,{variant:"outline",onClick:()=>Xe(A),children:[e.jsx(mn,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),e.jsxs(Q,{variant:"outline",onClick:()=>Ve(A),children:[e.jsx(Oi,{className:"h-4 w-4 mr-2"}),"Download Video"]}),e.jsxs(Q,{variant:"outline",onClick:()=>{F(!1),ot(A)},children:[e.jsx(En,{className:"h-4 w-4 mr-2"}),"Embed to CRM"]}),e.jsxs(Q,{variant:"outline",onClick:()=>{F(!1),ue(!0)},children:[e.jsx(ed,{className:"h-4 w-4 mr-2"}),"Send with Page Template"]}),d&&(A==null?void 0:A.share_token)&&e.jsxs(Q,{variant:"outline",onClick:()=>{F(!1),Te(!0)},children:[e.jsx(Mi,{className:"h-4 w-4 mr-2"}),"Send via Gmail"]})]}),e.jsx("div",{className:"flex justify-end pt-2 border-t",children:e.jsxs(Q,{variant:"destructive",onClick:()=>{F(!1),B(!0)},children:[e.jsx(Rs,{className:"h-4 w-4 mr-2"}),"Delete Video"]})})]})]})}),e.jsx(Dr,{open:O,onOpenChange:B,children:e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Delete Video"}),e.jsx(Gs,{children:"Are you sure you want to delete this video? This action cannot be undone."})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>B(!1),children:"Cancel"}),e.jsx(Q,{variant:"destructive",onClick:ft,disabled:l.isPending,children:l.isPending?"Deleting...":"Delete"})]})]})}),e.jsx(gJt,{open:$,onOpenChange:H}),e.jsx(Dr,{open:W,onOpenChange:X,children:e.jsxs(Lr,{className:"sm:max-w-lg",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Embed Video"}),e.jsx(Gs,{children:"Copy this code to embed the video on your website."})]}),A&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Embed Code"}),e.jsx(Ks,{readOnly:!0,rows:5,value:``,className:"font-mono text-xs"})]}),e.jsx("div",{className:"flex gap-2",children:e.jsxs(Q,{className:"flex-1",onClick:()=>{const Ot=``;rt(Ot,"Embed code")},children:[e.jsx(fo,{className:"h-4 w-4 mr-2"}),"Copy Embed Code"]})}),e.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."})]})]})}),A&&e.jsx(JVe,{open:de,onOpenChange:ue,video:A,contactName:Ue(A.contact_id)}),A&&e.jsx(xJt,{open:xe,onOpenChange:Te,video:A,gmailEmail:m,signedThumbnailUrl:(Mt=Ae[A.id])==null?void 0:Mt.thumbnailUrl}),e.jsx(Dr,{open:be,onOpenChange:we,children:e.jsxs(Lr,{className:"max-w-sm",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Rename Video"}),e.jsx(Gs,{children:"Enter a new title for this video."})]}),e.jsx(Qe,{value:ve,onChange:Ot=>tt(Ot.target.value),placeholder:"Video title",autoFocus:!0,onKeyDown:Ot=>{Ot.key==="Enter"&&ve.trim()&&i.mutate({id:A.id,title:ve.trim()},{onSuccess:()=>{Se.success("Video renamed"),we(!1)}})}}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>we(!1),children:"Cancel"}),e.jsx(Q,{disabled:!ve.trim()||i.isPending,onClick:()=>{i.mutate({id:A.id,title:ve.trim()},{onSuccess:()=>{Se.success("Video renamed"),we(!1)}})},children:i.isPending?"Saving...":"Save"})]})]})}),e.jsx(Dr,{open:se,onOpenChange:ae,children:e.jsxs(Lr,{className:"sm:max-w-lg",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{className:"flex items-center gap-2",children:[e.jsx(En,{className:"h-5 w-5"}),"Embed to CRM"]}),e.jsx(Gs,{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."})]}),fe?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Hr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):le?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"CRM Email HTML"}),e.jsx(Ks,{readOnly:!0,rows:12,value:le,className:"font-mono text-xs"})]}),e.jsxs(Q,{className:"w-full",onClick:()=>{rt(le,"CRM embed code")},children:[e.jsx(fo,{className:"h-4 w-4 mr-2"}),"Copy CRM Embed Code"]}),e.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 wJt({videos:t,isLoading:r,searchTerm:s,setSearchTerm:n}){const a=E.useMemo(()=>{if(!s)return t;const i=s.toLowerCase();return t.filter(d=>(d.title||"").toLowerCase().includes(i)||(d.owner_name||"").toLowerCase().includes(i)||(d.recipient_name||"").toLowerCase().includes(i))},[t,s]),o=E.useMemo(()=>{const i=new Map;return a.forEach(d=>{const m=i.get(d.owner_user_id);m?m.videos.push(d):i.set(d.owner_user_id,{name:d.owner_name,avatar:d.owner_avatar_url,videos:[d]})}),Array.from(i.entries())},[a]),l=i=>{if(!i)return"0:00";const d=Math.floor(i/60),m=i%60;return`${d}:${m.toString().padStart(2,"0")}`};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search team videos by title, owner, or recipient...",value:s,onChange:i=>n(i.target.value),className:"pl-10"})]}),r?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})}):a.length===0?e.jsx(ze,{children:e.jsxs(qe,{className:"py-12 text-center",children:[e.jsx(ws,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("h3",{className:"font-semibold mb-2",children:"No team videos"}),e.jsx("p",{className:"text-muted-foreground",children:t.length===0?"Your teammates haven't recorded any videos yet.":"No videos match your search."})]})}):e.jsx("div",{className:"space-y-6",children:o.map(([i,d])=>e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(ln,{className:"h-7 w-7",children:[e.jsx(pa,{src:d.avatar||""}),e.jsx(cn,{children:(d.name||"?").charAt(0).toUpperCase()})]}),e.jsx("h3",{className:"font-semibold text-sm",children:d.name}),e.jsx(bt,{variant:"secondary",className:"text-xs",children:d.videos.length})]}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:d.videos.map(m=>e.jsxs(ze,{className:"overflow-hidden",children:[e.jsxs("div",{className:"relative aspect-video bg-muted flex items-center justify-center",children:[m.thumbnail_url?e.jsx("img",{src:m.thumbnail_url,alt:m.title||"Video",className:"w-full h-full object-cover",referrerPolicy:"no-referrer",onError:g=>{g.target.style.display="none"}}):e.jsx(ya,{className:"h-10 w-10 text-muted-foreground"}),m.duration_seconds&&e.jsx("span",{className:"absolute bottom-2 right-2 bg-black/70 text-white text-xs px-1.5 py-0.5 rounded",children:l(m.duration_seconds)})]}),e.jsxs(qe,{className:"p-3",children:[e.jsx("p",{className:"font-medium text-sm truncate",children:m.title||"Untitled"}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 text-xs text-muted-foreground",children:[m.recipient_name&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Kl,{className:"h-3 w-3"}),m.recipient_name]}),m.view_count!=null&&m.view_count>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Gi,{className:"h-3 w-3"}),m.view_count]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ea,{className:"h-3 w-3"}),Xr(new Date(m.created_at),"MMM d")]})]})]})]},m.id))})]},i))})]})}const jJt=()=>{const{user:t}=Gr();return Ht({queryKey:["team-deals",t==null?void 0:t.id],queryFn:async()=>{const{data:r,error:s}=await Z.rpc("get_team_deals",{_user_id:t.id});if(s)throw s;return r||[]},enabled:!!t})};function kJt({open:t,onOpenChange:r}){const{data:s,isLoading:n}=jJt(),[a,o]=E.useState(""),[l,i]=E.useState("all"),d=E.useMemo(()=>{if(!s)return[];const v=new Map;return s.forEach(b=>{v.has(b.owner_user_id)||v.set(b.owner_user_id,{id:b.owner_user_id,name:b.owner_name||"Unknown",avatar:b.owner_avatar_url})}),Array.from(v.values())},[s]),m=E.useMemo(()=>{if(!s)return[];let v=s;if(l!=="all"&&(v=v.filter(b=>b.owner_user_id===l)),a.trim()){const b=a.toLowerCase();v=v.filter(N=>{var j,S,A,M;return N.deal_name.toLowerCase().includes(b)||((j=N.contact_name)==null?void 0:j.toLowerCase().includes(b))||((S=N.property_address)==null?void 0:S.toLowerCase().includes(b))||((A=N.city)==null?void 0:A.toLowerCase().includes(b))||((M=N.owner_name)==null?void 0:M.toLowerCase().includes(b))})}return v},[s,a,l]),g=E.useMemo(()=>{const v=new Map;return m.forEach(b=>{v.has(b.owner_user_id)||v.set(b.owner_user_id,{name:b.owner_name||"Unknown",avatar:b.owner_avatar_url,deals:[]}),v.get(b.owner_user_id).deals.push(b)}),Array.from(v.entries())},[m]),y=v=>v?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(v):null;return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"max-w-2xl max-h-[80vh] flex flex-col",children:[e.jsx(Ur,{children:e.jsxs(Br,{className:"flex items-center gap-2",children:[e.jsx(ws,{className:"h-5 w-5"}),"Team Pipeline"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search deals...",value:a,onChange:v=>o(v.target.value),className:"pl-9"})]}),e.jsxs(ds,{value:l,onValueChange:i,children:[e.jsx(ls,{className:"w-[180px]",children:e.jsx(us,{placeholder:"All Members"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Members"}),d.map(v=>e.jsx(Ut,{value:v.id,children:v.name},v.id))]})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto space-y-4 mt-2",children:n?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(v=>e.jsx(fr,{className:"h-20 w-full"},v))}):m.length===0?e.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[e.jsx(ws,{className:"h-10 w-10 mx-auto mb-3 opacity-50"}),e.jsx("p",{className:"font-medium",children:"No team deals found"}),e.jsx("p",{className:"text-sm",children:"Team members' deals will appear here based on your team's visibility settings."})]}):g.map(([v,b])=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 sticky top-0 bg-background py-1 z-10",children:[e.jsxs(ln,{className:"h-6 w-6",children:[e.jsx(pa,{src:b.avatar||""}),e.jsx(cn,{className:"text-xs",children:b.name.charAt(0).toUpperCase()})]}),e.jsx("span",{className:"font-medium text-sm",children:b.name}),e.jsxs(bt,{variant:"secondary",className:"text-xs",children:[b.deals.length," deals"]})]}),e.jsx("div",{className:"space-y-2 pl-8",children:b.deals.map(N=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-card",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-medium text-sm truncate",children:N.deal_name}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-1",children:[N.contact_name&&e.jsx("span",{className:"text-xs text-muted-foreground",children:N.contact_name}),N.property_address&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["• ",N.property_address]}),N.deal_type&&e.jsx(bt,{variant:"outline",className:"text-[10px] capitalize",children:N.deal_type})]})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-2 shrink-0",children:[N.sale_price&&e.jsxs("span",{className:"text-xs font-medium flex items-center gap-0.5 text-muted-foreground",children:[e.jsx(yd,{className:"h-3 w-3"}),y(N.sale_price)]}),N.stage_name&&e.jsxs(bt,{variant:"outline",className:"text-[10px] whitespace-nowrap",style:{borderColor:N.stage_color||void 0,color:N.stage_color||void 0,backgroundColor:N.stage_color?`${N.stage_color}10`:void 0},children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full inline-block mr-1",style:{backgroundColor:N.stage_color||void 0}}),N.stage_name]})]})]},N.id))})]},v))}),e.jsxs("p",{className:"text-xs text-muted-foreground text-center pt-2 border-t",children:[m.length," deal",m.length!==1?"s":""," from ",g.length," team member",g.length!==1?"s":""]})]})})}function NJt({members:t,enabledMembers:r,onToggleMember:s,isOpen:n,onToggleOpen:a}){const o=r.size;return e.jsxs("div",{className:qt("shrink-0 border-r border-border/50 bg-muted/20 transition-all duration-300 flex flex-col",n?"w-[220px]":"w-[48px]"),children:[e.jsx("div",{className:"p-2 border-b border-border/50 shrink-0",children:e.jsxs(Q,{variant:"ghost",size:"sm",className:"w-full justify-start gap-2 px-2",onClick:a,children:[e.jsx(ws,{className:"h-4 w-4 shrink-0 text-primary"}),n&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs font-semibold flex-1 text-left",children:"Team"}),o>0&&e.jsx("span",{className:"text-[10px] bg-primary text-primary-foreground rounded-full px-1.5 py-0.5",children:o}),e.jsx(uc,{className:"h-3 w-3 text-muted-foreground"})]}),!n&&o>0&&e.jsx("span",{className:"absolute -top-1 -right-1 text-[9px] bg-primary text-primary-foreground rounded-full w-4 h-4 flex items-center justify-center",children:o})]})}),n?e.jsxs(Eo,{className:"flex-1 p-2",children:[e.jsx("div",{className:"space-y-1",children:t.map(l=>{const i=r.has(l.id);return e.jsxs("button",{onClick:()=>s(l.id),className:qt("w-full flex items-center gap-2 px-2 py-2 rounded-lg text-left transition-colors",i?"bg-primary/10 hover:bg-primary/15":"hover:bg-muted/50"),children:[e.jsxs("div",{className:"relative",children:[e.jsxs(ln,{className:"h-7 w-7",children:[e.jsx(pa,{src:l.avatar_url||""}),e.jsx(cn,{className:"text-[10px] font-semibold text-white",style:{backgroundColor:l.color},children:l.name.charAt(0).toUpperCase()})]}),i&&e.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full border-2 border-background",style:{backgroundColor:l.color}})]}),e.jsx("span",{className:qt("text-xs truncate flex-1",i?"font-medium text-foreground":"text-muted-foreground"),children:l.name}),e.jsx(xn,{checked:i,onCheckedChange:()=>s(l.id),className:"scale-75",onClick:d=>d.stopPropagation()})]},l.id)})}),t.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:"No team members"})]}):e.jsxs("div",{className:"flex-1 flex flex-col items-center pt-2 gap-2",children:[t.slice(0,5).map(l=>{const i=r.has(l.id);return e.jsx("button",{onClick:()=>s(l.id),className:"relative",title:l.name,children:e.jsxs(ln,{className:qt("h-7 w-7 transition-all",i?"ring-2 ring-offset-1 ring-offset-background":"opacity-50"),style:i?{"--tw-ring-color":l.color}:{},children:[e.jsx(pa,{src:l.avatar_url||""}),e.jsx(cn,{className:"text-[10px] font-semibold text-white",style:{backgroundColor:l.color},children:l.name.charAt(0).toUpperCase()})]})},l.id)}),t.length>5&&e.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["+",t.length-5]})]})]})}const LTe=["#8B5CF6","#EC4899","#F59E0B","#10B981","#3B82F6","#EF4444","#06B6D4","#F97316"];function SJt(){const{user:t}=Gr(),{data:r}=Lv(),s=(r==null?void 0:r.role)==="team_leader",n=r==null?void 0:r.teamId,a=Ht({queryKey:["team-pipeline-members",n],queryFn:async()=>{const{data:o,error:l}=await Z.from("team_members").select("user_id, role").eq("team_id",n).neq("user_id",t.id);if(l)throw l;if(!o||o.length===0)return[];const i=o.map(g=>g.user_id),{data:d,error:m}=await Z.from("profiles").select("id, name, avatar_url").in("id",i);if(m)throw m;return(d||[]).map((g,y)=>({id:g.id,name:g.name||"Unknown",avatar_url:g.avatar_url,color:LTe[y%LTe.length]}))},enabled:!!n&&!!t&&s,staleTime:5*60*1e3});return{isTeamLeader:s,teamMembers:a.data||[],isLoadingMembers:a.isLoading}}function CJt(t){return Ht({queryKey:["team-member-deals",t],queryFn:async()=>{if(t.length===0)return[];const{data:r,error:s}=await Z.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), deal_pipeline_stages(name) `).in("owner_user_id",t).order("updated_at",{ascending:!1});if(s)throw s;return(r||[]).map(n=>{var a;return{...n,_stage_name:((a=n.deal_pipeline_stages)==null?void 0:a.name)||null}})},enabled:t.length>0})}function eHe({stages:t,currentStageId:r,onStageSelect:s,disabled:n}){const[a,o]=E.useState(!1),l=t.find(d=>d.id===r),i=d=>{d.id!==r&&s(d.id,d.name),o(!1)};return e.jsxs(mh,{open:a,onOpenChange:o,children:[e.jsx(ph,{asChild:!0,children:e.jsxs(Q,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",disabled:n,onClick:d=>d.stopPropagation(),children:[l&&e.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:l.color}}),e.jsx("span",{className:"max-w-[80px] truncate",children:(l==null?void 0:l.name)||"Move"}),e.jsx(Wi,{className:"h-3 w-3 shrink-0"})]})}),e.jsx(Au,{align:"end",className:"w-48 z-50 bg-popover",onClick:d=>d.stopPropagation(),children:t.map(d=>{const m=d.icon&&VIe[d.icon]||ah,g=d.id===r;return e.jsxs(Ba,{onClick:()=>i(d),className:qt("flex items-center gap-2 cursor-pointer",g&&"bg-accent"),children:[e.jsx("div",{className:"w-5 h-5 rounded flex items-center justify-center shrink-0",style:{backgroundColor:`${d.color}20`},children:e.jsx(m,{className:"h-3 w-3",style:{color:d.color}})}),e.jsx("span",{className:"flex-1",children:d.name}),g&&e.jsx(li,{className:"h-4 w-4 text-primary"})]},d.id)})})]})}const MJt={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"}},TJt={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 tHe({deal:t,onClick:r,isDragging:s,stages:n,onStageChange:a,showStagePicker:o=!1,isWonStage:l=!1,ownerInfo:i=null}){var M,I;const d=e5(),m=MJt[t.deal_type],g=TJt[t.priority],y=E.useMemo(()=>t.target_close_date?Dy(new Date(t.target_close_date),new Date):null,[t.target_close_date]),v=y!==null&&y<0,b=y!==null&&y<=7&&y>=0,N=E.useMemo(()=>{var B;if(t.deal_type!=="seller"&&t.deal_type!=="dual")return null;const F=((B=t.listing)==null?void 0:B.created_at)||t.listing_date;if(!F)return null;const O=t.contract_date?new Date(t.contract_date):new Date;return Dy(O,new Date(F))},[t]),j=l&&!t.scorecard_transaction_id,S=!!t.scorecard_transaction_id,A=F=>F?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(F):null;return e.jsx(ze,{className:qt("cursor-pointer transition-all duration-200 hover:shadow-md hover:border-primary/30 group overflow-hidden",s&&"opacity-50 rotate-2 shadow-xl",v&&"border-red-200 bg-red-50/30",j&&"border-amber-300 bg-amber-50/30 dark:bg-amber-950/20"),onClick:r,style:i?{borderLeftWidth:4,borderLeftColor:i.color}:void 0,children:e.jsxs(qe,{className:"p-3 space-y-2.5",children:[i&&e.jsxs("div",{className:"flex items-center gap-1.5 -mt-0.5 mb-1",children:[e.jsxs(ln,{className:"h-4 w-4",children:[e.jsx(pa,{src:i.avatar_url||""}),e.jsx(cn,{className:"text-[8px] font-semibold text-white",style:{backgroundColor:i.color},children:i.name.charAt(0).toUpperCase()})]}),e.jsx("span",{className:"text-[10px] font-medium",style:{color:i.color},children:i.name})]}),e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("h4",{className:"font-medium text-sm leading-tight line-clamp-2 group-hover:text-primary transition-colors",children:t.deal_name})}),e.jsx(bt,{variant:"outline",className:qt("text-[10px] px-1.5 py-0 shrink-0",m.color),children:m.label})]}),t.contact&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(ln,{className:"h-5 w-5",children:e.jsxs(cn,{className:"text-[10px] bg-primary/10 text-primary",children:[(M=t.contact.first_name)==null?void 0:M[0],(I=t.contact.last_name)==null?void 0:I[0]]})}),e.jsxs("span",{className:"truncate",children:[t.contact.first_name," ",t.contact.last_name]})]}),t.listing&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx(jm,{className:"h-3 w-3 text-primary shrink-0"}),e.jsx("span",{className:"text-primary truncate",children:"Linked to Listing Exchange"})]}),j&&e.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:[e.jsx(ho,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate font-medium",children:"Add to Scorecard"})]}),S&&l&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-green-600 dark:text-green-400",children:[e.jsx(Li,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:"Synced to Scorecard"})]}),N!==null&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx(gA,{className:"h-3 w-3 text-muted-foreground shrink-0"}),e.jsxs("span",{className:qt("font-medium",N>90?"text-red-600":N>60?"text-amber-600":"text-muted-foreground"),children:[N," DOM"]}),t.contract_date&&e.jsx("span",{className:"text-muted-foreground",children:"(final)"})]}),!t.listing&&(t.property_address||t.city)&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(Wn,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:t.property_address||`${t.city}, ${t.state}`})]}),t.expected_price&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx(yd,{className:"h-3 w-3 text-emerald-500 shrink-0"}),e.jsx("span",{className:"font-semibold text-foreground",children:A(t.expected_price)}),t.expected_commission&&e.jsxs("span",{className:"text-muted-foreground",children:["• ",A(t.expected_commission)," GCI"]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-1 border-t border-border/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:qt("flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",g.color),children:[e.jsx("div",{className:qt("w-1.5 h-1.5 rounded-full",g.dot)}),e.jsx("span",{className:"capitalize",children:t.priority})]}),e.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[t.probability,"%"]})]}),o&&d&&n&&a?e.jsx(eHe,{stages:n,currentStageId:t.stage_id||"",onStageSelect:(F,O)=>a(t.id,F,O)}):t.target_close_date?e.jsxs("div",{className:qt("flex items-center gap-1 text-[10px]",v&&"text-red-600",b&&!v&&"text-amber-600",!v&&!b&&"text-muted-foreground"),children:[v?e.jsx(_l,{className:"h-3 w-3"}):e.jsx(Mn,{className:"h-3 w-3"}),e.jsx("span",{children:v?`${Math.abs(y)}d overdue`:b?`${y}d left`:Xr(new Date(t.target_close_date),"MMM d")})]}):null]})]})})}function AJt({stage:t,deals:r,onDealClick:s,onAddDeal:n,onDragStart:a,onDragOver:o,onDrop:l,isDragOver:i,isWonStage:d=!1,getOwnerInfo:m}){const g=E.useRef(null),y=r.reduce((j,S)=>j+(S.expected_price||0),0),v=r.reduce((j,S)=>j+(S.expected_commission||0),0),b=j=>j>=1e6?`$${(j/1e6).toFixed(1)}M`:j>=1e3?`$${(j/1e3).toFixed(0)}K`:`$${j.toFixed(0)}`,N=t.icon&&VIe[t.icon]||ah;return e.jsxs("div",{ref:g,className:qt("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:j=>o(j,t.id),onDrop:j=>l(j,t.id),children:[e.jsxs("div",{className:"p-3 border-b border-border/50 shrink-0",style:{borderTopColor:t.color,borderTopWidth:3},children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{backgroundColor:`${t.color}20`},children:e.jsx(N,{className:"h-4 w-4",style:{color:t.color}})}),e.jsx("div",{children:e.jsx("h3",{className:"font-semibold text-sm",children:t.name})})]}),e.jsx(bt,{variant:"secondary",className:"text-xs font-medium px-2",children:r.length})]}),y>0&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-foreground",children:b(y)}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:[b(v)," GCI"]})]})]}),e.jsx(Eo,{className:"flex-1 p-2",children:e.jsxs("div",{className:"space-y-2",children:[r.map(j=>e.jsx("div",{draggable:!0,onDragStart:S=>{S.dataTransfer.effectAllowed="move",a(j.id,t.id)},children:e.jsx(tHe,{deal:j,onClick:()=>s(j),isWonStage:d,ownerInfo:(m==null?void 0:m(j))||null})},j.id)),r.length===0&&e.jsxs("div",{className:"py-8 px-4 text-center text-muted-foreground text-sm",children:[e.jsx("p",{className:"mb-2",children:"No deals yet"}),e.jsx("p",{className:"text-xs",children:"Drag deals here or add new"})]})]})}),e.jsx("div",{className:"p-2 border-t border-border/50 shrink-0",children:e.jsxs(Q,{variant:"ghost",size:"sm",className:"w-full justify-start text-muted-foreground hover:text-foreground",onClick:()=>n(t.id),children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Deal"]})})]})}function EJt({stats:t,isLoading:r}){const s=a=>a>=1e6?`$${(a/1e6).toFixed(1)}M`:a>=1e3?`$${(a/1e3).toFixed(0)}K`:`$${a.toLocaleString()}`,n=[{label:"Active Deals",value:(t==null?void 0:t.activeDeals)||0,icon:bp,color:"text-blue-500",bgColor:"bg-blue-500/10"},{label:"Pipeline Value",value:s((t==null?void 0:t.pipelineValue)||0),icon:Nc,color:"text-purple-500",bgColor:"bg-purple-500/10"},{label:"Expected GCI",value:s((t==null?void 0:t.expectedCommission)||0),icon:yd,color:"text-emerald-500",bgColor:"bg-emerald-500/10"},{label:"Won Deals",value:(t==null?void 0:t.wonDeals)||0,icon:ho,color:"text-amber-500",bgColor:"bg-amber-500/10"}];return r?e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[1,2,3,4].map(a=>e.jsx(ze,{className:"animate-pulse",children:e.jsx(qe,{className:"p-4",children:e.jsx("div",{className:"h-10 bg-muted rounded"})})},a))}):e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:n.map(a=>e.jsx(ze,{className:"border-border/50 hover:shadow-sm transition-shadow",children:e.jsx(qe,{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:qt("p-2 rounded-lg",a.bgColor),children:e.jsx(a.icon,{className:qt("h-5 w-5",a.color)})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:a.label}),e.jsx("p",{className:"text-xl font-bold",children:a.value})]})]})})},a.label))})}function IJt(t){return Ht({queryKey:["client-portal",t],queryFn:async()=>{if(!t)return null;const{data:r,error:s}=await Z.from("client_portals").select("*").eq("deal_id",t).maybeSingle();if(s)throw s;return r},enabled:!!t})}function rHe(){const t=Ll(),r=qr();return Jt({mutationFn:async s=>{if(!t)throw new Error("Not authenticated");const{data:n,error:a}=await Z.from("client_portals").insert({deal_id:s.deal_id,owner_user_id:t,slug:"",is_enabled:s.is_enabled??!0,visibility:s.visibility||"private",require_onboarding:s.require_onboarding??!0,allow_spouse:s.allow_spouse??!1,client_name:s.client_name||null,client_email:s.client_email||null,client_phone:s.client_phone||null,invite_method:s.invite_method||"email"}).select().single();if(a)throw a;return n},onSuccess:(s,n)=>{r.invalidateQueries({queryKey:["client-portal",n.deal_id]})}})}function xve(){const t=qr();return Jt({mutationFn:async({id:r,...s})=>{const{data:n,error:a}=await Z.from("client_portals").update(s).eq("id",r).select().single();if(a)throw a;return n},onSuccess:r=>{t.invalidateQueries({queryKey:["client-portal",r.deal_id]})}})}function PJt(){const t=qr();return Jt({mutationFn:async r=>{const{data:s,error:n}=await Z.from("portal_updates").insert({portal_id:r.portal_id,title:r.title,content:r.content||null,video_url:r.video_url||null,is_stage_change:r.is_stage_change||!1}).select().single();if(n)throw n;return s},onSuccess:(r,s)=>{t.invalidateQueries({queryKey:["portal-updates",s.portal_id]})}})}function LJt(){const t=Ll();return Ht({queryKey:["portal-custom-questions",t],queryFn:async()=>{if(!t)return[];const{data:r,error:s}=await Z.from("portal_custom_questions").select("*").eq("owner_user_id",t).eq("is_active",!0).order("sort_order",{ascending:!0});if(s)throw s;return r},enabled:!!t})}function OJt(){const t=Ll(),r=qr();return Jt({mutationFn:async s=>{if(!t)throw new Error("Not authenticated");const{data:n,error:a}=await Z.from("portal_custom_questions").insert({owner_user_id:t,question_text:s.question_text,field_type:s.field_type,options:s.options||[],is_required:s.is_required||!1,sort_order:s.sort_order||0}).select().single();if(a)throw a;return n},onSuccess:()=>{r.invalidateQueries({queryKey:["portal-custom-questions"]})}})}function DJt(){const t=qr();return Jt({mutationFn:async({id:r,...s})=>{const{data:n,error:a}=await Z.from("portal_custom_questions").update(s).eq("id",r).select().single();if(a)throw a;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["portal-custom-questions"]})}})}function RJt(){const t=qr();return Jt({mutationFn:async r=>{const{error:s}=await Z.from("portal_custom_questions").update({is_active:!1}).eq("id",r);if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["portal-custom-questions"]})}})}function ite(t){const r=window.location.hostname;return r==="localhost"||r.includes("lovable.app")?`${window.location.origin}/portal/${t}`:`https://clients.relevelup.com/${t}`}function FJt({formData:t,onChange:r,isEditing:s}){const{isAdmin:n}=Gr(),[a,o]=E.useState(t.portal_enabled);if(!n)return e.jsxs("div",{className:"border rounded-lg p-4 opacity-60",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(An,{className:"h-4 w-4 text-primary"}),e.jsx("h4",{className:"font-medium text-sm",children:"Client Portal"}),e.jsx(bt,{variant:"secondary",className:"text-xs",children:"Coming Soon"})]})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Give your clients a premium, real-time view of their transaction — coming soon!"})]});const l=i=>{r({...t,...i})};return e.jsx(ek,{open:a,onOpenChange:o,children:e.jsxs("div",{className:"border rounded-lg",children:[e.jsxs(tk,{className:"w-full p-4 flex items-center justify-between hover:bg-muted/50 transition-colors rounded-t-lg",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(An,{className:"h-4 w-4 text-primary"}),e.jsx("h4",{className:"font-medium text-sm",children:"Client Portal"}),t.portal_enabled&&e.jsx(bt,{className:"text-xs bg-emerald-500/10 text-emerald-600 border-emerald-200",variant:"outline",children:"Enabled"})]}),e.jsx(Jc,{className:qt("h-4 w-4 text-muted-foreground transition-transform",a&&"rotate-180")})]}),e.jsx(rk,{children:e.jsxs("div",{className:"px-4 pb-4 space-y-5 border-t pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Enable Client Portal"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Create a beautiful portal your client can track their deal from"})]}),e.jsx(xn,{checked:t.portal_enabled,onCheckedChange:i=>l({portal_enabled:i})})]}),t.portal_enabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Portal Visibility"}),e.jsxs(Bye,{value:t.visibility,onValueChange:i=>l({visibility:i}),className:"grid grid-cols-2 gap-3",children:[e.jsxs("label",{className:qt("flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-colors",t.visibility==="private"?"border-primary bg-primary/5":"hover:bg-muted/50"),children:[e.jsx(cre,{value:"private"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(ku,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"text-sm font-medium",children:"Private"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Link-only access"})]})]}),e.jsxs("label",{className:qt("flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition-colors",t.visibility==="public"?"border-primary bg-primary/5":"hover:bg-muted/50"),children:[e.jsx(cre,{value:"public"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Gg,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"text-sm font-medium",children:"Public"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Shareable link"})]})]})]})]}),e.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg bg-muted/30",children:[e.jsx(Yo,{id:"require_onboarding",checked:t.require_onboarding,onCheckedChange:i=>l({require_onboarding:!!i}),className:"mt-0.5"}),e.jsxs("div",{children:[e.jsx(Ee,{htmlFor:"require_onboarding",className:"text-sm font-medium cursor-pointer",children:"Require client onboarding before portal access"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Client confirms contact details + preferences before viewing portal. Info is saved to your contacts."})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Yo,{id:"allow_spouse",checked:t.allow_spouse,onCheckedChange:i=>l({allow_spouse:!!i})}),e.jsx(Ee,{htmlFor:"allow_spouse",className:"text-sm cursor-pointer",children:"Allow client to add spouse/partner during onboarding"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Client Invite Details"}),e.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{className:"text-xs text-muted-foreground",children:"Client Full Name"}),e.jsx(Qe,{value:t.client_name,onChange:i=>l({client_name:i.target.value}),placeholder:"Jane Smith"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{className:"text-xs text-muted-foreground",children:"Email"}),e.jsx(Qe,{type:"email",value:t.client_email,onChange:i=>l({client_email:i.target.value}),placeholder:"jane@example.com"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{className:"text-xs text-muted-foreground",children:"Phone"}),e.jsx(Qe,{type:"tel",value:t.client_phone,onChange:i=>l({client_phone:i.target.value}),placeholder:"(555) 123-4567"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{className:"text-xs text-muted-foreground",children:"Preferred Invite Method"}),e.jsxs(ds,{value:t.invite_method,onValueChange:i=>l({invite_method:i}),children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"email",children:"Email"}),e.jsxs(Ut,{value:"sms",disabled:!t.client_phone,children:["SMS ",!t.client_phone&&"(add phone first)"]})]})]})]})]})]})]})]})})]})})}const zJt=[{value:"buyer",label:"Buyer"},{value:"seller",label:"Seller"},{value:"dual",label:"Dual Agency"},{value:"referral",label:"Referral"},{value:"lease",label:"Lease"}],BJt=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"urgent",label:"Urgent"}];function $Jt({open:t,onOpenChange:r,deal:s,defaultStageId:n}){const{data:a}=gve(),{data:o}=Ip(),{data:l}=ZRe(),i=KVe(),d=ZVe(),m=rHe(),[g,y]=E.useState({portal_enabled:!1,visibility:"private",require_onboarding:!0,allow_spouse:!1,client_name:"",client_email:"",client_phone:"",invite_method:"email"}),[v,b]=E.useState(""),[N,j]=E.useState(!1),S=(l==null?void 0:l.filter($=>((s==null?void 0:s.listing_id)===$.id,!0)))||[],[A,M]=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 $,H,W;t&&(s?(M({deal_name:s.deal_name,deal_type:s.deal_type,stage_id:s.stage_id||"",contact_id:s.contact_id||"",listing_id:s.listing_id||"",property_address:s.property_address||"",city:s.city||"",state:s.state||"",zip_code:s.zip_code||"",expected_price:(($=s.expected_price)==null?void 0:$.toString())||"",commission_percentage:((H=s.commission_percentage)==null?void 0:H.toString())||"3",target_close_date:s.target_close_date?new Date(s.target_close_date):void 0,contract_date:s.contract_date?new Date(s.contract_date):void 0,listing_date:s.listing_date?new Date(s.listing_date):void 0,priority:s.priority,probability:s.probability.toString(),notes:s.notes||""}),s.contact&&b(`${s.contact.first_name} ${s.contact.last_name}`)):(M({deal_name:"",deal_type:"buyer",stage_id:n||((W=a==null?void 0:a[0])==null?void 0:W.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:""}),b(""),y({portal_enabled:!1,visibility:"private",require_onboarding:!0,allow_spouse:!1,client_name:"",client_email:"",client_phone:"",invite_method:"email"})))},[t,s,n,a]);const I=o==null?void 0:o.filter($=>{var W,X,se;const H=v.toLowerCase();return((W=$.first_name)==null?void 0:W.toLowerCase().includes(H))||((X=$.last_name)==null?void 0:X.toLowerCase().includes(H))||((se=$.email)==null?void 0:se.toLowerCase().includes(H))}).slice(0,5),F=()=>{const $=parseFloat(A.expected_price)||0,H=parseFloat(A.commission_percentage)||0;return $*(H/100)},O=async $=>{var H,W,X;if($.preventDefault(),!A.deal_name.trim()){Se.error("Please enter a deal name");return}try{const se={deal_name:A.deal_name,deal_type:A.deal_type,stage_id:A.stage_id||null,contact_id:A.contact_id||null,listing_id:A.listing_id||null,property_address:A.property_address||null,city:A.city||null,state:A.state||null,zip_code:A.zip_code||null,expected_price:A.expected_price?parseFloat(A.expected_price):null,expected_commission:F()||null,commission_percentage:A.commission_percentage?parseFloat(A.commission_percentage):3,target_close_date:((H=A.target_close_date)==null?void 0:H.toISOString().split("T")[0])||null,contract_date:((W=A.contract_date)==null?void 0:W.toISOString().split("T")[0])||null,listing_date:((X=A.listing_date)==null?void 0:X.toISOString().split("T")[0])||null,priority:A.priority,probability:parseInt(A.probability)||50,notes:A.notes||null};if(s)await d.mutateAsync({id:s.id,...se}),Se.success("Deal updated successfully");else{const ae=await i.mutateAsync(se);if(Se.success("Deal created successfully"),g.portal_enabled&&(ae!=null&&ae.id))try{await m.mutateAsync({deal_id:ae.id,visibility:g.visibility,require_onboarding:g.require_onboarding,allow_spouse:g.allow_spouse,client_name:g.client_name||null,client_email:g.client_email||null,client_phone:g.client_phone||null,invite_method:g.invite_method}),Se.success("Client portal created!")}catch{Se.error("Deal created, but portal setup failed")}}r(!1)}catch{Se.error("Failed to save deal")}},B=i.isPending||d.isPending;return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:s?"Edit Deal":"Add New Deal"}),e.jsx(Gs,{children:s?"Update the deal details below.":"Enter the details for your new deal."})]}),e.jsxs("form",{onSubmit:O,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"col-span-2 space-y-2",children:[e.jsx(Ee,{htmlFor:"deal_name",children:"Deal Name *"}),e.jsx(Qe,{id:"deal_name",value:A.deal_name,onChange:$=>M(H=>({...H,deal_name:$.target.value})),placeholder:"e.g., Smith Family - 123 Main St"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Deal Type"}),e.jsxs(ds,{value:A.deal_type,onValueChange:$=>M(H=>({...H,deal_type:$})),children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsx(cs,{children:zJt.map($=>e.jsx(Ut,{value:$.value,children:$.label},$.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Stage"}),e.jsxs(ds,{value:A.stage_id||"none",onValueChange:$=>M(H=>({...H,stage_id:$==="none"?"":$})),children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Select stage"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"none",children:"No Stage"}),a==null?void 0:a.map($=>e.jsx(Ut,{value:$.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:$.color}}),$.name]})},$.id))]})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Link to Contact"}),e.jsxs("div",{className:"relative",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{value:v,onChange:$=>{b($.target.value),j(!0),$.target.value||M(H=>({...H,contact_id:""}))},onFocus:()=>j(!0),placeholder:"Search contacts...",className:"pl-9"}),N&&v&&I&&I.length>0&&e.jsx("div",{className:"absolute z-10 w-full mt-1 bg-background border rounded-lg shadow-lg max-h-48 overflow-y-auto",children:I.map($=>e.jsxs("button",{type:"button",className:"w-full px-3 py-2 text-left hover:bg-muted flex items-center gap-2",onClick:()=>{M(H=>({...H,contact_id:$.id})),b(`${$.first_name} ${$.last_name}`),j(!1)},children:[e.jsx(Kl,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("span",{children:[$.first_name," ",$.last_name]}),$.email&&e.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:$.email})]},$.id))})]})]}),S.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ee,{className:"flex items-center gap-2",children:[e.jsx(jm,{className:"h-4 w-4"}),"Link to Listing Exchange"]}),e.jsxs(ds,{value:A.listing_id||"none",onValueChange:$=>{const H=$==="none"?"":$,W=S.find(X=>X.id===H);M(W?X=>{var se;return{...X,listing_id:H,deal_type:"seller",property_address:W.property_address||X.property_address,city:W.city||X.city,state:W.state||X.state,expected_price:((se=W.price)==null?void 0:se.toString())||X.expected_price}}:X=>({...X,listing_id:H}))},children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Select a listing to sync status..."})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"none",children:"None"}),S.map($=>e.jsx(Ut,{value:$.id,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:$.property_address||`${$.city}, ${$.state}`}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["$",($.price/1e3).toFixed(0),"K"]})]})},$.id))]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Status changes will sync automatically between the deal and listing."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-medium text-sm",children:"Property Details"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"col-span-2 space-y-2",children:[e.jsx(Ee,{htmlFor:"property_address",children:"Address"}),e.jsx(Qe,{id:"property_address",value:A.property_address,onChange:$=>M(H=>({...H,property_address:$.target.value})),placeholder:"123 Main Street"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"city",children:"City"}),e.jsx(Qe,{id:"city",value:A.city,onChange:$=>M(H=>({...H,city:$.target.value}))})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"state",children:"State"}),e.jsx(Qe,{id:"state",value:A.state,onChange:$=>M(H=>({...H,state:$.target.value})),maxLength:2,placeholder:"TX"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"zip_code",children:"ZIP"}),e.jsx(Qe,{id:"zip_code",value:A.zip_code,onChange:$=>M(H=>({...H,zip_code:$.target.value}))})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-medium text-sm",children:"Financial Details"}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"expected_price",children:"Expected Price"}),e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"$"}),e.jsx(Qe,{id:"expected_price",type:"number",value:A.expected_price,onChange:$=>M(H=>({...H,expected_price:$.target.value})),className:"pl-7",placeholder:"500000"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"commission_percentage",children:"Commission %"}),e.jsxs("div",{className:"relative",children:[e.jsx(Qe,{id:"commission_percentage",type:"number",step:"0.1",value:A.commission_percentage,onChange:$=>M(H=>({...H,commission_percentage:$.target.value})),className:"pr-7"}),e.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Expected GCI"}),e.jsx(Qe,{value:F()?`$${F().toLocaleString()}`:"-",disabled:!0,className:"bg-muted"})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-medium text-sm",children:"Dates & Status"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Target Close Date"}),e.jsxs(rd,{children:[e.jsx(sd,{asChild:!0,children:e.jsxs(Q,{variant:"outline",className:qt("w-full justify-start text-left font-normal",!A.target_close_date&&"text-muted-foreground"),children:[e.jsx(Mn,{className:"mr-2 h-4 w-4"}),A.target_close_date?Xr(A.target_close_date,"PPP"):"Pick a date"]})}),e.jsx(Fc,{className:"w-auto p-0",align:"start",children:e.jsx(Vf,{mode:"single",selected:A.target_close_date,onSelect:$=>M(H=>({...H,target_close_date:$})),initialFocus:!0,className:"pointer-events-auto"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Contract Date"}),e.jsxs(rd,{children:[e.jsx(sd,{asChild:!0,children:e.jsxs(Q,{variant:"outline",className:qt("w-full justify-start text-left font-normal",!A.contract_date&&"text-muted-foreground"),children:[e.jsx(Mn,{className:"mr-2 h-4 w-4"}),A.contract_date?Xr(A.contract_date,"PPP"):"Pick a date"]})}),e.jsx(Fc,{className:"w-auto p-0",align:"start",children:e.jsx(Vf,{mode:"single",selected:A.contract_date,onSelect:$=>M(H=>({...H,contract_date:$})),initialFocus:!0,className:"pointer-events-auto"})})]})]}),(A.deal_type==="seller"||A.deal_type==="dual")&&!A.listing_id&&e.jsxs("div",{className:"space-y-2 col-span-2",children:[e.jsx(Ee,{children:"Listing Date (for Days on Market)"}),e.jsxs(rd,{children:[e.jsx(sd,{asChild:!0,children:e.jsxs(Q,{variant:"outline",className:qt("w-full justify-start text-left font-normal",!A.listing_date&&"text-muted-foreground"),children:[e.jsx(Mn,{className:"mr-2 h-4 w-4"}),A.listing_date?Xr(A.listing_date,"PPP"):"Pick a date"]})}),e.jsx(Fc,{className:"w-auto p-0",align:"start",children:e.jsx(Vf,{mode:"single",selected:A.listing_date,onSelect:$=>M(H=>({...H,listing_date:$})),initialFocus:!0,className:"pointer-events-auto"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Used to calculate Days on Market. Auto-filled for linked listings."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Priority"}),e.jsxs(ds,{value:A.priority,onValueChange:$=>M(H=>({...H,priority:$})),children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsx(cs,{children:BJt.map($=>e.jsx(Ut,{value:$.value,children:$.label},$.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Win Probability"}),e.jsxs("div",{className:"relative",children:[e.jsx(Qe,{type:"number",min:"0",max:"100",value:A.probability,onChange:$=>M(H=>({...H,probability:$.target.value})),className:"pr-7"}),e.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"notes",children:"Notes"}),e.jsx(Ks,{id:"notes",value:A.notes,onChange:$=>M(H=>({...H,notes:$.target.value})),placeholder:"Add any additional notes about this deal...",rows:3})]}),!s&&e.jsx(FJt,{formData:g,onChange:y}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t",children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsxs(Q,{type:"submit",disabled:B,children:[B&&e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),s?"Update Deal":"Create Deal"]})]})]})]})})}function UJt(t){return Ht({queryKey:["deal-files",t],queryFn:async()=>{const{data:r,error:s}=await Z.from("deal_files").select("*").eq("deal_id",t).order("created_at",{ascending:!1});if(s)throw s;return r},enabled:!!t})}function qJt(){const t=Ll(),r=qr();return Jt({mutationFn:async({dealId:s,file:n})=>{if(!t)throw new Error("Not authenticated");const a=n.name.split(".").pop(),o=`${t}/${s}/${crypto.randomUUID()}.${a}`,{error:l}=await Z.storage.from("deal-files").upload(o,n);if(l)throw l;const{data:i,error:d}=await Z.from("deal_files").insert({deal_id:s,owner_user_id:t,file_name:n.name,file_size:n.size,file_type:n.type||null,storage_path:o}).select().single();if(d)throw d;return i},onSuccess:(s,n)=>{r.invalidateQueries({queryKey:["deal-files",n.dealId]})}})}function VJt(){const t=qr();return Jt({mutationFn:async({fileId:r,storagePath:s,dealId:n})=>{await Z.storage.from("deal-files").remove([s]);const{error:a}=await Z.from("deal_files").delete().eq("id",r);if(a)throw a;return n},onSuccess:r=>{t.invalidateQueries({queryKey:["deal-files",r]})}})}function HJt(){const t=qr();return Jt({mutationFn:async({fileId:r,visible:s,dealId:n})=>{const{error:a}=await Z.from("deal_files").update({visible_on_portal:s}).eq("id",r);if(a)throw a;return n},onSuccess:r=>{t.invalidateQueries({queryKey:["deal-files",r]})}})}async function WJt(t){const{data:r,error:s}=await Z.storage.from("deal-files").createSignedUrl(t,3600);if(s)throw s;return r.signedUrl}const OTe={text:"Short Text",textarea:"Long Text",dropdown:"Dropdown",toggle:"Yes / No"};function GJt({open:t,onOpenChange:r}){const{data:s,isLoading:n}=LJt(),a=OJt(),o=DJt(),l=RJt(),[i,d]=E.useState(!1),[m,g]=E.useState({question_text:"",field_type:"text",options:[],is_required:!1}),[y,v]=E.useState(""),b=async()=>{if(m.question_text.trim())try{await a.mutateAsync({question_text:m.question_text.trim(),field_type:m.field_type,options:m.field_type==="dropdown"?m.options:[],is_required:m.is_required,sort_order:((s==null?void 0:s.length)||0)+1}),g({question_text:"",field_type:"text",options:[],is_required:!1}),v(""),d(!1),Se.success("Question added")}catch{Se.error("Failed to add question")}},N=async M=>{try{await l.mutateAsync(M),Se.success("Question removed")}catch{Se.error("Failed to remove question")}},j=async(M,I)=>{try{await o.mutateAsync({id:M,is_required:I})}catch{Se.error("Failed to update question")}},S=()=>{y.trim()&&(g(M=>({...M,options:[...M.options,y.trim()]})),v(""))},A=M=>{g(I=>({...I,options:I.options.filter((F,O)=>O!==M)}))};return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"max-w-md max-h-[85vh] flex flex-col",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Custom Intake Questions"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"These questions appear on all your portal onboarding forms."})]}),e.jsx(Eo,{className:"flex-1",children:e.jsxs("div",{className:"space-y-3 pr-2",children:[n&&e.jsx("div",{className:"flex justify-center py-8",children:e.jsx(Hr,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),s==null?void 0:s.map(M=>{var I;return e.jsx("div",{className:"border rounded-lg p-3 space-y-2",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(xp,{className:"h-4 w-4 text-muted-foreground/40 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:M.question_text}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(bt,{variant:"secondary",className:"text-xs",children:OTe[M.field_type]||M.field_type}),M.is_required&&e.jsx(bt,{variant:"outline",className:"text-xs",children:"Required"})]}),M.field_type==="dropdown"&&((I=M.options)==null?void 0:I.length)>0&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Options: ",M.options.join(", ")]})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(xn,{checked:M.is_required,onCheckedChange:F=>j(M.id,F),className:"scale-75"}),e.jsx(Q,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:()=>N(M.id),children:e.jsx(Rs,{className:"h-3.5 w-3.5"})})]})]})},M.id)}),!n&&(s==null?void 0:s.length)===0&&!i&&e.jsxs("div",{className:"text-center py-8 border border-dashed rounded-lg",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"No custom questions yet"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Add questions that clients will answer during onboarding."})]}),i&&e.jsxs("div",{className:"border-2 border-primary/20 rounded-lg p-4 space-y-3 bg-primary/5",children:[e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Question"}),e.jsx(Qe,{value:m.question_text,onChange:M=>g(I=>({...I,question_text:M.target.value})),className:"mt-1",placeholder:"e.g., Do you have a home to sell first?",autoFocus:!0})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Answer Type"}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:Object.entries(OTe).map(([M,I])=>e.jsx("button",{type:"button",onClick:()=>g(F=>({...F,field_type:M,options:[]})),className:`px-3 py-1.5 rounded-full text-xs font-medium border transition-colors ${m.field_type===M?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-input hover:border-primary/50"}`,children:I},M))})]}),m.field_type==="dropdown"&&e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Options"}),e.jsxs("div",{className:"space-y-1.5 mt-1.5",children:[m.options.map((M,I)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex-1 text-sm bg-muted/50 rounded px-2 py-1",children:M}),e.jsx("button",{onClick:()=>A(I),className:"text-muted-foreground hover:text-destructive",children:e.jsx(rn,{className:"h-3.5 w-3.5"})})]},I)),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Qe,{value:y,onChange:M=>v(M.target.value),onKeyDown:M=>M.key==="Enter"&&(M.preventDefault(),S()),placeholder:"Add option...",className:"h-8 text-sm"}),e.jsx(Q,{variant:"outline",size:"sm",onClick:S,disabled:!y.trim(),className:"h-8",children:e.jsx(gs,{className:"h-3 w-3"})})]})]})]}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xn,{checked:m.is_required,onCheckedChange:M=>g(I=>({...I,is_required:M}))}),e.jsx(Ee,{className:"text-xs text-muted-foreground",children:"Required"})]})}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx(Q,{variant:"outline",size:"sm",onClick:()=>d(!1),className:"flex-1",children:"Cancel"}),e.jsxs(Q,{size:"sm",onClick:b,disabled:!m.question_text.trim()||a.isPending,className:"flex-1",children:[a.isPending?e.jsx(Hr,{className:"h-3 w-3 mr-1 animate-spin"}):null,"Add Question"]})]})]})]})}),e.jsxs("div",{className:"flex justify-between pt-4 border-t shrink-0",children:[i?e.jsx("div",{}):e.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>d(!0),children:[e.jsx(gs,{className:"h-4 w-4 mr-1"})," Add Question"]}),e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>r(!1),children:"Done"})]})]})})}function KJt({open:t,onOpenChange:r,portal:s,dealOwnerId:n}){const a=xve(),[o,l]=E.useState(!1),[i,d]=E.useState(s.next_step_text||""),[m,g]=E.useState(s.next_step_video_url||""),[y,v]=E.useState(s.inspection_date||""),[b,N]=E.useState(s.appraisal_date||""),[j,S]=E.useState(s.welcome_message||""),[A,M]=E.useState(s.review_url||""),[I,F]=E.useState(s.show_post_close_tips),[O,B]=E.useState(s.require_onboarding),[$,H]=E.useState(s.allow_spouse),[W,X]=E.useState(s.visibility),[se,ae]=E.useState(s.stage_mapping||[]),{data:le}=Ht({queryKey:["pipeline-stages-for-portal",n],queryFn:async()=>{const{data:xe,error:Te}=await Z.from("deal_pipeline_stages").select("*").eq("owner_user_id",n).order("sort_order",{ascending:!0});if(Te)throw Te;return xe},enabled:t});E.useEffect(()=>{d(s.next_step_text||""),g(s.next_step_video_url||""),v(s.inspection_date||""),N(s.appraisal_date||""),S(s.welcome_message||""),M(s.review_url||""),F(s.show_post_close_tips),B(s.require_onboarding),H(s.allow_spouse),X(s.visibility),ae(s.stage_mapping||[])},[s]);const ne=async()=>{try{await a.mutateAsync({id:s.id,next_step_text:i||null,next_step_video_url:m||null,inspection_date:y||null,appraisal_date:b||null,welcome_message:j||null,review_url:A||null,show_post_close_tips:I,require_onboarding:O,allow_spouse:$,visibility:W,stage_mapping:se.length>0?se:null}),Se.success("Portal settings saved"),r(!1)}catch{Se.error("Failed to save settings")}},fe=()=>{ae([...se,{label:""}])},oe=xe=>{ae(se.filter((Te,be)=>be!==xe))},de=(xe,Te)=>{const be=[...se];be[xe]={...be[xe],label:Te},ae(be)},ue=()=>{const Te=xDe(null).map(be=>({label:be.label,stageId:void 0}));ae(Te)};return e.jsxs(e.Fragment,{children:[e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"max-w-lg max-h-[85vh] flex flex-col",children:[e.jsx(Ur,{children:e.jsx(Br,{children:"Portal Settings"})}),e.jsxs(ci,{defaultValue:"general",className:"flex-1 overflow-hidden flex flex-col",children:[e.jsxs(ri,{className:"grid grid-cols-3 shrink-0",children:[e.jsx(Kr,{value:"general",children:"General"}),e.jsx(Kr,{value:"timeline",children:"Timeline"}),e.jsx(Kr,{value:"content",children:"Content"})]}),e.jsxs(Eo,{className:"flex-1 mt-4",children:[e.jsxs(ms,{value:"general",className:"space-y-4 mt-0 px-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Visibility"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Public portals appear without restrictions"})]}),e.jsx("div",{className:"flex gap-1",children:["private","public"].map(xe=>e.jsx("button",{onClick:()=>X(xe),className:`px-3 py-1.5 rounded-full text-xs font-medium border transition-colors ${W===xe?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-input hover:border-primary/50"}`,children:xe.charAt(0).toUpperCase()+xe.slice(1)},xe))})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Require Onboarding"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Clients must fill out intake form"})]}),e.jsx(xn,{checked:O,onCheckedChange:B})]}),O&&e.jsxs("div",{className:"flex items-center justify-between pl-4 border-l-2 border-primary/20",children:[e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Custom Questions"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Manage intake form questions"})]}),e.jsx(Q,{variant:"outline",size:"sm",onClick:()=>l(!0),className:"text-xs",children:"Manage"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Allow Spouse/Partner"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Show spouse fields on onboarding"})]}),e.jsx(xn,{checked:$,onCheckedChange:H})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Post-Close Celebration"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Show congrats card when deal closes"})]}),e.jsx(xn,{checked:I,onCheckedChange:F})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Inspection Date"}),e.jsx(Qe,{type:"date",value:y,onChange:xe=>v(xe.target.value),className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Appraisal Date"}),e.jsx(Qe,{type:"date",value:b,onChange:xe=>N(xe.target.value),className:"mt-1"})]})]}),e.jsx(ms,{value:"timeline",className:"space-y-4 mt-0 px-1",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Client-Facing Stages"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Customize the client-friendly stage labels shown on the portal timeline"})]}),e.jsx(Q,{variant:"outline",size:"sm",onClick:ue,className:"text-xs",children:"Auto-map"})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground bg-muted/50 rounded-md p-2",children:'💡 These labels are what clients see. Internal pipeline stages (Lead, Consultation, etc.) are automatically translated to friendly names like "Getting Started" and "Planning Your Move."'}),se.length===0&&e.jsxs("div",{className:"border border-dashed rounded-lg p-4 text-center",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"No custom mapping — using default client-friendly journey stages"}),e.jsx(Q,{variant:"outline",size:"sm",onClick:ue,children:"Customize journey labels"})]}),e.jsx("div",{className:"space-y-2 mt-2",children:se.map((xe,Te)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xp,{className:"h-4 w-4 text-muted-foreground/50 flex-shrink-0"}),e.jsx(Qe,{value:xe.label,onChange:be=>de(Te,be.target.value),placeholder:`Stage ${Te+1} label`,className:"flex-1 h-9 text-sm"}),e.jsx(Q,{variant:"ghost",size:"icon",className:"h-9 w-9 text-muted-foreground hover:text-destructive",onClick:()=>oe(Te),children:e.jsx(Rs,{className:"h-3.5 w-3.5"})})]},Te))}),se.length>0&&e.jsxs(Q,{variant:"outline",size:"sm",onClick:fe,className:"mt-2 text-xs w-full",children:[e.jsx(gs,{className:"h-3 w-3 mr-1"})," Add Stage"]})]})}),e.jsxs(ms,{value:"content",className:"space-y-4 mt-0 px-1",children:[e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Welcome Message"}),e.jsx("textarea",{value:j,onChange:xe=>S(xe.target.value),className:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm min-h-[60px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",placeholder:"Welcome! Here's everything you need for your transaction."})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"What's Next"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Tell your client what to expect next"}),e.jsx("textarea",{value:i,onChange:xe=>d(xe.target.value),className:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm min-h-[60px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",placeholder:"We're waiting on the inspection report..."})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Next Step Video (optional)"}),e.jsx(Qe,{value:m,onChange:xe=>g(xe.target.value),className:"mt-1",placeholder:"YouTube or Loom URL"})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Review URL"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Shown after deal closes"}),e.jsx(Qe,{value:A,onChange:xe=>M(xe.target.value),className:"mt-1",placeholder:"https://g.page/r/..."})]})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t shrink-0",children:[e.jsx(Q,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsxs(Q,{onClick:ne,disabled:a.isPending,children:[a.isPending?e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(_p,{className:"h-4 w-4 mr-2"}),"Save Settings"]})]})]})}),e.jsx(GJt,{open:o,onOpenChange:l})]})}function ZJt({open:t,onOpenChange:r,portalId:s}){const[n,a]=E.useState(""),[o,l]=E.useState(""),[i,d]=E.useState(""),[m,g]=E.useState(!1),y=PJt(),v=async()=>{if(n.trim())try{await y.mutateAsync({portal_id:s,title:n.trim(),content:o.trim()||void 0,video_url:i.trim()||void 0,is_stage_change:m}),Se.success("Update posted to portal"),a(""),l(""),d(""),g(!1),r(!1)}catch{Se.error("Failed to post update")}};return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"max-w-md",children:[e.jsx(Ur,{children:e.jsx(Br,{children:"Post Portal Update"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Title *"}),e.jsx(Qe,{value:n,onChange:b=>a(b.target.value),className:"mt-1",placeholder:"Inspection cleared!"})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Message"}),e.jsx("textarea",{value:o,onChange:b=>l(b.target.value),className:"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm min-h-[80px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",placeholder:"Everything looked great during the inspection..."})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Video URL (optional)"}),e.jsxs("div",{className:"relative mt-1",children:[e.jsx(Qe,{value:i,onChange:b=>d(b.target.value),className:"pl-9",placeholder:"YouTube or Loom link"}),e.jsx(ya,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>g(!m),className:`px-3 py-1.5 rounded-full text-xs font-medium border transition-colors ${m?"bg-emerald-500/10 text-emerald-700 border-emerald-200":"bg-background text-muted-foreground border-input"}`,children:"📊 Stage Change"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Mark as a milestone update"})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(Q,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsxs(Q,{onClick:v,disabled:!n.trim()||y.isPending,children:[y.isPending?e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(Mi,{className:"h-4 w-4 mr-2"}),"Post Update"]})]})]})})}function YJt({open:t,onOpenChange:r,portal:s,dealName:n}){const a=xve(),{isGmailConnected:o,gmailEmail:l}=J3(),[i,d]=E.useState(s.client_name||""),[m,g]=E.useState(s.client_email||""),[y,v]=E.useState(!1),[b,N]=E.useState(!1),j=ite(s.slug),S=i.split(" ")[0]||"there",A=`Your Transaction Portal – ${n}`,M=`Hi ${S}, I've set up a dedicated portal where you can track the progress of your transaction in real-time. Here's your link: ${j} You can view your timeline, key dates, documents, and any updates I post along the way. Let me know if you have any questions!`,I=()=>{navigator.clipboard.writeText(j),N(!0),setTimeout(()=>N(!1),2e3),Se.success("Portal link copied!")},F=async()=>{if(!m.trim()){Se.error("Please enter the client email");return}v(!0);try{await a.mutateAsync({id:s.id,client_name:i||null,client_email:m||null,invite_sent_at:new Date().toISOString(),invite_method:"email"});const{error:B}=await Z.functions.invoke("gmail-send",{body:{to:m,subject:A,body:M.replace(/\n/g,"
")}});if(B)throw B;Se.success(`Invite sent to ${m}`),r(!1)}catch(B){Se.error(B.message||"Failed to send invite")}finally{v(!1)}},O=()=>{const B=encodeURIComponent(A),$=encodeURIComponent(M);window.open(`mailto:${m}?subject=${B}&body=${$}`,"_blank"),a.mutateAsync({id:s.id,client_name:i||null,client_email:m||null,invite_sent_at:new Date().toISOString(),invite_method:"email"}).catch(()=>{})};return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"max-w-md",children:[e.jsx(Ur,{children:e.jsx(Br,{children:"Invite Client to Portal"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Client Name"}),e.jsx(Qe,{value:i,onChange:B=>d(B.target.value),className:"mt-1",placeholder:"John Doe"})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Client Email"}),e.jsx(Qe,{type:"email",value:m,onChange:B=>g(B.target.value),className:"mt-1",placeholder:"john@example.com"})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Portal Link"}),e.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 bg-muted/50 rounded-md px-3 py-2",children:e.jsx("p",{className:"text-xs font-mono text-muted-foreground truncate",children:j})}),e.jsx(Q,{variant:"outline",size:"icon",onClick:I,className:"shrink-0",children:b?e.jsx(li,{className:"h-4 w-4 text-emerald-600"}):e.jsx(fo,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"space-y-2 pt-2 border-t",children:[o?e.jsxs(Q,{onClick:F,disabled:y||!m.trim(),className:"w-full",children:[y?e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(mn,{className:"h-4 w-4 mr-2"}),"Send via Gmail (",l,")"]}):e.jsxs(Q,{onClick:O,disabled:!m.trim(),className:"w-full",variant:"outline",children:[e.jsx(En,{className:"h-4 w-4 mr-2"}),"Open in Email App"]}),e.jsxs(Q,{variant:"ghost",onClick:I,className:"w-full text-muted-foreground",children:[e.jsx(fo,{className:"h-4 w-4 mr-2"}),"Just Copy Link"]})]})]})]})})}function XJt({deal:t}){const{isAdmin:r,user:s}=Gr(),{data:n,isLoading:a}=IJt(t.id),o=rHe(),l=xve(),[i,d]=E.useState(!1),[m,g]=E.useState(!1),[y,v]=E.useState(!1),[b,N]=E.useState(!1);if(!r)return e.jsxs("div",{className:"border rounded-lg p-4 opacity-60",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(An,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"font-medium text-sm",children:"Client Portal"}),e.jsx(bt,{variant:"secondary",className:"text-xs",children:"Coming Soon"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Give your clients a premium view of their transaction."})]});if(a)return e.jsx("div",{className:"border rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(An,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"font-medium text-sm",children:"Client Portal"}),e.jsx(Hr,{className:"h-3 w-3 animate-spin ml-auto"})]})});const j=async()=>{var O,B;d(!0);try{await o.mutateAsync({deal_id:t.id,visibility:"private",require_onboarding:!0,client_name:t.contact?`${t.contact.first_name} ${t.contact.last_name}`:void 0,client_email:((O=t.contact)==null?void 0:O.email)||void 0,client_phone:((B=t.contact)==null?void 0:B.phone)||void 0}),Se.success("Client portal enabled!")}catch{Se.error("Failed to create portal")}finally{d(!1)}},S=async O=>{if(n)try{await l.mutateAsync({id:n.id,is_enabled:O}),Se.success(O?"Portal enabled":"Portal disabled")}catch{Se.error("Failed to update portal")}},A=()=>{if(!n)return;const O=ite(n.slug);navigator.clipboard.writeText(O),Se.success("Portal link copied!")},M=()=>{if(!n)return;const O=ite(n.slug);window.open(O,"_blank")};if(!n)return e.jsxs("div",{className:"border rounded-lg p-4 border-dashed",children:[e.jsx("div",{className:"flex items-center justify-between mb-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(An,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"font-medium text-sm",children:"Client Portal"})]})}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Create a beautiful portal so your client can track their deal progress in real-time."}),e.jsxs(Q,{onClick:j,disabled:i,size:"sm",className:"w-full",children:[i?e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(An,{className:"h-4 w-4 mr-2"}),"Enable Client Portal"]})]});const I=ite(n.slug),F=(s==null?void 0:s.id)||"";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"border rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(An,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"font-medium text-sm",children:"Client Portal"}),e.jsx(bt,{variant:"outline",className:n.is_enabled?"text-xs bg-emerald-500/10 text-emerald-600 border-emerald-200":"text-xs bg-muted text-muted-foreground",children:n.is_enabled?"Active":"Disabled"})]}),e.jsx(xn,{checked:n.is_enabled,onCheckedChange:S})]}),e.jsxs("div",{className:"space-y-1.5 mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{children:"Visibility:"}),e.jsx(bt,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:n.visibility==="private"?"Private":"Public"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{children:"Onboarding:"}),e.jsx("span",{className:"text-foreground",children:n.require_onboarding?"Required":"Disabled"})]}),n.client_name&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{children:"Client:"}),e.jsx("span",{className:"text-foreground",children:n.client_name})]})]}),e.jsx("div",{className:"bg-muted/50 rounded-md p-2 mb-3",children:e.jsx("p",{className:"text-xs font-mono text-muted-foreground truncate",children:I})}),e.jsxs("div",{className:"grid grid-cols-3 gap-2 mb-2",children:[e.jsxs(Q,{variant:"outline",size:"sm",onClick:A,className:"text-xs",children:[e.jsx(fo,{className:"h-3 w-3 mr-1"}),"Copy"]}),e.jsxs(Q,{variant:"outline",size:"sm",onClick:M,className:"text-xs",children:[e.jsx(En,{className:"h-3 w-3 mr-1"}),"Preview"]}),e.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>N(!0),className:"text-xs",children:[e.jsx(Mi,{className:"h-3 w-3 mr-1"}),"Invite"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>v(!0),className:"text-xs text-muted-foreground",children:[e.jsx(CA,{className:"h-3 w-3 mr-1"}),"Post Update"]}),e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>g(!0),className:"text-xs text-muted-foreground",children:[e.jsx(vd,{className:"h-3 w-3 mr-1"}),"Settings"]})]})]}),e.jsx(KJt,{open:m,onOpenChange:g,portal:n,dealOwnerId:F}),e.jsx(ZJt,{open:y,onOpenChange:v,portalId:n.id}),e.jsx(YJt,{open:b,onOpenChange:N,portal:n,dealName:t.deal_name})]})}const QJt={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"}},JJt={note:$o,call:wi,email:mn,meeting:Mn,stage_change:En,task_completed:Li,document:Wn,system:Ea};function eer({deal:t,open:r,onOpenChange:s,onEdit:n,onAddToScorecard:a,isWonStage:o}){var Ue,Ye;const{data:l,isLoading:i}=ZQt((t==null?void 0:t.id)||""),{data:d,isLoading:m}=XQt((t==null?void 0:t.id)||""),g=YQt(),y=JQt(),v=QQt(),b=KQt(),{data:N,isLoading:j}=UJt((t==null?void 0:t.id)||""),S=qJt(),A=VJt(),M=HJt(),I=E.useRef(null),[F,O]=E.useState(""),[B,$]=E.useState(""),[H,W]=E.useState(!1),[X,se]=E.useState(!1);if(!t)return null;const ae=QJt[t.deal_type],le=(()=>{var It;if(t.deal_type!=="seller"&&t.deal_type!=="dual")return null;const Ie=((It=t.listing)==null?void 0:It.created_at)||t.listing_date;if(!Ie)return null;const et=t.contract_date?new Date(t.contract_date):new Date;return Dy(et,new Date(Ie))})(),ne=Ie=>Ie?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(Ie):"-",fe=async()=>{if(F.trim())try{await g.mutateAsync({deal_id:t.id,activity_type:"note",title:"Note added",description:F}),O(""),Se.success("Note added")}catch{Se.error("Failed to add note")}},oe=async()=>{if(B.trim())try{await y.mutateAsync({deal_id:t.id,title:B,sort_order:((d==null?void 0:d.length)||0)+1}),$(""),Se.success("Task added")}catch{Se.error("Failed to add task")}},de=async(Ie,et)=>{try{await v.mutateAsync({id:Ie,is_completed:et,deal_id:t.id})}catch{Se.error("Failed to update task")}},ue=async()=>{try{await b.mutateAsync(t.id),Se.success("Deal deleted"),s(!1)}catch{Se.error("Failed to delete deal")}},xe=(d==null?void 0:d.filter(Ie=>Ie.is_completed).length)||0,Te=(d==null?void 0:d.length)||0,be=(N==null?void 0:N.length)||0,we=Ie=>Ie<1024?`${Ie} B`:Ie<1024*1024?`${(Ie/1024).toFixed(1)} KB`:`${(Ie/(1024*1024)).toFixed(1)} MB`,ve=Ie=>Ie?Ie.startsWith("image/")?El:Ie.includes("pdf")?fa:FS:FS,tt=async Ie=>{const et=Ie.target.files;if(!(!et||!t)){se(!0);try{for(const It of Array.from(et)){if(It.size>20*1024*1024){Se.error(`${It.name} exceeds 20MB limit`);continue}await S.mutateAsync({dealId:t.id,file:It})}Se.success("File(s) uploaded")}catch{Se.error("Failed to upload file")}finally{se(!1),I.current&&(I.current.value="")}}},Ae=async(Ie,et)=>{if(t)try{await A.mutateAsync({fileId:Ie,storagePath:et,dealId:t.id}),Se.success("File deleted")}catch{Se.error("Failed to delete file")}},Le=async(Ie,et)=>{try{const It=await WJt(Ie),Pe=document.createElement("a");Pe.href=It,Pe.download=et,Pe.target="_blank",document.body.appendChild(Pe),Pe.click(),document.body.removeChild(Pe)}catch{Se.error("Failed to download file")}};return e.jsxs(e.Fragment,{children:[e.jsx(eae,{open:r,onOpenChange:s,children:e.jsxs(jP,{className:"w-full sm:max-w-xl p-0 flex flex-col",children:[e.jsx(tae,{className:"p-6 pb-4 border-b shrink-0",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(bt,{variant:"outline",className:qt("text-xs",ae.color),children:ae.label}),e.jsxs(bt,{variant:"secondary",className:"text-xs capitalize",children:[t.priority," priority"]})]}),e.jsx(rae,{className:"text-xl",children:t.deal_name})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Q,{variant:"outline",size:"icon",onClick:()=>n(t),children:e.jsx(wc,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"outline",size:"icon",className:"text-destructive hover:bg-destructive/10",onClick:()=>W(!0),children:e.jsx(Rs,{className:"h-4 w-4"})})]})]})}),e.jsx(Eo,{className:"flex-1",children:e.jsxs("div",{className:"p-6 space-y-6",children:[t.contact&&e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[e.jsx(ln,{className:"h-10 w-10",children:e.jsxs(cn,{className:"bg-primary/10 text-primary",children:[(Ue=t.contact.first_name)==null?void 0:Ue[0],(Ye=t.contact.last_name)==null?void 0:Ye[0]]})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("p",{className:"font-medium",children:[t.contact.first_name," ",t.contact.last_name]}),t.contact.email&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t.contact.email})]}),e.jsxs("div",{className:"flex gap-2",children:[t.contact.phone&&e.jsx(Q,{variant:"outline",size:"icon",asChild:!0,children:e.jsx("a",{href:`tel:${t.contact.phone}`,children:e.jsx(wi,{className:"h-4 w-4"})})}),t.contact.email&&e.jsx(Q,{variant:"outline",size:"icon",asChild:!0,children:e.jsx("a",{href:`mailto:${t.contact.email}`,children:e.jsx(mn,{className:"h-4 w-4"})})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[(t.property_address||t.city)&&e.jsxs("div",{className:"col-span-2 flex items-start gap-2 text-sm",children:[e.jsx(Wn,{className:"h-4 w-4 text-muted-foreground mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:t.property_address||"Address TBD"}),e.jsx("p",{className:"text-muted-foreground",children:[t.city,t.state,t.zip_code].filter(Boolean).join(", ")})]})]}),e.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Expected Price"}),e.jsx("p",{className:"text-lg font-bold",children:ne(t.expected_price)})]}),e.jsxs("div",{className:"bg-emerald-500/10 rounded-lg p-3",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Expected GCI"}),e.jsx("p",{className:"text-lg font-bold text-emerald-600",children:ne(t.expected_commission)})]}),o&&!t.scorecard_transaction_id&&a&&e.jsxs(Q,{onClick:()=>a(t),className:"w-full bg-green-600 hover:bg-green-700",children:[e.jsx(ho,{className:"h-4 w-4 mr-2"}),"Add to Scorecard"]}),t.scorecard_transaction_id&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground bg-muted/50 rounded-lg p-3",children:[e.jsx(Li,{className:"h-4 w-4 text-green-600"}),e.jsx("span",{children:"Synced to Scorecard"})]}),le!==null&&e.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 col-span-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Days on Market"}),e.jsxs("p",{className:qt("text-lg font-bold",le>90?"text-red-600":le>60?"text-amber-600":"text-foreground"),children:[le," ",t.contract_date?"(final)":"days"]})]}),t.target_close_date&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Mn,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("span",{children:["Close: ",Xr(new Date(t.target_close_date),"MMM d, yyyy")]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(yd,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("span",{children:[t.probability,"% probability"]})]})]}),t.notes&&e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"font-medium mb-1",children:"Notes"}),e.jsx("p",{className:"text-muted-foreground",children:t.notes})]}),e.jsx(XJt,{deal:t}),e.jsxs(ci,{defaultValue:"tasks",className:"w-full",children:[e.jsxs(ri,{className:"w-full grid grid-cols-3",children:[e.jsxs(Kr,{value:"tasks",className:"gap-1",children:[e.jsx(Li,{className:"h-4 w-4"}),"Tasks ",Te>0&&`(${xe}/${Te})`]}),e.jsxs(Kr,{value:"files",className:"gap-1",children:[e.jsx(Gj,{className:"h-4 w-4"}),"Files ",be>0&&`(${be})`]}),e.jsxs(Kr,{value:"activity",className:"gap-1",children:[e.jsx(Ea,{className:"h-4 w-4"}),"Activity"]})]}),e.jsxs(ms,{value:"tasks",className:"mt-4 space-y-3",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Qe,{placeholder:"Add a new task...",value:B,onChange:Ie=>$(Ie.target.value),onKeyDown:Ie=>Ie.key==="Enter"&&oe()}),e.jsx(Q,{onClick:oe,disabled:!B.trim(),children:e.jsx(gs,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-2",children:[d==null?void 0:d.map(Ie=>e.jsxs("div",{className:qt("flex items-center gap-3 p-3 rounded-lg border transition-colors",Ie.is_completed?"bg-muted/50 border-border":"bg-background"),children:[e.jsx(Yo,{checked:Ie.is_completed,onCheckedChange:et=>de(Ie.id,!!et)}),e.jsx("span",{className:qt("flex-1 text-sm",Ie.is_completed&&"line-through text-muted-foreground"),children:Ie.title}),Ie.due_date&&e.jsx("span",{className:"text-xs text-muted-foreground",children:Xr(new Date(Ie.due_date),"MMM d")})]},Ie.id)),(d==null?void 0:d.length)===0&&e.jsx("p",{className:"text-center text-muted-foreground text-sm py-4",children:"No tasks yet. Add one above!"})]})]}),e.jsxs(ms,{value:"files",className:"mt-4 space-y-3",children:[e.jsx("input",{type:"file",ref:I,className:"hidden",multiple:!0,onChange:tt,accept:".pdf,.doc,.docx,.xls,.xlsx,.jpg,.jpeg,.png,.webp,.gif,.txt,.csv"}),e.jsxs(Q,{variant:"outline",className:"w-full border-dashed",onClick:()=>{var Ie;return(Ie=I.current)==null?void 0:Ie.click()},disabled:X,children:[X?e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(to,{className:"h-4 w-4 mr-2"}),X?"Uploading...":"Upload Files"]}),e.jsxs("div",{className:"space-y-2",children:[N==null?void 0:N.map(Ie=>{const et=ve(Ie.file_type);return e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg border bg-background",children:[e.jsx("div",{className:"w-8 h-8 rounded bg-muted flex items-center justify-center shrink-0",children:e.jsx(et,{className:"h-4 w-4 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:Ie.file_name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[we(Ie.file_size)," · ",Xr(new Date(Ie.created_at),"MMM d, yyyy")]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(L3,{children:e.jsxs(Uf,{children:[e.jsx(qf,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"icon",className:`h-8 w-8 ${Ie.visible_on_portal?"text-primary":"text-muted-foreground/40"}`,onClick:()=>M.mutate({fileId:Ie.id,visible:!Ie.visible_on_portal,dealId:t.id}),children:e.jsx(Gi,{className:"h-4 w-4"})})}),e.jsx(wp,{side:"top",children:Ie.visible_on_portal?"Visible on client portal":"Hidden from client portal"})]})}),e.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>Le(Ie.storage_path,Ie.file_name),children:e.jsx(Oi,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>Ae(Ie.id,Ie.storage_path),children:e.jsx(rn,{className:"h-4 w-4"})})]})]},Ie.id)}),(N==null?void 0:N.length)===0&&e.jsx("p",{className:"text-center text-muted-foreground text-sm py-4",children:"No files yet. Upload contracts, disclosures, or other documents."})]})]}),e.jsxs(ms,{value:"activity",className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ks,{placeholder:"Add a note...",value:F,onChange:Ie=>O(Ie.target.value),rows:2}),e.jsxs(Q,{onClick:fe,disabled:!F.trim(),size:"sm",className:"w-full",children:[e.jsx(Mi,{className:"h-4 w-4 mr-2"}),"Add Note"]})]}),e.jsxs("div",{className:"space-y-3",children:[l==null?void 0:l.map(Ie=>{const et=JJt[Ie.activity_type]||Ea;return e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-muted flex items-center justify-center shrink-0",children:e.jsx(et,{className:"h-4 w-4 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:Ie.title}),Ie.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:Ie.description}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:Su(new Date(Ie.created_at),{addSuffix:!0})})]})]},Ie.id)}),(l==null?void 0:l.length)===0&&e.jsx("p",{className:"text-center text-muted-foreground text-sm py-4",children:"No activity yet"})]})]})]})]})})]})}),e.jsx(Xc,{open:H,onOpenChange:W,children:e.jsxs(Tc,{children:[e.jsxs(Ac,{children:[e.jsx(Ic,{children:"Delete Deal?"}),e.jsxs(Pc,{children:['This will permanently delete "',t.deal_name,'" and all associated data. This action cannot be undone.']})]}),e.jsxs(Ec,{children:[e.jsx(Lc,{children:"Cancel"}),e.jsx(dc,{onClick:ue,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function ter({open:t,onOpenChange:r,deal:s,onComplete:n}){const a=yae(),o=ZVe(),{data:l}=xae(),{data:i}=Qf(),[d,m]=E.useState({property_address:"",city:"",state:"",zip:"",transaction_type:"buyer",close_date:Xr(new Date,"yyyy-MM-dd"),sale_price:0,commission_amount:0,lead_source_id:"",client_type_id:"",notes:""});E.useEffect(()=>{if(s&&t){const v=s.deal_type==="seller"?"seller":"buyer",b=s.expected_price||0,N=s.commission_percentage||3,j=s.expected_commission||b*N/100;m({property_address:s.property_address||s.deal_name||"",city:s.city||"",state:s.state||"",zip:s.zip_code||"",transaction_type:v,close_date:s.actual_close_date||s.target_close_date||Xr(new Date,"yyyy-MM-dd"),sale_price:b,commission_amount:j,lead_source_id:"",client_type_id:"",notes:s.notes||""})}},[s,t]);const g=async v=>{if(v.preventDefault(),!!s)try{const b=await a.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||null,lead_source_id:d.lead_source_id||null,client_type_id:d.client_type_id||null,contact_id:s.contact_id||null,notes:d.notes||null,is_win:!0});await o.mutateAsync({id:s.id,scorecard_transaction_id:b.id,actual_close_date:d.close_date}),Se.success("Deal added to Scorecard! 🎉"),r(!1),n==null||n()}catch(b){console.error("Error syncing to scorecard:",b),Se.error("Failed to add to scorecard")}},y=v=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(v);return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{className:"sm:max-w-[550px] max-h-[90vh] overflow-y-auto",children:[e.jsxs(Ur,{className:"space-y-3",children:[e.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:e.jsx(ho,{className:"h-6 w-6 text-green-600 dark:text-green-400"})}),e.jsx(Br,{className:"text-center text-xl",children:"Congratulations on Closing! 🎉"}),e.jsx(Gs,{className:"text-center",children:"Review and confirm the details before adding this deal to your Scorecard."})]}),e.jsxs("form",{onSubmit:g,className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ee,{htmlFor:"property_address",className:"flex items-center gap-2",children:[e.jsx(Wn,{className:"h-4 w-4 text-muted-foreground"}),"Property Address *"]}),e.jsx(Qe,{id:"property_address",value:d.property_address,onChange:v=>m(b=>({...b,property_address:v.target.value})),placeholder:"123 Main St",required:!0})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"city",children:"City"}),e.jsx(Qe,{id:"city",value:d.city,onChange:v=>m(b=>({...b,city:v.target.value})),placeholder:"City"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"state",children:"State"}),e.jsx(Qe,{id:"state",value:d.state,onChange:v=>m(b=>({...b,state:v.target.value})),placeholder:"TX",maxLength:2})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"zip",children:"Zip"}),e.jsx(Qe,{id:"zip",value:d.zip,onChange:v=>m(b=>({...b,zip:v.target.value})),placeholder:"75001"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Transaction Type *"}),e.jsxs(ds,{value:d.transaction_type,onValueChange:v=>m(b=>({...b,transaction_type:v})),children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"buyer",children:"Buyer"}),e.jsx(Ut,{value:"seller",children:"Seller"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ee,{htmlFor:"close_date",className:"flex items-center gap-2",children:[e.jsx(Mn,{className:"h-4 w-4 text-muted-foreground"}),"Close Date *"]}),e.jsx(Qe,{id:"close_date",type:"date",value:d.close_date,onChange:v=>m(b=>({...b,close_date:v.target.value})),required:!0})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ee,{htmlFor:"sale_price",className:"flex items-center gap-2",children:[e.jsx(yd,{className:"h-4 w-4 text-muted-foreground"}),"Sale Price *"]}),e.jsx(Qe,{id:"sale_price",type:"number",value:d.sale_price||"",onChange:v=>m(b=>({...b,sale_price:Number(v.target.value)})),placeholder:"450000",required:!0,min:0}),d.sale_price>0&&e.jsx("p",{className:"text-xs text-muted-foreground",children:y(d.sale_price)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(Ee,{htmlFor:"commission_amount",className:"flex items-center gap-2",children:[e.jsx(KS,{className:"h-4 w-4 text-muted-foreground"}),"GCI (Commission)"]}),e.jsx(Qe,{id:"commission_amount",type:"number",value:d.commission_amount||"",onChange:v=>m(b=>({...b,commission_amount:Number(v.target.value)})),placeholder:"13500",min:0}),d.commission_amount>0&&e.jsx("p",{className:"text-xs text-muted-foreground",children:y(d.commission_amount)})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Lead Source"}),e.jsxs(ds,{value:d.lead_source_id,onValueChange:v=>m(b=>({...b,lead_source_id:v})),children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Select source"})}),e.jsx(cs,{children:l==null?void 0:l.map(v=>e.jsx(Ut,{value:v.id,children:v.name},v.id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Client Type"}),e.jsxs(ds,{value:d.client_type_id,onValueChange:v=>m(b=>({...b,client_type_id:v})),children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Select type"})}),e.jsx(cs,{children:i==null?void 0:i.map(v=>e.jsx(Ut,{value:v.id,children:v.name},v.id))})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"notes",children:"Notes"}),e.jsx(Ks,{id:"notes",value:d.notes,onChange:v=>m(b=>({...b,notes:v.target.value})),placeholder:"Any additional notes about this transaction...",rows:2})]}),e.jsxs(Dn,{className:"gap-2 sm:gap-0 pt-4",children:[e.jsx(Q,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Skip for now"}),e.jsx(Q,{type:"submit",disabled:a.isPending||o.isPending,className:"bg-green-600 hover:bg-green-700",children:a.isPending?"Adding...":e.jsxs(e.Fragment,{children:["Add to Scorecard",e.jsx(Hi,{className:"ml-2 h-4 w-4"})]})})]})]})]})})}const rer={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"}},DTe={urgent:0,high:1,medium:2,low:3};function ser({deals:t,stages:r,onDealClick:s,onStageChange:n}){const[a,o]=E.useState("target_close_date"),[l,i]=E.useState("asc"),d=b=>{a===b?i(N=>N==="asc"?"desc":"asc"):(o(b),i("asc"))},m=E.useMemo(()=>[...t].sort((b,N)=>{var S,A;let j=0;switch(a){case"deal_name":j=b.deal_name.localeCompare(N.deal_name);break;case"stage":{const M=((S=r.find(F=>F.id===b.stage_id))==null?void 0:S.sort_order)||0,I=((A=r.find(F=>F.id===N.stage_id))==null?void 0:A.sort_order)||0;j=M-I;break}case"expected_price":j=(b.expected_price||0)-(N.expected_price||0);break;case"expected_commission":j=(b.expected_commission||0)-(N.expected_commission||0);break;case"target_close_date":{const M=b.target_close_date?new Date(b.target_close_date).getTime():1/0,I=N.target_close_date?new Date(N.target_close_date).getTime():1/0;j=M-I;break}case"priority":j=DTe[b.priority]-DTe[N.priority];break}return l==="asc"?j:-j}),[t,r,a,l]),g=b=>b?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(b):"—",y=b=>b?r.find(N=>N.id===b):null,v=({field:b,children:N})=>e.jsxs(Q,{variant:"ghost",size:"sm",className:"h-8 -ml-3 font-medium",onClick:()=>d(b),children:[N,a===b?l==="asc"?e.jsx(fp,{className:"ml-2 h-4 w-4"}):e.jsx(my,{className:"ml-2 h-4 w-4"}):e.jsx(Of,{className:"ml-2 h-4 w-4 opacity-50"})]});return t.length===0?e.jsx("div",{className:"text-center py-16",children:e.jsx("p",{className:"text-muted-foreground",children:"No deals to display"})}):e.jsx("div",{className:"border rounded-lg overflow-hidden",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{className:"bg-muted/50",children:[e.jsx(Ct,{className:"w-[250px]",children:e.jsx(v,{field:"deal_name",children:"Deal Name"})}),e.jsx(Ct,{className:"w-[150px]",children:e.jsx(v,{field:"stage",children:"Stage"})}),e.jsx(Ct,{className:"w-[100px]",children:"Type"}),e.jsx(Ct,{className:"w-[120px]",children:e.jsx(v,{field:"expected_price",children:"Price"})}),e.jsx(Ct,{className:"w-[120px]",children:e.jsx(v,{field:"expected_commission",children:"GCI"})}),e.jsx(Ct,{className:"w-[130px]",children:e.jsx(v,{field:"target_close_date",children:"Close Date"})}),e.jsx(Ct,{className:"w-[100px]",children:e.jsx(v,{field:"priority",children:"Priority"})})]})}),e.jsx(zn,{children:m.map(b=>{y(b.stage_id);const N=rer[b.deal_type],j=b.target_close_date?Dy(new Date(b.target_close_date),new Date):null,S=j!==null&&j<0,A=j!==null&&j<=7&&j>=0;return e.jsxs(Nr,{className:qt("cursor-pointer hover:bg-muted/50 transition-colors",S&&"bg-red-50/50"),onClick:()=>s(b),children:[e.jsx(dt,{className:"font-medium",children:e.jsxs("div",{children:[e.jsx("p",{className:"truncate max-w-[230px]",children:b.deal_name}),b.contact&&e.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[b.contact.first_name," ",b.contact.last_name]})]})}),e.jsx(dt,{onClick:M=>M.stopPropagation(),children:e.jsx(eHe,{stages:r,currentStageId:b.stage_id||"",onStageSelect:(M,I)=>n(b.id,M,I)})}),e.jsx(dt,{children:e.jsx(bt,{variant:"outline",className:qt("text-xs",N.color),children:N.label})}),e.jsx(dt,{children:e.jsx("span",{className:"font-medium",children:g(b.expected_price)})}),e.jsx(dt,{children:e.jsx("span",{className:"text-emerald-600",children:g(b.expected_commission)})}),e.jsx(dt,{children:b.target_close_date?e.jsxs("div",{className:qt("flex items-center gap-1 text-sm",S&&"text-red-600",A&&!S&&"text-amber-600"),children:[S&&e.jsx(_l,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:Xr(new Date(b.target_close_date),"MMM d, yyyy")})]}):e.jsx("span",{className:"text-muted-foreground",children:"—"})}),e.jsx(dt,{children:e.jsx(bt,{variant:"outline",className:qt("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)})})]})})}class ner extends E.Component{constructor(r){super(r),this.state={hasError:!1,error:null}}static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,s){console.error("DealPipeline error:",r,s)}render(){return this.state.hasError?e.jsx(Fr,{children:e.jsxs("div",{className:"flex flex-col items-center justify-center h-[60vh] gap-4 text-center px-4",children:[e.jsx("div",{className:"w-16 h-16 bg-destructive/10 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-2xl",children:"⚠️"})}),e.jsx("h2",{className:"text-xl font-semibold",children:"Something went wrong"}),e.jsx("p",{className:"text-muted-foreground max-w-md",children:"There was an error in the deal pipeline. Click below to try again."}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{onClick:()=>this.setState({hasError:!1,error:null}),className:"px-4 py-2 bg-primary text-primary-foreground rounded-md text-sm font-medium hover:bg-primary/90",children:"Try Again"}),e.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 border border-border rounded-md text-sm font-medium hover:bg-muted",children:"Refresh Page"})]})]})}):this.props.children}}function aer(){var ct;const t=e5(),{data:r,isLoading:s}=gve(),{data:n,isLoading:a,refetch:o}=GVe(),{data:l,isLoading:i}=eJt(),d=WVe(),m=GQt(),[g,y]=E.useState("board"),[v,b]=E.useState(!1),[N,j]=E.useState(!1),[S,A]=E.useState(null),[M,I]=E.useState(null),[F,O]=E.useState(null),[B,$]=E.useState(null),[H,W]=E.useState(!1),[X,se]=E.useState(null),[ae,le]=E.useState(""),[ne,fe]=E.useState("all"),[oe,de]=E.useState(!1),[ue,xe]=E.useState(!1),[Te,be]=E.useState(new Set),{data:we}=Lv(),{isTeamLeader:ve,teamMembers:tt}=SJt(),Ae=E.useMemo(()=>Array.from(Te),[Te]),{data:Le}=CJt(Ae),Ue=E.useMemo(()=>{const Mt=new Map;return tt.forEach(Ot=>Mt.set(Ot.id,{name:Ot.name,avatar_url:Ot.avatar_url,color:Ot.color})),Mt},[tt]),Ye=E.useCallback(Mt=>Mt.owner_user_id&&Ue.get(Mt.owner_user_id)||null,[Ue]),Ie=E.useCallback(Mt=>{be(Ot=>{const rr=new Set(Ot);return rr.has(Mt)?rr.delete(Mt):rr.add(Mt),rr})},[]);E.useEffect(()=>{!s&&r&&r.length===0&&d.mutate()},[s,r]);const[et,It]=Bc(),Pe=E.useRef(!1);E.useEffect(()=>{const Mt=et.get("deal");if(Mt&&n&&n.length>0&&!Pe.current){const Ot=n.find(rr=>rr.id===Mt);Ot&&(Pe.current=!0,A(Ot),j(!0),et.delete("deal"),It(et,{replace:!0}))}},[n,et]);const at=E.useMemo(()=>{if(!Le||!r)return[];const Mt=new Map(r.map(Ot=>[Ot.name,Ot.id]));return Le.map(Ot=>{const rr=Ot._stage_name&&Mt.get(Ot._stage_name)||null;return{...Ot,stage_id:rr||Ot.stage_id}})},[Le,r]),ce=E.useMemo(()=>[...n||[],...at],[n,at]),$e=ce.filter(Mt=>{var cr,Mr,As,At,Rt,Cr;const Ot=ae.toLowerCase(),rr=!Ot||Mt.deal_name.toLowerCase().includes(Ot)||((Mr=(cr=Mt.contact)==null?void 0:cr.first_name)==null?void 0:Mr.toLowerCase().includes(Ot))||((At=(As=Mt.contact)==null?void 0:As.last_name)==null?void 0:At.toLowerCase().includes(Ot))||((Rt=Mt.property_address)==null?void 0:Rt.toLowerCase().includes(Ot))||((Cr=Mt.city)==null?void 0:Cr.toLowerCase().includes(Ot)),Ir=ne==="all"||Mt.deal_type===ne;return rr&&Ir}),Ge=E.useMemo(()=>{if(!r)return l||null;const Mt=new Set(r.filter(cr=>cr.is_won_stage).map(cr=>cr.id)),Ot=new Set(r.filter(cr=>cr.is_lost_stage).map(cr=>cr.id)),rr=ce.filter(cr=>!Mt.has(cr.stage_id)&&!Ot.has(cr.stage_id)),Ir=ce.filter(cr=>Mt.has(cr.stage_id));return{totalDeals:ce.length,activeDeals:rr.length,wonDeals:Ir.length,pipelineValue:rr.reduce((cr,Mr)=>cr+(Mr.expected_price||0),0),expectedCommission:rr.reduce((cr,Mr)=>cr+(Mr.expected_commission||0),0),wonValue:Ir.reduce((cr,Mr)=>cr+(Mr.expected_price||0),0)}},[ce,r,l]),rt=Mt=>{A(Mt),j(!0)},je=Mt=>{I(Mt||null),A(null),b(!0)},it=Mt=>{A(Mt),j(!1),b(!0)},Me=(Mt,Ot)=>{O(Mt)},Je=(Mt,Ot)=>{Mt.preventDefault(),Mt.dataTransfer.dropEffect="move",$(Ot)},Xe=async(Mt,Ot)=>{if(Mt.preventDefault(),$(null),!F)return;const rr=n==null?void 0:n.find(cr=>cr.id===F),Ir=r==null?void 0:r.find(cr=>cr.id===Ot);if(!rr||!Ir||rr.stage_id===Ot){O(null);return}try{if(await m.mutateAsync({dealId:F,stageId:Ot,stageName:Ir.name}),Se.success(`Moved to ${Ir.name}`),Ir.is_won_stage&&!rr.scorecard_transaction_id){const cr={...rr,stage_id:Ot};se(cr),W(!0)}}catch{Se.error("Failed to move deal")}O(null)},Ve=E.useCallback(async(Mt,Ot,rr)=>{const Ir=n==null?void 0:n.find(Mr=>Mr.id===Mt),cr=r==null?void 0:r.find(Mr=>Mr.id===Ot);if(!(!Ir||!cr||Ir.stage_id===Ot))try{if(await m.mutateAsync({dealId:Mt,stageId:Ot,stageName:rr}),Se.success(`Moved to ${rr}`),cr.is_won_stage&&!Ir.scorecard_transaction_id){const Mr={...Ir,stage_id:Ot};se(Mr),W(!0)}}catch{Se.error("Failed to move deal")}},[n,r,m]),ot=Mt=>$e.filter(Ot=>Ot.stage_id===Mt),mt=s||a,ft=t?"list":g;return e.jsxs(Fr,{children:[e.jsxs("div",{className:"flex flex-col h-[calc(100vh-4rem)]",children:[e.jsxs("div",{className:"shrink-0 p-4 md:p-6 pb-0 space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Deal Pipeline"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Track and manage your active deals"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q,{variant:"outline",size:"icon",onClick:()=>o(),className:"shrink-0",children:e.jsx(Ko,{className:"h-4 w-4"})}),!t&&e.jsx(L3,{children:e.jsxs("div",{className:"flex bg-muted rounded-lg p-1 gap-0.5",children:[e.jsxs(Uf,{children:[e.jsx(qf,{asChild:!0,children:e.jsxs(Q,{variant:g==="board"?"secondary":"ghost",size:"sm",onClick:()=>y("board"),className:"px-3 gap-1.5",children:[e.jsx(yp,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline text-xs",children:"Board"})]})}),e.jsx(wp,{children:"Kanban board view"})]}),e.jsxs(Uf,{children:[e.jsx(qf,{asChild:!0,children:e.jsxs(Q,{variant:g==="list"?"secondary":"ghost",size:"sm",onClick:()=>y("list"),className:"px-3 gap-1.5",children:[e.jsx(vp,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline text-xs",children:"List"})]})}),e.jsx(wp,{children:"Grouped list view"})]}),e.jsxs(Uf,{children:[e.jsx(qf,{asChild:!0,children:e.jsxs(Q,{variant:g==="table"?"secondary":"ghost",size:"sm",onClick:()=>y("table"),className:"px-3 gap-1.5",children:[e.jsx(YS,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline text-xs",children:"Table"})]})}),e.jsx(wp,{children:"Sortable table view"})]})]})}),we&&!ve&&e.jsxs(Q,{variant:"outline",onClick:()=>de(!0),children:[e.jsx(ws,{className:"h-4 w-4 mr-2"}),"Team"]}),e.jsxs(Q,{onClick:()=>je(),children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Deal"]})]})]}),e.jsx(EJt,{stats:Ge,isLoading:i}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search deals, contacts, addresses...",value:ae,onChange:Mt=>le(Mt.target.value),className:"pl-9 pr-8"}),ae&&e.jsx("button",{onClick:()=>le(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:e.jsx(rn,{className:"h-4 w-4"})})]}),e.jsxs(ds,{value:ne,onValueChange:fe,children:[e.jsx(ls,{className:"w-[140px]",children:e.jsx(us,{placeholder:"All Types"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Types"}),e.jsx(Ut,{value:"buyer",children:"Buyer"}),e.jsx(Ut,{value:"seller",children:"Seller"}),e.jsx(Ut,{value:"dual",children:"Dual"}),e.jsx(Ut,{value:"referral",children:"Referral"}),e.jsx(Ut,{value:"lease",children:"Lease"})]})]}),(ae||ne!=="all")&&e.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[$e.length," of ",(n==null?void 0:n.length)||0," deals"]})]})]}),e.jsxs("div",{className:"flex-1 min-h-0 flex",children:[ve&&!t&&tt.length>0&&e.jsx(NJt,{members:tt,enabledMembers:Te,onToggleMember:Ie,isOpen:ue,onToggleOpen:()=>xe(Mt=>!Mt)}),e.jsx("div",{className:"flex-1 min-w-0 min-h-0 p-4 md:p-6 pt-4",children:mt?e.jsx("div",{className:"flex gap-4 h-full",children:[1,2,3,4].map(Mt=>e.jsx("div",{className:"min-w-[280px] max-w-[320px] flex-shrink-0",children:e.jsx(fr,{className:"h-full rounded-xl"})},Mt))}):ft==="board"?e.jsxs(Eo,{className:"h-full -mx-4 md:-mx-6 px-4 md:px-6",children:[e.jsx("div",{className:"flex gap-4 h-full pb-4",children:r==null?void 0:r.map(Mt=>e.jsx(AJt,{stage:Mt,deals:ot(Mt.id),onDealClick:rt,onAddDeal:je,onDragStart:Me,onDragOver:Je,onDrop:Xe,isDragOver:B===Mt.id,isWonStage:Mt.is_won_stage,getOwnerInfo:Ye},Mt.id))}),e.jsx(Nye,{orientation:"horizontal"})]}):ft==="table"?e.jsx(Eo,{className:"h-full",children:e.jsx(ser,{deals:$e,stages:r||[],onDealClick:rt,onStageChange:Ve})}):e.jsx(Eo,{className:"h-full",children:e.jsxs("div",{className:"space-y-6",children:[r==null?void 0:r.map(Mt=>{const Ot=ot(Mt.id);return Ot.length===0?null:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Mt.color}}),e.jsx("h3",{className:"font-semibold",children:Mt.name}),e.jsxs("span",{className:"text-muted-foreground text-sm",children:["(",Ot.length,")"]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:Ot.map(rr=>e.jsx(tHe,{deal:rr,onClick:()=>rt(rr),stages:r,onStageChange:Ve,showStagePicker:!0,isWonStage:Mt.is_won_stage,ownerInfo:Ye(rr)},rr.id))})]},Mt.id)}),(n==null?void 0:n.length)===0&&e.jsxs("div",{className:"text-center py-16",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-muted rounded-full flex items-center justify-center",children:e.jsx(yp,{className:"h-8 w-8 text-muted-foreground"})}),e.jsx("h3",{className:"font-semibold text-lg mb-2",children:"No deals yet"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Start tracking your opportunities by adding your first deal"}),e.jsxs(Q,{onClick:()=>je(),children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Your First Deal"]})]}),((n==null?void 0:n.length)||0)>0&&$e.length===0&&e.jsxs("div",{className:"text-center py-16",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-muted rounded-full flex items-center justify-center",children:e.jsx(Qn,{className:"h-8 w-8 text-muted-foreground"})}),e.jsx("h3",{className:"font-semibold text-lg mb-2",children:"No matching deals"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Try adjusting your search or filters"}),e.jsx(Q,{variant:"outline",onClick:()=>{le(""),fe("all")},children:"Clear Filters"})]})]})})})]})]}),e.jsx($Jt,{open:v,onOpenChange:b,deal:S,defaultStageId:M}),e.jsx(eer,{deal:S,open:N,onOpenChange:j,onEdit:it,isWonStage:S?(ct=r==null?void 0:r.find(Mt=>Mt.id===S.stage_id))==null?void 0:ct.is_won_stage:!1,onAddToScorecard:Mt=>{se(Mt),W(!0),j(!1)}}),e.jsx(ter,{open:H,onOpenChange:W,deal:X,onComplete:()=>{o(),se(null)}}),e.jsx(kJt,{open:oe,onOpenChange:de})]})}function ier(){return e.jsx(ner,{children:e.jsx(aer,{})})}const ige=[{value:"video_intro",label:"Video Intro",icon:ya,description:"Add an intro video"},{value:"testimonials",label:"Testimonials",icon:MA,description:"Client testimonials carousel"},{value:"specialties",label:"Specialties",icon:Xg,description:"Tags for your specialties"},{value:"custom_links",label:"Custom Links",icon:jm,description:"Custom CTA buttons"},{value:"social_media",label:"Social Media",icon:Oc,description:"Links to your social profiles"}],oer=["First-Time Buyers","Luxury Homes","Investment Properties","Relocation","New Construction","Condos & Townhomes","Waterfront","Commercial","Land & Lots","Senior Living","Military/VA","Short Sales & Foreclosures"],ler={video_intro:{video_url:""},testimonials:{testimonials:[{name:"",quote:"",role:""}]},specialties:{tags:[]},custom_links:{links:[{label:"",url:""}]},social_media:{platforms:[]}};function sHe({cardId:t}){const{data:r,isLoading:s}=udt(t),n=hdt(),a=mdt(),o=pdt(),[l,i]=E.useState(!1),[d,m]=E.useState(""),[g,y]=E.useState(null);if(s)return e.jsxs("div",{className:"space-y-3",children:[e.jsx(fr,{className:"h-16 w-full"}),e.jsx(fr,{className:"h-16 w-full"})]});const v=()=>{d&&n.mutate({card_id:t,block_type:d,sort_order:(r==null?void 0:r.length)||0,config:ler[d]||{}},{onSuccess:()=>{i(!1),m("")}})},b=M=>{a.mutate({id:M.id,is_visible:!M.is_visible})},N=(M,I)=>{if(!r)return;const F=r.findIndex($=>$.id===M.id),O=I==="up"?F-1:F+1;if(O<0||O>=r.length)return;const B=r[O];a.mutate({id:M.id,sort_order:B.sort_order}),a.mutate({id:B.id,sort_order:M.sort_order})},j=M=>{confirm("Remove this block from this card?")&&o.mutate(M.id)},S=(M,I)=>{a.mutate({id:M.id,config:I},{onSuccess:()=>y(null)})},A=M=>ige.find(I=>I.value===M);return e.jsxs("div",{className:"space-y-3",children:[!r||r.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted-foreground mb-4 text-sm",children:"No blocks yet. Add a block to customize this card."}),e.jsxs(Q,{size:"sm",onClick:()=>i(!0),children:[e.jsx(gs,{className:"h-4 w-4 mr-1"})," Add Block"]})]}):e.jsxs(e.Fragment,{children:[r.map((M,I)=>{const F=A(M.block_type),O=(F==null?void 0:F.icon)||Xg;return e.jsx(ze,{className:M.is_visible?"":"opacity-50",children:e.jsx(qe,{className:"p-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xp,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx(O,{className:"h-4 w-4 text-primary flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-xs",children:(F==null?void 0:F.label)||M.block_type}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:cer(M)})]}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(Q,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>N(M,"up"),disabled:I===0,children:e.jsx(fp,{className:"h-3 w-3"})}),e.jsx(Q,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>N(M,"down"),disabled:I===r.length-1,children:e.jsx(my,{className:"h-3 w-3"})}),e.jsx(Q,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>b(M),children:M.is_visible?e.jsx(Gi,{className:"h-3 w-3"}):e.jsx(zf,{className:"h-3 w-3"})}),e.jsx(Q,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>y(M),children:"Edit"}),e.jsx(Q,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive",onClick:()=>j(M),children:e.jsx(Rs,{className:"h-3 w-3"})})]})]})})},M.id)}),e.jsxs(Q,{variant:"outline",size:"sm",className:"w-full",onClick:()=>i(!0),children:[e.jsx(gs,{className:"h-4 w-4 mr-1"})," Add Block"]})]}),e.jsx(Dr,{open:l,onOpenChange:i,children:e.jsxs(Lr,{children:[e.jsx(Ur,{children:e.jsx(Br,{children:"Add Block"})}),e.jsx("div",{className:"grid gap-3",children:ige.map(M=>{const I=M.icon;return e.jsxs("button",{onClick:()=>m(M.value),className:`flex items-center gap-3 p-3 rounded-lg border text-left transition-colors ${d===M.value?"border-primary bg-primary/5":"border-border hover:bg-muted"}`,children:[e.jsx(I,{className:"h-5 w-5 text-primary flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:M.label}),e.jsx("p",{className:"text-xs text-muted-foreground",children:M.description})]})]},M.value)})}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(Q,{onClick:v,disabled:!d||n.isPending,children:"Add Block"})]})]})}),g&&e.jsx(der,{block:g,onSave:M=>S(g,M),onClose:()=>y(null)})]})}function cer(t){var s;const r=t.config;switch(t.block_type){case"video_intro":return r.video_url?"Video configured":"No video set";case"testimonials":{const n=((s=r.testimonials)==null?void 0:s.length)||0;return`${n} testimonial${n!==1?"s":""}`}case"specialties":{const n=r.tags||[];return n.length?n.slice(0,3).join(", ")+(n.length>3?"...":""):"No tags"}case"custom_links":{const n=r.links||[];return`${n.length} link${n.length!==1?"s":""}`}case"social_media":{const n=r.platforms||[];return n.length?n.map(a=>a.platform).join(", "):"No platforms"}default:return""}}function der({block:t,onSave:r,onClose:s}){const[n,a]=E.useState(t.config),o=ige.find(l=>l.value===t.block_type);return e.jsx(Dr,{open:!0,onOpenChange:s,children:e.jsxs(Lr,{className:"max-w-lg max-h-[80vh] overflow-y-auto",children:[e.jsx(Ur,{children:e.jsxs(Br,{children:["Edit ",o==null?void 0:o.label]})}),t.block_type==="video_intro"&&e.jsx(uer,{config:n,onChange:a,cardId:t.card_id}),t.block_type==="testimonials"&&e.jsx(her,{config:n,onChange:a}),t.block_type==="specialties"&&e.jsx(mer,{config:n,onChange:a}),t.block_type==="custom_links"&&e.jsx(per,{config:n,onChange:a}),t.block_type==="social_media"&&e.jsx(fer,{config:n,onChange:a}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:s,children:"Cancel"}),e.jsx(Q,{onClick:()=>r(n),children:"Save"})]})]})})}function uer({config:t,onChange:r,cardId:s}){var b,N;const[n,a]=E.useState(""),[o,l]=E.useState((b=t.video_url)!=null&&b.includes("youtube")||(N=t.video_url)!=null&&N.includes("youtu.be")?"youtube":"library"),{data:i}=Ht({queryKey:["card-owner",s],queryFn:async()=>{const{data:j}=await Z.from("agent_cards").select("user_id").eq("id",s).single();return j==null?void 0:j.user_id},enabled:!!s}),{data:d,isLoading:m}=Ht({queryKey:["agent-videos-library",i],queryFn:async()=>{const{data:j,error:S}=await Z.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(S)throw S;return j||[]},enabled:!!i}),g=(d==null?void 0:d.filter(j=>!n||(j.title||"").toLowerCase().includes(n.toLowerCase())))||[],y=t.bunny_video_id,v=j=>{var I;const S=(I=j.playback_url)==null?void 0:I.match(/\/(?:play|embed)\/(\d+)\//),M=`https://iframe.mediadelivery.net/embed/${S?S[1]:"570924"}/${j.bunny_video_id}?autoplay=false&responsive=true`;r({...t,video_url:M,bunny_video_id:j.bunny_video_id,video_source:"library"})};return e.jsx("div",{className:"space-y-4",children:e.jsxs(ci,{value:o,onValueChange:l,children:[e.jsxs(ri,{className:"w-full",children:[e.jsx(Kr,{value:"library",className:"flex-1",children:"Video Library"}),e.jsx(Kr,{value:"youtube",className:"flex-1",children:"YouTube URL"})]}),e.jsxs(ms,{value:"library",className:"space-y-3 mt-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search videos...",value:n,onChange:j=>a(j.target.value),className:"pl-9"})]}),e.jsx(Eo,{className:"h-[240px]",children:m?e.jsxs("div",{className:"space-y-2",children:[e.jsx(fr,{className:"h-14 w-full"}),e.jsx(fr,{className:"h-14 w-full"})]}):g.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:(d==null?void 0:d.length)===0?"No videos in library yet":"No matching videos"}):e.jsx("div",{className:"space-y-1.5 pr-3",children:g.map(j=>e.jsxs("button",{onClick:()=>v(j),className:`w-full flex items-center gap-3 p-2 rounded-lg border text-left transition-colors ${y===j.bunny_video_id?"border-primary bg-primary/5":"border-border hover:bg-muted"}`,children:[j.thumbnail_url?e.jsx("img",{src:j.thumbnail_url,alt:"",className:"h-10 w-16 rounded object-cover flex-shrink-0 bg-muted",onError:S=>{var A;S.currentTarget.style.display="none",(A=S.currentTarget.nextElementSibling)==null||A.classList.remove("hidden")}}):null,e.jsx("div",{className:`h-10 w-16 rounded bg-muted flex items-center justify-center flex-shrink-0 ${j.thumbnail_url?"hidden":""}`,children:e.jsx(ya,{className:"h-4 w-4 text-muted-foreground"})}),e.jsx("span",{className:"text-sm font-medium truncate flex-1",children:j.title||"Untitled Video"}),y===j.bunny_video_id&&e.jsx(li,{className:"h-4 w-4 text-primary flex-shrink-0"})]},j.id))})})]}),e.jsx(ms,{value:"youtube",className:"space-y-3 mt-3",children:e.jsxs("div",{children:[e.jsx(Ee,{children:"YouTube URL"}),e.jsx(Qe,{placeholder:"https://www.youtube.com/watch?v=...",value:t.video_source==="youtube"&&t.video_url||"",onChange:j=>r({...t,video_url:j.target.value,bunny_video_id:null,video_source:"youtube"})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Paste a YouTube video link"})]})})]})})}function her({config:t,onChange:r}){const s=t.testimonials||[],n=(l,i,d)=>{const m=[...s];m[l]={...m[l],[i]:d},r({...t,testimonials:m})},a=()=>r({...t,testimonials:[...s,{name:"",quote:"",role:""}]}),o=l=>r({...t,testimonials:s.filter((i,d)=>d!==l)});return e.jsxs("div",{className:"space-y-4",children:[s.map((l,i)=>e.jsx(ze,{children:e.jsxs(qe,{className:"p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Ee,{className:"text-xs font-medium",children:["Testimonial ",i+1]}),s.length>1&&e.jsx(Q,{variant:"ghost",size:"icon",className:"h-6 w-6 text-destructive",onClick:()=>o(i),children:e.jsx(Rs,{className:"h-3 w-3"})})]}),e.jsx(Qe,{placeholder:"Client name",value:l.name,onChange:d=>n(i,"name",d.target.value)}),e.jsx(Qe,{placeholder:"Role/title (optional)",value:l.role||"",onChange:d=>n(i,"role",d.target.value)}),e.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:d=>n(i,"quote",d.target.value)})]})},i)),e.jsxs(Q,{variant:"outline",size:"sm",onClick:a,className:"w-full",children:[e.jsx(gs,{className:"h-4 w-4 mr-1"})," Add Testimonial"]})]})}function mer({config:t,onChange:r}){const s=t.tags||[],[n,a]=E.useState(""),o=i=>{r({...t,tags:s.includes(i)?s.filter(d=>d!==i):[...s,i]})},l=()=>{n.trim()&&!s.includes(n.trim())&&(r({...t,tags:[...s,n.trim()]}),a(""))};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm mb-2 block",children:"Preset Specialties"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:oer.map(i=>e.jsx("button",{onClick:()=>o(i),className:`px-3 py-1.5 text-xs rounded-full border transition-colors ${s.includes(i)?"bg-primary text-primary-foreground border-primary":"bg-muted border-border hover:bg-muted/80"}`,children:i},i))})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm mb-2 block",children:"Custom Tag"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Qe,{placeholder:"Add your own...",value:n,onChange:i=>a(i.target.value),onKeyDown:i=>i.key==="Enter"&&(i.preventDefault(),l())}),e.jsx(Q,{variant:"outline",size:"sm",onClick:l,children:"Add"})]})]}),s.length>0&&e.jsxs("div",{children:[e.jsxs(Ee,{className:"text-xs text-muted-foreground mb-1 block",children:["Selected (",s.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.map(i=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 text-xs bg-primary/10 text-primary rounded-full",children:[i,e.jsx("button",{onClick:()=>o(i),className:"hover:text-destructive",children:"×"})]},i))})]})]})}function per({config:t,onChange:r}){const s=t.links||[],n=(l,i,d)=>{const m=[...s];m[l]={...m[l],[i]:d},r({...t,links:m})},a=()=>r({...t,links:[...s,{label:"",url:""}]}),o=l=>r({...t,links:s.filter((i,d)=>d!==l)});return e.jsxs("div",{className:"space-y-3",children:[s.map((l,i)=>e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(Qe,{placeholder:"Button label",value:l.label,onChange:d=>n(i,"label",d.target.value)}),e.jsx(Qe,{placeholder:"https://...",value:l.url,onChange:d=>n(i,"url",d.target.value)})]}),s.length>1&&e.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8 mt-1 text-destructive",onClick:()=>o(i),children:e.jsx(Rs,{className:"h-3 w-3"})})]},i)),e.jsxs(Q,{variant:"outline",size:"sm",onClick:a,className:"w-full",children:[e.jsx(gs,{className:"h-4 w-4 mr-1"})," Add Link"]})]})}const RTe=[{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 fer({config:t,onChange:r}){const s=t.platforms||[],n=d=>{s.find(m=>m.platform===d)||r({...t,platforms:[...s,{platform:d,url:""}]})},a=(d,m)=>{const g=[...s];g[d]={...g[d],url:m},r({...t,platforms:g})},o=d=>{r({...t,platforms:s.filter((m,g)=>g!==d)})},l=RTe.filter(d=>!s.find(m=>m.platform===d.value)),i=d=>{const m=_me[d],g=RTe.find(y=>y.value===d);return{label:(g==null?void 0:g.label)||d,color:(m==null?void 0:m.color)||"#666",iconPath:m==null?void 0:m.icon}};return e.jsxs("div",{className:"space-y-4",children:[s.length>0&&e.jsx("div",{className:"space-y-3",children:s.map((d,m)=>{const g=i(d.platform);return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-9 w-9 rounded-lg flex items-center justify-center flex-shrink-0 border",style:{borderColor:g.color+"30",backgroundColor:g.color+"10"},children:g.iconPath&&e.jsx("svg",{viewBox:"0 0 24 24",width:16,height:16,fill:g.color,children:e.jsx("path",{d:g.iconPath})})}),e.jsx("div",{className:"flex-1",children:e.jsx(Qe,{placeholder:`Your ${g.label} profile URL`,value:d.url,onChange:y=>a(m,y.target.value)})}),e.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive flex-shrink-0",onClick:()=>o(m),children:e.jsx(Rs,{className:"h-3.5 w-3.5"})})]},m)})}),l.length>0&&e.jsxs("div",{children:[e.jsx(Ee,{className:"text-xs text-muted-foreground mb-2 block",children:"Add a platform"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(d=>{const m=_me[d.value];return e.jsxs("button",{onClick:()=>n(d.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:[(m==null?void 0:m.icon)&&e.jsx("svg",{viewBox:"0 0 24 24",width:12,height:12,fill:m.color,children:e.jsx("path",{d:m.icon})}),d.label]},d.value)})})]}),s.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Tap a platform above to add your social media profile."})]})}var ger=Object.defineProperty,ane=Object.getOwnPropertySymbols,nHe=Object.prototype.hasOwnProperty,aHe=Object.prototype.propertyIsEnumerable,FTe=(t,r,s)=>r in t?ger(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s,oge=(t,r)=>{for(var s in r||(r={}))nHe.call(r,s)&&FTe(t,s,r[s]);if(ane)for(var s of ane(r))aHe.call(r,s)&&FTe(t,s,r[s]);return t},lge=(t,r)=>{var s={};for(var n in t)nHe.call(t,n)&&r.indexOf(n)<0&&(s[n]=t[n]);if(t!=null&&ane)for(var n of ane(t))r.indexOf(n)<0&&aHe.call(t,n)&&(s[n]=t[n]);return s};/** * @license QR Code generator library (TypeScript) * Copyright (c) Project Nayuki. * SPDX-License-Identifier: MIT */var Dk;(t=>{const r=class qi{constructor(d,m,g,y){if(this.version=d,this.errorCorrectionLevel=m,this.modules=[],this.isFunction=[],dqi.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=d*4+17;let v=[];for(let N=0;N7)throw new RangeError("Invalid value");let N,j;for(N=g;;N++){const I=qi.getNumDataCodewords(N,m)*8,F=l.getTotalBits(d,N);if(F<=I){j=F;break}if(N>=y)throw new RangeError("Data too long")}for(const I of[qi.Ecc.MEDIUM,qi.Ecc.QUARTILE,qi.Ecc.HIGH])b&&j<=qi.getNumDataCodewords(N,I)*8&&(m=I);let S=[];for(const I of d){s(I.mode.modeBits,4,S),s(I.numChars,I.mode.numCharCountBits(N),S);for(const F of I.getData())S.push(F)}a(S.length==j);const A=qi.getNumDataCodewords(N,m)*8;a(S.length<=A),s(0,Math.min(4,A-S.length),S),s(0,(8-S.length%8)%8,S),a(S.length%8==0);for(let I=236;S.lengthM[F>>>3]|=I<<7-(F&7)),new qi(N,m,M,v)}getModule(d,m){return 0<=d&&d>>9)*1335;const y=(m<<10|g)^21522;a(y>>>15==0);for(let v=0;v<=5;v++)this.setFunctionModule(8,v,n(y,v));this.setFunctionModule(8,7,n(y,6)),this.setFunctionModule(8,8,n(y,7)),this.setFunctionModule(7,8,n(y,8));for(let v=9;v<15;v++)this.setFunctionModule(14-v,8,n(y,v));for(let v=0;v<8;v++)this.setFunctionModule(this.size-1-v,8,n(y,v));for(let v=8;v<15;v++)this.setFunctionModule(8,this.size-15+v,n(y,v));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let d=this.version;for(let g=0;g<12;g++)d=d<<1^(d>>>11)*7973;const m=this.version<<12|d;a(m>>>18==0);for(let g=0;g<18;g++){const y=n(m,g),v=this.size-11+g%3,b=Math.floor(g/3);this.setFunctionModule(v,b,y),this.setFunctionModule(b,v,y)}}drawFinderPattern(d,m){for(let g=-4;g<=4;g++)for(let y=-4;y<=4;y++){const v=Math.max(Math.abs(y),Math.abs(g)),b=d+y,N=m+g;0<=b&&b{(I!=j-v||O>=N)&&M.push(F[I])});return a(M.length==b),M}drawCodewords(d){if(d.length!=Math.floor(qi.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let m=0;for(let g=this.size-1;g>=1;g-=2){g==6&&(g=5);for(let y=0;y>>3],7-(m&7)),m++)}}a(m==d.length*8)}applyMask(d){if(d<0||d>7)throw new RangeError("Mask value out of range");for(let m=0;m5&&d++):(this.finderPenaltyAddHistory(N,j),b||(d+=this.finderPenaltyCountPatterns(j)*qi.PENALTY_N3),b=this.modules[v][S],N=1);d+=this.finderPenaltyTerminateAndCount(b,N,j)*qi.PENALTY_N3}for(let v=0;v5&&d++):(this.finderPenaltyAddHistory(N,j),b||(d+=this.finderPenaltyCountPatterns(j)*qi.PENALTY_N3),b=this.modules[S][v],N=1);d+=this.finderPenaltyTerminateAndCount(b,N,j)*qi.PENALTY_N3}for(let v=0;vb+(N?1:0),m);const g=this.size*this.size,y=Math.ceil(Math.abs(m*20-g*10)/g)-1;return a(0<=y&&y<=9),d+=y*qi.PENALTY_N4,a(0<=d&&d<=2568888),d}getAlignmentPatternPositions(){if(this.version==1)return[];{const d=Math.floor(this.version/7)+2,m=this.version==32?26:Math.ceil((this.version*4+4)/(d*2-2))*2;let g=[6];for(let y=this.size-7;g.lengthqi.MAX_VERSION)throw new RangeError("Version number out of range");let m=(16*d+128)*d+64;if(d>=2){const g=Math.floor(d/7)+2;m-=(25*g-10)*g-55,d>=7&&(m-=36)}return a(208<=m&&m<=29648),m}static getNumDataCodewords(d,m){return Math.floor(qi.getNumRawDataModules(d)/8)-qi.ECC_CODEWORDS_PER_BLOCK[m.ordinal][d]*qi.NUM_ERROR_CORRECTION_BLOCKS[m.ordinal][d]}static reedSolomonComputeDivisor(d){if(d<1||d>255)throw new RangeError("Degree out of range");let m=[];for(let y=0;y0);for(const y of d){const v=y^g.shift();g.push(0),m.forEach((b,N)=>g[N]^=qi.reedSolomonMultiply(b,v))}return g}static reedSolomonMultiply(d,m){if(d>>>8||m>>>8)throw new RangeError("Byte out of range");let g=0;for(let y=7;y>=0;y--)g=g<<1^(g>>>7)*285,g^=(m>>>y&1)*d;return a(g>>>8==0),g}finderPenaltyCountPatterns(d){const m=d[1];a(m<=this.size*3);const g=m>0&&d[2]==m&&d[3]==m*3&&d[4]==m&&d[5]==m;return(g&&d[0]>=m*4&&d[6]>=m?1:0)+(g&&d[6]>=m*4&&d[0]>=m?1:0)}finderPenaltyTerminateAndCount(d,m,g){return d&&(this.finderPenaltyAddHistory(m,g),m=0),m+=this.size,this.finderPenaltyAddHistory(m,g),this.finderPenaltyCountPatterns(g)}finderPenaltyAddHistory(d,m){m[0]==0&&(d+=this.size),m.pop(),m.unshift(d)}};r.MIN_VERSION=1,r.MAX_VERSION=40,r.PENALTY_N1=3,r.PENALTY_N2=3,r.PENALTY_N3=40,r.PENALTY_N4=10,r.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]],r.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],t.QrCode=r;function s(i,d,m){if(d<0||d>31||i>>>d)throw new RangeError("Value out of range");for(let g=d-1;g>=0;g--)m.push(i>>>g&1)}function n(i,d){return(i>>>d&1)!=0}function a(i){if(!i)throw new Error("Assertion error")}const o=class ec{constructor(d,m,g){if(this.mode=d,this.numChars=m,this.bitData=g,m<0)throw new RangeError("Invalid argument");this.bitData=g.slice()}static makeBytes(d){let m=[];for(const g of d)s(g,8,m);return new ec(ec.Mode.BYTE,d.length,m)}static makeNumeric(d){if(!ec.isNumeric(d))throw new RangeError("String contains non-numeric characters");let m=[];for(let g=0;g=1<{(r=>{const s=class{constructor(a,o){this.ordinal=a,this.formatBits=o}};s.LOW=new s(0,1),s.MEDIUM=new s(1,0),s.QUARTILE=new s(2,3),s.HIGH=new s(3,2),r.Ecc=s})(t.QrCode||(t.QrCode={}))})(Dk||(Dk={}));(t=>{(r=>{const s=class{constructor(a,o){this.modeBits=a,this.numBitsCharCount=o}numCharCountBits(a){return this.numBitsCharCount[Math.floor((a+7)/17)]}};s.NUMERIC=new s(1,[10,12,14]),s.ALPHANUMERIC=new s(2,[9,11,13]),s.BYTE=new s(4,[8,16,16]),s.KANJI=new s(8,[8,10,12]),s.ECI=new s(7,[0,0,0]),r.Mode=s})(t.QrSegment||(t.QrSegment={}))})(Dk||(Dk={}));var kS=Dk;/** * @license qrcode.react * Copyright (c) Paul O'Shannessy * SPDX-License-Identifier: ISC */var xer={L:kS.QrCode.Ecc.LOW,M:kS.QrCode.Ecc.MEDIUM,Q:kS.QrCode.Ecc.QUARTILE,H:kS.QrCode.Ecc.HIGH},iHe=128,oHe="L",lHe="#FFFFFF",cHe="#000000",dHe=!1,uHe=1,yer=4,ver=0,_er=.1;function hHe(t,r=0){const s=[];return t.forEach(function(n,a){let o=null;n.forEach(function(l,i){if(!l&&o!==null){s.push(`M${o+r} ${a+r}h${i-o}v1H${o+r}z`),o=null;return}if(i===n.length-1){if(!l)return;o===null?s.push(`M${i+r},${a+r} h1v1H${i+r}z`):s.push(`M${o+r},${a+r} h${i+1-o}v1H${o+r}z`);return}l&&o===null&&(o=i)})}),s.join("")}function mHe(t,r){return t.slice().map((s,n)=>n=r.y+r.h?s:s.map((a,o)=>o=r.x+r.w?a:!1))}function ber(t,r,s,n){if(n==null)return null;const a=t.length+s*2,o=Math.floor(r*_er),l=a/r,i=(n.width||o)*l,d=(n.height||o)*l,m=n.x==null?t.length/2-i/2:n.x*l,g=n.y==null?t.length/2-d/2:n.y*l,y=n.opacity==null?1:n.opacity;let v=null;if(n.excavate){let N=Math.floor(m),j=Math.floor(g),S=Math.ceil(i+m-N),A=Math.ceil(d+g-j);v={x:N,y:j,w:S,h:A}}const b=n.crossOrigin;return{x:m,y:g,h:d,w:i,excavation:v,opacity:y,crossOrigin:b}}function wer(t,r){return r!=null?Math.max(Math.floor(r),0):t?yer:ver}function pHe({value:t,level:r,minVersion:s,includeMargin:n,marginSize:a,imageSettings:o,size:l,boostLevel:i}){let d=lt.useMemo(()=>{const N=(Array.isArray(t)?t:[t]).reduce((j,S)=>(j.push(...kS.QrSegment.makeSegments(S)),j),[]);return kS.QrCode.encodeSegments(N,xer[r],s,void 0,void 0,i)},[t,r,s,i]);const{cells:m,margin:g,numCells:y,calculatedImageSettings:v}=lt.useMemo(()=>{let b=d.getModules();const N=wer(n,a),j=b.length+N*2,S=ber(b,l,N,o);return{cells:b,margin:N,numCells:j,calculatedImageSettings:S}},[d,l,o,n,a]);return{qrcode:d,margin:g,cells:m,numCells:y,calculatedImageSettings:v}}var jer=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),ker=lt.forwardRef(function(r,s){const n=r,{value:a,size:o=iHe,level:l=oHe,bgColor:i=lHe,fgColor:d=cHe,includeMargin:m=dHe,minVersion:g=uHe,boostLevel:y,marginSize:v,imageSettings:b}=n,j=lge(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:S}=j,A=lge(j,["style"]),M=b==null?void 0:b.src,I=lt.useRef(null),F=lt.useRef(null),O=lt.useCallback(ne=>{I.current=ne,typeof s=="function"?s(ne):s&&(s.current=ne)},[s]),[B,$]=lt.useState(!1),{margin:H,cells:W,numCells:X,calculatedImageSettings:se}=pHe({value:a,level:l,minVersion:g,boostLevel:y,includeMargin:m,marginSize:v,imageSettings:b,size:o});lt.useEffect(()=>{if(I.current!=null){const ne=I.current,fe=ne.getContext("2d");if(!fe)return;let oe=W;const de=F.current,ue=se!=null&&de!==null&&de.complete&&de.naturalHeight!==0&&de.naturalWidth!==0;ue&&se.excavation!=null&&(oe=mHe(W,se.excavation));const xe=window.devicePixelRatio||1;ne.height=ne.width=o*xe;const Te=o/X*xe;fe.scale(Te,Te),fe.fillStyle=i,fe.fillRect(0,0,X,X),fe.fillStyle=d,jer?fe.fill(new Path2D(hHe(oe,H))):W.forEach(function(be,we){be.forEach(function(ve,tt){ve&&fe.fillRect(tt+H,we+H,1,1)})}),se&&(fe.globalAlpha=se.opacity),ue&&fe.drawImage(de,se.x+H,se.y+H,se.w,se.h)}}),lt.useEffect(()=>{$(!1)},[M]);const ae=oge({height:o,width:o},S);let le=null;return M!=null&&(le=lt.createElement("img",{src:M,key:M,style:{display:"none"},onLoad:()=>{$(!0)},ref:F,crossOrigin:se==null?void 0:se.crossOrigin})),lt.createElement(lt.Fragment,null,lt.createElement("canvas",oge({style:ae,height:o,width:o,ref:O,role:"img"},A)),le)});ker.displayName="QRCodeCanvas";var yve=lt.forwardRef(function(r,s){const n=r,{value:a,size:o=iHe,level:l=oHe,bgColor:i=lHe,fgColor:d=cHe,includeMargin:m=dHe,minVersion:g=uHe,boostLevel:y,title:v,marginSize:b,imageSettings:N}=n,j=lge(n,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:S,cells:A,numCells:M,calculatedImageSettings:I}=pHe({value:a,level:l,minVersion:g,boostLevel:y,includeMargin:m,marginSize:b,imageSettings:N,size:o});let F=A,O=null;N!=null&&I!=null&&(I.excavation!=null&&(F=mHe(A,I.excavation)),O=lt.createElement("image",{href:N.src,height:I.h,width:I.w,x:I.x+S,y:I.y+S,preserveAspectRatio:"none",opacity:I.opacity,crossOrigin:I.crossOrigin}));const B=hHe(F,S);return lt.createElement("svg",oge({height:o,width:o,viewBox:`0 0 ${M} ${M}`,ref:s,role:"img"},j),!!v&<.createElement("title",null,v),lt.createElement("path",{fill:i,d:`M0,0 h${M}v${M}H0z`,shapeRendering:"crispEdges"}),lt.createElement("path",{fill:d,d:B,shapeRendering:"crispEdges"}),O)});yve.displayName="QRCodeSVG";function Ner({slug:t,agentName:r}){const s=E.useRef(null),n=`https://cards.relevelup.com/${t}`,a=E.useCallback(()=>{var y;const o=(y=s.current)==null?void 0:y.querySelector("svg");if(!o)return;const l=document.createElement("canvas"),i=1024;l.width=i,l.height=i;const d=l.getContext("2d");if(!d)return;const m=new XMLSerializer().serializeToString(o),g=new Image;g.onload=()=>{d.fillStyle="#ffffff",d.fillRect(0,0,i,i),d.drawImage(g,0,0,i,i);const v=document.createElement("a");v.download=`${t}-qr-code.png`,v.href=l.toDataURL("image/png"),v.click(),Se.success("QR code downloaded!")},g.src="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(m)))},[t]);return e.jsxs("div",{className:"space-y-3",children:[e.jsx(Ee,{className:"text-sm font-medium",children:"QR Code"}),e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{ref:s,className:"bg-white p-3 rounded-lg border shadow-sm shrink-0",children:e.jsx(yve,{value:n,size:120,level:"H",bgColor:"#ffffff",fgColor:"#000000"})}),e.jsxs("div",{className:"space-y-2 min-w-0",children:[e.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."}),e.jsxs(Q,{variant:"outline",size:"sm",onClick:a,className:"gap-1.5",children:[e.jsx(Oi,{className:"h-3.5 w-3.5"}),"Download PNG"]})]})]})]})}function kue(t){return{is_published:t.is_published,theme:t.theme,title:t.title||"",positioning_statement:t.positioning_statement||"",bio:t.bio||"",review_snippet:t.review_snippet||"",review_source_url:t.review_source_url||"",booking_url:t.booking_url||"",custom_cta_label:t.custom_cta_label||"",show_photo:t.show_photo,show_bio:t.show_bio,show_credentials:t.show_credentials,show_social_links:t.show_social_links,show_save_contact:t.show_save_contact,show_leave_review:t.show_leave_review,show_refer_friend:t.show_refer_friend,brokerage_display_name:t.brokerage_display_name||"",brokerage_logo_url:t.brokerage_logo_url||"",brokerage_logo_size:t.brokerage_logo_size||56,team_name:t.team_name||"",team_logo_url:t.team_logo_url||"",team_logo_size:t.team_logo_size||56,bold_theme_colors:t.bold_theme_colors||null,display_email:t.display_email||""}}function Ser(){const{user:t}=Gr(),{data:r,isLoading:s}=ldt(t==null?void 0:t.id),n=e5(),[a,o]=E.useState(null),l=E.useMemo(()=>a||(r?kue(r):null),[a,r]);if(s)return e.jsx(Fr,{children:e.jsxs("div",{className:"max-w-2xl mx-auto p-4 space-y-4",children:[e.jsx(fr,{className:"h-8 w-48"}),e.jsx(fr,{className:"h-32 w-full"}),e.jsx(fr,{className:"h-32 w-full"})]})});if(!r)return e.jsx(Fr,{children:e.jsx(Mer,{userId:t==null?void 0:t.id})});const i=l||kue(r),d=m=>{o(g=>{const y=g||kue(r);return typeof m=="function"?m(y):m})};return e.jsx(Fr,{children:e.jsxs("div",{className:"flex gap-6 items-start",children:[e.jsxs("div",{className:`${n?"w-full":"flex-1 min-w-0"} max-w-2xl p-4 space-y-6 animate-fade-in`,children:[e.jsx(Ter,{card:r}),e.jsx(Per,{card:r,form:i,setForm:d})]}),!n&&e.jsx("div",{className:"w-[400px] shrink-0","aria-hidden":"true"}),!n&&e.jsx("div",{className:"fixed right-8 top-[5.5rem] w-[400px] z-30",style:{height:"calc(100vh - 6.5rem)"},children:e.jsxs("div",{className:"rounded-xl border bg-muted/30 overflow-hidden h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 border-b bg-card shrink-0",children:[e.jsx(Wj,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium",children:"Live Preview"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(Cer,{card:r,form:i})})]})})]})})}function Cer({card:t,form:r}){const{data:s}=Ht({queryKey:["card-preview-profile",t.user_id],queryFn:async()=>{const{data:a}=await Z.from("profiles").select("name, email, phone, avatar_url, brokerage_id").eq("id",t.user_id).single();let o=(a==null?void 0:a.avatar_url)||null;if(!o){const{data:l}=await Z.storage.from("avatars").list(`${t.user_id}`);if(l&&l.length>0){const{data:i}=Z.storage.from("avatars").getPublicUrl(`${t.user_id}/${l[0].name}`);o=`${i.publicUrl}?t=${Date.now()}`}}return{...a,avatar_url:o}}}),n=E.useMemo(()=>({...t,is_published:r.is_published,theme:r.theme,title:r.title||null,positioning_statement:r.positioning_statement||null,bio:r.bio||null,review_snippet:r.review_snippet||null,review_source_url:r.review_source_url||null,booking_url:r.booking_url||null,custom_cta_label:r.custom_cta_label||null,custom_cta_url:t.custom_cta_url,show_photo:r.show_photo,show_bio:r.show_bio,show_video:t.show_video,show_credentials:r.show_credentials,show_social_links:r.show_social_links,show_save_contact:r.show_save_contact,show_leave_review:r.show_leave_review,show_refer_friend:r.show_refer_friend,brokerage_display_name:r.brokerage_display_name||null,brokerage_logo_url:r.brokerage_logo_url||null,brokerage_logo_size:r.brokerage_logo_size,team_name:r.team_name||null,team_logo_url:r.team_logo_url||null,team_logo_size:r.team_logo_size,display_email:r.display_email||null,social_links:t.social_links||[],profile:{name:(s==null?void 0:s.name)||null,email:r.display_email||(s==null?void 0:s.email)||null,phone:(s==null?void 0:s.phone)||null,brokerage_id:(s==null?void 0:s.brokerage_id)||null},brokerage_name:r.brokerage_display_name||null,avatar_url:(s==null?void 0:s.avatar_url)||null}),[t,r,s]);return e.jsx("div",{className:"transform scale-[0.85] origin-top",children:e.jsx(lye,{card:n})})}function Mer({userId:t}){var d;const[r,s]=E.useState(""),n=qOe(),{data:a}=Ht({queryKey:["my-profile-for-card",t],queryFn:async()=>{if(!t)return null;const{data:m}=await Z.from("profiles").select("name").eq("id",t).single();return m},enabled:!!t}),o=((d=a==null?void 0:a.name)==null?void 0:d.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""))||"",l=()=>{if(!t)return;const m=(r.trim()||o).toLowerCase().replace(/[^a-z0-9-]/g,"-");if(!m){Se.error("Please enter a URL slug for your card");return}n.mutate({user_id:t,slug:m,is_published:!0},{onSuccess:()=>Se.success("Your digital card has been created!")})},i=[{icon:Gg,title:"Shareable Link",desc:"One link that works everywhere"},{icon:Qg,title:"Lead Capture",desc:"Collect leads automatically"},{icon:Nu,title:"Always Up-to-Date",desc:"Edit anytime, changes are instant"},{icon:ed,title:"Fully Customizable",desc:"Themes, colors, and content blocks"}];return e.jsxs("div",{className:"max-w-2xl mx-auto p-4 animate-fade-in",children:[e.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:[e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_30%_20%,rgba(255,255,255,0.15),transparent_50%)]"}),e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_80%_80%,rgba(0,0,0,0.1),transparent_50%)]"}),e.jsxs("div",{className:"relative z-10",children:[e.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:[e.jsx(An,{className:"h-3.5 w-3.5"}),"New Feature"]}),e.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-3 tracking-tight",children:"Your Digital Business Card"}),e.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."})]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 mb-8",children:i.map(m=>e.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl border bg-card hover:shadow-md transition-shadow",children:[e.jsx("div",{className:"mt-0.5 p-2 rounded-lg bg-primary/10 shrink-0",children:e.jsx(m.icon,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-sm",children:m.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:m.desc})]})]},m.title))}),e.jsxs(ze,{className:"shadow-lg border-2",children:[e.jsxs(Wt,{className:"text-center pb-2",children:[e.jsx(Zt,{className:"text-xl",children:"Set Up Your Card"}),e.jsx(Ss,{children:"Choose a URL slug — this is the link you'll share with clients"})]}),e.jsxs(qe,{className:"p-6 pt-2 space-y-5",children:[e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Your Card URL"}),e.jsxs("div",{className:"flex items-center gap-0 mt-1.5",children:[e.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/"}),e.jsx(Qe,{value:r||o,onChange:m=>s(m.target.value),placeholder:"your-name",className:"rounded-l-none"})]})]}),e.jsxs(Q,{onClick:l,disabled:n.isPending,className:"w-full h-11 text-base font-semibold",size:"lg",children:[e.jsx(An,{className:"h-4 w-4 mr-2"}),n.isPending?"Creating...":"Create My Card"]})]})]})]})}function Ter({card:t}){const s=`https://cards.relevelup.com/${t.slug}`,n=()=>{navigator.clipboard.writeText(s),Se.success("Card link copied!")};return e.jsx("div",{className:"rounded-xl border bg-card p-5",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h1",{className:"text-xl font-bold",children:"My Digital Card"}),e.jsx(bt,{variant:t.is_published?"default":"secondary",className:"text-[10px] uppercase tracking-wider",children:t.is_published?"Live":"Draft"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(Gg,{className:"h-3.5 w-3.5"}),"cards.relevelup.com/",t.slug]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Q,{variant:"outline",size:"sm",onClick:n,className:"gap-1.5",children:[e.jsx(fo,{className:"h-3.5 w-3.5"})," Copy Link"]}),e.jsx(Q,{size:"sm",asChild:!0,className:"gap-1.5",children:e.jsxs("a",{href:s,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(En,{className:"h-3.5 w-3.5"})," Preview"]})})]})]})})}function Aer({userId:t}){const r=qr(),s=E.useRef(null),[n,a]=E.useState(!1),[o,l]=E.useState(""),{data:i,isLoading:d}=Ht({queryKey:["card-editor-profile",t],queryFn:async()=>{const{data:se}=await Z.from("profiles").select("name, email, phone, avatar_url").eq("id",t).single();let ae=(se==null?void 0:se.avatar_url)||null;if(!ae){const{data:le}=await Z.storage.from("avatars").list(`${t}`);if(le&&le.length>0){const{data:ne}=Z.storage.from("avatars").getPublicUrl(`${t}/${le[0].name}`);ae=`${ne.publicUrl}?t=${Date.now()}`,await Z.from("profiles").update({avatar_url:ae}).eq("id",t)}}return{...se,avatar_url:ae}}}),[m,g]=E.useState(null),[y,v]=E.useState(null),[b,N]=E.useState(null),[j,S]=E.useState(!1),A=m??(i==null?void 0:i.name)??"",M=y??(i==null?void 0:i.phone)??"",I=b??(i==null?void 0:i.email)??"",F=i==null?void 0:i.avatar_url,O=((i==null?void 0:i.name)||"A").split(" ").map(se=>se[0]).join("").toUpperCase().slice(0,2),B=!(i!=null&&i.avatar_url)||!(i!=null&&i.phone),$=Jt({mutationFn:async se=>{const{error:ae}=await Z.from("profiles").update(se).eq("id",t);if(ae)throw ae},onSuccess:()=>{r.invalidateQueries({queryKey:["card-editor-profile",t]}),r.invalidateQueries({queryKey:["card-preview-profile",t]}),r.invalidateQueries({queryKey:["agent-card-user"]}),Se.success("Profile updated!")},onError:()=>Se.error("Failed to update profile")}),H=()=>{const se={};if(m!==null&&m!==(i==null?void 0:i.name)&&(se.name=m),y!==null&&y!==(i==null?void 0:i.phone)&&(se.phone=y||null),b!==null&&b!==(i==null?void 0:i.email)&&(se.email=b),Object.keys(se).length===0){Se.info("No changes to save");return}$.mutate(se)},W=se=>{var ne;const ae=(ne=se.target.files)==null?void 0:ne[0];if(!ae)return;if(!ae.type.startsWith("image/")){Se.error("Please select an image file");return}const le=new FileReader;le.onloadend=()=>{l(le.result),a(!0)},le.readAsDataURL(ae),se.target.value=""},X=async se=>{S(!0);try{const{data:ae}=await Z.storage.from("avatars").list(`${t}`);ae&&ae.length>0&&await Z.storage.from("avatars").remove(ae.map(de=>`${t}/${de.name}`));const le=`${t}/avatar.jpg`,{error:ne}=await Z.storage.from("avatars").upload(le,se,{upsert:!0,contentType:"image/jpeg"});if(ne)throw ne;const{data:fe}=Z.storage.from("avatars").getPublicUrl(le),oe=fe.publicUrl+"?t="+Date.now();await Z.from("profiles").update({avatar_url:oe}).eq("id",t),r.invalidateQueries({queryKey:["card-editor-profile",t]}),r.invalidateQueries({queryKey:["card-preview-profile",t]}),r.invalidateQueries({queryKey:["agent-card-user"]}),Se.success("Photo updated!")}catch{Se.error("Failed to upload photo")}finally{S(!1)}};return d?e.jsx(fr,{className:"h-32 w-full rounded-xl"}):e.jsxs(e.Fragment,{children:[e.jsx(ze,{className:B?"border-amber-300 dark:border-amber-700":"",children:e.jsxs(qe,{className:"p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Ee,{className:"text-sm font-semibold",children:"Profile Info"}),B&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-amber-600 dark:text-amber-400 font-medium",children:[e.jsx(_l,{className:"h-3 w-3"}),"Missing info — complete below so your card looks great"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-3",children:"This info shows on your digital card and updates your profile everywhere."}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"relative group cursor-pointer",onClick:()=>{var se;return(se=s.current)==null?void 0:se.click()},children:[e.jsxs(ln,{className:"h-16 w-16 ring-2 ring-muted",children:[e.jsx(pa,{src:F||void 0,alt:A}),e.jsx(cn,{className:"text-lg font-semibold bg-primary/10 text-primary",children:O})]}),e.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:e.jsx(Vg,{className:"h-5 w-5 text-white"})}),e.jsx("input",{ref:s,type:"file",accept:"image/*",className:"hidden",onChange:W})]}),e.jsxs("div",{className:"flex-1 space-y-0.5",children:[e.jsx("p",{className:"text-sm font-medium",children:j?"Uploading...":F?"Tap to change photo":"Add a profile photo"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"This photo appears on your card, profile, and community posts"})]})]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{className:"text-xs font-medium text-muted-foreground",children:"Full Name"}),e.jsx(Qe,{value:A,onChange:se=>g(se.target.value),placeholder:"Your full name",className:"h-10"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{className:"text-xs font-medium text-muted-foreground",children:"Phone Number"}),e.jsx(Qe,{value:M,onChange:se=>v(se.target.value),placeholder:"(555) 123-4567",className:"h-10",type:"tel"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{className:"text-xs font-medium text-muted-foreground",children:"Email"}),e.jsx(Qe,{value:I,onChange:se=>N(se.target.value),placeholder:"you@example.com",className:"h-10",type:"email"})]})]})]}),e.jsx(Q,{variant:"outline",size:"sm",onClick:H,disabled:$.isPending,className:"w-full",children:$.isPending?"Saving...":"Update Profile Info"})]})}),e.jsx(D0e,{open:n,onClose:()=>a(!1),imageSrc:o,onCropComplete:X,aspectRatio:1})]})}function Eer({form:t,setForm:r,userId:s}){const[n,a]=E.useState(null),[o,l]=E.useState(t.brokerage_logo_url?"logo":"name"),[i,d]=E.useState(t.team_logo_url?"logo":"name"),m=b=>{l(b),r(b==="name"?N=>({...N,brokerage_logo_url:""}):N=>({...N,brokerage_display_name:""}))},g=b=>{d(b),r(b==="name"?N=>({...N,team_logo_url:""}):N=>({...N,team_name:""}))},y=async(b,N)=>{var S;const j=(S=b.target.files)==null?void 0:S[0];if(j){if(!j.type.startsWith("image/")){Se.error("Please select an image file");return}a(N);try{const A=j.name.split(".").pop()||"png",I=`${s}/${N==="brokerage_logo_url"?"brokerage-logo":"team-logo"}.${A}`,{error:F}=await Z.storage.from("card-logos").upload(I,j,{upsert:!0});if(F)throw F;const{data:O}=Z.storage.from("card-logos").getPublicUrl(I),B=O.publicUrl+"?t="+Date.now();r(N==="brokerage_logo_url"?$=>({...$,[N]:B,brokerage_display_name:""}):$=>({...$,[N]:B,team_name:""})),Se.success("Logo uploaded!")}catch{Se.error("Failed to upload logo")}finally{a(null),b.target.value=""}}},v=b=>{r(N=>({...N,[b]:""}))};return e.jsx(ze,{children:e.jsxs(qe,{className:"p-5 space-y-5",children:[e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-semibold",children:"Brokerage & Team Branding"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Choose either a name or a logo for each — not both."})]}),e.jsxs("div",{className:"space-y-3 p-3 rounded-lg bg-muted/30 border",children:[e.jsx(Ee,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Brokerage"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Q,{type:"button",variant:o==="name"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>m("name"),children:"Use Name"}),e.jsx(Q,{type:"button",variant:o==="logo"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>m("logo"),children:"Use Logo"})]}),o==="name"?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{className:"text-xs font-medium text-muted-foreground",children:"Brokerage Name"}),e.jsx(Qe,{value:t.brokerage_display_name,onChange:b=>r(N=>({...N,brokerage_display_name:b.target.value})),placeholder:"e.g. Keller Williams Realty",className:"h-10"})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsx(Ee,{className:"text-xs font-medium text-muted-foreground",children:"Brokerage Logo"}),e.jsxs("div",{className:"flex items-center gap-3",children:[t.brokerage_logo_url?e.jsxs("div",{className:"relative group",children:[e.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"}),e.jsx("button",{onClick:()=>v("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,e.jsxs("label",{className:"cursor-pointer",children:[e.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:[e.jsx(Vg,{className:"h-3.5 w-3.5"}),n==="brokerage_logo_url"?"Uploading...":t.brokerage_logo_url?"Change":"Upload Logo"]}),e.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:b=>y(b,"brokerage_logo_url"),disabled:n!==null})]})]}),t.brokerage_logo_url&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ee,{className:"text-xs font-medium text-muted-foreground",children:"Logo Size"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.brokerage_logo_size||56,"px"]})]}),e.jsx(If,{value:[t.brokerage_logo_size||56],onValueChange:([b])=>r(N=>({...N,brokerage_logo_size:b})),min:24,max:120,step:4})]})]})]}),e.jsxs("div",{className:"space-y-3 p-3 rounded-lg bg-muted/30 border",children:[e.jsx(Ee,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Team"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Q,{type:"button",variant:i==="name"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>g("name"),children:"Use Name"}),e.jsx(Q,{type:"button",variant:i==="logo"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>g("logo"),children:"Use Logo"})]}),i==="name"?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{className:"text-xs font-medium text-muted-foreground",children:"Team Name"}),e.jsx(Qe,{value:t.team_name,onChange:b=>r(N=>({...N,team_name:b.target.value})),placeholder:"e.g. The Smith Group",className:"h-10"})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsx(Ee,{className:"text-xs font-medium text-muted-foreground",children:"Team Logo"}),e.jsxs("div",{className:"flex items-center gap-3",children:[t.team_logo_url?e.jsxs("div",{className:"relative group",children:[e.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"}),e.jsx("button",{onClick:()=>v("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,e.jsxs("label",{className:"cursor-pointer",children:[e.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:[e.jsx(Vg,{className:"h-3.5 w-3.5"}),n==="team_logo_url"?"Uploading...":t.team_logo_url?"Change":"Upload Logo"]}),e.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:b=>y(b,"team_logo_url"),disabled:n!==null})]})]}),t.team_logo_url&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ee,{className:"text-xs font-medium text-muted-foreground",children:"Logo Size"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.team_logo_size||56,"px"]})]}),e.jsx(If,{value:[t.team_logo_size||56],onValueChange:([b])=>r(N=>({...N,team_logo_size:b})),min:24,max:120,step:4})]})]})]})]})})}function Ier({form:t,setForm:r}){const s={accent:"#ff5722",dark:"#1a1a2e",button:"#ff5722"},n=t.bold_theme_colors||s,a=(i,d)=>{r(m=>({...m,bold_theme_colors:{...s,...m.bold_theme_colors,[i]:d}}))},o=()=>{r(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 e.jsxs("div",{className:"space-y-3 p-4 rounded-xl border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(Ee,{className:"text-sm font-semibold flex items-center gap-1.5",children:[e.jsx(ed,{className:"h-4 w-4"})," Brand Colors"]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Customize colors to match your brand"})]}),e.jsx(Q,{variant:"ghost",size:"sm",className:"text-xs h-7",onClick:o,children:"Reset to Default"})]}),e.jsx("div",{className:"grid gap-3",children:l.map(({key:i,label:d,desc:m})=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("label",{className:"relative shrink-0",children:[e.jsx("input",{type:"color",value:n[i],onChange:g=>a(i,g.target.value),className:"sr-only"}),e.jsx("div",{className:"h-10 w-10 rounded-lg border-2 border-border cursor-pointer shadow-sm hover:scale-105 transition-transform",style:{backgroundColor:n[i]}})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:d}),e.jsx("p",{className:"text-xs text-muted-foreground",children:m})]}),e.jsx(Qe,{value:n[i],onChange:g=>{const y=g.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))}),e.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Preview:"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("div",{className:"h-6 w-12 rounded",style:{backgroundColor:n.accent}}),e.jsx("div",{className:"h-6 w-12 rounded",style:{backgroundColor:n.dark}}),e.jsx("div",{className:"h-6 w-12 rounded",style:{backgroundColor:n.button}})]})]})]})}function Per({card:t,form:r,setForm:s}){var j;const n=VOe(),a=qr(),{data:o}=HOe(t.id),[l,i]=E.useState(t.slug),[d,m]=E.useState(!1),[g,y]=E.useState("idle"),v=E.useRef(JSON.stringify(r)),b=E.useRef(null);E.useEffect(()=>{const S=JSON.stringify(r);if(S!==v.current)return b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{y("saving"),n.mutate({id:t.id,...r,is_published:!0,title:r.title||null,positioning_statement:r.positioning_statement||null,bio:r.bio||null,review_snippet:r.review_snippet||null,review_source_url:r.review_source_url||null,booking_url:r.booking_url||null,custom_cta_label:r.custom_cta_label||null,brokerage_display_name:r.brokerage_display_name||null,brokerage_logo_url:r.brokerage_logo_url||null,brokerage_logo_size:r.brokerage_logo_size,team_name:r.team_name||null,team_logo_url:r.team_logo_url||null,team_logo_size:r.team_logo_size,bold_theme_colors:r.bold_theme_colors||null,display_email:r.display_email||null},{onSuccess:()=>{v.current=S,y("saved"),setTimeout(()=>y("idle"),2e3)},onError:()=>y("idle")})},1500),()=>{b.current&&clearTimeout(b.current)}},[r]);const N=async()=>{const S=l.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/(^-|-$)/g,"");if(!S){Se.error("Please enter a valid URL");return}if(S===t.slug){Se.info("No changes to save");return}m(!0);try{const{data:A}=await Z.from("agent_cards").select("id").eq("slug",S).neq("id",t.id).maybeSingle();if(A){Se.error("This URL is already taken. Try another one.");return}const{error:M}=await Z.from("agent_cards").update({slug:S}).eq("id",t.id);if(M)throw M;i(S),a.invalidateQueries({queryKey:["agent-card"]}),Se.success("Card address updated!")}catch{Se.error("Failed to update card address")}finally{m(!1)}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(ci,{defaultValue:"content",children:[e.jsxs(ri,{className:"w-full h-11 p-1",children:[e.jsxs(Kr,{value:"content",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[e.jsx(gp,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Content"]}),e.jsxs(Kr,{value:"sections",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[e.jsx(Gi,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Sections"]}),e.jsxs(Kr,{value:"blocks",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[e.jsx(Qg,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Blocks"]}),e.jsxs(Kr,{value:"qrcode",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[e.jsx(Zj,{className:"h-3.5 w-3.5 hidden sm:inline"}),"QR Code"]}),e.jsxs(Kr,{value:"analytics",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[e.jsx(J1,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Analytics"]})]}),e.jsxs(ms,{value:"content",className:"mt-4 space-y-4",children:[e.jsx(Aer,{userId:t.user_id}),e.jsx(Eer,{form:r,setForm:s,userId:t.user_id}),e.jsx(ze,{children:e.jsxs(qe,{className:"p-5 space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/50",children:[e.jsxs("div",{children:[e.jsx(Ee,{className:"text-sm font-semibold",children:"Card Status"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Toggle your card on or off"})]}),e.jsx(xn,{checked:r.is_published,onCheckedChange:S=>s(A=>({...A,is_published:S}))})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Card Address"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex flex-1",children:[e.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/"}),e.jsx(Qe,{value:l,onChange:S=>i(S.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"-")),placeholder:"your-name",className:"rounded-l-none h-10"})]}),e.jsx(Q,{variant:"outline",size:"sm",onClick:N,disabled:d||l===t.slug,className:"shrink-0",children:d?"Saving...":"Update"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"This is your unique card URL. Only letters, numbers, and dashes allowed."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Card Email (Override)"}),e.jsx(Qe,{value:r.display_email,onChange:S=>s(A=>({...A,display_email:S.target.value})),placeholder:"you@yourbusiness.com",className:"h-11",type:"email"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional — use a different email on your card instead of your sign-in email."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Theme"}),e.jsxs(ds,{value:r.theme,onValueChange:S=>s(A=>({...A,theme:S})),children:[e.jsx(ls,{className:"h-11",children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"standard",children:"✨ Standard — Modern & Clean"}),e.jsx(Ut,{value:"luxury",children:"🌙 Luxury — Dark & Gold"}),e.jsx(Ut,{value:"bold",children:"🔥 Bold — Vibrant & Punchy"}),e.jsx(Ut,{value:"classic",children:"📋 Classic — Professional"})]})]})]}),r.theme==="bold"&&e.jsx(Ier,{form:r,setForm:s}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Title / Tagline"}),e.jsx(Qe,{value:r.title,onChange:S=>s(A=>({...A,title:S.target.value})),placeholder:"e.g. Luxury Real Estate Specialist",className:"h-11"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Shown below your name on the card"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Positioning Statement"}),e.jsx(Qe,{value:r.positioning_statement,onChange:S=>s(A=>({...A,positioning_statement:S.target.value})),placeholder:"Your home journey, handled with care.",className:"h-11"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Bio"}),e.jsx(Ks,{value:r.bio,onChange:S=>s(A=>({...A,bio:S.target.value})),placeholder:"A short intro about you and what makes you different...",rows:3})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Review Snippet"}),e.jsx(Qe,{value:r.review_snippet,onChange:S=>s(A=>({...A,review_snippet:S.target.value})),placeholder:"Best agent we've ever worked with...",className:"h-11"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Review Source URL"}),e.jsx(Qe,{value:r.review_source_url,onChange:S=>s(A=>({...A,review_source_url:S.target.value})),placeholder:"https://g.page/your-business/review",className:"h-11"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Booking URL"}),e.jsx(Qe,{value:r.booking_url,onChange:S=>s(A=>({...A,booking_url:S.target.value})),placeholder:"https://calendly.com/your-link",className:"h-11"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave empty to show a built-in lead form instead"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{className:"text-sm font-medium",children:"Custom CTA Label"}),e.jsx(Qe,{value:r.custom_cta_label,onChange:S=>s(A=>({...A,custom_cta_label:S.target.value})),placeholder:"Book a Call",className:"h-11"})]})]})})]}),e.jsx(ms,{value:"sections",className:"mt-4",children:e.jsx(ze,{children:e.jsx(qe,{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:S,label:A,desc:M})=>e.jsxs("div",{className:"flex items-center justify-between py-4 first:pt-0 last:pb-0",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(Ee,{className:"text-sm font-medium",children:A}),e.jsx("p",{className:"text-xs text-muted-foreground",children:M})]}),e.jsx(xn,{checked:r[S],onCheckedChange:I=>s(F=>({...F,[S]:I}))})]},S))})})}),e.jsx(ms,{value:"blocks",className:"mt-4",children:e.jsx(sHe,{cardId:t.id})}),e.jsx(ms,{value:"analytics",className:"mt-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-3 gap-3",children:[{label:"Views",value:(o==null?void 0:o.views)??0,icon:Gi,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:J1,color:"text-amber-600 bg-amber-100 dark:text-amber-400 dark:bg-amber-900/30"},{label:"Leads",value:((j=o==null?void 0:o.leads)==null?void 0:j.length)??0,icon:$d,color:"text-emerald-600 bg-emerald-100 dark:text-emerald-400 dark:bg-emerald-900/30"}].map(S=>e.jsx(ze,{className:"overflow-hidden",children:e.jsxs(qe,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:`p-1.5 rounded-md ${S.color}`,children:e.jsx(S.icon,{className:"h-3.5 w-3.5"})}),e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:S.label})]}),e.jsx("div",{className:"text-2xl font-bold",children:S.value})]})},S.label))}),o&&o.leads.length>0&&e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-3",children:e.jsx(Zt,{className:"text-base",children:"Recent Leads"})}),e.jsx(qe,{className:"pt-0 space-y-2",children:o.leads.slice(0,5).map(S=>e.jsxs("div",{className:"flex items-center justify-between text-sm p-3 rounded-lg bg-muted/50",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:S.name}),S.phone&&e.jsx("span",{className:"text-muted-foreground ml-2",children:S.phone})]}),S.intent&&e.jsx(bt,{variant:"secondary",className:"text-xs",children:S.intent})]},S.id))})]}),(!o||o.leads.length===0)&&e.jsx(ze,{children:e.jsxs(qe,{className:"p-8 text-center",children:[e.jsx(J1,{className:"h-10 w-10 text-muted-foreground/40 mx-auto mb-3"}),e.jsx("p",{className:"font-medium text-muted-foreground",children:"No analytics data yet"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Share your card link to start tracking"})]})})]})}),e.jsx(ms,{value:"qrcode",className:"mt-4 space-y-4",children:e.jsx(ze,{children:e.jsx(qe,{className:"p-6",children:e.jsx(Ner,{slug:t.slug})})})})]}),e.jsxs("div",{className:"flex items-center justify-center gap-2 py-2 text-sm text-muted-foreground",children:[g==="saving"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-amber-400 animate-pulse"})," Saving..."]}),g==="saved"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-green-500"})," All changes saved"]}),g==="idle"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-muted-foreground/30"})," Changes auto-save"]})]})]})}function Ler(){const{isAdmin:t}=Gr(),r=qr(),[s,n]=E.useState(!1),[a,o]=E.useState(!1),[l,i]=E.useState(!1),{data:d,isLoading:m}=Ht({queryKey:["gmail-integration"],queryFn:async()=>{const{data:F,error:O}=await Z.from("gmail_integrations").select("*").maybeSingle();if(O)throw O;return F}}),{data:g}=Ht({queryKey:["social-accounts"],queryFn:async()=>{const{data:{user:F}}=await Z.auth.getUser();if(!F)return[];const{data:O,error:B}=await Z.from("social_accounts").select("*").eq("user_id",F.id).order("created_at",{ascending:!1});if(B)throw B;return O}}),y=async()=>{n(!0);try{const{data:F,error:O}=await Z.functions.invoke("gmail-oauth",{body:{action:"get_auth_url"}});if(O)throw O;if(F!=null&&F.authUrl)window.location.href=F.authUrl;else throw new Error("Failed to get authorization URL")}catch(F){console.error("Gmail OAuth error:",F),Se.error("Failed to start Gmail connection"),n(!1)}},v=async()=>{o(!0);try{const{data:F,error:O}=await Z.functions.invoke("meta-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/callback"}});if(O)throw O;if(F!=null&&F.authUrl)window.location.href=F.authUrl;else throw new Error("Failed to get authorization URL")}catch(F){console.error("Meta OAuth error:",F),Se.error("Failed to start connection. Make sure Meta App credentials are configured."),o(!1)}},b=async()=>{i(!0);try{const{data:F,error:O}=await Z.functions.invoke("linkedin-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/linkedin-callback"}});if(O)throw O;if(F!=null&&F.authUrl)window.location.href=F.authUrl;else throw new Error("Failed to get LinkedIn authorization URL")}catch(F){console.error("LinkedIn OAuth error:",F),Se.error("Failed to start LinkedIn connection. Please try again."),i(!1)}},N=Jt({mutationFn:async F=>{const{error:O}=await Z.from("gmail_integrations").delete().eq("id",F);if(O)throw O},onSuccess:()=>{r.invalidateQueries({queryKey:["gmail-integration"]}),Se.success("Gmail disconnected")},onError:()=>{Se.error("Failed to disconnect Gmail")}}),j=Jt({mutationFn:async F=>{const{error:O}=await Z.from("social_accounts").delete().eq("id",F);if(O)throw O},onSuccess:()=>{r.invalidateQueries({queryKey:["social-accounts"]}),Se.success("Account disconnected")},onError:()=>{Se.error("Failed to disconnect account")}}),S=!!(d!=null&&d.is_active),A=(g==null?void 0:g.filter(F=>F.platform==="facebook"))||[],M=(g==null?void 0:g.filter(F=>F.platform==="instagram"))||[],I=(g==null?void 0:g.filter(F=>F.platform==="linkedin"))||[];return e.jsx(Fr,{children:e.jsxs("div",{className:"max-w-3xl mx-auto space-y-6 animate-fade-in",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Integrations"}),e.jsx("p",{className:"text-muted-foreground",children:"Connect third-party services to supercharge your Agent OS workflow."})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-destructive/10 flex items-center justify-center",children:e.jsx(mn,{className:"h-5 w-5 text-destructive"})}),e.jsxs("div",{children:[e.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:["Gmail",S&&e.jsx(bt,{variant:"default",className:"text-xs bg-green-600",children:"Connected"})]}),e.jsx(Ss,{children:"Send emails directly from your contact pages and auto-log them as touchpoints."})]})]})}),e.jsx(qe,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[e.jsx(ui,{className:"h-4 w-4 mt-0.5 text-green-500 shrink-0"}),e.jsx("span",{children:"Send personalized emails from your Gmail account"})]}),e.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[e.jsx(ui,{className:"h-4 w-4 mt-0.5 text-green-500 shrink-0"}),e.jsx("span",{children:"Automatically log emails as activity touchpoints"})]}),e.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[e.jsx(ui,{className:"h-4 w-4 mt-0.5 text-green-500 shrink-0"}),e.jsx("span",{children:"Quick compose from any contact detail page"})]}),S?e.jsxs("div",{className:"flex items-center justify-between mt-4 p-3 rounded-lg border",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:d.gmail_email}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected Gmail account"})]}),e.jsxs(Xc,{children:[e.jsx(xm,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:e.jsx(Rs,{className:"h-4 w-4"})})}),e.jsxs(Tc,{children:[e.jsxs(Ac,{children:[e.jsx(Ic,{children:"Disconnect Gmail?"}),e.jsx(Pc,{children:"This will remove your Gmail connection. You'll need to reconnect to send emails."})]}),e.jsxs(Ec,{children:[e.jsx(Lc,{children:"Cancel"}),e.jsx(dc,{onClick:()=>N.mutate(d.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]}):e.jsxs(Q,{className:"mt-4",onClick:y,disabled:s||m,children:[s?e.jsx(Ko,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(mn,{className:"h-4 w-4 mr-2"}),"Connect Gmail",e.jsx(Hi,{className:"h-4 w-4 ml-2"})]})]})})]}),e.jsxs(ze,{className:t?"":"opacity-70",children:[e.jsx(Wt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-blue-500/10 flex items-center justify-center",children:e.jsx(iu,{className:"h-5 w-5 text-blue-600"})}),e.jsxs("div",{children:[e.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:["Facebook",t?A.length>0?e.jsx(bt,{variant:"default",className:"text-xs bg-green-600",children:"Connected"}):null:e.jsxs(bt,{variant:"secondary",className:"text-xs gap-1",children:[e.jsx(ku,{className:"h-3 w-3"}),"Coming Soon"]})]}),e.jsx(Ss,{children:"Connect Facebook Pages to post content and reach your audience."})]})]})}),t&&e.jsxs(qe,{className:"space-y-3",children:[A.length>0&&e.jsx("div",{className:"space-y-2",children:A.map(F=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(ln,{className:"h-8 w-8",children:[e.jsx(pa,{src:F.profile_picture_url||""}),e.jsx(cn,{children:e.jsx(iu,{className:"h-4 w-4"})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:F.page_name||F.platform_username||"Facebook Page"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected Facebook Page"})]})]}),e.jsxs(Xc,{children:[e.jsx(xm,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:e.jsx(Rs,{className:"h-4 w-4"})})}),e.jsxs(Tc,{children:[e.jsxs(Ac,{children:[e.jsx(Ic,{children:"Disconnect Facebook?"}),e.jsx(Pc,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),e.jsxs(Ec,{children:[e.jsx(Lc,{children:"Cancel"}),e.jsx(dc,{onClick:()=>j.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}),e.jsxs(Q,{onClick:v,disabled:a,variant:"outline",className:"gap-2",children:[a?e.jsx(Ko,{className:"h-4 w-4 animate-spin"}):e.jsx(gs,{className:"h-4 w-4"}),"Connect Facebook Page"]})]})]}),e.jsxs(ze,{className:t?"":"opacity-70",children:[e.jsx(Wt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-pink-500/10 flex items-center justify-center",children:e.jsx(ju,{className:"h-5 w-5 text-pink-600"})}),e.jsxs("div",{children:[e.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:["Instagram",t?M.length>0?e.jsx(bt,{variant:"default",className:"text-xs bg-green-600",children:"Connected"}):null:e.jsxs(bt,{variant:"secondary",className:"text-xs gap-1",children:[e.jsx(ku,{className:"h-3 w-3"}),"Coming Soon"]})]}),e.jsx(Ss,{children:"Connect Instagram Business accounts to schedule and publish posts."})]})]})}),t&&e.jsxs(qe,{className:"space-y-3",children:[M.length>0&&e.jsx("div",{className:"space-y-2",children:M.map(F=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(ln,{className:"h-8 w-8",children:[e.jsx(pa,{src:F.profile_picture_url||""}),e.jsx(cn,{children:e.jsx(ju,{className:"h-4 w-4"})})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"font-medium text-sm",children:["@",F.platform_username||"Instagram Account"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected Instagram account"})]})]}),e.jsxs(Xc,{children:[e.jsx(xm,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:e.jsx(Rs,{className:"h-4 w-4"})})}),e.jsxs(Tc,{children:[e.jsxs(Ac,{children:[e.jsx(Ic,{children:"Disconnect Instagram?"}),e.jsx(Pc,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),e.jsxs(Ec,{children:[e.jsx(Lc,{children:"Cancel"}),e.jsx(dc,{onClick:()=>j.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}),e.jsxs(Q,{onClick:v,disabled:a,variant:"outline",className:"gap-2",children:[a?e.jsx(Ko,{className:"h-4 w-4 animate-spin"}):e.jsx(gs,{className:"h-4 w-4"}),"Connect Instagram Business"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Instagram Business accounts must be connected to a Facebook Page."})]})]}),e.jsxs(ze,{className:t?"":"opacity-70",children:[e.jsx(Wt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-blue-700/10 flex items-center justify-center",children:e.jsx(km,{className:"h-5 w-5 text-blue-700"})}),e.jsxs("div",{children:[e.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:["LinkedIn",t?I.length>0?e.jsx(bt,{variant:"default",className:"text-xs bg-green-600",children:"Connected"}):null:e.jsxs(bt,{variant:"secondary",className:"text-xs gap-1",children:[e.jsx(ku,{className:"h-3 w-3"}),"Coming Soon"]})]}),e.jsx(Ss,{children:"Connect your LinkedIn profile to share content and grow your professional network."})]})]})}),t&&e.jsxs(qe,{className:"space-y-3",children:[I.length>0&&e.jsx("div",{className:"space-y-2",children:I.map(F=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(ln,{className:"h-8 w-8",children:[e.jsx(pa,{src:F.profile_picture_url||""}),e.jsx(cn,{children:e.jsx(km,{className:"h-4 w-4"})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:F.platform_username||"LinkedIn Account"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected LinkedIn profile"})]})]}),e.jsxs(Xc,{children:[e.jsx(xm,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:e.jsx(Rs,{className:"h-4 w-4"})})}),e.jsxs(Tc,{children:[e.jsxs(Ac,{children:[e.jsx(Ic,{children:"Disconnect LinkedIn?"}),e.jsx(Pc,{children:"This will remove your LinkedIn connection. You'll need to reconnect to post content."})]}),e.jsxs(Ec,{children:[e.jsx(Lc,{children:"Cancel"}),e.jsx(dc,{onClick:()=>j.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}),e.jsxs(Q,{onClick:b,disabled:l,variant:"outline",className:"gap-2",children:[l?e.jsx(Ko,{className:"h-4 w-4 animate-spin"}):e.jsx(gs,{className:"h-4 w-4"}),"Connect LinkedIn"]})]})]})]})})}function Oer(){const[t]=Bc(),r=Ws(),[s,n]=E.useState("loading"),[a,o]=E.useState("Connecting your Gmail account...");return E.useEffect(()=>{(async()=>{const i=t.get("code"),d=t.get("error"),m=t.get("error_description"),g=t.get("state");if(d){n("error"),o(m||"Authorization was denied"),Se.error("Connection failed: "+(m||d));return}if(!i){n("error"),o("No authorization code received"),Se.error("No authorization code received");return}try{const{data:y,error:v}=await Z.functions.invoke("gmail-oauth",{body:{action:"exchange_code",code:i,state:g}});if(v)throw v;if(y!=null&&y.success)n("success"),o(y.message||"Gmail connected successfully!"),Se.success("Gmail connected!");else throw new Error((y==null?void 0:y.error)||"Unknown error")}catch(y){console.error("Gmail OAuth callback error:",y),n("error"),o(y instanceof Error?y.message:"Failed to connect Gmail"),Se.error("Failed to connect: "+(y instanceof Error?y.message:"Unknown error"))}})()},[t]),e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs(ze,{className:"w-full max-w-md",children:[e.jsxs(Wt,{className:"text-center",children:[s==="loading"&&e.jsx(Hr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),s==="success"&&e.jsx(ui,{className:"h-12 w-12 mx-auto text-green-500"}),s==="error"&&e.jsx(Sc,{className:"h-12 w-12 mx-auto text-destructive"}),e.jsxs(Zt,{className:"mt-4",children:[s==="loading"&&"Connecting...",s==="success"&&"Connected!",s==="error"&&"Connection Failed"]}),e.jsx(Ss,{children:a})]}),e.jsx(qe,{className:"flex justify-center",children:s!=="loading"&&e.jsx(Q,{onClick:()=>r("/mission-control/integrations"),children:s==="success"?"Back to Integrations":"Try Again"})})]})})}function Der(){const t=Ws();return E.useEffect(()=>{const r=setTimeout(()=>{t("/mission-control/integrations",{replace:!0})},1500);return()=>clearTimeout(r)},[t]),e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx("div",{className:"h-10 w-10 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Finishing Canva connection…"})]})})}function Rer(){const[t]=Bc(),r=Ws(),[s,n]=E.useState("loading"),[a,o]=E.useState("Processing your connection...");return E.useEffect(()=>{(async()=>{var y;const i=t.get("code"),d=t.get("error"),m=t.get("error_description"),g=t.get("state");if(d){n("error"),o(m||"Authorization was denied"),Se.error("Connection failed: "+(m||d));return}if(!i){n("error"),o("No authorization code received"),Se.error("No authorization code received");return}try{const{data:v,error:b}=await Z.functions.invoke("meta-oauth",{body:{action:"exchange_code",code:i,state:g,callbackPath:"/mission-control/integrations/meta/callback"}});if(b)throw b;if(v!=null&&v.success)n("success"),o(`Successfully connected ${((y=v.accounts)==null?void 0:y.length)||0} account(s)!`),Se.success("Social accounts connected successfully!");else throw new Error((v==null?void 0:v.error)||"Unknown error")}catch(v){console.error("OAuth callback error:",v),n("error"),o(v instanceof Error?v.message:"Failed to connect accounts"),Se.error("Failed to connect: "+(v instanceof Error?v.message:"Unknown error"))}})()},[t]),e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs(ze,{className:"w-full max-w-md",children:[e.jsxs(Wt,{className:"text-center",children:[s==="loading"&&e.jsx(Hr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),s==="success"&&e.jsx(ui,{className:"h-12 w-12 mx-auto text-green-500"}),s==="error"&&e.jsx(Sc,{className:"h-12 w-12 mx-auto text-destructive"}),e.jsxs(Zt,{className:"mt-4",children:[s==="loading"&&"Connecting...",s==="success"&&"Connected!",s==="error"&&"Connection Failed"]}),e.jsx(Ss,{children:a})]}),e.jsx(qe,{className:"flex justify-center",children:s!=="loading"&&e.jsx(Q,{onClick:()=>r("/mission-control/integrations"),children:s==="success"?"View Integrations":"Try Again"})})]})})}const fHe=new Date().getFullYear(),Fer=Array.from({length:5},(t,r)=>fHe-r);function zer(){const[t,r]=E.useState(fHe),s=Ws(),{data:n,isLoading:a}=ryt();return a?e.jsx(Fr,{title:"Scorecard Admin",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(fr,{className:"h-8 w-64"}),e.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4].map(o=>e.jsx(fr,{className:"h-24"},o))}),e.jsx(fr,{className:"h-96"})]})}):e.jsx(Fr,{title:"Scorecard Admin",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Scorecard Admin"}),e.jsx("p",{className:"text-muted-foreground",children:"View agent performance and scorecards"})]}),e.jsxs(ds,{value:String(t),onValueChange:o=>r(Number(o)),children:[e.jsx(ls,{className:"w-[120px]",children:e.jsx(us,{})}),e.jsx(cs,{children:Fer.map(o=>e.jsx(Ut,{value:String(o),children:o},o))})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(ws,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs font-medium",children:"Agents Tracking"})]}),e.jsx("p",{className:"text-2xl font-bold",children:(n==null?void 0:n.length)||0})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(Nc,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs font-medium",children:"Total Agents"})]}),e.jsx("p",{className:"text-2xl font-bold",children:(n==null?void 0:n.length)||0}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"with transactions"})]})})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsx(Zt,{children:"Agents with Scorecards"}),e.jsx(Ss,{children:"Click to view individual agent scorecards"})]}),e.jsx(qe,{children:!n||n.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(Nc,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"No agents have added transactions yet"})]}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Agent"}),e.jsx(Ct,{children:"Email"}),e.jsx(Ct,{className:"text-right",children:"Actions"})]})}),e.jsx(zn,{children:n.map(o=>e.jsxs(Nr,{children:[e.jsx(dt,{className:"font-medium",children:o.name}),e.jsx(dt,{className:"text-muted-foreground",children:o.email}),e.jsx(dt,{className:"text-right",children:e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>s(`/admin/scorecard/${o.id}`),children:[e.jsx(Gi,{className:"h-4 w-4 mr-2"}),"View Scorecard"]})})]},o.id))})]})})]})]})})}const gHe=new Date().getFullYear(),Ber=Array.from({length:10},(t,r)=>gHe-r);function $er(){var v;const{userId:t}=Xl(),r=Ws(),[s,n]=E.useState(gHe),{data:a,isLoading:o}=Ht({queryKey:["agent-profile",t],queryFn:async()=>{const{data:b,error:N}=await Z.from("profiles").select("id, name, email").eq("id",t).single();if(N)throw N;return b},enabled:!!t}),{data:l,isLoading:i}=Gye(s,t),{yearStats:d,lifetimeStats:m,showCommission:g}=oFe(s,t),{data:y}=iFe(s,t);return o?e.jsx(Fr,{title:"Agent Scorecard",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(fr,{className:"h-8 w-64"}),e.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4].map(b=>e.jsx(fr,{className:"h-24"},b))})]})}):e.jsx(Fr,{title:`${a==null?void 0:a.name}'s Scorecard`,children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>r("/admin/scorecard"),children:e.jsx(_i,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:a==null?void 0:a.name}),e.jsx("p",{className:"text-muted-foreground",children:a==null?void 0:a.email})]})]}),e.jsxs(ds,{value:String(s),onValueChange:b=>n(Number(b)),children:[e.jsx(ls,{className:"w-[120px]",children:e.jsx(us,{})}),e.jsx(cs,{children:Ber.map(b=>e.jsx(Ut,{value:String(b),children:b},b))})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-4",children:[e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(Wn,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs font-medium",children:"Transactions"})]}),e.jsx("p",{className:"text-2xl font-bold",children:d.totalTransactions}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[m.totalTransactions," lifetime"]})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(ws,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs font-medium",children:"Buyer/Seller"})]}),e.jsxs("p",{className:"text-2xl font-bold",children:[d.buyerCount,"/",d.sellerCount]})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(yd,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs font-medium",children:"Volume"})]}),e.jsx("p",{className:"text-2xl font-bold",children:ru(d.totalVolume,!0)})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(ou,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs font-medium",children:"Avg Price"})]}),e.jsx("p",{className:"text-2xl font-bold",children:ru(d.averagePrice,!0)})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(ql,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs font-medium",children:"Top Source"})]}),e.jsx("p",{className:"text-lg font-bold truncate",children:((v=d.topLeadSource)==null?void 0:v.name)||"-"})]})})]}),y&&e.jsx(QBe,{goals:y,stats:d,year:s,showCommission:g}),e.jsxs(ci,{defaultValue:"transactions",className:"space-y-4",children:[e.jsxs(ri,{children:[e.jsx(Kr,{value:"transactions",children:"Transactions"}),e.jsx(Kr,{value:"charts",children:"Charts"}),e.jsxs(Kr,{value:"map",children:[e.jsx(eo,{className:"h-4 w-4 mr-1"}),"Map"]})]}),e.jsx(ms,{value:"transactions",children:e.jsx(XBe,{transactions:l||[],showCommission:g,isLoading:i})}),e.jsx(ms,{value:"charts",children:e.jsx(UVe,{stats:d,year:s})}),e.jsx(ms,{value:"map",children:e.jsx(qVe,{transactions:l||[],isLoading:i})})]})]})})}function Uer(){const t=qr(),[r,s]=E.useState(""),[n,a]=E.useState("all");bDe();const{data:o,refetch:l}=Ht({queryKey:["listing-exchange-flag"],queryFn:async()=>{const{data:M}=await Z.from("feature_flags").select("enabled").eq("key","listing_exchange_enabled").single();return(M==null?void 0:M.enabled)??!1}}),{data:i,isLoading:d}=Ht({queryKey:["admin-listings"],queryFn:async()=>{const{data:M,error:I}=await Z.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 M}}),{data:m}=Ht({queryKey:["admin-listing-stats"],queryFn:async()=>{const{data:M}=await Z.from("listings").select("id, is_approved, status"),{data:I}=await Z.from("listing_shares").select("id"),{data:F}=await Z.from("listing_views").select("id");return{total:(M==null?void 0:M.length)||0,pending:(M==null?void 0:M.filter(O=>!O.is_approved).length)||0,active:(M==null?void 0:M.filter(O=>O.status==="active").length)||0,totalShares:(I==null?void 0:I.length)||0,totalViews:(F==null?void 0:F.length)||0}}}),g=Jt({mutationFn:async({id:M,approved:I})=>{const{error:F}=await Z.from("listings").update({is_approved:I}).eq("id",M);if(F)throw F},onSuccess:(M,{approved:I})=>{t.invalidateQueries({queryKey:["admin-listings"]}),t.invalidateQueries({queryKey:["admin-listing-stats"]}),Se.success(I?"Listing approved":"Listing unapproved")}}),y=Jt({mutationFn:async({id:M,featured:I})=>{const{error:F}=await Z.from("listings").update({is_featured:I}).eq("id",M);if(F)throw F},onSuccess:(M,{featured:I})=>{t.invalidateQueries({queryKey:["admin-listings"]}),Se.success(I?"Listing featured":"Listing unfeatured")}}),v=Jt({mutationFn:async M=>{const{error:I}=await Z.from("listings").delete().eq("id",M);if(I)throw I},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-listings"]}),t.invalidateQueries({queryKey:["admin-listing-stats"]}),Se.success("Listing deleted")}}),b=Jt({mutationFn:async M=>{const{error:I}=await Z.from("feature_flags").update({enabled:M}).eq("key","listing_exchange_enabled");if(I)throw I},onSuccess:()=>{l(),Se.success("Feature flag updated")}}),N=o??!1,j=i==null?void 0:i.filter(M=>{var O,B,$,H;const I=((O=M.city)==null?void 0:O.toLowerCase().includes(r.toLowerCase()))||(($=(B=M.agent)==null?void 0:B.name)==null?void 0:$.toLowerCase().includes(r.toLowerCase()))||((H=M.property_address)==null?void 0:H.toLowerCase().includes(r.toLowerCase())),F=n==="all"||n==="pending"&&!M.is_approved||n==="approved"&&M.is_approved;return I&&F}),S=M=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(M),A=M=>{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[M]||I.active};return e.jsx(Fr,{title:"Listing Exchange Admin",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Listing Exchange"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage community listings"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Feature visible to agents"}),e.jsx(xn,{checked:N,onCheckedChange:M=>b.mutate(M)})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[e.jsx(ze,{children:e.jsxs(qe,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(bi,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Listings"})]}),e.jsx("p",{className:"text-2xl font-bold mt-1",children:(m==null?void 0:m.total)||0})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ou,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Active"})]}),e.jsx("p",{className:"text-2xl font-bold mt-1",children:(m==null?void 0:m.active)||0})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ws,{className:"h-4 w-4 text-amber-500"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Pending Review"})]}),e.jsx("p",{className:"text-2xl font-bold mt-1",children:(m==null?void 0:m.pending)||0})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Gi,{className:"h-4 w-4 text-blue-500"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Views"})]}),e.jsx("p",{className:"text-2xl font-bold mt-1",children:(m==null?void 0:m.totalViews)||0})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Oc,{className:"h-4 w-4 text-purple-500"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Shares"})]}),e.jsx("p",{className:"text-2xl font-bold mt-1",children:(m==null?void 0:m.totalShares)||0})]})})]}),e.jsx(ze,{children:e.jsx(qe,{className:"p-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search by city, address, or agent...",value:r,onChange:M=>s(M.target.value),className:"pl-9"})]}),e.jsx(ci,{value:n,onValueChange:M=>a(M),children:e.jsxs(ri,{children:[e.jsx(Kr,{value:"all",children:"All"}),e.jsx(Kr,{value:"pending",children:"Pending"}),e.jsx(Kr,{value:"approved",children:"Approved"})]})})]})})}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{children:["Listings (",(j==null?void 0:j.length)||0,")"]})}),e.jsx(qe,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Property"}),e.jsx(Ct,{children:"Agent"}),e.jsx(Ct,{children:"Price"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{className:"text-center",children:"Approved"}),e.jsx(Ct,{className:"text-center",children:"Featured"}),e.jsx(Ct,{children:"Views"}),e.jsx(Ct,{children:"Shares"}),e.jsx(Ct,{children:"Date"}),e.jsx(Ct,{})]})}),e.jsx(zn,{children:d?e.jsx(Nr,{children:e.jsx(dt,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:"Loading..."})}):(j==null?void 0:j.length)===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:"No listings found"})}):j==null?void 0:j.map(M=>{var I,F,O,B,$;return e.jsxs(Nr,{children:[e.jsx(dt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[(F=(I=M.photos)==null?void 0:I[0])!=null&&F.photo_url?e.jsx("img",{src:M.photos[0].photo_url,alt:"",className:"w-12 h-12 object-cover rounded"}):e.jsx("div",{className:"w-12 h-12 bg-muted rounded flex items-center justify-center",children:e.jsx(bi,{className:"h-5 w-5 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:M.property_address||`${M.city}, ${M.state}`}),e.jsx("p",{className:"text-xs text-muted-foreground",children:(O=M.property_type)==null?void 0:O.replace("_"," ")})]})]})}),e.jsx(dt,{children:e.jsx("p",{className:"text-sm",children:((B=M.agent)==null?void 0:B.name)||"Unknown"})}),e.jsx(dt,{className:"font-medium",children:S(M.price)}),e.jsx(dt,{children:e.jsx(bt,{variant:"outline",className:A(M.status),children:($=M.status)==null?void 0:$.replace("_"," ")})}),e.jsx(dt,{className:"text-center",children:e.jsx(xn,{checked:M.is_approved??!1,onCheckedChange:H=>g.mutate({id:M.id,approved:H})})}),e.jsx(dt,{className:"text-center",children:e.jsx(xn,{checked:M.is_featured??!1,onCheckedChange:H=>y.mutate({id:M.id,featured:H})})}),e.jsx(dt,{children:M.view_count||0}),e.jsx(dt,{children:M.share_count||0}),e.jsx(dt,{className:"text-sm text-muted-foreground",children:Xr(new Date(M.created_at),"MMM d, yyyy")}),e.jsx(dt,{children:e.jsxs(mh,{children:[e.jsx(ph,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"icon",children:e.jsx(kf,{className:"h-4 w-4"})})}),e.jsxs(Au,{align:"end",children:[e.jsxs(Ba,{onClick:()=>window.open(`/mission-control/listings/${M.id}`,"_blank"),children:[e.jsx(Gi,{className:"h-4 w-4 mr-2"}),"View Listing"]}),e.jsxs(Ba,{onClick:()=>y.mutate({id:M.id,featured:!M.is_featured}),children:[e.jsx(Ln,{className:"h-4 w-4 mr-2"}),M.is_featured?"Unfeature":"Feature"]}),e.jsxs(Ba,{className:"text-destructive",onClick:()=>{confirm("Are you sure you want to delete this listing?")&&v.mutate(M.id)},children:[e.jsx(rn,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},M.id)})})]})})})]})]})})}const qer=()=>{var y,v;const[t,r]=E.useState(""),[s,n]=E.useState(null),{data:a,isLoading:o}=Ht({queryKey:["membership-reviews"],queryFn:async()=>{const{data:b,error:N}=await Z.from("membership_reviews").select("*").order("created_at",{ascending:!1});if(N)throw N;const j=(b==null?void 0:b.map(M=>M.user_id))||[],{data:S}=await Z.from("profiles").select("id, name, email").in("id",j);return b==null?void 0:b.map(M=>({...M,profiles:(S==null?void 0:S.find(I=>I.id===M.user_id))||null}))}}),l=a==null?void 0:a.filter(b=>{var j,S,A,M,I;const N=t.toLowerCase();return((S=(j=b.profiles)==null?void 0:j.name)==null?void 0:S.toLowerCase().includes(N))||((M=(A=b.profiles)==null?void 0:A.email)==null?void 0:M.toLowerCase().includes(N))||((I=b.review_text)==null?void 0:I.toLowerCase().includes(N))}),i=a!=null&&a.length?(a.reduce((b,N)=>b+N.rating,0)/a.length).toFixed(1):"0.0",d=a==null?void 0:a.reduce((b,N)=>(b[N.rating]=(b[N.rating]||0)+1,b),{}),m=(a==null?void 0:a.filter(b=>b.posted_to_google).length)||0,g=b=>e.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(N=>e.jsx(Ln,{className:qt("h-4 w-4",b>=N?"fill-yellow-400 text-yellow-400":"text-muted-foreground")},N))});return e.jsx(Fr,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(Lu,{title:"Membership Reviews",description:"View and manage feedback from LevelUp members"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[e.jsx(ze,{children:e.jsxs(Wt,{className:"pb-2",children:[e.jsx(Ss,{children:"Total Reviews"}),e.jsx(Zt,{className:"text-3xl",children:(a==null?void 0:a.length)||0})]})}),e.jsx(ze,{children:e.jsxs(Wt,{className:"pb-2",children:[e.jsx(Ss,{children:"Average Rating"}),e.jsxs(Zt,{className:"flex items-center gap-2 text-3xl",children:[i,e.jsx(Ln,{className:"h-6 w-6 fill-yellow-400 text-yellow-400"})]})]})}),e.jsx(ze,{children:e.jsxs(Wt,{className:"pb-2",children:[e.jsx(Ss,{children:"5-Star Reviews"}),e.jsx(Zt,{className:"text-3xl",children:(d==null?void 0:d[5])||0})]})}),e.jsx(ze,{children:e.jsxs(Wt,{className:"pb-2",children:[e.jsx(Ss,{children:"Posted to Google"}),e.jsxs(Zt,{className:"flex items-center gap-2 text-3xl",children:[m,e.jsx(En,{className:"h-5 w-5 text-muted-foreground"})]})]})})]}),e.jsxs("div",{className:"relative max-w-sm",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search by name, email, or review...",value:t,onChange:b=>r(b.target.value),className:"pl-9"})]}),e.jsx(ze,{children:e.jsx(qe,{className:"p-0",children:e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Member"}),e.jsx(Ct,{children:"Rating"}),e.jsx(Ct,{className:"hidden md:table-cell",children:"Review"}),e.jsx(Ct,{children:"Google"}),e.jsx(Ct,{children:"Date"})]})}),e.jsx(zn,{children:o?e.jsx(Nr,{children:e.jsx(dt,{colSpan:5,className:"text-center py-8",children:"Loading reviews..."})}):(l==null?void 0:l.length)===0?e.jsx(Nr,{children:e.jsx(dt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No reviews found"})}):l==null?void 0:l.map(b=>{var N,j;return e.jsxs(Nr,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>n(b),children:[e.jsx(dt,{children:e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:((N=b.profiles)==null?void 0:N.name)||"Unknown"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:(j=b.profiles)==null?void 0:j.email})]})}),e.jsx(dt,{children:g(b.rating)}),e.jsx(dt,{className:"hidden md:table-cell max-w-xs",children:e.jsx("p",{className:"truncate text-sm text-muted-foreground",children:b.review_text||"-"})}),e.jsx(dt,{children:b.posted_to_google?e.jsx(bt,{variant:"secondary",className:"bg-green-100 text-green-800",children:"Posted"}):e.jsx(bt,{variant:"outline",children:"No"})}),e.jsx(dt,{className:"text-sm text-muted-foreground",children:Xr(new Date(b.created_at),"MMM d, yyyy")})]},b.id)})})]})})}),e.jsx(Dr,{open:!!s,onOpenChange:()=>n(null),children:e.jsxs(Lr,{className:"max-w-lg",children:[e.jsx(Ur,{children:e.jsx(Br,{children:"Review Details"})}),s&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-4 p-4 bg-muted/50 rounded-lg",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-semibold text-lg",children:((y=s.profiles)==null?void 0:y.name)||"Unknown Member"}),((v=s.profiles)==null?void 0:v.email)&&e.jsxs("a",{href:`mailto:${s.profiles.email}`,className:"flex items-center gap-1 text-sm text-muted-foreground hover:text-primary",children:[e.jsx(mn,{className:"h-3 w-3"}),s.profiles.email]})]}),e.jsxs("div",{className:"text-right",children:[g(s.rating),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[s.rating," out of 5 stars"]})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium mb-2",children:"Review"}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:s.review_text||"No written review provided."})]}),e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Mn,{className:"h-4 w-4"}),Xr(new Date(s.created_at),"MMMM d, yyyy 'at' h:mm a")]}),s.posted_to_google?e.jsxs(bt,{variant:"secondary",className:"bg-green-100 text-green-800",children:[e.jsx(En,{className:"h-3 w-3 mr-1"}),"Posted to Google"]}):e.jsx(bt,{variant:"outline",children:"Not posted to Google"})]})]})]})})]})})},Ver=[{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"}],Her=Array.from({length:24},(t,r)=>({value:String(r),label:r===0?"12:00 AM":r<12?`${r}:00 AM`:r===12?"12:00 PM":`${r-12}:00 PM`}));function Wer(){const t=qr(),{user:r}=Gr(),[s,n]=E.useState(!1),[a,o]=E.useState(!1),[l,i]=E.useState(!1),{data:d,isLoading:m}=Ht({queryKey:["weekly-digest-settings"],queryFn:async()=>{const{data:H,error:W}=await Z.from("weekly_digest_settings").select("*").single();if(W)throw W;return H}}),{data:g,isLoading:y}=Ht({queryKey:["weekly-digest-logs"],queryFn:async()=>{const{data:H,error:W}=await Z.from("weekly_digest_logs").select("*").order("sent_at",{ascending:!1}).limit(100);if(W)throw W;return H}}),{data:v}=Ht({queryKey:["digest-subscriber-count"],queryFn:async()=>{const{count:H,error:W}=await Z.from("profiles").select("id",{count:"exact",head:!0}).eq("digest_opt_out",!1).not("email","is",null);if(W)throw W;return H||0}}),{data:b,refetch:N}=Ht({queryKey:["digest-queue-status"],queryFn:async()=>{const H=new Date;H.setUTCHours(0,0,0,0);const[W,X,se,ae]=await Promise.all([Z.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","pending").gte("created_at",H.toISOString()),Z.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","processing").gte("created_at",H.toISOString()),Z.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","sent").gte("created_at",H.toISOString()),Z.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","failed").gte("created_at",H.toISOString())]);return{pending:W.count||0,processing:X.count||0,sent:se.count||0,failed:ae.count||0,total:(W.count||0)+(X.count||0)+(se.count||0)+(ae.count||0)}},refetchInterval:5e3});E.useEffect(()=>{if(b&&(b.pending>0||b.processing>0)){const H=setInterval(()=>{N(),t.invalidateQueries({queryKey:["weekly-digest-logs"]}),t.invalidateQueries({queryKey:["digest-today-failed-count"]}),t.invalidateQueries({queryKey:["digest-today-missing-count"]})},5e3);return()=>clearInterval(H)}},[b,N,t]);const{data:j=0}=Ht({queryKey:["digest-today-failed-count"],queryFn:async()=>{const H=new Date;H.setUTCHours(0,0,0,0);const{count:W,error:X}=await Z.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","failed").gte("sent_at",H.toISOString());if(X)throw X;return W||0}}),S=Jt({mutationFn:async H=>{const{error:W}=await Z.from("weekly_digest_settings").update(H).eq("id",d==null?void 0:d.id);if(W)throw W},onSuccess:()=>{t.invalidateQueries({queryKey:["weekly-digest-settings"]}),Se.success("Settings updated")},onError:H=>{Se.error("Failed to update settings: "+H.message)}}),A=async()=>{n(!0);try{const{data:H,error:W}=await Z.functions.invoke("send-weekly-digest",{body:{manual:!0}});if(W)throw W;H.queued?Se.success(`${H.queued.toLocaleString()} emails queued! They'll be sent automatically (~80/minute).`):H.sent!==void 0&&Se.success(`Digest sent! ${H.sent} emails delivered, ${H.failed} failed`),N(),t.invalidateQueries({queryKey:["weekly-digest-logs"]})}catch(H){Se.error("Failed to send digest: "+H.message)}finally{n(!1)}},M=async()=>{var H,W,X,se,ae,le;if(!(r!=null&&r.email)){Se.error("No email found for your account");return}o(!0);try{const{data:ne,error:fe}=await Z.functions.invoke("send-weekly-digest",{body:{preview:!0,previewEmail:r.email}});if(fe)throw fe;const oe=ne==null?void 0:ne.resendId,de=ne==null?void 0:ne.resendDetails,ue=de==null?void 0:de.status,xe=((H=de==null?void 0:de.body)==null?void 0:H.status)||((X=(W=de==null?void 0:de.body)==null?void 0:W.data)==null?void 0:X.status),Te=((ae=(se=de==null?void 0:de.body)==null?void 0:se.error)==null?void 0:ae.message)||((le=de==null?void 0:de.body)==null?void 0:le.message);Se.success(oe?`Preview accepted by email provider (id: ${oe})${ue?`, status check: ${ue}`:""}${xe?`, provider: ${xe}`:""}${Te?` (${Te})`:""}. Check spam/promotions—delivery can take a few minutes.`:"Preview accepted by email provider. Check spam/promotions—delivery can take a few minutes.")}catch(ne){Se.error("Failed to send preview: "+ne.message)}finally{o(!1)}},I=async()=>{i(!0);try{const{data:H,error:W}=await Z.functions.invoke("send-weekly-digest",{body:{retryFailed:!0}});if(W)throw W;H.queued===0||H.sent===0&&H.failed===0&&!H.queued?Se.info("No failed emails to retry"):H.queued?Se.success(`${H.queued} emails queued for retry!`):Se.success(`Retry complete! ${H.sent} emails delivered, ${H.failed} failed`),N(),t.invalidateQueries({queryKey:["weekly-digest-logs"]}),t.invalidateQueries({queryKey:["digest-today-failed-count"]}),t.invalidateQueries({queryKey:["digest-today-missing-count"]})}catch(H){Se.error("Failed to retry: "+H.message)}finally{i(!1)}},F=b!=null&&b.total?Math.round((b.sent+b.failed)/b.total*100):0,O=((b==null?void 0:b.pending)||0)>0||((b==null?void 0:b.processing)||0)>0,{data:B}=Ht({queryKey:["digest-delivery-stats"],queryFn:async()=>{var le,ne;const H=new Date;H.setUTCHours(0,0,0,0);const[W,X,se,ae]=await Promise.all([Z.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","sent").gte("sent_at",H.toISOString()),Z.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","failed").gte("sent_at",H.toISOString()),Z.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("has_agent_os_activity",!0).gte("sent_at",H.toISOString()),Z.from("weekly_digest_logs").select("sent_at").order("sent_at",{ascending:!1}).limit(1)]);return{totalSent:W.count||0,totalFailed:X.count||0,agentOsEngaged:se.count||0,lastSent:((ne=(le=ae.data)==null?void 0:le[0])==null?void 0:ne.sent_at)||null}},refetchInterval:O?5e3:!1}),$={totalSent:(B==null?void 0:B.totalSent)||0,totalFailed:(B==null?void 0:B.totalFailed)||0,lastSent:B==null?void 0:B.lastSent,agentOsEngaged:(B==null?void 0:B.agentOsEngaged)||0};return m?e.jsx(Fr,{title:"Weekly Digest",description:"Manage automated weekly email digests",children:e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-32 bg-muted rounded-lg"}),e.jsx("div",{className:"h-64 bg-muted rounded-lg"})]})}):e.jsx(Fr,{title:"Weekly Digest",description:"Configure and manage automated weekly email digests for members",children:e.jsxs(ci,{defaultValue:"settings",className:"space-y-6",children:[e.jsxs(ri,{children:[e.jsxs(Kr,{value:"settings",className:"flex items-center gap-2",children:[e.jsx(vd,{className:"h-4 w-4"}),"Settings"]}),e.jsxs(Kr,{value:"stats",className:"flex items-center gap-2",children:[e.jsx(Nc,{className:"h-4 w-4"}),"Delivery Stats"]})]}),e.jsxs(ms,{value:"settings",className:"space-y-6",children:[O&&b&&e.jsx(ze,{className:"border-primary/50 bg-primary/5",children:e.jsxs(qe,{className:"pt-6",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[e.jsx(Hr,{className:"h-5 w-5 animate-spin text-primary"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium",children:"Sending emails..."}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[b.sent.toLocaleString()," sent, ",b.pending.toLocaleString()," pending",b.failed>0&&`, ${b.failed} failed`]})]}),e.jsxs("span",{className:"text-sm font-medium",children:[F,"%"]})]}),e.jsx(hc,{value:F,className:"h-2"}),e.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"]})]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsx(ze,{children:e.jsx(qe,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"p-3 rounded-full bg-primary/10",children:e.jsx(ws,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:v}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Subscribers"})]})]})})}),e.jsx(ze,{children:e.jsx(qe,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"p-3 rounded-full bg-emerald-500/10",children:e.jsx(Li,{className:"h-5 w-5 text-emerald-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:$.totalSent}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Delivered"})]})]})})}),e.jsx(ze,{children:e.jsx(qe,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"p-3 rounded-full bg-destructive/10",children:e.jsx(Sc,{className:"h-5 w-5 text-destructive"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:$.totalFailed}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed"})]})]})})}),e.jsx(ze,{children:e.jsx(qe,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"p-3 rounded-full bg-primary/10",children:e.jsx(Ea,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:$.lastSent?Xr(new Date($.lastSent),"MMM d"):"Never"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Last Sent"})]})]})})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(Ea,{className:"h-5 w-5"}),"Schedule"]}),e.jsx(Ss,{children:"Configure when the digest is sent"})]}),e.jsxs(qe,{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Ee,{children:"Enable Weekly Digest"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Send automated weekly emails to members"})]}),e.jsx(xn,{checked:d==null?void 0:d.is_enabled,onCheckedChange:H=>S.mutate({is_enabled:H})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Cron Frequency"}),e.jsxs(ds,{value:(d==null?void 0:d.cron_frequency)||"daily",onValueChange:H=>S.mutate({cron_frequency:H}),children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"daily",children:"Daily (runs once at selected time)"}),e.jsx(Ut,{value:"hourly",children:"Hourly (checks every hour)"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:(d==null?void 0:d.cron_frequency)==="hourly"?"Cron runs every hour; digest sends when day & hour match.":"Cron runs once daily at the selected hour (UTC)."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Day of Week"}),e.jsxs(ds,{value:String(d==null?void 0:d.send_day),onValueChange:H=>S.mutate({send_day:parseInt(H)}),children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsx(cs,{children:Ver.map(H=>e.jsx(Ut,{value:H.value,children:H.label},H.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Time (UTC)"}),e.jsxs(ds,{value:String(d==null?void 0:d.send_hour),onValueChange:H=>S.mutate({send_hour:parseInt(H)}),disabled:(d==null?void 0:d.cron_frequency)==="daily",children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsx(cs,{children:Her.map(H=>e.jsx(Ut,{value:H.value,children:H.label},H.value))})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Q,{onClick:M,disabled:a,variant:"outline",className:"flex-1",children:[e.jsx(Gi,{className:"h-4 w-4 mr-2"}),a?"Sending...":"Send Preview to Me"]}),e.jsxs(Q,{onClick:A,disabled:s,className:"flex-1",children:[e.jsx(Mi,{className:"h-4 w-4 mr-2"}),s?"Sending...":"Send to All"]})]}),j>0&&e.jsxs(Q,{onClick:I,disabled:l,variant:"outline",className:"w-full",children:[e.jsx(Ko,{className:`h-4 w-4 mr-2 ${l?"animate-spin":""}`}),l?"Retrying...":`Retry ${j} Failed`]})]})]})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(fa,{className:"h-5 w-5"}),"Content Sections"]}),e.jsx(Ss,{children:"Choose what to include in the digest"})]}),e.jsxs(qe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fa,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(Ee,{children:"New Resources"})]}),e.jsx(xn,{checked:d==null?void 0:d.include_new_resources,onCheckedChange:H=>S.mutate({include_new_resources:H})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ws,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(Ee,{children:"Community Highlights"})]}),e.jsx(xn,{checked:d==null?void 0:d.include_community_posts,onCheckedChange:H=>S.mutate({include_community_posts:H})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Nc,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(Ee,{children:"Agent OS Stats"})]}),e.jsx(xn,{checked:d==null?void 0:d.include_agent_os_stats,onCheckedChange:H=>S.mutate({include_agent_os_stats:H})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Mn,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(Ee,{children:"Upcoming Events"})]}),e.jsx(xn,{checked:d==null?void 0:d.include_upcoming_events,onCheckedChange:H=>S.mutate({include_upcoming_events:H})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(bp,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(Ee,{children:"Goals Progress"})]}),e.jsx(xn,{checked:d==null?void 0:d.include_goals_progress,onCheckedChange:H=>S.mutate({include_goals_progress:H})})]})]})]})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsx(Zt,{children:"Custom Introduction"}),e.jsx(Ss,{children:"Personalize the intro message (optional)"})]}),e.jsx(qe,{children:e.jsx(Ks,{placeholder:"Here's what's new this week to help you grow your business...",value:(d==null?void 0:d.custom_intro_text)||"",onChange:H=>S.mutate({custom_intro_text:H.target.value||null}),rows:3})})]})]}),e.jsx(ms,{value:"stats",children:e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(mn,{className:"h-5 w-5"}),"Delivery History"]}),e.jsx(Ss,{children:"Recent digest emails sent to members"})]}),e.jsx(qe,{children:y?e.jsx("div",{className:"animate-pulse space-y-2",children:[1,2,3,4,5].map(H=>e.jsx("div",{className:"h-12 bg-muted rounded"},H))}):g&&g.length>0?e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Email"}),e.jsx(Ct,{children:"Sent At"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{children:"Resources"}),e.jsx(Ct,{children:"Agent OS"})]})}),e.jsx(zn,{children:g.map(H=>e.jsxs(Nr,{children:[e.jsx(dt,{className:"font-medium",children:H.email_sent_to}),e.jsx(dt,{children:Xr(new Date(H.sent_at),"MMM d, yyyy h:mm a")}),e.jsx(dt,{children:e.jsx(bt,{variant:H.delivery_status==="sent"?"default":"destructive",children:H.delivery_status})}),e.jsx(dt,{children:H.resources_count}),e.jsx(dt,{children:H.has_agent_os_activity?e.jsx(bt,{variant:"secondary",children:"Active"}):e.jsx(bt,{variant:"outline",children:"Not Started"})})]},H.id))})]}):e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(mn,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"No digests sent yet"}),e.jsx("p",{className:"text-sm",children:"Send your first digest to see delivery stats"})]})})]})})]})})}const Ger={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 Ker(){var we,ve,tt;const t=qr(),[r,s]=E.useState(""),[n,a]=E.useState(null),[o,l]=E.useState(!1),[i,d]=E.useState(!1),[m,g]=E.useState(""),[y,v]=E.useState(""),[b,N]=E.useState(!0),[j,S]=E.useState(!1),[A,M]=E.useState(""),[I,F]=E.useState(null),{data:O,isLoading:B}=Ht({queryKey:["admin-agent-points"],queryFn:async()=>{const{data:Ae,error:Le}=await Z.from("agent_attendance_stats").select("*").order("total_points",{ascending:!1});if(Le)throw Le;const Ue=(Ae==null?void 0:Ae.map(et=>et.user_id))||[],{data:Ye}=await Z.from("profiles").select("id, name, email").in("id",Ue),Ie=new Map((Ye==null?void 0:Ye.map(et=>[et.id,{name:et.name,email:et.email}]))||[]);return Ae==null?void 0:Ae.map(et=>({...et,profile:Ie.get(et.user_id)||null}))}}),{data:$}=Ht({queryKey:["all-profiles-for-points",O],queryFn:async()=>{const{data:Ae,error:Le}=await Z.from("profiles").select("id, name, email").order("name");if(Le)throw Le;return Ae}}),W=(($==null?void 0:$.filter(Ae=>!(O!=null&&O.some(Le=>Le.user_id===Ae.id))))||[]).filter(Ae=>{var Ue,Ye;if(!A)return!0;const Le=A.toLowerCase();return((Ue=Ae.name)==null?void 0:Ue.toLowerCase().includes(Le))||((Ye=Ae.email)==null?void 0:Ye.toLowerCase().includes(Le))}),{data:X,isLoading:se}=Ht({queryKey:["agent-point-history",n==null?void 0:n.user_id],queryFn:async()=>{if(!(n!=null&&n.user_id))return[];const{data:Ae,error:Le}=await Z.from("agent_points").select("*").eq("user_id",n.user_id).order("created_at",{ascending:!1});if(Le)throw Le;return Ae},enabled:!!(n!=null&&n.user_id)&&i}),{data:ae}=Ht({queryKey:["agent-badges",n==null?void 0:n.user_id],queryFn:async()=>{if(!(n!=null&&n.user_id))return[];const{data:Ae,error:Le}=await Z.from("agent_badges").select("*").eq("user_id",n.user_id).order("earned_at",{ascending:!1});if(Le)throw Le;return Ae},enabled:!!(n!=null&&n.user_id)}),le=Jt({mutationFn:async({userId:Ae,points:Le,reason:Ue})=>{const{error:Ye}=await Z.from("agent_points").insert({user_id:Ae,points:Le,reason:Ue});if(Ye)throw Ye;const{data:Ie}=await Z.from("agent_attendance_stats").select("total_points, spendable_points").eq("user_id",Ae).maybeSingle(),et=((Ie==null?void 0:Ie.total_points)||0)+Le,It=((Ie==null?void 0:Ie.spendable_points)||0)+Le,{error:Pe}=await Z.from("agent_attendance_stats").upsert({user_id:Ae,total_points:Math.max(0,et),spendable_points:Math.max(0,It),updated_at:new Date().toISOString()},{onConflict:"user_id"});if(Pe)throw Pe},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-agent-points"]}),t.invalidateQueries({queryKey:["agent-point-history"]}),l(!1),g(""),v(""),Se.success(b?"Points awarded successfully!":"Points deducted successfully!")},onError:Ae=>{console.error("Error modifying points:",Ae),Se.error("Failed to modify points")}}),ne=()=>{if(!n||!m||!y){Se.error("Please fill in all fields");return}const Ae=parseInt(m);if(isNaN(Ae)||Ae<=0){Se.error("Please enter a valid positive number");return}le.mutate({userId:n.user_id,points:b?Ae:-Ae,reason:y})},fe=()=>{if(!I||!m||!y){Se.error("Please fill in all fields");return}const Ae=parseInt(m);if(isNaN(Ae)||Ae<=0){Se.error("Please enter a valid positive number");return}le.mutate({userId:I.id,points:Ae,reason:y},{onSuccess:()=>{S(!1),F(null),M("")}})},oe=(Ae,Le)=>{a(Ae),N(Le),l(!0)},de=Ae=>{a(Ae),d(!0)},ue=O==null?void 0:O.filter(Ae=>{var Ie,et,It,Pe;const Le=((et=(Ie=Ae.profile)==null?void 0:Ie.name)==null?void 0:et.toLowerCase())||"",Ue=((Pe=(It=Ae.profile)==null?void 0:It.email)==null?void 0:Pe.toLowerCase())||"",Ye=r.toLowerCase();return Le.includes(Ye)||Ue.includes(Ye)}),xe=(O==null?void 0:O.reduce((Ae,Le)=>Ae+Le.total_points,0))||0,Te=(O==null?void 0:O.length)||0,be=Te>0?Math.round(xe/Te):0;return B?e.jsx(Fr,{title:"Agent Points",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(fr,{className:"h-8 w-64"}),e.jsx("div",{className:"grid grid-cols-3 gap-4",children:[1,2,3].map(Ae=>e.jsx(fr,{className:"h-24"},Ae))}),e.jsx(fr,{className:"h-96"})]})}):e.jsx(Fr,{title:"Agent Points",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Agent Points Management"}),e.jsx("p",{className:"text-muted-foreground",children:"Track, view, and manage agent gamification points"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(ws,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs font-medium",children:"Total Agents"})]}),e.jsx("p",{className:"text-2xl font-bold",children:Te}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"with points tracked"})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(ho,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs font-medium",children:"Total Points"})]}),e.jsx("p",{className:"text-2xl font-bold",children:xe.toLocaleString()}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"awarded across all agents"})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(ou,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs font-medium",children:"Average Points"})]}),e.jsx("p",{className:"text-2xl font-bold",children:be}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"per agent"})]})})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between",children:[e.jsxs("div",{className:"relative max-w-sm w-full",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search agents...",value:r,onChange:Ae=>s(Ae.target.value),className:"pl-10"})]}),e.jsxs(Q,{onClick:()=>S(!0),children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Award Points to New Agent"]})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsx(Zt,{children:"Agent Leaderboard"}),e.jsx(Ss,{children:"All agents with their points, events, and streaks"})]}),e.jsx(qe,{children:!ue||ue.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(ho,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"No agents with points yet"})]}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{className:"w-12",children:"#"}),e.jsx(Ct,{children:"Agent"}),e.jsx(Ct,{className:"text-center",children:"Total Points"}),e.jsx(Ct,{className:"text-center",children:"Spendable"}),e.jsx(Ct,{className:"text-center",children:"Events"}),e.jsx(Ct,{className:"text-center",children:"Streak"}),e.jsx(Ct,{className:"text-right",children:"Actions"})]})}),e.jsx(zn,{children:ue.map((Ae,Le)=>{var Ue,Ye,Ie,et;return e.jsxs(Nr,{children:[e.jsx(dt,{className:"font-medium",children:Le<3?e.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center ${Le===0?"bg-yellow-100 text-yellow-700":Le===1?"bg-gray-100 text-gray-600":"bg-amber-100 text-amber-700"}`,children:Le+1}):e.jsx("span",{className:"text-muted-foreground",children:Le+1})}),e.jsx(dt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ln,{className:"h-8 w-8",children:e.jsx(cn,{children:((Ye=(Ue=Ae.profile)==null?void 0:Ue.name)==null?void 0:Ye.charAt(0))||"?"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:((Ie=Ae.profile)==null?void 0:Ie.name)||"Unknown"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:(et=Ae.profile)==null?void 0:et.email})]})]})}),e.jsx(dt,{className:"text-center",children:e.jsxs(bt,{variant:"secondary",className:"font-bold",children:[e.jsx(Ln,{className:"h-3 w-3 mr-1"}),Ae.total_points]})}),e.jsx(dt,{className:"text-center",children:e.jsxs(bt,{variant:"outline",className:"font-bold text-primary",children:[e.jsx(uo,{className:"h-3 w-3 mr-1"}),Ae.spendable_points||0]})}),e.jsx(dt,{className:"text-center",children:e.jsxs("div",{className:"flex items-center justify-center gap-1",children:[e.jsx(Mn,{className:"h-3 w-3 text-muted-foreground"}),Ae.total_events_attended]})}),e.jsx(dt,{className:"text-center",children:e.jsxs("div",{className:"flex items-center justify-center gap-1",children:[e.jsx(_m,{className:"h-3 w-3 text-orange-500"}),Ae.current_streak]})}),e.jsx(dt,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>oe(Ae,!0),title:"Award points",children:e.jsx(gs,{className:"h-4 w-4 text-green-600"})}),e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>oe(Ae,!1),title:"Deduct points",children:e.jsx(Q1,{className:"h-4 w-4 text-red-600"})}),e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>de(Ae),title:"View history",children:e.jsx(BS,{className:"h-4 w-4"})})]})})]},Ae.user_id)})})]})})]}),e.jsx(Dr,{open:o,onOpenChange:l,children:e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:b?"Award Points":"Deduct Points"}),e.jsxs(Gs,{children:[b?"Award":"Deduct"," points ",b?"to":"from"," ",((we=n==null?void 0:n.profile)==null?void 0:we.name)||"this agent"]})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"points",children:"Points Amount"}),e.jsx(Qe,{id:"points",type:"number",min:"1",placeholder:"Enter points...",value:m,onChange:Ae=>g(Ae.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"reason",children:"Reason"}),e.jsx(Ks,{id:"reason",placeholder:"Enter reason for this adjustment...",value:y,onChange:Ae=>v(Ae.target.value)})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(Q,{onClick:ne,disabled:le.isPending,className:b?"bg-green-600 hover:bg-green-700":"bg-red-600 hover:bg-red-700",children:le.isPending?"Saving...":b?"Award Points":"Deduct Points"})]})]})}),e.jsx(Dr,{open:i,onOpenChange:d,children:e.jsxs(Lr,{className:"max-w-2xl",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{children:["Point History: ",(ve=n==null?void 0:n.profile)==null?void 0:ve.name]}),e.jsx(Gs,{children:"View all point transactions and badges for this agent"})]}),e.jsxs(ci,{defaultValue:"history",className:"w-full",children:[e.jsxs(ri,{className:"grid w-full grid-cols-2",children:[e.jsx(Kr,{value:"history",children:"Point History"}),e.jsx(Kr,{value:"badges",children:"Badges"})]}),e.jsx(ms,{value:"history",className:"mt-4",children:se?e.jsx("div",{className:"space-y-2",children:[1,2,3].map(Ae=>e.jsx(fr,{className:"h-12"},Ae))}):!X||X.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(BS,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"No point history yet"})]}):e.jsx("div",{className:"max-h-80 overflow-y-auto space-y-2",children:X.map(Ae=>e.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium",children:Ae.reason}),e.jsx("p",{className:"text-xs text-muted-foreground",children:Xr(new Date(Ae.created_at),"MMM d, yyyy h:mm a")})]}),e.jsxs(bt,{variant:Ae.points>=0?"default":"destructive",className:Ae.points>=0?"bg-green-100 text-green-800":"",children:[Ae.points>=0?"+":"",Ae.points]})]},Ae.id))})}),e.jsx(ms,{value:"badges",className:"mt-4",children:!ae||ae.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(ql,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"No badges earned yet"})]}):e.jsx("div",{className:"grid grid-cols-2 gap-3",children:ae.map(Ae=>e.jsxs("div",{className:`p-3 rounded-lg ${Ger[Ae.badge_type]||"bg-gray-100"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ql,{className:"h-5 w-5"}),e.jsx("span",{className:"font-medium",children:Ae.badge_name})]}),Ae.badge_description&&e.jsx("p",{className:"text-xs mt-1 opacity-80",children:Ae.badge_description}),e.jsxs("p",{className:"text-xs mt-1 opacity-60",children:["Earned ",Xr(new Date(Ae.earned_at),"MMM d, yyyy")]})]},Ae.id))})})]})]})}),e.jsx(Dr,{open:j,onOpenChange:Ae=>{S(Ae),Ae||(F(null),M(""),g(""),v(""))},children:e.jsxs(Lr,{className:"max-w-md",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Award Points to New Agent"}),e.jsx(Gs,{children:"Select an agent who doesn't have points yet and award them points"})]}),e.jsx("div",{className:"space-y-4 py-4",children:I?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[e.jsx(ln,{className:"h-10 w-10",children:e.jsx(cn,{children:((tt=I.name)==null?void 0:tt.charAt(0))||"?"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium",children:I.name||"Unknown"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:I.email})]}),e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>F(null),children:"Change"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"new-points",children:"Points Amount"}),e.jsx(Qe,{id:"new-points",type:"number",min:"1",placeholder:"Enter points...",value:m,onChange:Ae=>g(Ae.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"new-reason",children:"Reason"}),e.jsx(Ks,{id:"new-reason",placeholder:"Enter reason for awarding points...",value:y,onChange:Ae=>v(Ae.target.value)})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Search Agent"}),e.jsxs("div",{className:"relative",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search by name or email...",value:A,onChange:Ae=>M(Ae.target.value),className:"pl-10"})]})]}),e.jsx("div",{className:"max-h-60 overflow-y-auto border rounded-lg",children:W.length===0?e.jsxs("div",{className:"text-center py-4 text-muted-foreground",children:[e.jsx(ws,{className:"h-6 w-6 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:A?"No matching agents found":"All agents already have points"})]}):W.slice(0,20).map(Ae=>{var Le;return e.jsxs("button",{onClick:()=>F(Ae),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:[e.jsx(ln,{className:"h-8 w-8",children:e.jsx(cn,{children:((Le=Ae.name)==null?void 0:Le.charAt(0))||"?"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:Ae.name||"Unknown"}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Ae.email})]})]},Ae.id)})})]})}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),I&&e.jsxs(Q,{onClick:fe,disabled:le.isPending,className:"bg-green-600 hover:bg-green-700",children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Award Points"]})]})]})})]})})}function Zer(){const{data:t,isLoading:r}=odt(),[s,n]=E.useState(null),[a,o]=E.useState(!1),[l,i]=E.useState(""),[d,m]=E.useState("all"),[g,y]=E.useState("newest"),[v,b]=E.useState("table"),N=E.useMemo(()=>(t==null?void 0:t.map(I=>I.user_id))||[],[t]),j=E.useMemo(()=>(t==null?void 0:t.map(I=>I.id))||[],[t]),{data:S}=Ht({queryKey:["card-profiles-lookup",N],queryFn:async()=>{if(N.length===0)return{};const{data:I}=await Z.from("profiles").select("id, name, email").in("id",N),F={};return I==null||I.forEach(O=>{F[O.id]={name:O.name||"",email:O.email||""}}),F},enabled:N.length>0}),{data:A}=Ht({queryKey:["card-stats-all",j],queryFn:async()=>{if(j.length===0)return{};const I={};j.forEach(B=>{I[B]={views:0,leads:0}});const{data:F}=await Z.from("agent_card_interactions").select("card_id").in("card_id",j).eq("interaction_type","card_view");F==null||F.forEach(B=>{I[B.card_id]&&I[B.card_id].views++});const{data:O}=await Z.from("agent_card_leads").select("card_id").in("card_id",j);return O==null||O.forEach(B=>{I[B.card_id]&&I[B.card_id].leads++}),I},enabled:j.length>0}),M=E.useMemo(()=>{if(!t)return[];let I=[...t];if(d==="live"?I=I.filter(F=>F.is_published):d==="draft"&&(I=I.filter(F=>!F.is_published)),l.trim()){const F=l.toLowerCase();I=I.filter(O=>{var $,H;const B=S==null?void 0:S[O.user_id];return O.slug.toLowerCase().includes(F)||(($=B==null?void 0:B.name)==null?void 0:$.toLowerCase().includes(F))||((H=B==null?void 0:B.email)==null?void 0:H.toLowerCase().includes(F))})}return g==="newest"?I.sort((F,O)=>new Date(O.created_at).getTime()-new Date(F.created_at).getTime()):g==="oldest"?I.sort((F,O)=>new Date(F.created_at).getTime()-new Date(O.created_at).getTime()):g==="name"?I.sort((F,O)=>{var B,$;return(((B=S==null?void 0:S[F.user_id])==null?void 0:B.name)||"").localeCompare((($=S==null?void 0:S[O.user_id])==null?void 0:$.name)||"")}):g==="slug"?I.sort((F,O)=>F.slug.localeCompare(O.slug)):g==="views_desc"?I.sort((F,O)=>{var B,$;return(((B=A==null?void 0:A[O.id])==null?void 0:B.views)||0)-((($=A==null?void 0:A[F.id])==null?void 0:$.views)||0)}):g==="views_asc"?I.sort((F,O)=>{var B,$;return(((B=A==null?void 0:A[F.id])==null?void 0:B.views)||0)-((($=A==null?void 0:A[O.id])==null?void 0:$.views)||0)}):g==="leads_desc"?I.sort((F,O)=>{var B,$;return(((B=A==null?void 0:A[O.id])==null?void 0:B.leads)||0)-((($=A==null?void 0:A[F.id])==null?void 0:$.leads)||0)}):g==="leads_asc"&&I.sort((F,O)=>{var B,$;return(((B=A==null?void 0:A[F.id])==null?void 0:B.leads)||0)-((($=A==null?void 0:A[O.id])==null?void 0:$.leads)||0)}),I},[t,d,l,g,S]);return e.jsxs(Fr,{title:"Digital Agent Cards",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Digital Agent Cards"}),e.jsx("p",{className:"text-muted-foreground",children:"Create and manage agent digital business cards"})]}),e.jsxs(Q,{onClick:()=>o(!0),children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Create Card"]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search by name, email, or slug...",value:l,onChange:I=>i(I.target.value),className:"pl-9"})]}),e.jsxs(ds,{value:d,onValueChange:m,children:[e.jsx(ls,{className:"w-full sm:w-36",children:e.jsx(us,{placeholder:"Status"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"all",children:"All Status"}),e.jsx(Ut,{value:"live",children:"Live"}),e.jsx(Ut,{value:"draft",children:"Draft"})]})]}),e.jsxs(ds,{value:g,onValueChange:y,children:[e.jsx(ls,{className:"w-full sm:w-44",children:e.jsx(us,{placeholder:"Sort by"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"newest",children:"Newest First"}),e.jsx(Ut,{value:"oldest",children:"Oldest First"}),e.jsx(Ut,{value:"name",children:"Name A–Z"}),e.jsx(Ut,{value:"slug",children:"Slug A–Z"}),e.jsx(Ut,{value:"views_desc",children:"Most Views"}),e.jsx(Ut,{value:"views_asc",children:"Fewest Views"}),e.jsx(Ut,{value:"leads_desc",children:"Most Leads"}),e.jsx(Ut,{value:"leads_asc",children:"Fewest Leads"})]})]}),e.jsxs("div",{className:"flex border rounded-md",children:[e.jsx(Q,{variant:v==="table"?"default":"ghost",size:"sm",onClick:()=>b("table"),className:"rounded-r-none",children:e.jsx(YS,{className:"h-4 w-4"})}),e.jsx(Q,{variant:v==="grid"?"default":"ghost",size:"sm",onClick:()=>b("grid"),className:"rounded-l-none",children:e.jsx(yp,{className:"h-4 w-4"})})]})]}),!r&&t&&t.length>0&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",M.length," of ",t.length," cards"]}),r?e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(I=>e.jsx(fr,{className:"h-48"},I))}):M.length>0?v==="table"?e.jsx(Yer,{cards:M,cardProfiles:S,cardStats:A,onEdit:n,sortBy:g,setSortBy:y}):e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:M.map(I=>e.jsx(Xer,{card:I,onEdit:()=>n(I),stats:A==null?void 0:A[I.id]},I.id))}):t&&t.length>0?e.jsx(ze,{children:e.jsxs(qe,{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(Qn,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-1",children:"No matching cards"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Try adjusting your search or filters"})]})}):e.jsx(ze,{children:e.jsxs(qe,{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(ws,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-1",children:"No cards yet"}),e.jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Create your first digital agent card"}),e.jsxs(Q,{onClick:()=>o(!0),children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Create Card"]})]})})]}),e.jsx(Qer,{open:a,onOpenChange:o}),s&&e.jsx(Jer,{card:s,open:!!s,onOpenChange:I=>!I&&n(null)})]})}function Yer({cards:t,cardProfiles:r,cardStats:s,onEdit:n,sortBy:a,setSortBy:o}){const l=d=>{a===`${d}_desc`?o(`${d}_asc`):o(`${d}_desc`)},i=({field:d})=>a===`${d}_desc`?e.jsx(my,{className:"h-3 w-3"}):a===`${d}_asc`?e.jsx(fp,{className:"h-3 w-3"}):e.jsx(Of,{className:"h-3 w-3 opacity-40"});return e.jsx(ze,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b bg-muted/50",children:[e.jsx("th",{className:"text-left p-3 font-medium",children:e.jsxs("button",{onClick:()=>{o(a==="name"?"newest":"name")},className:"flex items-center gap-1 hover:text-foreground text-muted-foreground",children:["Agent ",a==="name"&&e.jsx(fp,{className:"h-3 w-3"})]})}),e.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground hidden md:table-cell",children:"Slug"}),e.jsx("th",{className:"text-center p-3 font-medium text-muted-foreground",children:"Status"}),e.jsx("th",{className:"text-right p-3 font-medium",children:e.jsxs("button",{onClick:()=>l("views"),className:"flex items-center gap-1 ml-auto hover:text-foreground text-muted-foreground",children:["Views ",e.jsx(i,{field:"views"})]})}),e.jsx("th",{className:"text-right p-3 font-medium",children:e.jsxs("button",{onClick:()=>l("leads"),className:"flex items-center gap-1 ml-auto hover:text-foreground text-muted-foreground",children:["Leads ",e.jsx(i,{field:"leads"})]})}),e.jsx("th",{className:"text-right p-3 font-medium text-muted-foreground",children:"Actions"})]})}),e.jsx("tbody",{children:t.map(d=>{const m=r==null?void 0:r[d.user_id],g=s==null?void 0:s[d.id],y=`https://cards.relevelup.com/${d.slug}`;return e.jsxs("tr",{className:"border-b last:border-0 hover:bg-muted/30 transition-colors",children:[e.jsx("td",{className:"p-3",children:e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:(m==null?void 0:m.name)||"Unknown"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:(m==null?void 0:m.email)||""})]})}),e.jsx("td",{className:"p-3 hidden md:table-cell",children:e.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:["/",d.slug]})}),e.jsx("td",{className:"p-3 text-center",children:e.jsx(bt,{variant:d.is_published?"default":"secondary",className:"text-xs",children:d.is_published?"Live":"Draft"})}),e.jsx("td",{className:"p-3 text-right tabular-nums font-medium",children:(g==null?void 0:g.views)??0}),e.jsx("td",{className:"p-3 text-right tabular-nums font-medium",children:(g==null?void 0:g.leads)??0}),e.jsx("td",{className:"p-3",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>n(d),className:"h-8 w-8 p-0",children:e.jsx(ei,{className:"h-3.5 w-3.5"})}),e.jsx(Q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{navigator.clipboard.writeText(y),Se.success("Link copied!")},children:e.jsx(fo,{className:"h-3.5 w-3.5"})}),e.jsx(Q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",asChild:!0,children:e.jsx("a",{href:y,target:"_blank",rel:"noopener noreferrer",children:e.jsx(En,{className:"h-3.5 w-3.5"})})})]})})]},d.id)})})]})})})}function Xer({card:t,onEdit:r,stats:s}){const[n,a]=E.useState(null);E.useEffect(()=>{(async()=>{const{data:d}=await Z.from("profiles").select("name").eq("id",t.user_id).single();let m=null;try{const{data:g}=await Z.storage.from("avatars").list(`${t.user_id}`);if(g&&g.length>0){const{data:y}=Z.storage.from("avatars").getPublicUrl(`${t.user_id}/${g[0].name}`);m=y.publicUrl}}catch{}a({name:(d==null?void 0:d.name)||"Unknown",avatar_url:m})})()},[t.user_id]);const o=`https://cards.relevelup.com/${t.slug}`,l=()=>{navigator.clipboard.writeText(o),Se.success("Link copied!")};return e.jsx(ze,{children:e.jsxs(qe,{className:"p-4",children:[e.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[e.jsxs(ln,{className:"h-10 w-10",children:[e.jsx(pa,{src:(n==null?void 0:n.avatar_url)||void 0}),e.jsx(cn,{children:((n==null?void 0:n.name)||"U")[0]})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-semibold truncate",children:(n==null?void 0:n.name)||"Loading..."}),e.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:["/card/",t.slug]})]}),e.jsx(bt,{variant:t.is_published?"default":"secondary",children:t.is_published?"Live":"Draft"})]}),e.jsxs("div",{className:"flex items-center gap-3 mb-3 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Gi,{className:"h-3.5 w-3.5"}),(s==null?void 0:s.views)??0," views"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ws,{className:"h-3.5 w-3.5"}),(s==null?void 0:s.leads)??0," leads"]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Q,{variant:"outline",size:"sm",onClick:r,className:"flex-1",children:[e.jsx(ei,{className:"h-3 w-3 mr-1"}),"Edit"]}),e.jsx(Q,{variant:"outline",size:"sm",onClick:l,children:e.jsx(fo,{className:"h-3 w-3"})}),e.jsx(Q,{variant:"outline",size:"sm",asChild:!0,children:e.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",children:e.jsx(En,{className:"h-3 w-3"})})})]})]})})}function Qer({open:t,onOpenChange:r}){const[s,n]=E.useState(""),[a,o]=E.useState(""),[l,i]=E.useState(""),[d,m]=E.useState(!1),g=qOe(),y=l.trim(),{data:v}=Ht({queryKey:["profiles-search-for-cards",y],queryFn:async()=>{let M=Z.from("profiles").select("id, name, email").order("name").limit(50);y.length>=2&&(M=M.or(`name.ilike.%${y}%,email.ilike.%${y}%`));const{data:I}=await M;return I||[]},enabled:t}),[b,N]=E.useState(null),j=(v==null?void 0:v.find(M=>M.id===s))||b,S=()=>{if(!s||!a.trim()){Se.error("Select an agent and enter a slug");return}g.mutate({user_id:s,slug:a.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-"),is_published:!0},{onSuccess:()=>{r(!1),n(""),o(""),i("")}})},A=M=>{var F;n(M),m(!1);const I=v==null?void 0:v.find(O=>O.id===M);I&&(N(I),o(((F=I.name)==null?void 0:F.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""))||""))};return e.jsx(Dr,{open:t,onOpenChange:r,children:e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Create Agent Card"}),e.jsx(Gs,{children:"Select an agent and set their card URL slug."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{children:"Agent"}),e.jsxs(rd,{open:d,onOpenChange:m,children:[e.jsx(sd,{asChild:!0,children:e.jsxs(Q,{variant:"outline",role:"combobox","aria-expanded":d,className:"w-full justify-between font-normal",children:[j?`${j.name} (${j.email})`:"Search for an agent...",e.jsx(fy,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Fc,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(Ry,{shouldFilter:!1,children:[e.jsx(Fy,{placeholder:"Search by name or email...",value:l,onValueChange:i}),e.jsxs(zy,{children:[e.jsx(By,{children:"No agents found."}),e.jsx($y,{children:(v||[]).map(M=>e.jsxs(Uy,{value:M.id,onSelect:A,children:[e.jsx(li,{className:qt("mr-2 h-4 w-4",s===M.id?"opacity-100":"opacity-0")}),M.name," (",M.email,")"]},M.id))})]})]})})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"URL Slug"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"/card/"}),e.jsx(Qe,{value:a,onChange:M=>o(M.target.value),placeholder:"john-doe"})]})]}),e.jsx(Q,{onClick:S,disabled:g.isPending,className:"w-full",children:g.isPending?"Creating...":"Create Card"})]})]})})}function Jer({card:t,open:r,onOpenChange:s}){const n=VOe(),{data:a}=HOe(t.id),o=qr(),[l,i]=E.useState(null),[d,m]=E.useState(!1),[g,y]=E.useState(!1),[v,b]=E.useState(""),[N,j]=E.useState(t.slug),[S,A]=E.useState(!1),[M,I]=E.useState({is_published:t.is_published,theme:t.theme,title:t.title||"",positioning_statement:t.positioning_statement||"",bio:t.bio||"",review_snippet:t.review_snippet||"",review_source_url:t.review_source_url||"",booking_url:t.booking_url||"",custom_cta_label:t.custom_cta_label||"",custom_cta_url:t.custom_cta_url||"",show_photo:t.show_photo,show_bio:t.show_bio,show_credentials:t.show_credentials,show_social_links:t.show_social_links,show_save_contact:t.show_save_contact,show_leave_review:t.show_leave_review,show_refer_friend:t.show_refer_friend,brokerage_display_name:t.brokerage_display_name||"",brokerage_logo_url:t.brokerage_logo_url||"",brokerage_logo_size:t.brokerage_logo_size||56,team_name:t.team_name||"",team_logo_url:t.team_logo_url||"",team_logo_size:t.team_logo_size||56});E.useEffect(()=>{r&&(async()=>{try{const{data:X}=await Z.storage.from("avatars").list(`${t.user_id}`);if(X&&X.length>0){const{data:se}=Z.storage.from("avatars").getPublicUrl(`${t.user_id}/${X[0].name}`);i(`${se.publicUrl}?t=${Date.now()}`)}}catch{}})()},[t.user_id,r]);const F=W=>{var ae;const X=(ae=W.target.files)==null?void 0:ae[0];if(!X)return;if(!X.type.startsWith("image/")){Se.error("Please select an image file");return}if(X.size>5*1024*1024){Se.error("Image must be under 5MB");return}const se=new FileReader;se.onloadend=()=>{b(se.result),y(!0)},se.readAsDataURL(X),W.target.value=""},O=async W=>{m(!0);try{const{data:X}=await Z.storage.from("avatars").list(`${t.user_id}`);X&&X.length>0&&await Z.storage.from("avatars").remove(X.map(fe=>`${t.user_id}/${fe.name}`));const se=`${t.user_id}/avatar.jpg`,{error:ae}=await Z.storage.from("avatars").upload(se,W,{upsert:!0,contentType:"image/jpeg"});if(ae)throw ae;const{data:le}=Z.storage.from("avatars").getPublicUrl(se),ne=`${le.publicUrl}?t=${Date.now()}`;i(ne),await Z.from("profiles").update({avatar_url:ne}).eq("id",t.user_id),o.invalidateQueries({queryKey:["agent-card-public"]}),Se.success("Photo updated!")}catch(X){Se.error(X.message||"Upload failed")}finally{m(!1)}},B=async()=>{const W=N.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/(^-|-$)/g,"");if(!W){Se.error("Please enter a valid URL");return}if(W===t.slug){Se.info("No changes to save");return}A(!0);try{const{data:X}=await Z.from("agent_cards").select("id").eq("slug",W).neq("id",t.id).maybeSingle();if(X){Se.error("This URL is already taken. Try another one.");return}const{error:se}=await Z.from("agent_cards").update({slug:W}).eq("id",t.id);if(se)throw se;j(W),o.invalidateQueries({queryKey:["agent-cards-admin"]}),Se.success("Card address updated!")}catch{Se.error("Failed to update card address")}finally{A(!1)}},$=async(W,X)=>{var ae;const se=(ae=W.target.files)==null?void 0:ae[0];if(se){if(!se.type.startsWith("image/")){Se.error("Please select an image file");return}try{const le=se.name.split(".").pop()||"png",ne=X==="brokerage_logo_url"?"brokerage-logo":"team-logo",fe=`${t.user_id}/${ne}.${le}`,{error:oe}=await Z.storage.from("card-logos").upload(fe,se,{upsert:!0});if(oe)throw oe;const{data:de}=Z.storage.from("card-logos").getPublicUrl(fe),ue=de.publicUrl+"?t="+Date.now();I(X==="brokerage_logo_url"?xe=>({...xe,[X]:ue,brokerage_display_name:""}):xe=>({...xe,[X]:ue,team_name:""})),Se.success("Logo uploaded!")}catch{Se.error("Failed to upload logo")}finally{W.target.value=""}}},H=()=>{n.mutate({id:t.id,...M,title:M.title||null,positioning_statement:M.positioning_statement||null,bio:M.bio||null,review_snippet:M.review_snippet||null,review_source_url:M.review_source_url||null,booking_url:M.booking_url||null,custom_cta_label:M.custom_cta_label||null,custom_cta_url:M.custom_cta_url||null,brokerage_display_name:M.brokerage_display_name||null,brokerage_logo_url:M.brokerage_logo_url||null,brokerage_logo_size:M.brokerage_logo_size,team_name:M.team_name||null,team_logo_url:M.team_logo_url||null,team_logo_size:M.team_logo_size},{onSuccess:()=>s(!1)})};return e.jsxs(e.Fragment,{children:[e.jsx(Dr,{open:r,onOpenChange:s,children:e.jsxs(Lr,{className:"max-w-2xl max-h-[85vh] overflow-y-auto",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Edit Agent Card"}),e.jsxs(Gs,{children:["/card/",t.slug]})]}),e.jsxs(ci,{defaultValue:"content",children:[e.jsxs(ri,{className:"w-full",children:[e.jsx(Kr,{value:"content",className:"flex-1",children:"Content"}),e.jsx(Kr,{value:"sections",className:"flex-1",children:"Sections"}),e.jsx(Kr,{value:"blocks",className:"flex-1",children:"Blocks"}),e.jsx(Kr,{value:"analytics",className:"flex-1",children:"Analytics"})]}),e.jsxs(ms,{value:"content",className:"space-y-4 mt-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ee,{children:"Published"}),e.jsx(xn,{checked:M.is_published,onCheckedChange:W=>I(X=>({...X,is_published:W}))})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"Agent Photo"}),e.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[e.jsxs(ln,{className:"h-16 w-16",children:[e.jsx(pa,{src:l||void 0}),e.jsx(cn,{children:"?"})]}),e.jsxs("label",{className:"cursor-pointer",children:[e.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:F,disabled:d}),e.jsx(Q,{variant:"outline",size:"sm",asChild:!0,disabled:d,children:e.jsx("span",{children:d?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"h-3 w-3 mr-1 animate-spin"}),"Uploading..."]}):e.jsxs(e.Fragment,{children:[e.jsx(to,{className:"h-3 w-3 mr-1"}),"Change Photo"]})})})]})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"Card Address"}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsxs("div",{className:"flex flex-1",children:[e.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/"}),e.jsx(Qe,{value:N,onChange:W=>j(W.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"-")),placeholder:"agent-name",className:"rounded-l-none"})]}),e.jsx(Q,{variant:"outline",size:"sm",onClick:B,disabled:S||N===t.slug,className:"shrink-0",children:S?"Saving...":"Update"})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"Theme"}),e.jsxs(ds,{value:M.theme,onValueChange:W=>I(X=>({...X,theme:W})),children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"standard",children:"✨ Standard (Modern Clean)"}),e.jsx(Ut,{value:"luxury",children:"🌙 Luxury (Dark & Gold)"}),e.jsx(Ut,{value:"bold",children:"🔥 Bold (Vibrant & Punchy)"}),e.jsx(Ut,{value:"classic",children:"📋 Classic (Professional)"})]})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"Title / Tagline"}),e.jsx(Qe,{value:M.title,onChange:W=>I(X=>({...X,title:W.target.value})),placeholder:"e.g. Luxury Real Estate Specialist"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Shown below the agent's name on the card"})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"Positioning Statement"}),e.jsx(Qe,{value:M.positioning_statement,onChange:W=>I(X=>({...X,positioning_statement:W.target.value})),placeholder:"Your home journey, handled with care."})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"Bio"}),e.jsx(Ks,{value:M.bio,onChange:W=>I(X=>({...X,bio:W.target.value})),placeholder:"Short about me...",rows:3})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"Review Snippet"}),e.jsx(Qe,{value:M.review_snippet,onChange:W=>I(X=>({...X,review_snippet:W.target.value})),placeholder:"Best agent we've ever worked with..."})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"Review Source URL"}),e.jsx(Qe,{value:M.review_source_url,onChange:W=>I(X=>({...X,review_source_url:W.target.value})),placeholder:"https://g.page/your-business/review"})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"Booking URL (optional — if empty, shows lead form)"}),e.jsx(Qe,{value:M.booking_url,onChange:W=>I(X=>({...X,booking_url:W.target.value})),placeholder:"https://calendly.com/your-link"})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"Custom CTA Label (optional)"}),e.jsx(Qe,{value:M.custom_cta_label,onChange:W=>I(X=>({...X,custom_cta_label:W.target.value})),placeholder:"Book a Call"})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"Custom CTA URL (optional)"}),e.jsx(Qe,{value:M.custom_cta_url,onChange:W=>I(X=>({...X,custom_cta_url:W.target.value})),placeholder:"https://example.com/landing"})]}),e.jsxs("div",{className:"space-y-3 p-3 rounded-lg bg-muted/30 border",children:[e.jsx(Ee,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Brokerage Branding"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Qe,{value:M.brokerage_display_name,onChange:W=>I(X=>({...X,brokerage_display_name:W.target.value,brokerage_logo_url:""})),placeholder:"Brokerage name (or upload logo below)",disabled:!!M.brokerage_logo_url}),e.jsxs("div",{className:"flex items-center gap-3",children:[M.brokerage_logo_url&&e.jsxs("div",{className:"relative group",children:[e.jsx("img",{src:M.brokerage_logo_url,alt:"Brokerage logo",style:{height:`${M.brokerage_logo_size||56}px`},className:"max-w-[200px] object-contain rounded border bg-white p-1"}),e.jsx("button",{onClick:()=>I(W=>({...W,brokerage_logo_url:""})),className:"absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-destructive text-destructive-foreground text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:"×"})]}),e.jsxs("label",{className:"cursor-pointer",children:[e.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:[e.jsx(to,{className:"h-3.5 w-3.5"}),M.brokerage_logo_url?"Change Logo":"Upload Logo"]}),e.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:W=>$(W,"brokerage_logo_url")})]})]}),M.brokerage_logo_url&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ee,{className:"text-xs font-medium text-muted-foreground",children:"Logo Size"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[M.brokerage_logo_size||56,"px"]})]}),e.jsx(If,{value:[M.brokerage_logo_size||56],onValueChange:([W])=>I(X=>({...X,brokerage_logo_size:W})),min:24,max:120,step:4})]})]})]}),e.jsxs("div",{className:"space-y-3 p-3 rounded-lg bg-muted/30 border",children:[e.jsx(Ee,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Team Branding"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Qe,{value:M.team_name,onChange:W=>I(X=>({...X,team_name:W.target.value,team_logo_url:""})),placeholder:"Team name (or upload logo below)",disabled:!!M.team_logo_url}),e.jsxs("div",{className:"flex items-center gap-3",children:[M.team_logo_url&&e.jsxs("div",{className:"relative group",children:[e.jsx("img",{src:M.team_logo_url,alt:"Team logo",style:{height:`${M.team_logo_size||56}px`},className:"max-w-[200px] object-contain rounded border bg-white p-1"}),e.jsx("button",{onClick:()=>I(W=>({...W,team_logo_url:""})),className:"absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-destructive text-destructive-foreground text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:"×"})]}),e.jsxs("label",{className:"cursor-pointer",children:[e.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:[e.jsx(to,{className:"h-3.5 w-3.5"}),M.team_logo_url?"Change Logo":"Upload Logo"]}),e.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:W=>$(W,"team_logo_url")})]})]}),M.team_logo_url&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Ee,{className:"text-xs font-medium text-muted-foreground",children:"Logo Size"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[M.team_logo_size||56,"px"]})]}),e.jsx(If,{value:[M.team_logo_size||56],onValueChange:([W])=>I(X=>({...X,team_logo_size:W})),min:24,max:120,step:4})]})]})]})]}),e.jsx(ms,{value:"sections",className:"space-y-4 mt-4",children:[{key:"show_photo",label:"Show Photo",hint:"Photo is pulled from the agent's profile."},{key:"show_bio",label:"Show Bio"},{key:"show_credentials",label:"Show Credentials"},{key:"show_social_links",label:"Show Social Links"},{key:"show_save_contact",label:"Save Contact Button"},{key:"show_leave_review",label:"Leave Review Button"},{key:"show_refer_friend",label:"Refer a Friend Button"}].map(({key:W,label:X,hint:se})=>e.jsxs("div",{className:"flex items-center justify-between py-2",children:[e.jsxs("div",{children:[e.jsx(Ee,{children:X}),se&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[se," ",W==="show_photo"&&e.jsx("a",{href:"/profile",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline hover:no-underline",children:"Update Profile"})]})]}),e.jsx(xn,{checked:M[W],onCheckedChange:ae=>I(le=>({...le,[W]:ae}))})]},W))}),e.jsx(ms,{value:"blocks",className:"mt-4",children:e.jsx(sHe,{cardId:t.id})}),e.jsx(ms,{value:"analytics",className:"mt-4",children:a?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(ze,{children:e.jsxs(qe,{className:"p-4 text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:a.views}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Views"})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"p-4 text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:a.clicks}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Clicks"})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"p-4 text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:a.leads.length}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Leads"})]})})]}),a.leads.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold mb-2",children:"Recent Leads"}),e.jsx("div",{className:"space-y-2",children:a.leads.slice(0,5).map(W=>e.jsxs("div",{className:"text-sm p-2 bg-muted/50 rounded-lg",children:[e.jsx("span",{className:"font-medium",children:W.name}),W.phone&&e.jsxs("span",{className:"text-muted-foreground",children:[" · ",W.phone]}),W.intent&&e.jsx(bt,{variant:"secondary",className:"ml-2 text-xs",children:W.intent})]},W.id))})]})]}):e.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No analytics data yet"})})]}),e.jsx(Q,{onClick:H,disabled:n.isPending,className:"w-full mt-4",children:n.isPending?"Saving...":"Save Changes"})]})}),e.jsx(D0e,{open:g,onClose:()=>y(!1),imageSrc:v,onCropComplete:O,aspectRatio:1})]})}const gC={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"},vve={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 _ve(t=!0){return Ht({queryKey:["marketplace-categories",t],queryFn:async()=>{let r=Z.from("marketplace_categories").select("*").order("sort_order",{ascending:!0});t&&(r=r.eq("is_active",!0));const{data:s,error:n}=await r;if(n)throw n;return s}})}function etr(){const t=qr();return Jt({mutationFn:async r=>{const{data:s,error:n}=await Z.from("marketplace_categories").insert([r]).select().single();if(n)throw n;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-categories"]}),Se.success("Category created successfully")},onError:r=>{Se.error("Failed to create category: "+r.message)}})}function ttr(){const t=qr();return Jt({mutationFn:async({id:r,...s})=>{const{data:n,error:a}=await Z.from("marketplace_categories").update(s).eq("id",r).select().single();if(a)throw a;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-categories"]}),Se.success("Category updated successfully")},onError:r=>{Se.error("Failed to update category: "+r.message)}})}function rtr(){const t=qr();return Jt({mutationFn:async r=>{const{error:s}=await Z.from("marketplace_categories").delete().eq("id",r);if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-categories"]}),Se.success("Category deleted successfully")},onError:r=>{Se.error("Failed to delete category: "+r.message)}})}function xHe(t,r=!0){return Ht({queryKey:["marketplace-products",t,r],queryFn:async()=>{let s=Z.from("marketplace_products").select(` *, category:marketplace_categories(*), images:marketplace_product_images(*), video:marketplace_product_videos(*), variants:marketplace_product_variants(*) `).order("sort_order",{ascending:!0});t&&(s=s.eq("category_id",t)),r&&(s=s.eq("is_active",!0));const{data:n,error:a}=await s;if(a)throw a;return n}})}function str(t){return Ht({queryKey:["marketplace-product",t],queryFn:async()=>{const{data:r,error:s}=await Z.from("marketplace_products").select(` *, category:marketplace_categories(*), images:marketplace_product_images(*), video:marketplace_product_videos(*), variants:marketplace_product_variants(*) `).eq("id",t).single();if(s)throw s;return r},enabled:!!t})}function ntr(){const t=qr();return Jt({mutationFn:async r=>{const{data:s,error:n}=await Z.from("marketplace_products").insert([r]).select().single();if(n)throw n;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-products"]}),Se.success("Product created successfully")},onError:r=>{Se.error("Failed to create product: "+r.message)}})}function atr(){const t=qr();return Jt({mutationFn:async({id:r,...s})=>{const{data:n,error:a}=await Z.from("marketplace_products").update(s).eq("id",r).select().single();if(a)throw a;return n},onSuccess:(r,s)=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",s.id]}),Se.success("Product updated successfully")},onError:r=>{Se.error("Failed to update product: "+r.message)}})}function itr(){const t=qr();return Jt({mutationFn:async r=>{const{error:s}=await Z.from("marketplace_products").delete().eq("id",r);if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-products"]}),Se.success("Product deleted successfully")},onError:r=>{Se.error("Failed to delete product: "+r.message)}})}function otr(){const t=qr();return Jt({mutationFn:async r=>{const{data:s,error:n}=await Z.from("marketplace_product_images").insert([r]).select().single();if(n)throw n;return s},onSuccess:(r,s)=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",s.product_id]})}})}function ltr(){const t=qr();return Jt({mutationFn:async({id:r,productId:s})=>{const{error:n}=await Z.from("marketplace_product_images").delete().eq("id",r);if(n)throw n;return s},onSuccess:r=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",r]}),Se.success("Image deleted successfully")},onError:r=>{Se.error("Failed to delete image: "+r.message)}})}function ctr(){const t=qr();return Jt({mutationFn:async({imageId:r,productId:s})=>{const{error:n}=await Z.from("marketplace_product_images").update({is_primary:!1}).eq("product_id",s);if(n)throw n;const{error:a}=await Z.from("marketplace_product_images").update({is_primary:!0}).eq("id",r);if(a)throw a;return s},onSuccess:r=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",r]}),Se.success("Primary image updated")},onError:r=>{Se.error("Failed to set primary image: "+r.message)}})}function dtr(){const t=qr();return Jt({mutationFn:async r=>{const{data:s,error:n}=await Z.from("marketplace_product_variants").insert([r]).select().single();if(n)throw n;return s},onSuccess:(r,s)=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",s.product_id]}),Se.success("Variant added successfully")}})}function utr(){const t=qr();return Jt({mutationFn:async({id:r,productId:s})=>{const{error:n}=await Z.from("marketplace_product_variants").delete().eq("id",r);if(n)throw n;return s},onSuccess:r=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",r]}),Se.success("Variant deleted successfully")}})}function htr(){const t=qr();return Jt({mutationFn:async({productId:r,videoUrl:s})=>{await Z.from("marketplace_product_videos").delete().eq("product_id",r);const{data:n,error:a}=await Z.from("marketplace_product_videos").insert({product_id:r,video_url:s}).select().single();if(a)throw a;return n},onSuccess:(r,s)=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",s.productId]}),Se.success("Video updated successfully")}})}function mtr(t){const{isAdmin:r}=Gr();return Ht({queryKey:["marketplace-orders",t,r],queryFn:async()=>{let s=Z.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).order("created_at",{ascending:!1});const{data:n,error:a}=await s;if(a)throw a;if(r&&n){const o=[...new Set(n.map(d=>d.user_id))],{data:l}=await Z.from("profiles").select("id, name, email").in("id",o),i=new Map((l==null?void 0:l.map(d=>[d.id,d]))||[]);return n.map(d=>({...d,user:i.get(d.user_id)}))}return n}})}function ptr(){const{user:t}=Gr();return Ht({queryKey:["my-marketplace-orders",t==null?void 0:t.id],queryFn:async()=>{const{data:r,error:s}=await Z.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).eq("user_id",t.id).order("created_at",{ascending:!1});if(s)throw s;return r},enabled:!!(t!=null&&t.id)})}function ftr(t){return Ht({queryKey:["marketplace-order",t],queryFn:async()=>{const{data:r,error:s}=await Z.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).eq("id",t).single();if(s)throw s;return r},enabled:!!t})}function gtr(){const t=qr(),{user:r}=Gr();return Jt({mutationFn:async({orderId:s,status:n,notes:a,trackingNumber:o,trackingUrl:l,previousStatus:i})=>{const d={status:n};o!==void 0&&(d.tracking_number=o),l!==void 0&&(d.tracking_url=l);const{error:m}=await Z.from("marketplace_orders").update(d).eq("id",s);if(m)throw m;const{error:g}=await Z.from("marketplace_order_status_history").insert({order_id:s,status:n,notes:a,created_by:r==null?void 0:r.id});if(g)throw g;if(["shipped","in_production","processing","completed"].includes(n)&&n!==i)try{await Z.functions.invoke("marketplace-order-notify",{body:{orderId:s,notificationType:n==="shipped"?"shipped":"status_update",newStatus:n,trackingNumber:o,trackingUrl:l}})}catch(v){console.error("Failed to send notification email:",v)}},onSuccess:(s,n)=>{t.invalidateQueries({queryKey:["marketplace-orders"]}),t.invalidateQueries({queryKey:["marketplace-order",n.orderId]}),t.invalidateQueries({queryKey:["my-marketplace-orders"]}),Se.success("Order status updated")},onError:s=>{Se.error("Failed to update order: "+s.message)}})}function xtr(){const t=qr();return Jt({mutationFn:async({itemId:r,proofUrl:s,proofNotes:n,orderId:a})=>{const{error:o}=await Z.from("marketplace_order_items").update({proof_url:s,proof_notes:n,proof_status:"pending"}).eq("id",r);if(o)throw o;await Z.from("marketplace_orders").update({status:"awaiting_proof_approval"}).eq("id",a);try{await Z.functions.invoke("marketplace-order-notify",{body:{orderId:a,notificationType:"proof_ready"}})}catch(l){console.error("Failed to send proof notification:",l)}return a},onSuccess:r=>{t.invalidateQueries({queryKey:["marketplace-orders"]}),t.invalidateQueries({queryKey:["marketplace-order",r]}),t.invalidateQueries({queryKey:["my-marketplace-orders"]}),Se.success("Proof uploaded & customer notified")}})}function ytr(){const t=qr();return Jt({mutationFn:async({itemId:r,orderId:s})=>{const{error:n}=await Z.from("marketplace_order_items").update({proof_status:"approved"}).eq("id",r);if(n)throw n;return s},onSuccess:r=>{t.invalidateQueries({queryKey:["marketplace-orders"]}),t.invalidateQueries({queryKey:["marketplace-order",r]}),t.invalidateQueries({queryKey:["my-marketplace-orders"]}),Se.success("Proof approved")}})}function vtr(){const t=qr();return Jt({mutationFn:async({itemId:r,orderId:s,reason:n})=>{const{error:a}=await Z.from("marketplace_order_items").update({proof_status:"rejected",proof_notes:n}).eq("id",r);if(a)throw a;return s},onSuccess:r=>{t.invalidateQueries({queryKey:["marketplace-orders"]}),t.invalidateQueries({queryKey:["marketplace-order",r]}),t.invalidateQueries({queryKey:["my-marketplace-orders"]}),Se.success("Proof rejected - please upload a new proof")}})}function _tr(){const{data:t,isLoading:r}=_ve(!1),s=etr(),n=ttr(),a=rtr(),[o,l]=E.useState(!1),[i,d]=E.useState(null),[m,g]=E.useState({name:"",description:"",image_url:"",sort_order:0,is_active:!0}),y=()=>{g({name:"",description:"",image_url:"",sort_order:0,is_active:!0}),d(null)},v=j=>{d(j),g({name:j.name,description:j.description||"",image_url:j.image_url||"",sort_order:j.sort_order,is_active:j.is_active}),l(!0)},b=async j=>{j.preventDefault(),i?await n.mutateAsync({id:i.id,...m}):await s.mutateAsync(m),l(!1),y()},N=async j=>{confirm("Are you sure you want to delete this category?")&&await a.mutateAsync(j)};return r?e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(fr,{className:"h-8 w-48"})}),e.jsx(qe,{children:e.jsx("div",{className:"space-y-4",children:[1,2,3].map(j=>e.jsx(fr,{className:"h-12 w-full"},j))})})]}):e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[e.jsx(Zt,{children:"Categories"}),e.jsxs(Dr,{open:o,onOpenChange:j=>{l(j),j||y()},children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Category"]})}),e.jsxs(Lr,{children:[e.jsx(Ur,{children:e.jsx(Br,{children:i?"Edit Category":"Add Category"})}),e.jsxs("form",{onSubmit:b,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"name",children:"Name"}),e.jsx(Qe,{id:"name",value:m.name,onChange:j=>g({...m,name:j.target.value}),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"description",children:"Description"}),e.jsx(Ks,{id:"description",value:m.description,onChange:j=>g({...m,description:j.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"image_url",children:"Image URL"}),e.jsx(Qe,{id:"image_url",value:m.image_url,onChange:j=>g({...m,image_url:j.target.value}),placeholder:"https://..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"sort_order",children:"Sort Order"}),e.jsx(Qe,{id:"sort_order",type:"number",value:m.sort_order,onChange:j=>g({...m,sort_order:parseInt(j.target.value)||0})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xn,{id:"is_active",checked:m.is_active,onCheckedChange:j=>g({...m,is_active:j})}),e.jsx(Ee,{htmlFor:"is_active",children:"Active"})]}),e.jsx(Q,{type:"submit",className:"w-full",disabled:s.isPending||n.isPending,children:i?"Update Category":"Create Category"})]})]})]})]}),e.jsx(qe,{children:t&&t.length>0?e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Name"}),e.jsx(Ct,{children:"Description"}),e.jsx(Ct,{children:"Sort Order"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{className:"text-right",children:"Actions"})]})}),e.jsx(zn,{children:t.map(j=>e.jsxs(Nr,{children:[e.jsx(dt,{className:"font-medium",children:j.name}),e.jsx(dt,{className:"max-w-xs truncate",children:j.description}),e.jsx(dt,{children:j.sort_order}),e.jsx(dt,{children:e.jsx("span",{className:`px-2 py-1 rounded-full text-xs ${j.is_active?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"}`,children:j.is_active?"Active":"Inactive"})}),e.jsx(dt,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>v(j),children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>N(j.id),disabled:a.isPending,children:e.jsx(Rs,{className:"h-4 w-4 text-destructive"})})]})})]},j.id))})]}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No categories yet. Create your first category to get started."})})]})}function btr(){var be,we;const{data:t,isLoading:r}=xHe(void 0,!1),{data:s}=_ve(!1),n=ntr(),a=atr(),o=itr(),l=otr(),i=ltr(),d=ctr(),m=dtr(),g=utr(),y=htr(),[v,b]=E.useState(!1),[N,j]=E.useState(!1),[S,A]=E.useState(!1),[M,I]=E.useState(null),[F,O]=E.useState(null),[B,$]=E.useState(!1),[H,W]=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}),[X,se]=E.useState({name:"",price_adjustment:0}),[ae,le]=E.useState(""),ne=()=>{W({name:"",description:"",base_price:0,shipping_fee:0,category_id:"",allow_artwork_upload:!1,requires_proof_approval:!1,is_active:!0,sort_order:0}),I(null)},fe=ve=>{I(ve),W({name:ve.name,description:ve.description||"",base_price:Number(ve.base_price),shipping_fee:Number(ve.shipping_fee),category_id:ve.category_id||"",allow_artwork_upload:ve.allow_artwork_upload,requires_proof_approval:ve.requires_proof_approval,is_active:ve.is_active,sort_order:ve.sort_order}),b(!0)},oe=async ve=>{ve.preventDefault();const tt={...H,category_id:H.category_id||null};M?await a.mutateAsync({id:M.id,...tt}):await n.mutateAsync(tt),b(!1),ne()},de=async ve=>{confirm("Are you sure you want to delete this product?")&&await o.mutateAsync(ve)},ue=async ve=>{if(!F||!ve.target.files||ve.target.files.length===0)return;$(!0);const tt=ve.target.files[0],Ae=tt.name.split(".").pop(),Le=`products/${F.id}/${Date.now()}.${Ae}`;try{const{error:Ue}=await Z.storage.from("marketplace").upload(Le,tt);if(Ue)throw Ue;const{data:{publicUrl:Ye}}=Z.storage.from("marketplace").getPublicUrl(Le);await l.mutateAsync({product_id:F.id,image_url:Ye,is_primary:!F.images||F.images.length===0}),Se.success("Image uploaded successfully")}catch(Ue){Se.error("Failed to upload image: "+Ue.message)}finally{$(!1)}},xe=async ve=>{ve.preventDefault(),F&&(await m.mutateAsync({product_id:F.id,name:X.name,price_adjustment:X.price_adjustment}),se({name:"",price_adjustment:0}))},Te=async()=>{!F||!ae||(await y.mutateAsync({productId:F.id,videoUrl:ae}),le(""))};return r?e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(fr,{className:"h-8 w-48"})}),e.jsx(qe,{children:e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(ve=>e.jsx(fr,{className:"h-64 w-full"},ve))})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[e.jsx(Zt,{children:"Products"}),e.jsxs(Dr,{open:v,onOpenChange:ve=>{b(ve),ve||ne()},children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Product"]})}),e.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsx(Ur,{children:e.jsx(Br,{children:M?"Edit Product":"Add Product"})}),e.jsxs("form",{onSubmit:oe,className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"name",children:"Product Name"}),e.jsx(Qe,{id:"name",value:H.name,onChange:ve=>W({...H,name:ve.target.value}),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"category",children:"Category"}),e.jsxs(ds,{value:H.category_id,onValueChange:ve=>W({...H,category_id:ve}),children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Select category"})}),e.jsx(cs,{children:s==null?void 0:s.map(ve=>e.jsx(Ut,{value:ve.id,children:ve.name},ve.id))})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"description",children:"Description"}),e.jsx(Ks,{id:"description",value:H.description,onChange:ve=>W({...H,description:ve.target.value}),rows:4})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"base_price",children:"Base Price ($)"}),e.jsx(Qe,{id:"base_price",type:"number",step:"0.01",min:"0",value:H.base_price,onChange:ve=>W({...H,base_price:parseFloat(ve.target.value)||0}),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"shipping_fee",children:"Shipping Fee ($)"}),e.jsx(Qe,{id:"shipping_fee",type:"number",step:"0.01",min:"0",value:H.shipping_fee,onChange:ve=>W({...H,shipping_fee:parseFloat(ve.target.value)||0})})]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"sort_order",children:"Sort Order"}),e.jsx(Qe,{id:"sort_order",type:"number",value:H.sort_order,onChange:ve=>W({...H,sort_order:parseInt(ve.target.value)||0})})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xn,{id:"allow_artwork_upload",checked:H.allow_artwork_upload,onCheckedChange:ve=>W({...H,allow_artwork_upload:ve})}),e.jsx(Ee,{htmlFor:"allow_artwork_upload",children:"Allow customer to upload artwork"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xn,{id:"requires_proof_approval",checked:H.requires_proof_approval,onCheckedChange:ve=>W({...H,requires_proof_approval:ve})}),e.jsx(Ee,{htmlFor:"requires_proof_approval",children:"Requires proof approval"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xn,{id:"is_active",checked:H.is_active,onCheckedChange:ve=>W({...H,is_active:ve})}),e.jsx(Ee,{htmlFor:"is_active",children:"Active"})]})]}),e.jsx(Q,{type:"submit",className:"w-full",disabled:n.isPending||a.isPending,children:M?"Update Product":"Create Product"})]})]})]})]}),e.jsx(qe,{children:t&&t.length>0?e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:t.map(ve=>{var tt,Ae;return e.jsxs(ze,{className:"overflow-hidden",children:[e.jsxs("div",{className:"aspect-video bg-muted relative",children:[ve.images&&ve.images.length>0?e.jsx("img",{src:((tt=ve.images.find(Le=>Le.is_primary))==null?void 0:tt.image_url)||ve.images[0].image_url,alt:ve.name,className:"w-full h-full object-cover"}):e.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"No image"}),!ve.is_active&&e.jsx(bt,{variant:"secondary",className:"absolute top-2 right-2",children:"Inactive"})]}),e.jsxs(qe,{className:"p-4",children:[e.jsx("h3",{className:"font-semibold mb-1",children:ve.name}),e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:((Ae=ve.category)==null?void 0:Ae.name)||"No category"}),e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("span",{className:"font-bold",children:["$",Number(ve.base_price).toFixed(2)]}),Number(ve.shipping_fee)>0&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:["+$",Number(ve.shipping_fee).toFixed(2)," shipping"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 mb-3",children:[ve.allow_artwork_upload&&e.jsx(bt,{variant:"outline",className:"text-xs",children:"Artwork Upload"}),ve.requires_proof_approval&&e.jsx(bt,{variant:"outline",className:"text-xs",children:"Proof Required"}),ve.variants&&ve.variants.length>0&&e.jsxs(bt,{variant:"outline",className:"text-xs",children:[ve.variants.length," Variants"]})]}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>fe(ve),children:[e.jsx(ei,{className:"h-3 w-3 mr-1"}),"Edit"]}),e.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>{O(ve),j(!0)},children:[e.jsx(X1,{className:"h-3 w-3 mr-1"}),"Images"]}),e.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>{O(ve),A(!0)},children:[e.jsx(Xg,{className:"h-3 w-3 mr-1"}),"Variants"]}),e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>de(ve.id),children:e.jsx(Rs,{className:"h-3 w-3 text-destructive"})})]})]})]},ve.id)})}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No products yet. Create your first product to get started."})})]}),e.jsx(Dr,{open:N,onOpenChange:j,children:e.jsxs(Lr,{className:"max-w-2xl",children:[e.jsx(Ur,{children:e.jsxs(Br,{children:["Manage Images - ",F==null?void 0:F.name]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-3 gap-4",children:(be=F==null?void 0:F.images)==null?void 0:be.map(ve=>e.jsxs("div",{className:"relative group",children:[e.jsx("img",{src:ve.image_url,alt:"",className:"w-full aspect-square object-cover rounded-lg"}),ve.is_primary&&e.jsx(bt,{className:"absolute top-2 left-2",variant:"default",children:"Primary"}),e.jsxs("div",{className:"absolute top-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[!ve.is_primary&&e.jsx(Q,{variant:"secondary",size:"icon",onClick:async()=>{var tt;await d.mutateAsync({imageId:ve.id,productId:F.id}),O({...F,images:(tt=F.images)==null?void 0:tt.map(Ae=>({...Ae,is_primary:Ae.id===ve.id}))})},disabled:d.isPending,title:"Set as primary",children:e.jsx(Ln,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"destructive",size:"icon",onClick:async()=>{var Ae;await i.mutateAsync({id:ve.id,productId:F.id});const tt=t==null?void 0:t.find(Le=>Le.id===F.id);tt&&O({...tt,images:(Ae=tt.images)==null?void 0:Ae.filter(Le=>Le.id!==ve.id)})},disabled:i.isPending,children:e.jsx(Rs,{className:"h-4 w-4"})})]})]},ve.id))}),e.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 text-center",children:[e.jsx("input",{type:"file",accept:"image/*",onChange:ue,className:"hidden",id:"image-upload",disabled:B}),e.jsxs("label",{htmlFor:"image-upload",className:"cursor-pointer",children:[e.jsx(X1,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:B?"Uploading...":"Click to upload an image"})]})]}),e.jsxs("div",{className:"border-t pt-4 mt-4",children:[e.jsx(Ee,{children:"Product Video (optional)"}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(Qe,{placeholder:"Enter video URL (YouTube, Vimeo, etc.)",value:ae,onChange:ve=>le(ve.target.value)}),e.jsxs(Q,{onClick:Te,disabled:!ae,children:[e.jsx(ya,{className:"h-4 w-4 mr-2"}),"Set Video"]})]}),(F==null?void 0:F.video)&&e.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:["Current video: ",F.video.video_url]})]})]})]})}),e.jsx(Dr,{open:S,onOpenChange:A,children:e.jsxs(Lr,{children:[e.jsx(Ur,{children:e.jsxs(Br,{children:["Manage Variants - ",F==null?void 0:F.name]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("form",{onSubmit:xe,className:"flex gap-2",children:[e.jsx(Qe,{placeholder:"Variant name (e.g., 500 count)",value:X.name,onChange:ve=>se({...X,name:ve.target.value}),required:!0}),e.jsx(Qe,{type:"number",step:"0.01",placeholder:"Price adj.",value:X.price_adjustment,onChange:ve=>se({...X,price_adjustment:parseFloat(ve.target.value)||0}),className:"w-32"}),e.jsx(Q,{type:"submit",children:"Add"})]}),e.jsxs("div",{className:"space-y-2",children:[(we=F==null?void 0:F.variants)==null?void 0:we.map(ve=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted rounded-lg",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:ve.name}),e.jsxs("span",{className:"text-sm text-muted-foreground ml-2",children:[Number(ve.price_adjustment)>=0?"+":"","$",Number(ve.price_adjustment).toFixed(2)]})]}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>g.mutateAsync({id:ve.id,productId:F.id}),children:e.jsx(Rs,{className:"h-4 w-4 text-destructive"})})]},ve.id)),(!(F!=null&&F.variants)||F.variants.length===0)&&e.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 wtr=["pending_payment","order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed","cancelled","refunded"];function jtr(){var j,S,A;const{data:t,isLoading:r}=mtr(),s=gtr(),n=xtr(),[a,o]=E.useState(null),[l,i]=E.useState(!1),[d,m]=E.useState({status:"",notes:"",trackingNumber:"",trackingUrl:""}),[g,y]=E.useState(!1),v=M=>{o(M),m({status:M.status,notes:"",trackingNumber:M.tracking_number||"",trackingUrl:M.tracking_url||""}),i(!0)},b=async()=>{a&&(await s.mutateAsync({orderId:a.id,status:d.status,notes:d.notes,trackingNumber:d.trackingNumber,trackingUrl:d.trackingUrl,previousStatus:a.status}),i(!1))},N=async(M,I)=>{if(!a||!M.target.files||M.target.files.length===0)return;y(!0);const F=M.target.files[0],O=F.name.split(".").pop(),B=`proofs/${a.id}/${I}/${Date.now()}.${O}`;try{const{error:$}=await Z.storage.from("marketplace").upload(B,F);if($)throw $;const{data:{publicUrl:H}}=Z.storage.from("marketplace").getPublicUrl(B);await n.mutateAsync({itemId:I,proofUrl:H,orderId:a.id}),Se.success("Proof uploaded successfully")}catch($){Se.error("Failed to upload proof: "+$.message)}finally{y(!1)}};return r?e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(fr,{className:"h-8 w-48"})}),e.jsx(qe,{children:e.jsx("div",{className:"space-y-4",children:[1,2,3].map(M=>e.jsx(fr,{className:"h-16 w-full"},M))})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{children:"Orders"})}),e.jsx(qe,{children:t&&t.length>0?e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Order #"}),e.jsx(Ct,{children:"Customer"}),e.jsx(Ct,{children:"Date"}),e.jsx(Ct,{children:"Total"}),e.jsx(Ct,{children:"Status"}),e.jsx(Ct,{className:"text-right",children:"Actions"})]})}),e.jsx(zn,{children:t.map(M=>{var I,F;return e.jsxs(Nr,{children:[e.jsx(dt,{className:"font-mono",children:M.order_number}),e.jsx(dt,{children:e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:((I=M.user)==null?void 0:I.name)||"Unknown"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:(F=M.user)==null?void 0:F.email})]})}),e.jsx(dt,{children:Xr(new Date(M.created_at),"MMM d, yyyy")}),e.jsxs(dt,{className:"font-bold",children:["$",Number(M.total).toFixed(2)]}),e.jsx(dt,{children:e.jsx(bt,{className:vve[M.status],children:gC[M.status]})}),e.jsx(dt,{className:"text-right",children:e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>v(M),children:[e.jsx(Gi,{className:"h-4 w-4 mr-1"}),"View"]})})]},M.id)})})]}):e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No orders yet."})})]}),e.jsx(Dr,{open:l,onOpenChange:i,children:e.jsxs(Lr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[e.jsx(Ur,{children:e.jsxs(Br,{children:["Order ",a==null?void 0:a.order_number]})}),a&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium mb-2",children:"Customer"}),e.jsx("p",{children:(j=a.user)==null?void 0:j.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:(S=a.user)==null?void 0:S.email})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium mb-2",children:"Shipping Address"}),e.jsx("p",{children:a.shipping_name}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[a.shipping_address,e.jsx("br",{}),a.shipping_city,", ",a.shipping_state," ",a.shipping_zip]})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium mb-2",children:"Order Items"}),e.jsx("div",{className:"space-y-3",children:(A=a.items)==null?void 0:A.map(M=>e.jsxs("div",{className:"border rounded-lg p-4",children:[e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:M.product_name}),M.variant_name&&e.jsx("p",{className:"text-sm text-muted-foreground",children:M.variant_name})]}),e.jsxs("p",{className:"font-bold",children:["$",Number(M.unit_price).toFixed(2)," x ",M.quantity]})]}),M.artwork_url&&e.jsxs("div",{className:"mt-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Customer Artwork:"}),e.jsx("a",{href:M.artwork_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-sm",children:"View Artwork"})]}),e.jsx("div",{className:"mt-3 pt-3 border-t",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Proof Status: "}),e.jsx(bt,{variant:M.proof_status==="approved"?"default":"secondary",children:M.proof_status||"No proof yet"})]}),M.proof_url?e.jsx("a",{href:M.proof_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-sm",children:"View Proof"}):e.jsxs("div",{children:[e.jsx("input",{type:"file",accept:"image/*,.pdf",onChange:I=>N(I,M.id),className:"hidden",id:`proof-${M.id}`,disabled:g}),e.jsx("label",{htmlFor:`proof-${M.id}`,children:e.jsx(Q,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("span",{children:[e.jsx(to,{className:"h-4 w-4 mr-1"}),g?"Uploading...":"Upload Proof"]})})})]})]})})]},M.id))})]}),e.jsxs("div",{className:"border-t pt-4",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{children:"Subtotal"}),e.jsxs("span",{children:["$",Number(a.subtotal).toFixed(2)]})]}),e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{children:"Shipping"}),e.jsxs("span",{children:["$",Number(a.shipping_total).toFixed(2)]})]}),e.jsxs("div",{className:"flex justify-between font-bold text-lg mt-2",children:[e.jsx("span",{children:"Total"}),e.jsxs("span",{children:["$",Number(a.total).toFixed(2)]})]})]}),e.jsxs("div",{className:"border-t pt-4",children:[e.jsx("h4",{className:"font-medium mb-3",children:"Update Order Status"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Status"}),e.jsxs(ds,{value:d.status,onValueChange:M=>m({...d,status:M}),children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsx(cs,{children:wtr.map(M=>e.jsx(Ut,{value:M,children:gC[M]},M))})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Tracking Number"}),e.jsx(Qe,{value:d.trackingNumber,onChange:M=>m({...d,trackingNumber:M.target.value}),placeholder:"Enter tracking number"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Tracking URL"}),e.jsx(Qe,{value:d.trackingUrl,onChange:M=>m({...d,trackingUrl:M.target.value}),placeholder:"https://..."})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Notes (optional)"}),e.jsx(Ks,{value:d.notes,onChange:M=>m({...d,notes:M.target.value}),placeholder:"Add a note about this status change..."})]}),e.jsxs(Q,{onClick:b,disabled:s.isPending,className:"w-full",children:[e.jsx(Wl,{className:"h-4 w-4 mr-2"}),"Update Status"]})]})]}),a.status_history&&a.status_history.length>0&&e.jsxs("div",{className:"border-t pt-4",children:[e.jsx("h4",{className:"font-medium mb-3",children:"Status History"}),e.jsx("div",{className:"space-y-2",children:a.status_history.map(M=>e.jsxs("div",{className:"flex justify-between text-sm p-2 bg-muted rounded",children:[e.jsxs("div",{children:[e.jsx(bt,{variant:"outline",children:gC[M.status]}),M.notes&&e.jsx("p",{className:"text-muted-foreground mt-1",children:M.notes})]}),e.jsx("span",{className:"text-muted-foreground",children:Xr(new Date(M.created_at),"MMM d, h:mm a")})]},M.id))})]})]})]})})]})}function ktr(){const[t,r]=E.useState("products"),s=Ws();return e.jsx(Fr,{title:"Marketplace Management",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Marketplace Management"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage products, categories, and orders"})]}),e.jsxs(Q,{variant:"outline",onClick:()=>s("/marketplace"),children:[e.jsx(En,{className:"h-4 w-4 mr-2"}),"View Store"]})]}),e.jsxs(ci,{value:t,onValueChange:r,children:[e.jsxs(ri,{className:"grid w-full grid-cols-3",children:[e.jsxs(Kr,{value:"products",className:"flex items-center gap-2",children:[e.jsx(Wl,{className:"h-4 w-4"}),"Products"]}),e.jsxs(Kr,{value:"categories",className:"flex items-center gap-2",children:[e.jsx(bm,{className:"h-4 w-4"}),"Categories"]}),e.jsxs(Kr,{value:"orders",className:"flex items-center gap-2",children:[e.jsx(Lh,{className:"h-4 w-4"}),"Orders"]})]}),e.jsx(ms,{value:"products",children:e.jsx(btr,{})}),e.jsx(ms,{value:"categories",children:e.jsx(_tr,{})}),e.jsx(ms,{value:"orders",children:e.jsx(jtr,{})})]})]})})}function yHe(){return Ht({queryKey:["reward-categories"],queryFn:async()=>{const{data:t,error:r}=await Z.from("reward_store_categories").select("*").order("sort_order",{ascending:!0});if(r)throw r;return t}})}function Ntr(t){return Ht({queryKey:["reward-items",t],queryFn:async()=>{let r=Z.from("reward_store_items").select(` *, category:reward_store_categories(*) `).order("created_at",{ascending:!1});const{data:s,error:n}=await r;if(n)throw n;return s}})}function Str(t){return Ht({queryKey:["active-reward-items",t],queryFn:async()=>{let r=Z.from("reward_store_items").select(` *, category:reward_store_categories(*) `).eq("is_active",!0).order("created_at",{ascending:!1});t&&(r=r.eq("category_id",t));const{data:s,error:n}=await r;if(n)throw n;return s}})}function Ctr(t){return Ht({queryKey:["user-purchases",t],queryFn:async()=>{if(!t)return[];const{data:r,error:s}=await Z.from("reward_store_purchases").select(` *, item:reward_store_items(*) `).eq("user_id",t).order("purchased_at",{ascending:!1});if(s)throw s;return r},enabled:!!t})}function Mtr(){return Ht({queryKey:["all-reward-purchases"],queryFn:async()=>{const{data:t,error:r}=await Z.from("reward_store_purchases").select(` *, item:reward_store_items(*) `).order("purchased_at",{ascending:!1});if(r)throw r;if(!t||t.length===0)return[];const s=[...new Set(t.map(l=>l.user_id))],{data:n,error:a}=await Z.from("profiles").select("id, name, email").in("id",s);if(a)throw a;const o=new Map((n==null?void 0:n.map(l=>[l.id,l]))||[]);return t.map(l=>({...l,user:o.get(l.user_id)||null}))}})}function Ttr(t){return Ht({queryKey:["spendable-points",t],queryFn:async()=>{if(!t)return 0;const{data:r,error:s}=await Z.from("agent_attendance_stats").select("spendable_points").eq("user_id",t).single();if(s&&s.code!=="PGRST116")throw s;return(r==null?void 0:r.spendable_points)||0},enabled:!!t})}function Atr(){const t=qr();return Jt({mutationFn:async r=>{const{data:s,error:n}=await Z.rpc("purchase_reward_item",{p_item_id:r});if(n)throw n;const a=s;if(!a.success)throw new Error(a.error||"Purchase failed");return a},onSuccess:()=>{t.invalidateQueries({queryKey:["user-purchases"]}),t.invalidateQueries({queryKey:["spendable-points"]}),t.invalidateQueries({queryKey:["active-reward-items"]}),t.invalidateQueries({queryKey:["reward-items"]})}})}function Etr(){const t=qr();return Jt({mutationFn:async r=>{const{data:s,error:n}=await Z.from("reward_store_categories").insert([r]).select().single();if(n)throw n;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-categories"]})}})}function Itr(){const t=qr();return Jt({mutationFn:async({id:r,...s})=>{const{data:n,error:a}=await Z.from("reward_store_categories").update(s).eq("id",r).select().single();if(a)throw a;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-categories"]})}})}function Ptr(){const t=qr();return Jt({mutationFn:async r=>{const{error:s}=await Z.from("reward_store_categories").delete().eq("id",r);if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-categories"]})}})}function Ltr(){const t=qr();return Jt({mutationFn:async r=>{const{data:s,error:n}=await Z.from("reward_store_items").insert([r]).select().single();if(n)throw n;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-items"]}),t.invalidateQueries({queryKey:["active-reward-items"]})}})}function Otr(){const t=qr();return Jt({mutationFn:async({id:r,...s})=>{const{data:n,error:a}=await Z.from("reward_store_items").update(s).eq("id",r).select().single();if(a)throw a;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-items"]}),t.invalidateQueries({queryKey:["active-reward-items"]})}})}function Dtr(){const t=qr();return Jt({mutationFn:async r=>{const{error:s}=await Z.from("reward_store_items").delete().eq("id",r);if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-items"]}),t.invalidateQueries({queryKey:["active-reward-items"]})}})}function Rtr(t){const r=t.match(/\/storage\/v1\/object\/public\/([^/]+)\/(.+)$/);return r?{bucket:r[1],path:r[2]}:null}async function Nue(t,r){const s=Rtr(t);if(s)try{const{data:n,error:a}=await Z.storage.from(s.bucket).download(s.path);if(a){console.error("Error downloading file:",a),Se.error("Failed to download file");return}const o=URL.createObjectURL(n),l=document.createElement("a");l.href=o,l.download=r||s.path.split("/").pop()||"download",document.body.appendChild(l),l.click(),document.body.removeChild(l),setTimeout(()=>URL.revokeObjectURL(o),100)}catch(n){console.error("Download error:",n),Se.error("Failed to download file")}else try{const a=await(await fetch(t)).blob(),o=URL.createObjectURL(a),l=document.createElement("a");l.href=o,l.download=r||t.split("/").pop()||"download",document.body.appendChild(l),l.click(),document.body.removeChild(l),setTimeout(()=>URL.revokeObjectURL(o),100)}catch(n){console.error("External download error:",n),Se.error("Failed to download file")}}function vHe(){return Ht({queryKey:["point-reward-settings"],queryFn:async()=>{const{data:t,error:r}=await Z.from("point_reward_settings").select("*").order("action_name");if(r)throw r;return t}})}function Ftr(){const t=qr();return Jt({mutationFn:async({id:r,points:s,is_active:n})=>{const a={points:s};n!==void 0&&(a.is_active=n);const{data:o,error:l}=await Z.from("point_reward_settings").update(a).eq("id",r).select().single();if(l)throw l;return o},onSuccess:()=>{t.invalidateQueries({queryKey:["point-reward-settings"]})}})}function ztr(){const{user:t}=Gr(),[r,s]=E.useState("items"),[n,a]=E.useState(!1),[o,l]=E.useState(null),[i,d]=E.useState(""),[m,g]=E.useState(""),[y,v]=E.useState(""),[b,N]=E.useState(null),[j,S]=E.useState(!1),[A,M]=E.useState(null),[I,F]=E.useState(""),[O,B]=E.useState(""),[$,H]=E.useState(null),[W,X]=E.useState(""),[se,ae]=E.useState("file"),[le,ne]=E.useState(""),[fe,oe]=E.useState(""),[de,ue]=E.useState(""),[xe,Te]=E.useState(!0),[be,we]=E.useState(null),[ve,tt]=E.useState(!1),[Ae,Le]=E.useState(!1),Ue=E.useRef(null),Ye=E.useRef(null),{data:Ie,isLoading:et}=yHe(),{data:It,isLoading:Pe}=Ntr(),{data:at,isLoading:ce}=Mtr(),{data:$e,isLoading:Ge}=vHe(),rt=Etr(),je=Itr(),it=Ptr(),Me=Ltr(),Je=Otr(),Xe=Dtr(),Ve=Ftr(),[ot,mt]=E.useState({}),ft=At=>{At?(l(At),d(At.name),g(At.description||""),v(At.icon||"")):(l(null),d(""),g(""),v("")),a(!0)},ct=async()=>{if(!i.trim()){Se.error("Please enter a category name");return}try{o?(await je.mutateAsync({id:o.id,name:i,description:m||null,icon:y||null}),Se.success("Category updated successfully")):(await rt.mutateAsync({name:i,description:m||null,icon:y||null,sort_order:((Ie==null?void 0:Ie.length)||0)+1}),Se.success("Category created successfully")),a(!1)}catch(At){console.error("Error saving category:",At),Se.error("Failed to save category")}},Mt=async()=>{if(b)try{await it.mutateAsync(b),Se.success("Category deleted successfully"),N(null)}catch(At){console.error("Error deleting category:",At),Se.error("Failed to delete category")}},Ot=At=>{var Rt;At?(M(At),F(At.name),B(At.description||""),H(At.category_id),X(At.points_cost.toString()),ae(At.item_type),ne(At.file_url||""),oe(At.preview_image_url||""),ue(((Rt=At.max_quantity)==null?void 0:Rt.toString())||""),Te(At.is_active)):(M(null),F(""),B(""),H(null),X(""),ae("file"),ne(""),oe(""),ue(""),Te(!0)),S(!0)},rr=async(At,Rt)=>{Rt==="file"?tt(!0):Le(!0);try{const Cr=At.name.split(".").pop(),fs=`${Date.now()}-${Math.random().toString(36).substring(7)}.${Cr}`,Vs=`${Rt==="file"?"items":"previews"}/${fs}`,{error:Js}=await Z.storage.from("reward-store").upload(Vs,At);if(Js)throw Js;const{data:{publicUrl:hi}}=Z.storage.from("reward-store").getPublicUrl(Vs);Rt==="file"?ne(hi):oe(hi),Se.success("File uploaded successfully")}catch(Cr){console.error("Error uploading file:",Cr),Se.error("Failed to upload file")}finally{Rt==="file"?tt(!1):Le(!1)}},Ir=async()=>{if(!I.trim()){Se.error("Please enter an item name");return}if(!W||parseInt(W)<0){Se.error("Please enter a valid points cost");return}try{const At={name:I,description:O||null,category_id:$,points_cost:parseInt(W),item_type:se,file_url:le||null,preview_image_url:fe||null,max_quantity:de?parseInt(de):null,current_quantity:de?parseInt(de):null,is_active:xe,created_by:t==null?void 0:t.id};A?(await Je.mutateAsync({id:A.id,...At,current_quantity:A.max_quantity!==(de?parseInt(de):null)?de?parseInt(de):null:A.current_quantity}),Se.success("Item updated successfully")):(await Me.mutateAsync(At),Se.success("Item created successfully")),S(!1)}catch(At){console.error("Error saving item:",At),Se.error("Failed to save item")}},cr=async()=>{if(be)try{await Xe.mutateAsync(be),Se.success("Item deleted successfully"),we(null)}catch(At){console.error("Error deleting item:",At),Se.error("Failed to delete item")}},Mr=async(At,Rt)=>{const Cr=ot[At];if(Cr===void 0||Cr===Rt.toString())return;const fs=parseInt(Cr);if(isNaN(fs)||fs<0){Se.error("Please enter a valid positive number");return}try{await Ve.mutateAsync({id:At,points:fs}),Se.success("Points updated successfully"),mt(Vs=>{const Js={...Vs};return delete Js[At],Js})}catch(Vs){console.error("Error updating points:",Vs),Se.error("Failed to update points")}};return et||Pe||ce||Ge?e.jsx(Fr,{title:"Reward Store",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(fr,{className:"h-8 w-64"}),e.jsx(fr,{className:"h-96"})]})}):e.jsxs(Fr,{title:"Reward Store",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Reward Store Management"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage store items that agents can purchase with their points"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(Wl,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs font-medium",children:"Total Items"})]}),e.jsx("p",{className:"text-2xl font-bold",children:(It==null?void 0:It.length)||0}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[(It==null?void 0:It.filter(At=>At.is_active).length)||0," active"]})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(bm,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs font-medium",children:"Categories"})]}),e.jsx("p",{className:"text-2xl font-bold",children:(Ie==null?void 0:Ie.length)||0})]})}),e.jsx(ze,{children:e.jsxs(qe,{className:"pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(Ln,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs font-medium",children:"Avg. Cost"})]}),e.jsxs("p",{className:"text-2xl font-bold",children:[It&&It.length>0?Math.round(It.reduce((At,Rt)=>At+Rt.points_cost,0)/It.length):0," pts"]})]})})]}),e.jsxs(ci,{value:r,onValueChange:s,children:[e.jsxs(ri,{children:[e.jsx(Kr,{value:"items",children:"Items"}),e.jsx(Kr,{value:"categories",children:"Categories"}),e.jsx(Kr,{value:"purchases",children:"Purchases"}),e.jsx(Kr,{value:"point-settings",children:"Point Settings"})]}),e.jsx(ms,{value:"items",className:"mt-4",children:e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Zt,{children:"Store Items"}),e.jsx(Ss,{children:"Manage rewards that agents can purchase"})]}),e.jsxs(Q,{onClick:()=>Ot(),children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Item"]})]}),e.jsx(qe,{children:!It||It.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(uo,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"No items yet. Add your first reward item!"})]}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Item"}),e.jsx(Ct,{children:"Category"}),e.jsx(Ct,{className:"text-center",children:"Cost"}),e.jsx(Ct,{className:"text-center",children:"Type"}),e.jsx(Ct,{className:"text-center",children:"Quantity"}),e.jsx(Ct,{className:"text-center",children:"Status"}),e.jsx(Ct,{className:"text-right",children:"Actions"})]})}),e.jsx(zn,{children:It.map(At=>e.jsxs(Nr,{children:[e.jsx(dt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[At.preview_image_url?e.jsx("img",{src:At.preview_image_url,alt:At.name,className:"h-10 w-10 rounded object-cover"}):e.jsx("div",{className:"h-10 w-10 rounded bg-muted flex items-center justify-center",children:e.jsx(uo,{className:"h-5 w-5 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:At.name}),e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:At.description||"No description"})]})]})}),e.jsx(dt,{children:At.category?e.jsx(bt,{variant:"outline",children:At.category.name}):e.jsx("span",{className:"text-muted-foreground",children:"—"})}),e.jsx(dt,{className:"text-center",children:e.jsxs(bt,{variant:"secondary",className:"font-bold",children:[e.jsx(Ln,{className:"h-3 w-3 mr-1"}),At.points_cost]})}),e.jsx(dt,{className:"text-center",children:e.jsxs("div",{className:"flex items-center justify-center gap-1",children:[At.item_type==="file"?e.jsx(fa,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(Bo,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-xs capitalize",children:At.item_type})]})}),e.jsx(dt,{className:"text-center",children:At.max_quantity!==null?e.jsxs("span",{className:At.current_quantity===0?"text-red-500":"",children:[At.current_quantity,"/",At.max_quantity]}):e.jsx("span",{className:"text-muted-foreground",children:"Unlimited"})}),e.jsx(dt,{className:"text-center",children:e.jsx(bt,{variant:At.is_active?"default":"secondary",children:At.is_active?"Active":"Inactive"})}),e.jsx(dt,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>Ot(At),children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>we(At.id),children:e.jsx(Rs,{className:"h-4 w-4 text-destructive"})})]})})]},At.id))})]})})]})}),e.jsx(ms,{value:"categories",className:"mt-4",children:e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Zt,{children:"Categories"}),e.jsx(Ss,{children:"Organize your store items into categories"})]}),e.jsxs(Q,{onClick:()=>ft(),children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),e.jsx(qe,{children:!Ie||Ie.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(bm,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"No categories yet. Add your first category!"})]}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Name"}),e.jsx(Ct,{children:"Description"}),e.jsx(Ct,{className:"text-center",children:"Items"}),e.jsx(Ct,{className:"text-right",children:"Actions"})]})}),e.jsx(zn,{children:Ie.map(At=>e.jsxs(Nr,{children:[e.jsxs(dt,{className:"font-medium",children:[At.icon&&e.jsx("span",{className:"mr-2",children:At.icon}),At.name]}),e.jsx(dt,{className:"text-muted-foreground",children:At.description||"—"}),e.jsx(dt,{className:"text-center",children:(It==null?void 0:It.filter(Rt=>Rt.category_id===At.id).length)||0}),e.jsx(dt,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>ft(At),children:e.jsx(ei,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>N(At.id),children:e.jsx(Rs,{className:"h-4 w-4 text-destructive"})})]})})]},At.id))})]})})]})}),e.jsx(ms,{value:"purchases",className:"mt-4",children:e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(Lh,{className:"h-5 w-5"}),"Purchase History"]}),e.jsx(Ss,{children:"View all reward redemptions by agents"})]}),e.jsx(qe,{children:!at||at.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(Lh,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"No purchases yet."})]}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Date"}),e.jsx(Ct,{children:"Agent"}),e.jsx(Ct,{children:"Item"}),e.jsx(Ct,{className:"text-center",children:"Points Spent"})]})}),e.jsx(zn,{children:at.map(At=>{var Rt,Cr,fs,Vs;return e.jsxs(Nr,{children:[e.jsx(dt,{className:"text-muted-foreground",children:Xr(new Date(At.purchased_at),"MMM d, yyyy 'at' h:mm a")}),e.jsx(dt,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-8 w-8 rounded-full bg-muted flex items-center justify-center",children:e.jsx(Kl,{className:"h-4 w-4 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:((Rt=At.user)==null?void 0:Rt.name)||"Unknown"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:((Cr=At.user)==null?void 0:Cr.email)||"—"})]})]})}),e.jsx(dt,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[(fs=At.item)!=null&&fs.preview_image_url?e.jsx("img",{src:At.item.preview_image_url,alt:At.item.name,className:"h-8 w-8 rounded object-cover"}):e.jsx("div",{className:"h-8 w-8 rounded bg-muted flex items-center justify-center",children:e.jsx(uo,{className:"h-4 w-4 text-muted-foreground"})}),e.jsx("span",{children:((Vs=At.item)==null?void 0:Vs.name)||"Deleted item"})]})}),e.jsx(dt,{className:"text-center",children:e.jsxs(bt,{variant:"secondary",className:"font-bold",children:[e.jsx(Ln,{className:"h-3 w-3 mr-1"}),At.points_spent]})})]},At.id)})})]})})]})})]})]}),e.jsx(Dr,{open:n,onOpenChange:a,children:e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:o?"Edit Category":"Add Category"}),e.jsx(Gs,{children:o?"Update the category details":"Create a new category for your store items"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"categoryName",children:"Name"}),e.jsx(Qe,{id:"categoryName",value:i,onChange:At=>d(At.target.value),placeholder:"e.g., Templates, Resources"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"categoryDescription",children:"Description"}),e.jsx(Ks,{id:"categoryDescription",value:m,onChange:At=>g(At.target.value),placeholder:"Optional description..."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"categoryIcon",children:"Icon (emoji)"}),e.jsx(Qe,{id:"categoryIcon",value:y,onChange:At=>v(At.target.value),placeholder:"e.g., 📄, 🎁"})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsx(Q,{onClick:ct,disabled:rt.isPending||je.isPending,children:rt.isPending||je.isPending?"Saving...":"Save"})]})]})}),e.jsx(Dr,{open:j,onOpenChange:S,children:e.jsxs(Lr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:A?"Edit Item":"Add Item"}),e.jsx(Gs,{children:A?"Update the item details":"Create a new reward item for agents to purchase"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"itemName",children:"Name *"}),e.jsx(Qe,{id:"itemName",value:I,onChange:At=>F(At.target.value),placeholder:"e.g., Premium Template Pack"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"itemDescription",children:"Description"}),e.jsx(Ks,{id:"itemDescription",value:O,onChange:At=>B(At.target.value),placeholder:"Describe the item..."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"itemCategory",children:"Category"}),e.jsxs(ds,{value:$||"none",onValueChange:At=>H(At==="none"?null:At),children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Select category"})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"none",children:"No category"}),Ie==null?void 0:Ie.map(At=>e.jsxs(Ut,{value:At.id,children:[At.icon&&`${At.icon} `,At.name]},At.id))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"itemPointsCost",children:"Points Cost *"}),e.jsx(Qe,{id:"itemPointsCost",type:"number",min:"0",value:W,onChange:At=>X(At.target.value),placeholder:"e.g., 100"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"itemType",children:"Type"}),e.jsxs(ds,{value:se,onValueChange:ae,children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"file",children:"File Download"}),e.jsx(Ut,{value:"link",children:"External Link"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"itemMaxQuantity",children:"Max Quantity"}),e.jsx(Qe,{id:"itemMaxQuantity",type:"number",min:"1",value:de,onChange:At=>ue(At.target.value),placeholder:"Leave empty for unlimited"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"File / Link URL"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Qe,{value:le,onChange:At=>ne(At.target.value),placeholder:se==="file"?"Upload a file or paste URL":"Paste external link"}),se==="file"&&e.jsxs(e.Fragment,{children:[e.jsx(Q,{type:"button",variant:"outline",size:"icon",onClick:()=>{var At;return(At=Ue.current)==null?void 0:At.click()},disabled:ve,children:e.jsx(to,{className:"h-4 w-4"})}),e.jsx("input",{ref:Ue,type:"file",className:"hidden",onChange:At=>{var Cr;const Rt=(Cr=At.target.files)==null?void 0:Cr[0];Rt&&rr(Rt,"file")}})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{children:"Preview Image"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Qe,{value:fe,onChange:At=>oe(At.target.value),placeholder:"Upload an image or paste URL"}),e.jsx(Q,{type:"button",variant:"outline",size:"icon",onClick:()=>{var At;return(At=Ye.current)==null?void 0:At.click()},disabled:Ae,children:e.jsx(El,{className:"h-4 w-4"})}),e.jsx("input",{ref:Ye,type:"file",accept:"image/*",className:"hidden",onChange:At=>{var Cr;const Rt=(Cr=At.target.files)==null?void 0:Cr[0];Rt&&rr(Rt,"preview")}})]}),fe&&e.jsx("img",{src:fe,alt:"Preview",className:"mt-2 h-24 rounded object-cover"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xn,{id:"itemIsActive",checked:xe,onCheckedChange:Te}),e.jsx(Ee,{htmlFor:"itemIsActive",children:"Active (visible to agents)"})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),e.jsx(Q,{onClick:Ir,disabled:Me.isPending||Je.isPending,children:Me.isPending||Je.isPending?"Saving...":"Save"})]})]})}),e.jsx(Xc,{open:!!b,onOpenChange:()=>N(null),children:e.jsxs(Tc,{children:[e.jsxs(Ac,{children:[e.jsx(Ic,{children:"Delete Category"}),e.jsx(Pc,{children:"Are you sure you want to delete this category? Items in this category will become uncategorized."})]}),e.jsxs(Ec,{children:[e.jsx(Lc,{children:"Cancel"}),e.jsx(dc,{onClick:Mt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),e.jsx(Xc,{open:!!be,onOpenChange:()=>we(null),children:e.jsxs(Tc,{children:[e.jsxs(Ac,{children:[e.jsx(Ic,{children:"Delete Item"}),e.jsx(Pc,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),e.jsxs(Ec,{children:[e.jsx(Lc,{children:"Cancel"}),e.jsx(dc,{onClick:cr,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),r==="point-settings"&&e.jsxs(ze,{className:"mt-4",children:[e.jsx(Wt,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(vd,{className:"h-5 w-5"}),e.jsxs("div",{children:[e.jsx(Zt,{children:"Point Reward Settings"}),e.jsx(Ss,{children:"Configure how many points agents earn for various actions. Adjust these values to run double-points promotions."})]})]})}),e.jsx(qe,{children:!$e||$e.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(vd,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"No point settings configured."})]}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Action"}),e.jsx(Ct,{children:"Description"}),e.jsx(Ct,{className:"text-center w-32",children:"Points"}),e.jsx(Ct,{className:"text-right w-24",children:"Save"})]})}),e.jsx(zn,{children:$e.map(At=>e.jsxs(Nr,{children:[e.jsx(dt,{children:e.jsx("p",{className:"font-medium",children:At.action_name})}),e.jsx(dt,{children:e.jsx("p",{className:"text-sm text-muted-foreground",children:At.description})}),e.jsx(dt,{className:"text-center",children:e.jsx(Qe,{type:"number",min:"0",className:"w-20 mx-auto text-center",value:ot[At.id]??At.points.toString(),onChange:Rt=>mt(Cr=>({...Cr,[At.id]:Rt.target.value}))})}),e.jsx(dt,{className:"text-right",children:e.jsx(Q,{size:"sm",variant:"outline",disabled:ot[At.id]===void 0||ot[At.id]===At.points.toString()||Ve.isPending,onClick:()=>Mr(At.id,At.points),children:e.jsx(_p,{className:"h-4 w-4"})})})]},At.id))})]})})]})]})}const zTe=()=>e.jsxs("svg",{viewBox:"0 0 100 100",className:"h-5 w-5",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("rect",{width:"100",height:"100",rx:"20",fill:"#7D2AE8"}),e.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"})]}),BTe=[{value:"template",label:"Templates"},{value:"brand",label:"Brand Assets"},{value:"listing",label:"Listing Assets"},{value:"social",label:"Social Media"},{value:"general",label:"General"}];function Btr(){const t=qr(),[r,s]=E.useState(!1),[n,a]=E.useState(!1),[o,l]=E.useState(!1),[i,d]=E.useState({brokerage_id:"",folder_id:"",folder_name:"",folder_type:"template",description:""}),{data:m,isLoading:g}=Ht({queryKey:["canva-integration"],queryFn:async()=>{const{data:M,error:I}=await Z.from("canva_integration").select("*").eq("is_active",!0).maybeSingle();if(I)throw I;return M}}),{data:y}=Ht({queryKey:["brokerages-list"],queryFn:async()=>{const{data:M,error:I}=await Z.from("brokerages").select("id, name").order("name");if(I)throw I;return M}}),{data:v}=Ht({queryKey:["canva-brokerage-folders"],queryFn:async()=>{const{data:M,error:I}=await Z.from("canva_brokerage_folders").select("*, brokerages(name)").order("sort_order");if(I)throw I;return M}}),b=async()=>{var M;s(!0);try{const{data:I}=await Z.auth.getSession(),F=(M=I==null?void 0:I.session)==null?void 0:M.access_token;if(!F)throw new Error("Not authenticated");const $=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/canva-oauth",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${F}`,apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJlbHplamlzd25vdGlramd2amh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE5NTAzNDQsImV4cCI6MjA3NzUyNjM0NH0.dzIkIr_oFSbFE3oWS0ktIr83iKHHkZxt40Gc7SpC_mM"},body:JSON.stringify({action:"get_auth_url"})}),H=await $.json();if(!$.ok||H!=null&&H.error)throw new Error((H==null?void 0:H.error)||"Failed to get authorization URL");if(H!=null&&H.authUrl){localStorage.setItem("canva_code_verifier",H.codeVerifier),localStorage.setItem("canva_oauth_state",H.state);const W=window.open(H.authUrl,"canva-oauth","width=600,height=700,scrollbars=yes,resizable=yes");if(!W){Se.error("Popup was blocked. Please allow popups for this site and try again."),s(!1);return}const X=ae=>{var le,ne;ae.origin===window.location.origin&&(((le=ae.data)==null?void 0:le.type)==="canva-oauth-success"?(window.removeEventListener("message",X),Se.success("Canva connected successfully!"),t.invalidateQueries({queryKey:["canva-integration"]}),s(!1)):((ne=ae.data)==null?void 0:ne.type)==="canva-oauth-error"&&(window.removeEventListener("message",X),Se.error("Canva connection failed: "+(ae.data.error||"Unknown error")),s(!1)))};window.addEventListener("message",X);const se=setInterval(()=>{W.closed&&(clearInterval(se),window.removeEventListener("message",X),t.invalidateQueries({queryKey:["canva-integration"]}),s(!1))},500)}else throw new Error("Failed to get authorization URL")}catch(I){console.error("Canva connect error:",I);const F=(I==null?void 0:I.message)||"";F.includes("CANVA_CLIENT_ID")?Se.error("Canva app credentials not configured yet."):Se.error(F||"Failed to start Canva connection"),s(!1)}},N=Jt({mutationFn:async M=>{var W;const{data:I}=await Z.auth.getSession(),F=(W=I==null?void 0:I.session)==null?void 0:W.access_token;if(!F)throw new Error("Not authenticated");const $=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/canva-oauth",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${F}`,apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJlbHplamlzd25vdGlramd2amh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE5NTAzNDQsImV4cCI6MjA3NzUyNjM0NH0.dzIkIr_oFSbFE3oWS0ktIr83iKHHkZxt40Gc7SpC_mM"},body:JSON.stringify({action:"disconnect",integrationId:M})}),H=await $.json();if(!$.ok||H!=null&&H.error)throw new Error((H==null?void 0:H.error)||"Failed to disconnect")},onSuccess:()=>{t.invalidateQueries({queryKey:["canva-integration"]}),Se.success("Canva disconnected")},onError:M=>{Se.error(M.message||"Failed to disconnect Canva")}}),j=Jt({mutationFn:async M=>{const{error:I}=await Z.from("canva_brokerage_folders").insert({brokerage_id:M.brokerage_id,folder_id:M.folder_id.trim(),folder_name:M.folder_name.trim(),folder_type:M.folder_type,description:M.description.trim()||null,sort_order:(v==null?void 0:v.length)||0});if(I)throw I},onSuccess:()=>{t.invalidateQueries({queryKey:["canva-brokerage-folders"]}),Se.success("Folder added"),l(!1),d({brokerage_id:"",folder_id:"",folder_name:"",folder_type:"template",description:""})},onError:()=>Se.error("Failed to add folder")}),S=Jt({mutationFn:async M=>{const{error:I}=await Z.from("canva_brokerage_folders").delete().eq("id",M);if(I)throw I},onSuccess:()=>{t.invalidateQueries({queryKey:["canva-brokerage-folders"]}),Se.success("Folder removed")},onError:()=>Se.error("Failed to remove folder")}),A=!!m;return e.jsxs(e.Fragment,{children:[e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-lg bg-accent flex items-center justify-center",children:e.jsx(zTe,{})}),e.jsxs("div",{children:[e.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:["Canva Connect",A&&e.jsx(bt,{variant:"default",className:"text-xs",children:"Connected"}),e.jsx(bt,{variant:"outline",className:"text-xs",children:"Admin Only"})]}),e.jsx(Ss,{children:"Auto-share brokerage asset folders with agents when they connect their Canva accounts."})]})]})})}),e.jsx(qe,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[e.jsx(ui,{className:"h-4 w-4 mt-0.5 text-primary shrink-0"}),e.jsx("span",{children:"OAuth 2.0 + PKCE for secure authorization"})]}),e.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[e.jsx(ui,{className:"h-4 w-4 mt-0.5 text-primary shrink-0"}),e.jsx("span",{children:"Map brokerage folders to auto-share with agents on connection"})]}),e.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[e.jsx(ui,{className:"h-4 w-4 mt-0.5 text-primary shrink-0"}),e.jsx("span",{children:"Multiple folders per brokerage (templates, brand assets, listings)"})]}),e.jsxs("div",{className:"mt-4 p-3 rounded-lg bg-muted border border-dashed",children:[e.jsx("p",{className:"text-xs font-medium text-foreground mb-1",children:"Canva App Redirect URL"}),e.jsx("code",{className:"text-xs text-muted-foreground break-all select-all",children:"https://dashboard.relevelup.com/canva-callback.html"})]}),A?e.jsxs("div",{className:"space-y-3 mt-4",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:m.canva_team_id?`Team: ${m.canva_team_id}`:"Canva Account"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:m.expires_at?`Token expires ${new Date(m.expires_at).toLocaleDateString()}`:"Platform integration active"})]}),e.jsxs(Xc,{children:[e.jsx(xm,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:e.jsx(Rs,{className:"h-4 w-4"})})}),e.jsxs(Tc,{children:[e.jsxs(Ac,{children:[e.jsx(Ic,{children:"Disconnect Canva?"}),e.jsx(Pc,{children:"This will remove the Canva platform integration. Agents who have already connected will not be affected, but new folder sharing will stop."})]}),e.jsxs(Ec,{children:[e.jsx(Lc,{children:"Cancel"}),e.jsx(dc,{onClick:()=>N.mutate(m.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]}),e.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[e.jsxs("button",{onClick:()=>a(!n),className:"w-full flex items-center justify-between p-3 text-sm font-medium hover:bg-muted transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(bm,{className:"h-4 w-4 text-primary"}),"Brokerage Folder Mappings",v&&v.length>0&&e.jsx(bt,{variant:"secondary",className:"text-xs",children:v.length})]}),n?e.jsx(Hg,{className:"h-4 w-4"}):e.jsx(Jc,{className:"h-4 w-4"})]}),n&&e.jsxs("div",{className:"border-t p-3 space-y-2",children:[v&&v.length>0?v.map(M=>{var I,F;return e.jsxs("div",{className:"flex items-center justify-between p-2 rounded-md bg-muted/50 text-sm",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium truncate",children:M.folder_name}),e.jsx(bt,{variant:"outline",className:"text-xs shrink-0",children:((I=BTe.find(O=>O.value===M.folder_type))==null?void 0:I.label)||M.folder_type})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[(F=M.brokerages)==null?void 0:F.name," · ID: ",e.jsx("span",{className:"font-mono",children:M.folder_id})]})]}),e.jsx(Q,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive shrink-0 ml-2",onClick:()=>S.mutate(M.id),children:e.jsx(rn,{className:"h-3.5 w-3.5"})})]},M.id)}):e.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"No folders mapped yet"}),e.jsxs(Q,{variant:"outline",size:"sm",className:"w-full gap-1.5 mt-1",onClick:()=>l(!0),children:[e.jsx(gs,{className:"h-3.5 w-3.5"}),"Add Folder Mapping"]})]})]})]}):e.jsxs(Q,{className:"mt-4",onClick:b,disabled:r||g,children:[r?e.jsx(Ko,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx("div",{className:"mr-2",children:e.jsx(zTe,{})}),"Connect Canva",e.jsx(Hi,{className:"h-4 w-4 ml-2"})]})]})})]}),e.jsx(Dr,{open:o,onOpenChange:l,children:e.jsxs(Lr,{children:[e.jsx(Ur,{children:e.jsx(Br,{children:"Add Brokerage Folder Mapping"})}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{children:"Brokerage"}),e.jsxs(ds,{value:i.brokerage_id,onValueChange:M=>d(I=>({...I,brokerage_id:M})),children:[e.jsx(ls,{children:e.jsx(us,{placeholder:"Select a brokerage…"})}),e.jsx(cs,{children:y==null?void 0:y.map(M=>e.jsx(Ut,{value:M.id,children:M.name},M.id))})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{children:"Canva Folder ID"}),e.jsx(Qe,{placeholder:"e.g. FABCdef123456",value:i.folder_id,onChange:M=>d(I=>({...I,folder_id:M.target.value}))}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Found in the Canva folder URL: canva.com/folder/",e.jsx("strong",{children:"FOLDER_ID"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{children:"Folder Display Name"}),e.jsx(Qe,{placeholder:"e.g. Brand Templates 2024",value:i.folder_name,onChange:M=>d(I=>({...I,folder_name:M.target.value}))})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ee,{children:"Folder Type"}),e.jsxs(ds,{value:i.folder_type,onValueChange:M=>d(I=>({...I,folder_type:M})),children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsx(cs,{children:BTe.map(M=>e.jsx(Ut,{value:M.value,children:M.label},M.value))})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(Ee,{children:["Description ",e.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),e.jsx(Qe,{placeholder:"What's in this folder?",value:i.description,onChange:M=>d(I=>({...I,description:M.target.value}))})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsxs(Q,{onClick:()=>j.mutate(i),disabled:!i.brokerage_id||!i.folder_id||!i.folder_name||j.isPending,children:[j.isPending?e.jsx(Ko,{className:"h-4 w-4 mr-2 animate-spin"}):null,"Add Folder"]})]})]})})]})}function $tr(){return e.jsx(Fr,{children:e.jsxs("div",{className:"space-y-6 p-4 md:p-8",children:[e.jsx(Lu,{title:"Integrations",description:"Manage platform-level service connections"}),e.jsx(Btr,{})]})})}const Utr={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 BT(t,r=18,s=10){return t.length<=r+s+3?t:`${t.slice(0,r)}…${t.slice(-s)}`}function qtr(){var se,ae,le,ne,fe;const t=qr(),[r,s]=E.useState("Test Push"),[n,a]=E.useState("Testing web push notification"),[o,l]=E.useState("/community"),[i,d]=E.useState(!1),[m,g]=E.useState(!1),[y,v]=E.useState({isSupported:typeof window<"u"&&"serviceWorker"in navigator&&"PushManager"in window}),[b,N]=E.useState(null),[j,S]=E.useState(null),{data:A,isLoading:M}=Ht({queryKey:["push-notification-settings"],queryFn:async()=>{const{data:oe,error:de}=await Z.from("push_notification_settings").select("*").order("setting_key");if(de)throw de;return oe}}),{data:I,isLoading:F}=Ht({queryKey:["push-subscription-stats"],queryFn:async()=>{const{count:oe,error:de}=await Z.from("push_subscriptions").select("*",{count:"exact",head:!0});if(de)throw de;return{totalSubscriptions:oe||0}}}),O=Jt({mutationFn:async({settingKey:oe,isEnabled:de})=>{const{error:ue}=await Z.from("push_notification_settings").update({is_enabled:de}).eq("setting_key",oe);if(ue)throw ue},onSuccess:()=>{t.invalidateQueries({queryKey:["push-notification-settings"]}),Se.success("Notification setting updated")},onError:oe=>{Se.error("Failed to update setting: "+oe.message)}}),B=E.useMemo(()=>{var oe,de;return y.isSupported?`perm=${y.permission??"unknown"} · controller=${y.controllerPresent?"yes":"no"} · sw=${((oe=y.serviceWorker)==null?void 0:oe.activeState)??"unknown"} · sub=${(de=y.subscription)!=null&&de.endpoint?"yes":"no"}`:"Push not supported in this browser."},[y]);E.useEffect(()=>{let oe=!0;const de=async()=>{var be,we,ve,tt,Ae,Le,Ue;const xe="serviceWorker"in navigator&&"PushManager"in window,Te={isSupported:xe,permission:typeof Notification<"u"?Notification.permission:void 0,controllerPresent:!!((be=navigator.serviceWorker)!=null&&be.controller)};if(!xe){oe&&v(Te);return}try{const{data:Ye,error:Ie}=await Z.functions.invoke("get-vapid-public-key",{body:{}});if(Ie)throw Ie;Te.vapidPublicKey=Ye==null?void 0:Ye.vapidPublicKey;const It=(await navigator.serviceWorker.getRegistrations()).find(Pe=>{var ce,$e,Ge;return(((ce=Pe.active)==null?void 0:ce.scriptURL)||(($e=Pe.waiting)==null?void 0:$e.scriptURL)||((Ge=Pe.installing)==null?void 0:Ge.scriptURL)||"").includes("/sw.js")});if(It){Te.pushWorkerScriptUrl=((we=It.active)==null?void 0:we.scriptURL)||((ve=It.waiting)==null?void 0:ve.scriptURL)||((tt=It.installing)==null?void 0:tt.scriptURL),Te.serviceWorker={scope:It.scope,activeState:(Ae=It.active)==null?void 0:Ae.state};const Pe=await It.pushManager.getSubscription();if(Pe){const at=Pe.toJSON();Te.subscription={endpoint:at.endpoint,p256dh:(Le=at.keys)==null?void 0:Le.p256dh,auth:(Ue=at.keys)==null?void 0:Ue.auth}}}}catch(Ye){Te.error=(Ye==null?void 0:Ye.message)||String(Ye)}oe&&v(Te)};de();const ue=window.setInterval(de,4e3);return()=>{oe=!1,window.clearInterval(ue)}},[]);const $=async()=>{if(typeof Notification>"u"){Se.error("Notifications API not available in this browser.");return}try{if(Notification.permission!=="granted"&&await Notification.requestPermission()!=="granted"){Se.error("Notification permission not granted.");return}new Notification("Local notification test",{body:"If you see this, OS/browser notifications can display."}),Se.success("Triggered a local notification (not push).")}catch(oe){Se.error(`Local notification failed: ${(oe==null?void 0:oe.message)||String(oe)}`)}},H=async()=>{d(!0),N(null);try{const{data:oe,error:de}=await Z.functions.invoke("send-push-notification",{body:{title:r,body:n,url:o}});if(de)throw de;N({sent:oe==null?void 0:oe.sent,failed:oe==null?void 0:oe.failed,expiredCleaned:oe==null?void 0:oe.expiredCleaned,vapidPublicKey:oe==null?void 0:oe.vapidPublicKey}),(oe==null?void 0:oe.sent)>0?Se.success(`Test notification sent to ${oe.sent} subscriber(s)`):(oe==null?void 0:oe.failed)>0?Se.warning(`Notification failed for ${oe.failed} subscriber(s). ${oe.expired||0} expired subscriptions cleaned up.`):Se.info("No active subscriptions to send to")}catch(oe){console.error("Error sending test notification:",oe),N({error:(oe==null?void 0:oe.message)||String(oe)}),Se.error("Failed to send test notification: "+(oe.message||"Unknown error"))}finally{d(!1)}},W=async()=>{g(!0),S(null);try{const{data:oe,error:de}=await Z.functions.invoke("generate-vapid-keys",{body:{}});if(de)throw de;const ue=oe==null?void 0:oe.publicKey,xe=oe==null?void 0:oe.privateKey;if(!ue||!xe)throw new Error("generate-vapid-keys did not return keys");S({publicKey:ue,privateKey:xe}),Se.success("Generated new VAPID keys. Update backend secrets, then clear + re-subscribe.")}catch(oe){console.error("Error generating VAPID keys:",oe),Se.error("Failed to generate VAPID keys: "+((oe==null?void 0:oe.message)||"Unknown error"))}finally{g(!1)}},X=Jt({mutationFn:async()=>{const{error:oe}=await Z.from("push_subscriptions").delete().neq("id","00000000-0000-0000-0000-000000000000");if(oe)throw oe},onSuccess:()=>{Se.success("All subscriptions cleared. Users will need to re-enable notifications."),t.invalidateQueries({queryKey:["push-subscription-stats"]})},onError:oe=>{Se.error("Failed to clear subscriptions: "+oe.message)}});return e.jsx(Fr,{title:"Notification Settings",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(Lu,{title:"Notification Settings",description:"Manage push notifications and test the notification system"}),e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(ws,{className:"h-5 w-5"}),"Push Notification Subscribers"]}),e.jsx(Ss,{children:"Current active push notification subscriptions"})]}),e.jsx(qe,{children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"text-4xl font-bold",children:F?"...":(I==null?void 0:I.totalSubscriptions)||0}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"active subscriptions"})]})})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(vd,{className:"h-5 w-5"}),"Notification Types"]}),e.jsx(Ss,{children:"Control which types of push notifications are sent to users"})]}),e.jsx(qe,{children:M?e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading settings..."}):e.jsx("div",{className:"space-y-4",children:A==null?void 0:A.map(oe=>{const de=Utr[oe.setting_key]||{label:oe.setting_key,icon:"🔔"};return e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-2xl",children:de.icon}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:de.label}),e.jsx("div",{className:"text-sm text-muted-foreground",children:oe.description})]})]}),e.jsx(xn,{checked:oe.is_enabled,onCheckedChange:ue=>O.mutate({settingKey:oe.setting_key,isEnabled:ue}),disabled:O.isPending})]},oe.id)})})})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(Df,{className:"h-5 w-5"}),"Send Test Notification"]}),e.jsx(Ss,{children:"Send a test push notification to all subscribed users"})]}),e.jsxs(qe,{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 text-sm",children:[e.jsx("div",{className:"font-medium",children:"Client push debug"}),e.jsx("div",{className:"mt-1 text-muted-foreground",children:B}),y.error&&e.jsx("div",{className:"mt-2 text-destructive",children:y.error}),e.jsxs("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Backend VAPID public key"}),e.jsx("div",{className:"break-all rounded-md border bg-background p-2 font-mono text-xs",children:y.vapidPublicKey?BT(y.vapidPublicKey):"(not loaded)"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Service worker"}),e.jsxs("div",{className:"rounded-md border bg-background p-2 font-mono text-xs",children:[e.jsxs("div",{children:["scope: ",(se=y.serviceWorker)!=null&&se.scope?BT(y.serviceWorker.scope,24,8):"none"]}),e.jsxs("div",{children:["active: ",((ae=y.serviceWorker)==null?void 0:ae.activeState)??"none"]})]})]}),e.jsxs("div",{className:"space-y-1 sm:col-span-2",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Current browser subscription"}),e.jsxs("div",{className:"rounded-md border bg-background p-2 font-mono text-xs",children:[e.jsxs("div",{children:["endpoint: ",(le=y.subscription)!=null&&le.endpoint?BT(y.subscription.endpoint,40,12):"none"]}),e.jsxs("div",{children:["p256dh: ",(ne=y.subscription)!=null&&ne.p256dh?BT(y.subscription.p256dh,22,10):"none"]}),e.jsxs("div",{children:["auth: ",(fe=y.subscription)!=null&&fe.auth?BT(y.subscription.auth,22,10):"none"]})]})]})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsx(Q,{variant:"outline",onClick:$,children:"Local notification test"}),e.jsx(Q,{variant:"outline",onClick:()=>window.location.reload(),children:"Reload page"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"test-title",children:"Notification Title"}),e.jsx(Qe,{id:"test-title",value:r,onChange:oe=>s(oe.target.value),placeholder:"Enter notification title"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"test-body",children:"Notification Body"}),e.jsx(Ks,{id:"test-body",value:n,onChange:oe=>a(oe.target.value),placeholder:"Enter notification message",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"test-url",children:"Click URL (optional)"}),e.jsx(Qe,{id:"test-url",value:o,onChange:oe=>l(oe.target.value),placeholder:"/community or full URL"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Where users will be taken when they click the notification"})]}),e.jsxs(Q,{onClick:H,disabled:i||!r||!n,className:"w-full sm:w-auto",children:[e.jsx(Mi,{className:"h-4 w-4 mr-2"}),i?"Sending...":"Send Test Notification"]}),b&&e.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 text-sm",children:[e.jsx("div",{className:"font-medium",children:"Last send debug"}),b.error?e.jsxs("div",{className:"mt-1 text-destructive",children:["Error: ",b.error]}):e.jsxs("div",{className:"mt-1 space-y-1 text-muted-foreground",children:[e.jsxs("div",{children:["Result: ",b.sent??0," sent, ",b.failed??0," failed, ",b.expiredCleaned??0," expired cleaned"]}),b.vapidPublicKey?e.jsxs("div",{className:"break-all",children:["Backend VAPID public key: ",e.jsx("span",{className:"font-mono",children:b.vapidPublicKey})]}):e.jsx("div",{children:"Backend VAPID public key: (not returned)"})]})]})]})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsxs(Zt,{className:"flex items-center gap-2 text-destructive",children:[e.jsx(Rs,{className:"h-5 w-5"}),"Subscription Maintenance"]}),e.jsx(Ss,{children:"Clear all push subscriptions if VAPID keys were changed or subscriptions are invalid"})]}),e.jsxs(qe,{className:"space-y-4",children:[e.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."}),e.jsxs(Q,{variant:"destructive",onClick:()=>X.mutate(),disabled:X.isPending,children:[e.jsx(Rs,{className:"h-4 w-4 mr-2"}),X.isPending?"Clearing...":"Clear All Subscriptions"]}),e.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 text-sm",children:[e.jsx("div",{className:"font-medium",children:"VAPID key rotation helper"}),e.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."}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:e.jsx(Q,{variant:"outline",onClick:W,disabled:m,children:m?"Generating…":"Generate VAPID keys"})}),j&&e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsxs("div",{className:"text-muted-foreground",children:["Copy these into backend secrets ",e.jsx("span",{className:"font-mono",children:"VAPID_PUBLIC_KEY"})," and ",e.jsx("span",{className:"font-mono",children:"VAPID_PRIVATE_KEY"}),"."]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Public key"}),e.jsx("div",{className:"break-all rounded-md border bg-background p-2 font-mono text-xs",children:j.publicKey})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Private key (keep secret)"}),e.jsx("div",{className:"break-all rounded-md border bg-background p-2 font-mono text-xs",children:j.privateKey})]})]})]})]})]})]})})}function Vtr(){const{toast:t}=fi(),[r,s]=E.useState([]),[n,a]=E.useState({totalPresentations:0,totalViews:0,totalLeads:0,totalCtaClicks:0,agentsUsing:0}),[o,l]=E.useState(!0);E.useEffect(()=>{i()},[]);const i=async()=>{try{l(!0);const{data:m,error:g}=await Z.rpc("get_admin_presentation_stats");if(g)throw g;if(!m||m.length===0){l(!1);return}const y=m.map(S=>S.owner_user_id),{data:v,error:b}=await Z.from("profiles").select("id, name, email, avatar_url").in("id",y);if(b)throw b;const N=new Map((v==null?void 0:v.map(S=>[S.id,S]))||[]),j=m.map(S=>{const A=N.get(S.owner_user_id);return{owner_user_id:S.owner_user_id,name:(A==null?void 0:A.name)||"Unknown",email:(A==null?void 0:A.email)||"",avatar_url:(A==null?void 0:A.avatar_url)||null,presentation_count:Number(S.presentation_count),total_views:Number(S.total_views),total_leads:Number(S.total_leads),total_cta_clicks:Number(S.total_cta_clicks)}});j.sort((S,A)=>A.presentation_count-S.presentation_count),s(j),a({totalPresentations:j.reduce((S,A)=>S+A.presentation_count,0),totalViews:j.reduce((S,A)=>S+A.total_views,0),totalLeads:j.reduce((S,A)=>S+A.total_leads,0),totalCtaClicks:j.reduce((S,A)=>S+A.total_cta_clicks,0),agentsUsing:j.length})}catch(m){console.error("Error loading presentation stats:",m),t({title:"Error",description:"Failed to load presentation analytics",variant:"destructive"})}finally{l(!1)}},d=[{label:"Agents Using",value:n.agentsUsing,icon:ws,color:"text-blue-600"},{label:"Total Presentations",value:n.totalPresentations,icon:$f,color:"text-violet-600"},{label:"Total Views",value:n.totalViews,icon:Gi,color:"text-emerald-600"},{label:"Total Leads",value:n.totalLeads,icon:$d,color:"text-amber-600"},{label:"CTA Clicks",value:n.totalCtaClicks,icon:J1,color:"text-rose-600"}];return e.jsx(Fr,{title:"Presentation Analytics",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Presentation Analytics"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Track Smart Presentations usage and engagement across all agents"})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4",children:d.map(m=>e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Zt,{className:"text-sm font-medium",children:m.label}),e.jsx(m.icon,{className:`h-4 w-4 ${m.color}`})]}),e.jsx(qe,{children:o?e.jsx(fr,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:m.value.toLocaleString()})})]},m.label))}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(ou,{className:"h-5 w-5"}),"Agent Breakdown"]})}),e.jsx(qe,{children:o?e.jsx("div",{className:"space-y-3",children:[...Array(5)].map((m,g)=>e.jsx(fr,{className:"h-12 w-full"},g))}):r.length===0?e.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No presentations created yet."}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Agent"}),e.jsx(Ct,{className:"text-center",children:"Presentations"}),e.jsx(Ct,{className:"text-center",children:"Views"}),e.jsx(Ct,{className:"text-center",children:"Leads"}),e.jsx(Ct,{className:"text-center",children:"CTA Clicks"}),e.jsx(Ct,{className:"text-center",children:"Conversion"})]})}),e.jsx(zn,{children:r.map(m=>{var y,v;const g=m.total_views>0?(m.total_leads/m.total_views*100).toFixed(1):"0.0";return e.jsxs(Nr,{children:[e.jsx(dt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-8 w-8 rounded-full bg-muted flex items-center justify-center overflow-hidden",children:m.avatar_url?e.jsx("img",{src:m.avatar_url,alt:"",className:"h-full w-full object-cover"}):e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:((v=(y=m.name)==null?void 0:y.charAt(0))==null?void 0:v.toUpperCase())||"?"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-sm",children:m.name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:m.email})]})]})}),e.jsx(dt,{className:"text-center font-medium",children:m.presentation_count}),e.jsx(dt,{className:"text-center",children:m.total_views.toLocaleString()}),e.jsx(dt,{className:"text-center",children:m.total_leads>0?e.jsx(bt,{variant:"secondary",children:m.total_leads}):e.jsx("span",{className:"text-muted-foreground",children:"0"})}),e.jsx(dt,{className:"text-center",children:m.total_cta_clicks}),e.jsx(dt,{className:"text-center",children:e.jsxs("span",{className:Number(g)>0?"text-emerald-600 font-medium":"text-muted-foreground",children:[g,"%"]})})]},m.owner_user_id)})})]})})]})]})})}function Htr(){const{toast:t}=fi(),[r,s]=E.useState([]),[n,a]=E.useState({totalOpenHouses:0,totalVisitors:0,totalLeads:0,activeOpenHouses:0,agentsUsing:0}),[o,l]=E.useState(!0);E.useEffect(()=>{i()},[]);const i=async()=>{try{l(!0);const{data:m,error:g}=await Z.rpc("get_admin_guest_book_stats");if(g)throw g;if(!m||m.length===0){l(!1);return}const y=m.map(S=>S.agent_id),{data:v,error:b}=await Z.from("profiles").select("id, name, email, avatar_url").in("id",y);if(b)throw b;const N=new Map((v==null?void 0:v.map(S=>[S.id,S]))||[]),j=m.map(S=>{const A=N.get(S.agent_id);return{agent_id:S.agent_id,name:(A==null?void 0:A.name)||"Unknown",email:(A==null?void 0:A.email)||"",avatar_url:(A==null?void 0:A.avatar_url)||null,open_house_count:Number(S.open_house_count),total_visitors:Number(S.total_visitors),total_leads:Number(S.total_leads),active_count:Number(S.active_count)}});j.sort((S,A)=>A.total_visitors-S.total_visitors),s(j),a({totalOpenHouses:j.reduce((S,A)=>S+A.open_house_count,0),totalVisitors:j.reduce((S,A)=>S+A.total_visitors,0),totalLeads:j.reduce((S,A)=>S+A.total_leads,0),activeOpenHouses:j.reduce((S,A)=>S+A.active_count,0),agentsUsing:j.length})}catch(m){console.error("Error loading guest book stats:",m),t({title:"Error",description:"Failed to load guest book analytics",variant:"destructive"})}finally{l(!1)}},d=[{label:"Agents Using",value:n.agentsUsing,icon:ws,color:"text-blue-600"},{label:"Total Open Houses",value:n.totalOpenHouses,icon:Wn,color:"text-violet-600"},{label:"Active Now",value:n.activeOpenHouses,icon:ui,color:"text-emerald-600"},{label:"Total Visitors",value:n.totalVisitors,icon:Gi,color:"text-amber-600"},{label:"Leads Created",value:n.totalLeads,icon:$d,color:"text-rose-600"}];return e.jsx(Fr,{title:"Guest Book Analytics",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Guest Book Analytics"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Track open house sign-in usage and lead generation across all agents"})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4",children:d.map(m=>e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Zt,{className:"text-sm font-medium",children:m.label}),e.jsx(m.icon,{className:`h-4 w-4 ${m.color}`})]}),e.jsx(qe,{children:o?e.jsx(fr,{className:"h-8 w-16"}):e.jsx("div",{className:"text-2xl font-bold",children:m.value.toLocaleString()})})]},m.label))}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(ou,{className:"h-5 w-5"}),"Agent Breakdown"]})}),e.jsx(qe,{children:o?e.jsx("div",{className:"space-y-3",children:[...Array(5)].map((m,g)=>e.jsx(fr,{className:"h-12 w-full"},g))}):r.length===0?e.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No open houses created yet."}):e.jsxs(Rn,{children:[e.jsx(Fn,{children:e.jsxs(Nr,{children:[e.jsx(Ct,{children:"Agent"}),e.jsx(Ct,{className:"text-center",children:"Open Houses"}),e.jsx(Ct,{className:"text-center",children:"Active"}),e.jsx(Ct,{className:"text-center",children:"Visitors"}),e.jsx(Ct,{className:"text-center",children:"Leads"}),e.jsx(Ct,{className:"text-center",children:"Conversion"})]})}),e.jsx(zn,{children:r.map(m=>{var y,v;const g=m.total_visitors>0?(m.total_leads/m.total_visitors*100).toFixed(1):"0.0";return e.jsxs(Nr,{children:[e.jsx(dt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-8 w-8 rounded-full bg-muted flex items-center justify-center overflow-hidden",children:m.avatar_url?e.jsx("img",{src:m.avatar_url,alt:"",className:"h-full w-full object-cover"}):e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:((v=(y=m.name)==null?void 0:y.charAt(0))==null?void 0:v.toUpperCase())||"?"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-sm",children:m.name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:m.email})]})]})}),e.jsx(dt,{className:"text-center font-medium",children:m.open_house_count}),e.jsx(dt,{className:"text-center",children:m.active_count>0?e.jsx(bt,{variant:"secondary",className:"bg-emerald-100 text-emerald-700",children:m.active_count}):e.jsx("span",{className:"text-muted-foreground",children:"0"})}),e.jsx(dt,{className:"text-center",children:m.total_visitors.toLocaleString()}),e.jsx(dt,{className:"text-center",children:m.total_leads>0?e.jsx(bt,{variant:"secondary",children:m.total_leads}):e.jsx("span",{className:"text-muted-foreground",children:"0"})}),e.jsx(dt,{className:"text-center",children:e.jsxs("span",{className:Number(g)>0?"text-emerald-600 font-medium":"text-muted-foreground",children:[g,"%"]})})]},m.agent_id)})})]})})]})]})})}function Wtr(){const[t]=Bc(),r=Ws(),[s,n]=E.useState("loading"),[a,o]=E.useState("Processing connection...");return E.useEffect(()=>{(async()=>{const i=t.get("code"),d=t.get("error"),m=t.get("error_description"),g=t.get("state");if(d){n("error"),o(m||"Authorization was denied"),Se.error("Failed to connect: "+(m||d));return}if(!i){n("error"),o("No authorization code received"),Se.error("Failed to connect: No authorization code");return}try{const{data:y,error:v}=await Z.functions.invoke("meta-oauth",{body:{action:"exchange_code",code:i,state:g}});if(v)throw v;if(y!=null&&y.success)n("success"),o(y.message||"Accounts connected successfully!"),Se.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),n("error"),o(y.message||"Failed to complete connection"),Se.error(y.message||"Failed to connect accounts")}})()},[t]),e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:e.jsxs(ze,{className:"w-full max-w-md",children:[e.jsxs(Wt,{className:"text-center",children:[e.jsxs("div",{className:"mx-auto mb-4",children:[s==="loading"&&e.jsx(Hr,{className:"h-12 w-12 animate-spin text-primary"}),s==="success"&&e.jsx(ui,{className:"h-12 w-12 text-green-500"}),s==="error"&&e.jsx(Sc,{className:"h-12 w-12 text-destructive"})]}),e.jsxs(Zt,{children:[s==="loading"&&"Connecting...",s==="success"&&"Connected!",s==="error"&&"Connection Failed"]}),e.jsx(Ss,{children:a})]}),e.jsx(qe,{className:"flex justify-center",children:e.jsx(Q,{onClick:()=>r("/admin/integrations"),children:s==="success"?"View Integrations":"Back to Integrations"})})]})})}function Gtr(){const t=qr(),[r,s]=E.useState(""),[n,a]=E.useState(""),[o,l]=E.useState([]),i=E.useRef(null),{data:d,isLoading:m}=Ht({queryKey:["prospect-emails"],queryFn:async()=>{const{data:S,error:A}=await Z.from("prospect_emails").select("*").order("sent_at",{ascending:!1});if(A)throw A;return S}}),g={total:(d==null?void 0:d.length)||0,sent:(d==null?void 0:d.filter(S=>S.status==="sent").length)||0,converted:(d==null?void 0:d.filter(S=>S.status==="converted").length)||0,conversionRate:d!=null&&d.length?Math.round(d.filter(S=>S.status==="converted").length/d.length*100):0},y=Jt({mutationFn:async S=>{const{data:A,error:M}=await Z.functions.invoke("send-prospect-email",{body:{emails:S}});if(M)throw M;return A},onSuccess:S=>{t.invalidateQueries({queryKey:["prospect-emails"]}),Se.success(`${S.sent} email${S.sent>1?"s":""} sent successfully!`),s(""),a(""),l([])},onError:S=>{Se.error("Failed to send: "+S.message)}}),v=Jt({mutationFn:async()=>{var I,F;const{data:{user:S}}=await Z.auth.getUser();if(!(S!=null&&S.email))throw new Error("Could not get your email");const{data:A,error:M}=await Z.functions.invoke("send-prospect-email",{body:{emails:[{email:S.email,first_name:(F=(I=S.user_metadata)==null?void 0:I.name)==null?void 0:F.split(" ")[0]}],test_mode:!0}});if(M)throw M;return A},onSuccess:()=>{Se.success("Test email sent to your inbox!")},onError:S=>{Se.error("Failed to send test: "+S.message)}}),b=()=>{if(!r.trim()){Se.error("Please enter an email address");return}if(d==null?void 0:d.find(A=>A.email.toLowerCase()===r.trim().toLowerCase())){Se.error("This email has already been prospected");return}y.mutate([{email:r.trim(),first_name:n.trim()||void 0}])},N=S=>{var I;const A=(I=S.target.files)==null?void 0:I[0];if(!A)return;const M=new FileReader;M.onload=F=>{var W,X;const B=((W=F.target)==null?void 0:W.result).split(` `).filter(se=>se.trim()),$=[],H=(X=B[0])!=null&&X.toLowerCase().includes("email")?1:0;for(let se=H;sefe.trim().replace(/"/g,"")),le=ae[0],ne=ae[1];le&&le.includes("@")&&$.push({email:le,first_name:ne||void 0})}l($),Se.success(`${$.length} entries loaded from CSV`)},M.readAsText(A),i.current&&(i.current.value="")},j=()=>{if(o.length===0){Se.error("No entries to send");return}const S=new Set((d==null?void 0:d.map(M=>M.email.toLowerCase()))||[]),A=o.filter(M=>!S.has(M.email.toLowerCase()));if(A.length===0){Se.error("All emails have already been prospected");return}A.lengthv.mutate(),disabled:v.isPending,className:"gap-2 ml-4 shrink-0",children:[v.isPending?e.jsx(Hr,{className:"h-3 w-3 animate-spin"}):e.jsx(mn,{className:"h-3 w-3"}),"Send Test to Me"]})]})]}),e.jsx(qe,{children:e.jsxs(ci,{defaultValue:"single",children:[e.jsxs(ri,{className:"mb-4",children:[e.jsxs(Kr,{value:"single",children:[e.jsx(Mi,{className:"h-4 w-4 mr-2"}),"Single Send"]}),e.jsxs(Kr,{value:"bulk",children:[e.jsx(to,{className:"h-4 w-4 mr-2"}),"Bulk CSV"]})]}),e.jsx(ms,{value:"single",children:e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx(Ee,{htmlFor:"prospect-email",className:"sr-only",children:"Email"}),e.jsx(Qe,{id:"prospect-email",type:"email",placeholder:"agent@example.com",value:r,onChange:S=>s(S.target.value),onKeyDown:S=>S.key==="Enter"&&b()})]}),e.jsxs("div",{className:"w-full sm:w-48",children:[e.jsx(Ee,{htmlFor:"prospect-name",className:"sr-only",children:"First Name"}),e.jsx(Qe,{id:"prospect-name",placeholder:"First name (optional)",value:n,onChange:S=>a(S.target.value),onKeyDown:S=>S.key==="Enter"&&b()})]}),e.jsxs(Q,{onClick:b,disabled:y.isPending,className:"gap-2",children:[y.isPending?e.jsx(Hr,{className:"h-4 w-4 animate-spin"}):e.jsx(Mi,{className:"h-4 w-4"}),"Send Invite"]})]})}),e.jsx(ms,{value:"bulk",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("input",{ref:i,type:"file",accept:".csv",onChange:N,className:"hidden"}),e.jsxs(Q,{variant:"outline",onClick:()=>{var S;return(S=i.current)==null?void 0:S.click()},className:"gap-2",children:[e.jsx(fa,{className:"h-4 w-4"}),"Upload CSV"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Format: email, first_name (one per line)"})]}),o.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(bt,{variant:"secondary",className:"gap-1",children:[e.jsx(ws,{className:"h-3 w-3"}),o.length," entries ready"]}),e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>l([]),children:[e.jsx(rn,{className:"h-4 w-4"}),"Clear"]})]}),e.jsxs("div",{className:"max-h-40 overflow-y-auto border rounded-lg p-3 bg-muted/30 text-sm font-mono space-y-1",children:[o.slice(0,20).map((S,A)=>e.jsxs("div",{className:"text-muted-foreground",children:[S.email,S.first_name?` — ${S.first_name}`:""]},A)),o.length>20&&e.jsxs("div",{className:"text-muted-foreground/60",children:["...and ",o.length-20," more"]})]}),e.jsxs(Q,{onClick:j,disabled:y.isPending,className:"gap-2",children:[y.isPending?e.jsx(Hr,{className:"h-4 w-4 animate-spin"}):e.jsx(Mi,{className:"h-4 w-4"}),"Send ",o.length," Invites"]})]})]})})]})})]}),e.jsxs(ze,{children:[e.jsxs(Wt,{children:[e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(mn,{className:"h-5 w-5"}),"Prospect Log"]}),e.jsx(Ss,{children:"Track all sent invitations and their conversion status"})]}),e.jsx(qe,{children:m?e.jsx("div",{className:"space-y-3",children:[...Array(5)].map((S,A)=>e.jsx(fr,{className:"h-12 w-full"},A))}):d&&d.length>0?e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"text-left py-3 px-4 text-sm font-medium text-muted-foreground",children:"Email"}),e.jsx("th",{className:"text-left py-3 px-4 text-sm font-medium text-muted-foreground",children:"Name"}),e.jsx("th",{className:"text-left py-3 px-4 text-sm font-medium text-muted-foreground",children:"Sent"}),e.jsx("th",{className:"text-left py-3 px-4 text-sm font-medium text-muted-foreground",children:"Status"}),e.jsx("th",{className:"text-left py-3 px-4 text-sm font-medium text-muted-foreground",children:"Converted"})]})}),e.jsx("tbody",{children:d.map(S=>e.jsxs("tr",{className:"border-b last:border-0 hover:bg-muted/30",children:[e.jsx("td",{className:"py-3 px-4 text-sm font-medium text-foreground",children:S.email}),e.jsx("td",{className:"py-3 px-4 text-sm text-muted-foreground",children:S.first_name||"—"}),e.jsx("td",{className:"py-3 px-4 text-sm text-muted-foreground",children:Xr(new Date(S.sent_at),"MMM d, yyyy")}),e.jsx("td",{className:"py-3 px-4",children:S.status==="converted"?e.jsxs(bt,{className:"bg-green-500/10 text-green-700 hover:bg-green-500/20 border-0",children:[e.jsx(Li,{className:"h-3 w-3 mr-1"}),"Converted"]}):e.jsxs(bt,{variant:"secondary",className:"gap-1",children:[e.jsx(Ea,{className:"h-3 w-3"}),"Sent"]})}),e.jsx("td",{className:"py-3 px-4 text-sm text-muted-foreground",children:S.converted_at?Xr(new Date(S.converted_at),"MMM d, yyyy"):"—"})]},S.id))})]})}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(bp,{className:"h-12 w-12 text-muted-foreground/30 mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"No prospects yet. Send your first invite above!"})]})})]})]})})}function Ktr(){const t=Ws(),r=qr(),{isAdmin:s}=Gr(),[n,a]=E.useState(!1),[o,l]=E.useState(null),[i,d]=E.useState(null),{data:m,isLoading:g}=Ht({queryKey:["my-social-accounts"],queryFn:async()=>{const{data:{user:O},error:B}=await Z.auth.getUser();if(B)throw B;if(!O)return[];const{data:$,error:H}=await Z.from("social_accounts").select("*").eq("user_id",O.id).order("created_at",{ascending:!1});if(H)throw H;return $}}),y=Jt({mutationFn:async O=>{const{data:{user:B},error:$}=await Z.auth.getUser();if($)throw $;if(!B)throw new Error("Not authenticated");const{error:H}=await Z.from("social_accounts").delete().eq("id",O).eq("user_id",B.id);if(H)throw H},onSuccess:()=>{r.invalidateQueries({queryKey:["my-social-accounts"]}),r.invalidateQueries({queryKey:["social-accounts-for-post"]}),Se.success("Account disconnected successfully")},onError:()=>{Se.error("Failed to disconnect account")}}),v=async()=>{a(!0);try{const{data:O,error:B}=await Z.functions.invoke("meta-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/callback"}});if(B)throw B;if(O!=null&&O.authUrl)window.location.href=O.authUrl;else throw new Error("Failed to get authorization URL")}catch(O){console.error("Meta OAuth error:",O),Se.error("Failed to start connection. Please try again."),a(!1)}},b=async()=>{a(!0);try{const{data:O,error:B}=await Z.functions.invoke("linkedin-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/linkedin-callback"}});if(B)throw B;if(O!=null&&O.authUrl)window.location.href=O.authUrl;else throw new Error("Failed to get LinkedIn authorization URL")}catch(O){console.error("LinkedIn OAuth error:",O),Se.error("Failed to start LinkedIn connection. Please try again."),a(!1)}},N=async()=>{a(!0);try{const{data:O,error:B}=await Z.functions.invoke("google-business-oauth",{body:{action:"get_auth_url"}});if(B)throw B;if(O!=null&&O.authUrl)window.location.href=O.authUrl;else throw new Error("Failed to get Google authorization URL")}catch(O){console.error("Google OAuth error:",O),Se.error("Failed to start Google connection. Please try again."),a(!1)}},j=(m==null?void 0:m.filter(O=>O.platform==="facebook"))||[],S=(m==null?void 0:m.filter(O=>O.platform==="instagram"))||[],A=(m==null?void 0:m.filter(O=>O.platform==="linkedin"))||[],M=(m==null?void 0:m.filter(O=>O.platform==="google_business"))||[],I=((m==null?void 0:m.length)||0)>0,F=async(O,B)=>{l(O),d(null);try{const{data:$,error:H}=await Z.functions.invoke("meta-api-test",{body:{testType:"all",accountId:O}});if(H)throw H;d($.results||[]),Se.success($.summary||"API tests completed")}catch($){console.error("Meta API test error:",$),Se.error("Failed to run API tests")}finally{l(null)}};return e.jsx(Fr,{title:"Social Connections",children:e.jsxs("div",{className:"space-y-6",children:[e.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:[e.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmYiIGZpbGwtb3BhY2l0eT0iMC4xIj48cGF0aCBkPSJNMzYgMzRjMC0yIDItNCAyLTRzMiAyIDIgNC0yIDQtMiA0LTItMi0yLTR6Ii8+PC9nPjwvZz48L3N2Zz4=')] opacity-30"}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"flex items-center gap-2 mb-3",children:e.jsxs(bt,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[e.jsx(An,{className:"h-3 w-3 mr-1"}),"Post directly from Social Swag"]})}),e.jsx("h1",{className:"text-2xl md:text-3xl font-bold mb-2",children:"Connect Your Social Accounts"}),e.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."})]})]}),e.jsxs(Q,{variant:"ghost",onClick:()=>t("/social-swag-2"),className:"gap-2",children:[e.jsx(_i,{className:"h-4 w-4"}),"Back to Social Swag"]}),!s&&e.jsx(ze,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-800",children:e.jsxs(qe,{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx("div",{className:"rounded-full bg-amber-100 dark:bg-amber-900/30 p-4 mb-4",children:e.jsx(Ea,{className:"h-10 w-10 text-amber-600 dark:text-amber-400"})}),e.jsx(bt,{variant:"secondary",className:"mb-3 bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400",children:"Coming Soon"}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Social Connections Coming Soon!"}),e.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."})]})}),s&&e.jsxs(e.Fragment,{children:[I&&e.jsx(ze,{className:"border-green-200 bg-green-50 dark:bg-green-950/20 dark:border-green-900",children:e.jsxs(qe,{className:"flex items-center gap-4 p-4",children:[e.jsx("div",{className:"rounded-full bg-green-500 p-2",children:e.jsx(ui,{className:"h-5 w-5 text-white"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-green-800 dark:text-green-200",children:"You're all set!"}),e.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."})]})]})}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-3",children:[e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"rounded-full bg-blue-500/10 p-3",children:e.jsx(iu,{className:"h-6 w-6 text-blue-600"})}),e.jsxs("div",{children:[e.jsx(Zt,{className:"text-lg",children:"Facebook"}),e.jsx(Ss,{children:"Connect your Facebook Pages"})]})]})}),e.jsxs(qe,{className:"space-y-4",children:[g?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Ko,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):j.length>0?e.jsx("div",{className:"space-y-3",children:j.map(O=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(ln,{className:"h-10 w-10",children:[e.jsx(pa,{src:O.profile_picture_url||""}),e.jsx(cn,{children:e.jsx(iu,{className:"h-5 w-5"})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:O.page_name||O.platform_username||"Facebook Page"}),e.jsx(bt,{variant:O.is_active?"default":"secondary",className:"text-xs",children:O.is_active?"Connected":"Inactive"})]})]}),e.jsxs(Xc,{children:[e.jsx(xm,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:e.jsx(Rs,{className:"h-4 w-4"})})}),e.jsxs(Tc,{children:[e.jsxs(Ac,{children:[e.jsx(Ic,{children:"Disconnect Facebook?"}),e.jsx(Pc,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),e.jsxs(Ec,{children:[e.jsx(Lc,{children:"Cancel"}),e.jsx(dc,{onClick:()=>y.mutate(O.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},O.id))}):e.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No Facebook pages connected yet"}),e.jsxs(Q,{onClick:v,disabled:n,className:"w-full gap-2",variant:j.length>0?"outline":"default",children:[n?e.jsx(Ko,{className:"h-4 w-4 animate-spin"}):e.jsx(gs,{className:"h-4 w-4"}),j.length>0?"Connect Another Page":"Connect Facebook Page"]})]})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"rounded-full bg-gradient-to-br from-purple-500/10 via-pink-500/10 to-orange-500/10 p-3",children:e.jsx(ju,{className:"h-6 w-6 text-pink-600"})}),e.jsxs("div",{children:[e.jsx(Zt,{className:"text-lg",children:"Instagram"}),e.jsx(Ss,{children:"Connect Instagram Business accounts"})]})]})}),e.jsxs(qe,{className:"space-y-4",children:[g?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Ko,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):S.length>0?e.jsx("div",{className:"space-y-3",children:S.map(O=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(ln,{className:"h-10 w-10",children:[e.jsx(pa,{src:O.profile_picture_url||""}),e.jsx(cn,{children:e.jsx(ju,{className:"h-5 w-5"})})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"font-medium",children:["@",O.platform_username||"Instagram Account"]}),e.jsx(bt,{variant:O.is_active?"default":"secondary",className:"text-xs",children:O.is_active?"Connected":"Inactive"})]})]}),e.jsxs(Xc,{children:[e.jsx(xm,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:e.jsx(Rs,{className:"h-4 w-4"})})}),e.jsxs(Tc,{children:[e.jsxs(Ac,{children:[e.jsx(Ic,{children:"Disconnect Instagram?"}),e.jsx(Pc,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),e.jsxs(Ec,{children:[e.jsx(Lc,{children:"Cancel"}),e.jsx(dc,{onClick:()=>y.mutate(O.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},O.id))}):e.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No Instagram accounts connected yet"}),e.jsxs(Q,{onClick:v,disabled:n,className:"w-full gap-2",variant:S.length>0?"outline":"default",children:[n?e.jsx(Ko,{className:"h-4 w-4 animate-spin"}):e.jsx(gs,{className:"h-4 w-4"}),S.length>0?"Connect Another Account":"Connect Instagram"]}),e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Instagram Business accounts must be connected to a Facebook Page"})]})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"rounded-full bg-blue-600/10 p-3",children:e.jsx(km,{className:"h-6 w-6 text-blue-700"})}),e.jsxs("div",{children:[e.jsx(Zt,{className:"text-lg",children:"LinkedIn"}),e.jsx(Ss,{children:"Connect your LinkedIn profile"})]})]})}),e.jsxs(qe,{className:"space-y-4",children:[g?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Ko,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):A.length>0?e.jsx("div",{className:"space-y-3",children:A.map(O=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(ln,{className:"h-10 w-10",children:[e.jsx(pa,{src:O.profile_picture_url||""}),e.jsx(cn,{children:e.jsx(km,{className:"h-5 w-5"})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:O.platform_username||"LinkedIn Account"}),e.jsx(bt,{variant:O.is_active?"default":"secondary",className:"text-xs",children:O.is_active?"Connected":"Inactive"})]})]}),e.jsxs(Xc,{children:[e.jsx(xm,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:e.jsx(Rs,{className:"h-4 w-4"})})}),e.jsxs(Tc,{children:[e.jsxs(Ac,{children:[e.jsx(Ic,{children:"Disconnect LinkedIn?"}),e.jsx(Pc,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),e.jsxs(Ec,{children:[e.jsx(Lc,{children:"Cancel"}),e.jsx(dc,{onClick:()=>y.mutate(O.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},O.id))}):e.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No LinkedIn account connected yet"}),e.jsxs(Q,{onClick:b,disabled:n,className:"w-full gap-2",variant:A.length>0?"outline":"default",children:[n?e.jsx(Ko,{className:"h-4 w-4 animate-spin"}):e.jsx(gs,{className:"h-4 w-4"}),A.length>0?"Reconnect LinkedIn":"Connect LinkedIn"]}),e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Share content directly to your LinkedIn profile"})]})]}),e.jsxs(ze,{className:`relative overflow-hidden ${s?"":"opacity-75"}`,children:[!s&&e.jsx("div",{className:"absolute top-3 right-3 z-10",children:e.jsx(bt,{variant:"secondary",className:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400",children:"Coming Soon"})}),s&&e.jsx("div",{className:"absolute top-3 right-3 z-10",children:e.jsx(bt,{variant:"secondary",className:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",children:"Admin Testing"})}),e.jsx(Wt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"rounded-full bg-red-500/10 p-3",children:e.jsx(eo,{className:"h-6 w-6 text-red-600"})}),e.jsxs("div",{children:[e.jsx(Zt,{className:"text-lg",children:"Google Business"}),e.jsx(Ss,{children:"Connect your Google Business Profile"})]})]})}),e.jsxs(qe,{className:"space-y-4",children:[g?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Ko,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):M.length>0?e.jsx("div",{className:"space-y-3",children:M.map(O=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(ln,{className:"h-10 w-10",children:[e.jsx(pa,{src:O.profile_picture_url||""}),e.jsx(cn,{children:e.jsx(eo,{className:"h-5 w-5"})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:O.page_name||O.platform_username||"Google Business"}),e.jsx(bt,{variant:O.is_active?"default":"secondary",className:"text-xs",children:O.is_active?"Connected":"Inactive"})]})]}),e.jsxs(Xc,{children:[e.jsx(xm,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:e.jsx(Rs,{className:"h-4 w-4"})})}),e.jsxs(Tc,{children:[e.jsxs(Ac,{children:[e.jsx(Ic,{children:"Disconnect Google Business?"}),e.jsx(Pc,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),e.jsxs(Ec,{children:[e.jsx(Lc,{children:"Cancel"}),e.jsx(dc,{onClick:()=>y.mutate(O.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},O.id))}):e.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:s?"No Google Business account connected yet":"Google Business Profile integration is coming soon!"}),e.jsxs(Q,{onClick:s?N:void 0,disabled:!s||n,className:"w-full gap-2",variant:M.length>0?"outline":"default",children:[n?e.jsx(Ko,{className:"h-4 w-4 animate-spin"}):e.jsx(gs,{className:"h-4 w-4"}),M.length>0?"Reconnect Google Business":"Connect Google Business"]}),e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Post updates directly to your Google Business Profile"})]})]})]}),s&&(j.length>0||S.length>0)&&e.jsxs(ze,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-900",children:[e.jsx(Wt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"rounded-full bg-amber-500/10 p-3",children:e.jsx($j,{className:"h-6 w-6 text-amber-600"})}),e.jsxs("div",{children:[e.jsx(Zt,{className:"text-lg",children:"Meta API Testing (Admin Only)"}),e.jsx(Ss,{children:"Run API tests to trigger all required permissions for Meta App Review"})]})]})}),e.jsxs(qe,{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:['Click "Run Tests" on an account to trigger API calls for: ',e.jsx("strong",{children:"public_profile"}),", ",e.jsx("strong",{children:"pages_show_list"}),", ",e.jsx("strong",{children:"pages_read_engagement"}),", ",e.jsx("strong",{children:"instagram_basic"}),", ",e.jsx("strong",{children:"pages_manage_posts"}),", and ",e.jsx("strong",{children:"instagram_content_publish"}),"."]}),e.jsxs("div",{className:"space-y-3",children:[j.map(O=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border bg-background p-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(iu,{className:"h-5 w-5 text-blue-600"}),e.jsx("span",{className:"font-medium",children:O.page_name||"Facebook Page"})]}),e.jsx(Q,{size:"sm",variant:"outline",onClick:()=>F(O.id),disabled:o===O.id,children:o===O.id?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):e.jsxs(e.Fragment,{children:[e.jsx($j,{className:"h-4 w-4 mr-2"}),"Run Tests"]})})]},`test-fb-${O.id}`)),S.map(O=>e.jsxs("div",{className:"flex items-center justify-between rounded-lg border bg-background p-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ju,{className:"h-5 w-5 text-pink-600"}),e.jsxs("span",{className:"font-medium",children:["@",O.platform_username||"Instagram"]})]}),e.jsx(Q,{size:"sm",variant:"outline",onClick:()=>F(O.id),disabled:o===O.id,children:o===O.id?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):e.jsxs(e.Fragment,{children:[e.jsx($j,{className:"h-4 w-4 mr-2"}),"Run Tests"]})})]},`test-ig-${O.id}`))]}),i&&i.length>0&&e.jsxs("div",{className:"mt-4 rounded-lg border bg-background p-4",children:[e.jsx("h4",{className:"font-medium mb-3",children:"Test Results"}),e.jsx("div",{className:"space-y-2",children:i.map((O,B)=>e.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[O.status==="success"?e.jsx(Li,{className:"h-4 w-4 text-green-600 mt-0.5 shrink-0"}):O.status==="pending"?e.jsx(Hr,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}):e.jsx(Sc,{className:"h-4 w-4 text-red-600 mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-mono text-xs bg-muted px-1 rounded",children:O.test}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:O.details})]})]},B))})]}),e.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."})]})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{className:"text-lg",children:"How it works"})}),e.jsx(qe,{children:e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"flex gap-3",children:[e.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"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Connect your accounts"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Link your Facebook, Instagram, or LinkedIn account"})]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.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"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Browse Social Swag"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Find the perfect image and caption for your post"})]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.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"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Post with one click"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:'Click "Create Post" to share directly to your accounts'})]})]})]})})]})]})]})})}function Ztr(){const[t]=Bc(),r=Ws(),[s,n]=E.useState("loading"),[a,o]=E.useState("Processing your connection...");return E.useEffect(()=>{(async()=>{var y;const i=t.get("code"),d=t.get("error"),m=t.get("error_description"),g=t.get("state");if(d){n("error"),o(m||"Authorization was denied"),Se.error("Connection failed: "+(m||d));return}if(!i){n("error"),o("No authorization code received"),Se.error("No authorization code received");return}try{const{data:v,error:b}=await Z.functions.invoke("meta-oauth",{body:{action:"exchange_code",code:i,state:g,callbackPath:"/social-connections/callback"}});if(b)throw b;if(v!=null&&v.success)n("success"),o(`Successfully connected ${((y=v.accounts)==null?void 0:y.length)||0} account(s)!`),Se.success("Social accounts connected successfully!");else throw new Error((v==null?void 0:v.error)||"Unknown error")}catch(v){console.error("OAuth callback error:",v),n("error"),o(v instanceof Error?v.message:"Failed to connect accounts"),Se.error("Failed to connect: "+(v instanceof Error?v.message:"Unknown error"))}})()},[t]),e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs(ze,{className:"w-full max-w-md",children:[e.jsxs(Wt,{className:"text-center",children:[s==="loading"&&e.jsx(Hr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),s==="success"&&e.jsx(ui,{className:"h-12 w-12 mx-auto text-green-500"}),s==="error"&&e.jsx(Sc,{className:"h-12 w-12 mx-auto text-destructive"}),e.jsxs(Zt,{className:"mt-4",children:[s==="loading"&&"Connecting...",s==="success"&&"Connected!",s==="error"&&"Connection Failed"]}),e.jsx(Ss,{children:a})]}),e.jsx(qe,{className:"flex justify-center",children:s!=="loading"&&e.jsx(Q,{onClick:()=>r("/mission-control/integrations"),children:s==="success"?"View Connected Accounts":"Try Again"})})]})})}function Ytr(){const[t]=Bc(),r=Ws(),[s,n]=E.useState("loading"),[a,o]=E.useState("Connecting your Google Business Profile...");return E.useEffect(()=>{(async()=>{const i=t.get("code"),d=t.get("error"),m=t.get("error_description"),g=t.get("state");if(d){n("error"),o(m||"Authorization was denied"),Se.error("Connection failed: "+(m||d));return}if(!i){n("error"),o("No authorization code received"),Se.error("No authorization code received");return}try{const{data:y,error:v}=await Z.functions.invoke("google-business-oauth",{body:{action:"exchange_code",code:i,state:g}});if(v)throw v;if(y!=null&&y.success)n("success"),o(y.message||"Successfully connected Google Business Profile!"),Se.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),n("error"),o(y instanceof Error?y.message:"Failed to connect Google Business Profile"),Se.error("Failed to connect: "+(y instanceof Error?y.message:"Unknown error"))}})()},[t]),e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs(ze,{className:"w-full max-w-md",children:[e.jsxs(Wt,{className:"text-center",children:[s==="loading"&&e.jsx(Hr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),s==="success"&&e.jsx(ui,{className:"h-12 w-12 mx-auto text-green-500"}),s==="error"&&e.jsx(Sc,{className:"h-12 w-12 mx-auto text-destructive"}),e.jsxs(Zt,{className:"mt-4",children:[s==="loading"&&"Connecting...",s==="success"&&"Connected!",s==="error"&&"Connection Failed"]}),e.jsx(Ss,{children:a})]}),e.jsx(qe,{className:"flex justify-center",children:s!=="loading"&&e.jsx(Q,{onClick:()=>r("/social-connections"),children:s==="success"?"View Connected Accounts":"Try Again"})})]})})}function Xtr(){const[t]=Bc(),r=Ws(),[s,n]=E.useState("loading"),[a,o]=E.useState("Connecting your LinkedIn account...");return E.useEffect(()=>{(async()=>{var y;const i=t.get("code"),d=t.get("state"),m=t.get("error"),g=t.get("error_description");if(m){console.error("LinkedIn OAuth error:",m,g),n("error"),o(g||"Failed to connect LinkedIn account"),Se.error(g||"Failed to connect LinkedIn");return}if(!i){n("error"),o("No authorization code received"),Se.error("No authorization code received");return}try{const{data:v,error:b}=await Z.functions.invoke("linkedin-oauth",{body:{action:"exchange_code",code:i,state:d,callbackPath:"/social-connections/linkedin-callback"}});if(b)throw b;if(v!=null&&v.success)n("success"),o(`Successfully connected ${((y=v.accounts)==null?void 0:y.length)||1} LinkedIn account`),Se.success("LinkedIn connected successfully!");else throw new Error((v==null?void 0:v.error)||"Failed to connect LinkedIn account")}catch(v){console.error("LinkedIn callback error:",v),n("error"),o(v instanceof Error?v.message:"Failed to connect LinkedIn account"),Se.error("Failed to connect LinkedIn")}})()},[t]),e.jsx("div",{className:"min-h-screen flex items-center justify-center p-4 bg-background",children:e.jsxs(ze,{className:"w-full max-w-md",children:[e.jsxs(Wt,{className:"text-center",children:[e.jsxs("div",{className:"mx-auto mb-4 rounded-full bg-blue-600/10 p-4 w-fit",children:[s==="loading"&&e.jsx(Hr,{className:"h-8 w-8 animate-spin text-blue-600"}),s==="success"&&e.jsx(ui,{className:"h-8 w-8 text-green-600"}),s==="error"&&e.jsx(Sc,{className:"h-8 w-8 text-red-600"})]}),e.jsxs(Zt,{className:"flex items-center justify-center gap-2",children:[e.jsx(km,{className:"h-5 w-5 text-blue-600"}),s==="loading"&&"Connecting...",s==="success"&&"Connected!",s==="error"&&"Connection Failed"]}),e.jsx(Ss,{children:a})]}),e.jsx(qe,{className:"flex justify-center",children:e.jsx(Q,{onClick:()=>r("/social-connections"),disabled:s==="loading",children:s==="success"?"Continue":"Back to Connections"})})]})})}function Qtr(){const t=Ws(),[r,s]=E.useState(null),{data:n,isLoading:a}=xHe(r||void 0,!0),{data:o,isLoading:l}=_ve(!0),{cartItems:i}=fae(),d=i.reduce((g,y)=>g+y.quantity,0),m=g=>{t(`/marketplace/${g.id}`)};return a||l?e.jsx(Fr,{title:"Marketplace",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex gap-2 overflow-x-auto pb-2",children:[1,2,3].map(g=>e.jsx(fr,{className:"h-10 w-24 flex-shrink-0"},g))}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:[1,2,3,4].map(g=>e.jsx(fr,{className:"h-72 w-full"},g))})]})}):e.jsx(Fr,{title:"Marketplace",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Marketplace"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Shop exclusive products for LevelUp members"})]}),e.jsxs(Q,{variant:"outline",onClick:()=>t("/marketplace/cart"),className:"relative",children:[e.jsx(Lh,{className:"h-4 w-4 mr-2"}),"Cart",d>0&&e.jsx(bt,{className:"absolute -top-2 -right-2 h-5 w-5 flex items-center justify-center p-0 text-xs",children:d})]})]}),o&&o.length>0&&e.jsxs("div",{className:"flex gap-2 overflow-x-auto pb-2",children:[e.jsx(Q,{variant:r===null?"default":"outline",size:"sm",onClick:()=>s(null),children:"All"}),o.map(g=>e.jsx(Q,{variant:r===g.id?"default":"outline",size:"sm",onClick:()=>s(g.id),children:g.name},g.id))]}),n&&n.length>0?e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:n.map(g=>{var y;return e.jsxs(ze,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>m(g),children:[e.jsxs("div",{className:"aspect-square bg-muted relative",children:[g.images&&g.images.length>0?e.jsx("img",{src:((y=g.images.find(v=>v.is_primary))==null?void 0:y.image_url)||g.images[0].image_url,alt:g.name,className:"w-full h-full object-cover"}):e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx(Wl,{className:"h-12 w-12 text-muted-foreground"})}),g.category&&e.jsx(bt,{className:"absolute top-2 left-2",variant:"secondary",children:g.category.name})]}),e.jsxs(qe,{className:"p-4",children:[e.jsx("h3",{className:"font-semibold mb-1 line-clamp-1",children:g.name}),g.description&&e.jsx("p",{className:"text-sm text-muted-foreground mb-2 line-clamp-2",children:g.description}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"font-bold text-lg",children:["$",Number(g.base_price).toFixed(2)]}),g.variants&&g.variants.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[g.variants.length," options"]})]})]})]},g.id)})}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(Wl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"No products available yet."})]})]})})}const _He=E.forwardRef(({...t},r)=>e.jsx("nav",{ref:r,"aria-label":"breadcrumb",...t}));_He.displayName="Breadcrumb";const bHe=E.forwardRef(({className:t,...r},s)=>e.jsx("ol",{ref:s,className:qt("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",t),...r}));bHe.displayName="BreadcrumbList";const ote=E.forwardRef(({className:t,...r},s)=>e.jsx("li",{ref:s,className:qt("inline-flex items-center gap-1.5",t),...r}));ote.displayName="BreadcrumbItem";const cge=E.forwardRef(({asChild:t,className:r,...s},n)=>{const a=t?lxe:"a";return e.jsx(a,{ref:n,className:qt("transition-colors hover:text-foreground",r),...s})});cge.displayName="BreadcrumbLink";const wHe=E.forwardRef(({className:t,...r},s)=>e.jsx("span",{ref:s,role:"link","aria-disabled":"true","aria-current":"page",className:qt("font-normal text-foreground",t),...r}));wHe.displayName="BreadcrumbPage";const dge=({children:t,className:r,...s})=>e.jsx("li",{role:"presentation","aria-hidden":"true",className:qt("[&>svg]:size-3.5",r),...s,children:t??e.jsx(Wi,{})});dge.displayName="BreadcrumbSeparator";function Jtr(){var le,ne;const{productId:t}=Xl(),r=Ws(),{data:s,isLoading:n}=str(t||""),{addToCart:a,cartItems:o}=fae(),[l,i]=E.useState(null),[d,m]=E.useState(1),[g,y]=E.useState(0),[v,b]=E.useState(null),[N,j]=E.useState(!1),[S,A]=E.useState(!1),M=(le=s==null?void 0:s.variants)==null?void 0:le.find(fe=>fe.id===l),I=((ne=s==null?void 0:s.variants)==null?void 0:ne.filter(fe=>fe.is_active))||[],F=Number((s==null?void 0:s.base_price)||0),O=M?Number(M.price_adjustment):0,B=F+O,$=Number((s==null?void 0:s.shipping_fee)||0),H=o.reduce((fe,oe)=>fe+oe.quantity,0),W=async fe=>{if(!fe.target.files||fe.target.files.length===0)return;j(!0);const oe=fe.target.files[0],de=oe.name.split(".").pop(),ue=`artwork/${Date.now()}-${Math.random().toString(36).substring(7)}.${de}`;try{const{error:xe}=await Z.storage.from("marketplace").upload(ue,oe);if(xe)throw xe;const{data:{publicUrl:Te}}=Z.storage.from("marketplace").getPublicUrl(ue);b(Te),Se.success("Artwork uploaded successfully")}catch(xe){Se.error("Failed to upload artwork: "+xe.message)}finally{j(!1)}},X=()=>{if(s){if(I.length>0&&!l){Se.error("Please select an option");return}a(s,M||void 0,d,v||void 0),A(!0),Se.success("Added to cart!"),setTimeout(()=>A(!1),2e3)}},se=()=>{s!=null&&s.images&&y(fe=>(fe+1)%s.images.length)},ae=()=>{s!=null&&s.images&&y(fe=>(fe-1+s.images.length)%s.images.length)};return n?e.jsx(Fr,{title:"Product",children:e.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[e.jsx(fr,{className:"aspect-square w-full"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(fr,{className:"h-8 w-3/4"}),e.jsx(fr,{className:"h-6 w-1/4"}),e.jsx(fr,{className:"h-24 w-full"}),e.jsx(fr,{className:"h-12 w-full"})]})]})}):s?e.jsxs(Fr,{title:s.name,children:[e.jsx(_He,{className:"mb-6",children:e.jsxs(bHe,{children:[e.jsx(ote,{children:e.jsx(cge,{asChild:!0,children:e.jsx(go,{to:"/marketplace",children:"Marketplace"})})}),s.category&&e.jsxs(e.Fragment,{children:[e.jsx(dge,{}),e.jsx(ote,{children:e.jsx(cge,{asChild:!0,children:e.jsx(go,{to:`/marketplace?category=${s.category.id}`,children:s.category.name})})})]}),e.jsx(dge,{}),e.jsx(ote,{children:e.jsx(wHe,{children:s.name})})]})}),e.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"relative aspect-square bg-muted rounded-lg overflow-hidden flex items-center justify-center",children:s.images&&s.images.length>0?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:s.images[g].image_url,alt:s.name,className:"max-w-full max-h-full object-contain"}),s.images.length>1&&e.jsxs(e.Fragment,{children:[e.jsx(Q,{variant:"ghost",size:"icon",className:"absolute left-2 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background",onClick:ae,children:e.jsx(uc,{className:"h-6 w-6"})}),e.jsx(Q,{variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background",onClick:se,children:e.jsx(Wi,{className:"h-6 w-6"})})]})]}):e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx(Wl,{className:"h-24 w-24 text-muted-foreground"})})}),s.images&&s.images.length>1&&e.jsx("div",{className:"flex gap-2 overflow-x-auto pb-2",children:s.images.map((fe,oe)=>e.jsx("button",{onClick:()=>y(oe),className:`w-16 h-16 flex-shrink-0 rounded-md overflow-hidden border-2 ${oe===g?"border-primary":"border-transparent"}`,children:e.jsx("img",{src:fe.image_url,alt:"",className:"w-full h-full object-cover"})},fe.id))}),s.video&&e.jsx(ze,{children:e.jsxs(qe,{className:"p-4",children:[e.jsx("h4",{className:"font-medium mb-2",children:"Product Video"}),e.jsx("div",{className:"aspect-video",children:e.jsx("iframe",{src:s.video.video_url,className:"w-full h-full rounded-lg",allowFullScreen:!0})})]})})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[s.category&&e.jsx(bt,{variant:"secondary",className:"mb-2",children:s.category.name}),e.jsx("h1",{className:"text-3xl font-bold mb-2",children:s.name}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-3xl font-bold",children:["$",B.toFixed(2)]}),$>0&&e.jsxs("span",{className:"text-muted-foreground",children:["+ $",$.toFixed(2)," shipping"]})]})]}),s.description&&e.jsx("div",{className:"prose prose-sm max-w-none",children:e.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:s.description})}),I.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(Ee,{children:"Select Option"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:I.map(fe=>e.jsxs(Q,{variant:l===fe.id?"default":"outline",onClick:()=>i(fe.id),children:[fe.name,Number(fe.price_adjustment)!==0&&e.jsxs("span",{className:"ml-1 opacity-70",children:["(",Number(fe.price_adjustment)>0?"+":"","$",Number(fe.price_adjustment).toFixed(2),")"]})]},fe.id))})]}),s.allow_artwork_upload&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(Ee,{children:"Upload Your Artwork (Optional)"}),v?e.jsxs("div",{className:"relative inline-block",children:[e.jsx("img",{src:v,alt:"Your artwork",className:"h-24 w-auto rounded-lg border"}),e.jsx(Q,{variant:"ghost",size:"sm",className:"absolute -top-2 -right-2",onClick:()=>b(null),children:"×"})]}):e.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6",children:[e.jsx("input",{type:"file",accept:"image/*,.pdf,.ai,.eps",onChange:W,className:"hidden",id:"artwork-upload",disabled:N}),e.jsxs("label",{htmlFor:"artwork-upload",className:"flex flex-col items-center cursor-pointer",children:[e.jsx(to,{className:"h-8 w-8 text-muted-foreground mb-2"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:N?"Uploading...":"Click to upload artwork"}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Supported: JPG, PNG, PDF, AI, EPS"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(Ee,{children:"Quantity"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q,{variant:"outline",size:"icon",onClick:()=>m(fe=>Math.max(1,fe-1)),children:"-"}),e.jsx(Qe,{type:"number",value:d,onChange:fe=>m(Math.max(1,parseInt(fe.target.value)||1)),className:"w-20 text-center",min:"1"}),e.jsx(Q,{variant:"outline",size:"icon",onClick:()=>m(fe=>fe+1),children:"+"})]})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(Q,{size:"lg",className:"flex-1",onClick:X,disabled:S,children:S?e.jsxs(e.Fragment,{children:[e.jsx(li,{className:"h-5 w-5 mr-2"}),"Added!"]}):e.jsxs(e.Fragment,{children:[e.jsx(Lh,{className:"h-5 w-5 mr-2"}),"Add to Cart"]})}),e.jsxs(Q,{variant:"outline",size:"lg",onClick:()=>r("/marketplace/cart"),className:"relative",children:[e.jsx(Lh,{className:"h-5 w-5"}),H>0&&e.jsx(bt,{className:"absolute -top-2 -right-2 h-5 w-5 flex items-center justify-center p-0 text-xs",children:H})]})]}),s.requires_proof_approval&&e.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."})]})]})]}):e.jsx(Fr,{title:"Product Not Found",children:e.jsxs("div",{className:"text-center py-12",children:[e.jsx(Wl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Product not found"}),e.jsx(Q,{onClick:()=>r("/marketplace"),children:"Back to Marketplace"})]})})}function err(){const t=Ws(),{cartItems:r,removeFromCart:s,updateQuantity:n,getItemPrice:a,getSubtotal:o,getShippingTotal:l,getTotal:i,clearCart:d}=fae(),[m,g]=E.useState(!1),[y,v]=E.useState(""),b=async()=>{if(r.length===0){Se.error("Your cart is empty");return}g(!0);try{const{data:N,error:j}=await Z.functions.invoke("marketplace-checkout",{body:{items:r.map(S=>{var A;return{product_id:S.product.id,variant_id:((A=S.variant)==null?void 0:A.id)||null,quantity:S.quantity,artwork_url:S.artworkUrl||null}}),notes:y.trim()||null}});if(j)throw j;if(N!=null&&N.url)d(),window.open(N.url,"_blank");else throw new Error("No checkout URL received")}catch(N){Se.error("Checkout failed: "+N.message)}finally{g(!1)}};return r.length===0?e.jsx(Fr,{title:"Shopping Cart",children:e.jsxs("div",{className:"text-center py-12",children:[e.jsx(Zg,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Your cart is empty"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"Add some products to get started!"}),e.jsx(Q,{onClick:()=>t("/marketplace"),children:"Browse Marketplace"})]})}):e.jsx(Fr,{title:"Shopping Cart",children:e.jsxs("div",{className:"grid gap-8 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[r.map(N=>{var j,S;return e.jsx(ze,{children:e.jsx(qe,{className:"p-4",children:e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"w-24 h-24 flex-shrink-0 bg-muted rounded-lg overflow-hidden",children:N.product.images&&N.product.images.length>0?e.jsx("img",{src:((j=N.product.images.find(A=>A.is_primary))==null?void 0:j.image_url)||N.product.images[0].image_url,alt:N.product.name,className:"w-full h-full object-cover"}):e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx(Zg,{className:"h-8 w-8 text-muted-foreground"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-semibold line-clamp-1",children:N.product.name}),N.variant&&e.jsx("p",{className:"text-sm text-muted-foreground",children:N.variant.name}),e.jsxs("p",{className:"font-medium mt-1",children:["$",a(N).toFixed(2),Number(N.product.shipping_fee)>0&&e.jsxs("span",{className:"text-sm text-muted-foreground ml-2",children:["+ $",Number(N.product.shipping_fee).toFixed(2)," shipping"]})]}),N.artworkUrl&&e.jsx("div",{className:"mt-2",children:e.jsx("span",{className:"text-xs text-muted-foreground",children:"Artwork uploaded ✓"})})]}),e.jsxs("div",{className:"flex flex-col items-end gap-2",children:[e.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{var A;return s(N.product.id,(A=N.variant)==null?void 0:A.id)},children:e.jsx(Rs,{className:"h-4 w-4 text-destructive"})}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Q,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>{var A;return n(N.product.id,(A=N.variant)==null?void 0:A.id,N.quantity-1)},disabled:N.quantity<=1,children:e.jsx(Q1,{className:"h-3 w-3"})}),e.jsx(Qe,{type:"number",value:N.quantity,onChange:A=>{var M;return n(N.product.id,(M=N.variant)==null?void 0:M.id,parseInt(A.target.value)||1)},className:"w-14 h-8 text-center text-sm",min:"1"}),e.jsx(Q,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>{var A;return n(N.product.id,(A=N.variant)==null?void 0:A.id,N.quantity+1)},children:e.jsx(gs,{className:"h-3 w-3"})})]})]})]})})},`${N.product.id}-${((S=N.variant)==null?void 0:S.id)||"base"}`)}),e.jsx(Q,{variant:"ghost",className:"text-destructive",onClick:d,children:"Clear Cart"})]}),e.jsx("div",{children:e.jsxs(ze,{className:"sticky top-4",children:[e.jsx(Wt,{children:e.jsx(Zt,{children:"Order Summary"})}),e.jsxs(qe,{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsxs("span",{children:["Subtotal (",r.reduce((N,j)=>N+j.quantity,0)," items)"]}),e.jsxs("span",{children:["$",o().toFixed(2)]})]}),e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{children:"Shipping"}),e.jsxs("span",{children:["$",l().toFixed(2)]})]}),e.jsx(gd,{}),e.jsxs("div",{className:"flex justify-between font-bold text-lg",children:[e.jsx("span",{children:"Total"}),e.jsxs("span",{children:["$",i().toFixed(2)]})]}),e.jsx(gd,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ee,{htmlFor:"orderNotes",children:"Order Notes (Optional)"}),e.jsx(Ks,{id:"orderNotes",placeholder:"Add any special instructions, design notes, or comments for your order...",value:y,onChange:N=>v(N.target.value),rows:3,className:"resize-none"})]}),e.jsx(Q,{className:"w-full",size:"lg",onClick:b,disabled:m,children:m?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"h-5 w-5 mr-2 animate-spin"}),"Processing..."]}):e.jsxs(e.Fragment,{children:["Checkout",e.jsx(Hi,{className:"h-5 w-5 ml-2"})]})}),e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"Secure checkout powered by Stripe"})]})]})})]})})}function trr(){const t=Ws(),{data:r,isLoading:s}=ptr();return s?e.jsx(Fr,{title:"My Orders",children:e.jsx("div",{className:"space-y-4",children:[1,2,3].map(n=>e.jsx(fr,{className:"h-32 w-full"},n))})}):!r||r.length===0?e.jsx(Fr,{title:"My Orders",children:e.jsxs("div",{className:"text-center py-12",children:[e.jsx(Wl,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"No orders yet"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"Start shopping to see your orders here!"}),e.jsx(Q,{onClick:()=>t("/marketplace"),children:"Browse Marketplace"})]})}):e.jsx(Fr,{title:"My Orders",children:e.jsx("div",{className:"space-y-4",children:r.map(n=>{var a,o,l;return e.jsx(ze,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>t(`/marketplace/orders/${n.id}`),children:e.jsxs(qe,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold",children:n.order_number}),e.jsx("span",{className:"text-muted-foreground text-sm ml-2",children:Xr(new Date(n.created_at),"MMM d, yyyy")})]}),e.jsx(bt,{className:vve[n.status],children:gC[n.status]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex -space-x-2",children:[(a=n.items)==null?void 0:a.slice(0,3).map((i,d)=>e.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-d},children:[i.quantity,"×"]},i.id)),n.items&&n.items.length>3&&e.jsxs("div",{className:"w-10 h-10 bg-muted rounded border-2 border-background flex items-center justify-center text-xs font-medium",children:["+",n.items.length-3]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm",children:((o=n.items)==null?void 0:o.length)===1?n.items[0].product_name:`${(l=n.items)==null?void 0:l.length} items`}),e.jsxs("p",{className:"font-semibold",children:["$",Number(n.total).toFixed(2)]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[n.tracking_url&&e.jsxs(Q,{variant:"outline",size:"sm",onClick:i=>{i.stopPropagation(),window.open(n.tracking_url,"_blank")},children:[e.jsx(En,{className:"h-4 w-4 mr-1"}),"Track"]}),e.jsx(Wi,{className:"h-5 w-5 text-muted-foreground"})]})]})]})},n.id)})})})}const $Te=["order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed"];function rrr({currentStatus:t,statusHistory:r}){const s=$Te.indexOf(t);return e.jsx("div",{className:"space-y-3",children:$Te.map((n,a)=>{const o=r==null?void 0:r.find(m=>m.status===n),l=as;return e.jsxs("div",{className:"flex items-start gap-3",children:[e.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?e.jsx(Li,{className:"h-4 w-4"}):i?e.jsx(Ea,{className:"h-4 w-4"}):e.jsx("span",{className:"text-xs",children:a+1})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:`font-medium ${d?"text-muted-foreground":""}`,children:gC[n]}),o&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[Xr(new Date(o.created_at),"MMM d, yyyy h:mm a"),o.notes&&` — ${o.notes}`]})]})]},n)})})}function srr(){var A;const{orderId:t}=Xl(),r=Ws(),{data:s,isLoading:n,refetch:a}=ftr(t||""),o=ytr(),l=vtr(),[i,d]=E.useState(!1),[m,g]=E.useState(null),[y,v]=E.useState(""),[b,N]=E.useState(null),j=async M=>{N(M);try{await o.mutateAsync({orderId:t,itemId:M}),Se.success("Proof approved!"),a()}catch{Se.error("Failed to approve proof")}finally{N(null)}},S=async()=>{if(m){N(m);try{await l.mutateAsync({orderId:t,itemId:m,reason:y}),Se.success("Revision requested"),d(!1),v(""),g(null),a()}catch{Se.error("Failed to request revision")}finally{N(null)}}};return n?e.jsx(Fr,{title:"Order Details",children:e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsx(fr,{className:"h-64 w-full"}),e.jsx(fr,{className:"h-48 w-full"})]}),e.jsx(fr,{className:"h-96 w-full"})]})}):s?e.jsxs(Fr,{title:`Order ${s.order_number}`,children:[e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs(ze,{children:[e.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[e.jsx(Zt,{children:"Order Status"}),e.jsx(bt,{className:vve[s.status],children:gC[s.status]})]}),e.jsx(qe,{children:e.jsx(rrr,{currentStatus:s.status,statusHistory:s.status_history})})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{children:"Items"})}),e.jsx(qe,{className:"space-y-4",children:(A=s.items)==null?void 0:A.map(M=>e.jsxs("div",{className:"border rounded-lg p-4",children:[e.jsxs("div",{className:"flex justify-between items-start mb-3",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold",children:M.product_name}),M.variant_name&&e.jsx("p",{className:"text-sm text-muted-foreground",children:M.variant_name}),e.jsxs("p",{className:"text-sm",children:["Qty: ",M.quantity," × $",Number(M.unit_price).toFixed(2)]})]}),e.jsxs("p",{className:"font-semibold",children:["$",(Number(M.unit_price)*M.quantity).toFixed(2)]})]}),M.artwork_url&&e.jsxs("div",{className:"mb-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Your Artwork:"}),e.jsxs("a",{href:M.artwork_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-primary hover:underline",children:[e.jsx(G1,{className:"h-4 w-4"}),"View Artwork",e.jsx(En,{className:"h-3 w-3"})]})]}),M.proof_url&&e.jsxs("div",{className:"bg-muted rounded-lg p-3",children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"Proof Ready for Review"}),e.jsxs("a",{href:M.proof_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-primary hover:underline mb-3",children:[e.jsx(G1,{className:"h-4 w-4"}),"View Proof",e.jsx(En,{className:"h-3 w-3"})]}),M.proof_status==="pending"&&e.jsxs("div",{className:"flex gap-2 mt-3",children:[e.jsxs(Q,{size:"sm",onClick:()=>j(M.id),disabled:b===M.id,children:[b===M.id?e.jsx(Hr,{className:"h-4 w-4 mr-1 animate-spin"}):e.jsx(_d,{className:"h-4 w-4 mr-1"}),"Approve"]}),e.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>{g(M.id),d(!0)},disabled:b===M.id,children:[e.jsx($A,{className:"h-4 w-4 mr-1"}),"Request Changes"]})]}),M.proof_status==="approved"&&e.jsxs(bt,{className:"bg-green-100 text-green-800",children:[e.jsx(Li,{className:"h-3 w-3 mr-1"}),"Proof Approved"]}),M.proof_status==="rejected"&&M.proof_notes&&e.jsxs("div",{className:"mt-2",children:[e.jsx(bt,{variant:"destructive",className:"mb-2",children:"Revision Requested"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:M.proof_notes})]})]})]},M.id))})]}),s.shipping_name&&e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsxs(Zt,{className:"flex items-center gap-2",children:[e.jsx(qA,{className:"h-5 w-5"}),"Shipping"]})}),e.jsxs(qe,{children:[e.jsx("p",{className:"font-medium",children:s.shipping_name}),e.jsxs("p",{className:"text-muted-foreground",children:[s.shipping_address,e.jsx("br",{}),s.shipping_city,", ",s.shipping_state," ",s.shipping_zip]}),s.tracking_number&&e.jsxs("div",{className:"mt-4 p-3 bg-muted rounded-lg",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Tracking Number:"}),e.jsx("p",{className:"font-mono font-medium",children:s.tracking_number}),s.tracking_url&&e.jsxs(Q,{variant:"link",className:"p-0 h-auto mt-1",onClick:()=>window.open(s.tracking_url,"_blank"),children:["Track Package",e.jsx(En,{className:"h-3 w-3 ml-1"})]})]})]})]})]}),e.jsx("div",{children:e.jsxs(ze,{className:"sticky top-4",children:[e.jsx(Wt,{children:e.jsx(Zt,{children:"Order Summary"})}),e.jsxs(qe,{className:"space-y-4",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["Placed on ",Xr(new Date(s.created_at),"MMMM d, yyyy")]}),e.jsx(gd,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{children:"Subtotal"}),e.jsxs("span",{children:["$",Number(s.subtotal).toFixed(2)]})]}),e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{children:"Shipping"}),e.jsxs("span",{children:["$",Number(s.shipping_total).toFixed(2)]})]})]}),e.jsx(gd,{}),e.jsxs("div",{className:"flex justify-between font-bold text-lg",children:[e.jsx("span",{children:"Total"}),e.jsxs("span",{children:["$",Number(s.total).toFixed(2)]})]}),s.notes&&e.jsxs(e.Fragment,{children:[e.jsx(gd,{}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-1",children:"Order Notes"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.notes})]})]})]})]})})]}),e.jsx(Dr,{open:i,onOpenChange:d,children:e.jsxs(Lr,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Request Changes"}),e.jsx(Gs,{children:"Please describe what changes you'd like made to the proof."})]}),e.jsx(Ks,{placeholder:"Describe the changes needed...",value:y,onChange:M=>v(M.target.value),rows:4}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>d(!1),children:"Cancel"}),e.jsxs(Q,{onClick:S,disabled:!y.trim()||b!==null,children:[b?e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}):null,"Submit Request"]})]})]})})]}):e.jsx(Fr,{title:"Order Not Found",children:e.jsxs("div",{className:"text-center py-12",children:[e.jsx(Wl,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Order not found"}),e.jsx(Q,{onClick:()=>r("/marketplace/orders"),children:"View All Orders"})]})})}function nrr(){const t=Ws(),[r]=Bc();return r.get("session_id"),E.useEffect(()=>{localStorage.removeItem("marketplace-cart")},[]),e.jsx(Fr,{title:"Order Confirmed",children:e.jsx("div",{className:"max-w-lg mx-auto text-center py-8",children:e.jsx(ze,{children:e.jsxs(qe,{className:"pt-8 pb-6",children:[e.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-6",children:e.jsx(Li,{className:"h-8 w-8 text-green-600"})}),e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Thank You for Your Order!"}),e.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."}),e.jsxs("div",{className:"bg-muted rounded-lg p-4 mb-6 text-left",children:[e.jsxs("h3",{className:"font-medium mb-2 flex items-center gap-2",children:[e.jsx(Wl,{className:"h-4 w-4"}),"What happens next?"]}),e.jsxs("ul",{className:"text-sm text-muted-foreground space-y-2",children:[e.jsx("li",{children:"• We'll review your order and prepare it for production"}),e.jsx("li",{children:"• If your order requires a proof, you'll receive it for approval"}),e.jsx("li",{children:"• Once approved, we'll begin production and ship when ready"}),e.jsx("li",{children:"• You'll receive tracking info when your order ships"})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsxs(Q,{className:"flex-1",onClick:()=>t("/marketplace/orders"),children:["View My Orders",e.jsx(Hi,{className:"h-4 w-4 ml-2"})]}),e.jsx(Q,{variant:"outline",className:"flex-1",onClick:()=>t("/marketplace"),children:"Continue Shopping"})]})]})})})})}function arr(){const{user:t}=Gr(),[r,s]=E.useState("store"),[n,a]=E.useState(null),[o,l]=E.useState(null),[i,d]=E.useState(!1),[m,g]=E.useState(5),[y,v]=E.useState(""),[b,N]=E.useState(!1),[j,S]=E.useState(!1),[A,M]=E.useState(""),[I,F]=E.useState(null),[O,B]=E.useState(!1),{hasSubmittedReview:$,submitReview:H,markPostedToGoogle:W}=ARe(),{data:X}=vHe(),{data:se,isLoading:ae}=yHe(),{data:le,isLoading:ne}=Str(n),{data:fe,isLoading:oe}=Ctr(t==null?void 0:t.id),{data:de=0}=Ttr(t==null?void 0:t.id),ue=Atr(),xe=new Set((fe==null?void 0:fe.map(Le=>Le.item_id))||[]),Te=async()=>{if(o)try{await ue.mutateAsync(o.id),Se.success(`Successfully purchased "${o.name}"!`),l(null)}catch(Le){Se.error(Le.message||"Failed to purchase item")}},be=async()=>{if(!y.trim()){Se.error("Please write a review");return}N(!0);const Le=await H(m,y);N(!1),Le.success?(Se.success("Thank you for your review! You earned 25 points!"),M(y),S(!0),v(""),g(5)):Se.error(Le.error||"Failed to submit review")},we=()=>{navigator.clipboard.writeText(A),Se.success("Review copied to clipboard!")},ve=()=>{W(),window.open("https://g.page/r/CT8bqTBTm7nJEBM/review","_blank")},tt=()=>{S(!1),d(!1),M("")};return ae||ne||oe?e.jsx(Fr,{title:"Reward Store",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(fr,{className:"h-24 w-full"}),e.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(Le=>e.jsx(fr,{className:"h-64"},Le))})]})}):e.jsxs(Fr,{title:"Reward Store",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Reward Store"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Redeem your points for exclusive rewards"})]}),e.jsx(ze,{className:"bg-gradient-to-r from-primary/10 to-primary/5 border-primary/20",children:e.jsx(qe,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/20 flex items-center justify-center",children:e.jsx(Ln,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your Spendable Points"}),e.jsx("p",{className:"text-3xl font-bold text-primary",children:de.toLocaleString()})]})]}),e.jsxs("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ho,{className:"h-4 w-4"}),e.jsx("span",{children:"Earn points by attending events"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(_m,{className:"h-4 w-4 text-orange-500"}),e.jsx("span",{children:"Streak bonuses add extra points!"})]})]})]})})}),e.jsx(ek,{open:O,onOpenChange:B,children:e.jsxs(ze,{className:"border-primary/20",children:[e.jsx(tk,{asChild:!0,children:e.jsx(Wt,{className:"cursor-pointer hover:bg-muted/50 transition-colors",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(ho,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx(Zt,{className:"text-base",children:"How to Earn Points"}),e.jsx(Ss,{children:"See all the ways you can earn spendable points"})]})]}),O?e.jsx(Hg,{className:"h-5 w-5 text-muted-foreground"}):e.jsx(Jc,{className:"h-5 w-5 text-muted-foreground"})]})})}),e.jsx(rk,{children:e.jsx(qe,{className:"pt-0",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:[X==null?void 0:X.filter(Le=>Le.is_active).map(Le=>{const Ue=Ye=>{switch(Ye){case"event_attendance":return e.jsx(Mn,{className:"h-5 w-5"});case"leave_review":return e.jsx(Ln,{className:"h-5 w-5"});case"add_listing":return e.jsx(Wn,{className:"h-5 w-5"});case"first_contact":return e.jsx(ws,{className:"h-5 w-5"});case"first_video":return e.jsx(ya,{className:"h-5 w-5"});case"first_community_post":return e.jsx($o,{className:"h-5 w-5"});default:return e.jsx(uo,{className:"h-5 w-5"})}};return e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/50 border",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center text-primary shrink-0",children:Ue(Le.action_key)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-sm",children:Le.action_name}),Le.description&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Le.description})]}),e.jsxs(bt,{variant:"secondary",className:"font-bold shrink-0",children:["+",Le.points]})]},Le.id)}),e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-orange-500/10 border border-orange-500/20",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-orange-500/20 flex items-center justify-center text-orange-500 shrink-0",children:e.jsx(_m,{className:"h-5 w-5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-sm",children:"Streak Bonuses"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Attend consecutive weeks for bonus points!"})]}),e.jsx(bt,{variant:"outline",className:"font-bold shrink-0 border-orange-500/50 text-orange-600",children:"+Bonus"})]})]})})})]})}),!$&&e.jsx(ze,{className:"bg-gradient-to-r from-yellow-500/10 to-orange-500/10 border-yellow-500/20",children:e.jsx(qe,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-12 w-12 rounded-full bg-yellow-500/20 flex items-center justify-center",children:e.jsx($o,{className:"h-6 w-6 text-yellow-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Earn 25 Free Points!"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Leave a quick review and earn 25 spendable points"})]})]}),e.jsxs(Q,{onClick:()=>d(!0),className:"bg-yellow-600 hover:bg-yellow-700",children:[e.jsx(Ln,{className:"h-4 w-4 mr-2"}),"Leave Review"]})]})})}),e.jsxs(ci,{value:r,onValueChange:s,children:[e.jsxs(ri,{children:[e.jsxs(Kr,{value:"store",className:"flex items-center gap-2",children:[e.jsx(Zg,{className:"h-4 w-4"}),"Store"]}),e.jsxs(Kr,{value:"my-rewards",className:"flex items-center gap-2",children:[e.jsx(Wl,{className:"h-4 w-4"}),"My Rewards",fe&&fe.length>0&&e.jsx(bt,{variant:"secondary",className:"ml-1",children:fe.length})]})]}),e.jsxs(ms,{value:"store",className:"mt-6",children:[se&&se.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[e.jsx(Q,{variant:n===null?"default":"outline",size:"sm",onClick:()=>a(null),children:"All"}),se.map(Le=>e.jsxs(Q,{variant:n===Le.id?"default":"outline",size:"sm",onClick:()=>a(Le.id),children:[Le.icon&&`${Le.icon} `,Le.name]},Le.id))]}),!le||le.length===0?e.jsx(ze,{children:e.jsx(qe,{className:"py-12",children:e.jsxs("div",{className:"text-center text-muted-foreground",children:[e.jsx(uo,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{className:"font-medium",children:"No items available"}),e.jsx("p",{className:"text-sm",children:"Check back later for new rewards!"})]})})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:le.map(Le=>{const Ue=xe.has(Le.id),Ye=Le.max_quantity!==null&&Le.current_quantity===0,Ie=de>=Le.points_cost;return e.jsxs(ze,{className:`overflow-hidden transition-all cursor-pointer hover:shadow-lg ${Ue?"ring-2 ring-green-500/50 bg-green-500/5":""}`,onClick:()=>F(Le),children:[Le.preview_image_url?e.jsxs("div",{className:"aspect-video relative overflow-hidden bg-muted",children:[e.jsx("img",{src:Le.preview_image_url,alt:Le.name,className:"w-full h-full object-cover"}),Ue&&e.jsx("div",{className:"absolute top-2 right-2",children:e.jsxs(bt,{className:"bg-green-500 text-white",children:[e.jsx(Li,{className:"h-3 w-3 mr-1"}),"Owned"]})}),Ye&&!Ue&&e.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:e.jsx(bt,{variant:"destructive",children:"Sold Out"})})]}):e.jsxs("div",{className:"aspect-video bg-muted flex items-center justify-center relative",children:[e.jsx(uo,{className:"h-12 w-12 text-muted-foreground/50"}),Ue&&e.jsx("div",{className:"absolute top-2 right-2",children:e.jsxs(bt,{className:"bg-green-500 text-white",children:[e.jsx(Li,{className:"h-3 w-3 mr-1"}),"Owned"]})})]}),e.jsxs(Wt,{className:"pb-2",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(Zt,{className:"text-lg",children:Le.name}),e.jsxs(bt,{variant:"secondary",className:"font-bold shrink-0",children:[e.jsx(Ln,{className:"h-3 w-3 mr-1"}),Le.points_cost]})]}),Le.category&&e.jsxs(bt,{variant:"outline",className:"w-fit",children:[Le.category.icon&&`${Le.category.icon} `,Le.category.name]})]}),e.jsxs(qe,{children:[e.jsx(Ss,{className:"mb-4 line-clamp-2",children:Le.description||"No description available"}),Le.max_quantity!==null&&!Ue&&e.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:[Le.current_quantity," of ",Le.max_quantity," remaining"]}),Ue?e.jsx(Q,{className:"w-full",onClick:et=>{et.stopPropagation(),Le.file_url&&Nue(Le.file_url,Le.name)},disabled:!Le.file_url,children:Le.item_type==="file"?e.jsxs(e.Fragment,{children:[e.jsx(Oi,{className:"h-4 w-4 mr-2"}),"Download"]}):e.jsxs(e.Fragment,{children:[e.jsx(En,{className:"h-4 w-4 mr-2"}),"Access"]})}):e.jsx(Q,{className:"w-full",onClick:et=>{et.stopPropagation(),l(Le)},disabled:Ye||!Ie,children:Ye?"Sold Out":Ie?e.jsxs(e.Fragment,{children:[e.jsx(Zg,{className:"h-4 w-4 mr-2"}),"Purchase"]}):`Need ${Le.points_cost-de} more pts`})]})]},Le.id)})})]}),e.jsx(ms,{value:"my-rewards",className:"mt-6",children:!fe||fe.length===0?e.jsx(ze,{children:e.jsx(qe,{className:"py-12",children:e.jsxs("div",{className:"text-center text-muted-foreground",children:[e.jsx(Wl,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{className:"font-medium",children:"No rewards yet"}),e.jsx("p",{className:"text-sm",children:"Purchase items from the store to see them here!"})]})})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:fe.map(Le=>{var Ue,Ye,Ie,et,It;return e.jsxs(ze,{className:"overflow-hidden",children:[(Ue=Le.item)!=null&&Ue.preview_image_url?e.jsx("div",{className:"aspect-video relative overflow-hidden bg-muted",children:e.jsx("img",{src:Le.item.preview_image_url,alt:((Ye=Le.item)==null?void 0:Ye.name)||"Reward",className:"w-full h-full object-cover"})}):e.jsx("div",{className:"aspect-video bg-muted flex items-center justify-center",children:e.jsx(uo,{className:"h-12 w-12 text-muted-foreground/50"})}),e.jsxs(Wt,{className:"pb-2",children:[e.jsx(Zt,{className:"text-lg",children:((Ie=Le.item)==null?void 0:Ie.name)||"Unknown Item"}),e.jsxs(Ss,{className:"text-xs",children:["Purchased for ",Le.points_spent," points • ",new Date(Le.purchased_at).toLocaleDateString()]})]}),e.jsx(qe,{children:e.jsx(Q,{className:"w-full",onClick:()=>{var Pe,at;(Pe=Le.item)!=null&&Pe.file_url&&Nue(Le.item.file_url,(at=Le.item)==null?void 0:at.name)},disabled:!((et=Le.item)!=null&&et.file_url),children:((It=Le.item)==null?void 0:It.item_type)==="file"?e.jsxs(e.Fragment,{children:[e.jsx(Oi,{className:"h-4 w-4 mr-2"}),"Download"]}):e.jsxs(e.Fragment,{children:[e.jsx(En,{className:"h-4 w-4 mr-2"}),"Access"]})})})]},Le.id)})})})]})]}),e.jsx(Xc,{open:!!o,onOpenChange:()=>l(null),children:e.jsxs(Tc,{children:[e.jsxs(Ac,{children:[e.jsx(Ic,{children:"Confirm Purchase"}),e.jsxs(Pc,{children:['Are you sure you want to purchase "',o==null?void 0:o.name,'" for ',o==null?void 0:o.points_cost," points?",e.jsx("br",{}),e.jsx("br",{}),"You currently have ",e.jsxs("strong",{children:[de," points"]}),". After this purchase, you'll have"," ",e.jsxs("strong",{children:[de-((o==null?void 0:o.points_cost)||0)," points"]})," remaining."]})]}),e.jsxs(Ec,{children:[e.jsx(Lc,{children:"Cancel"}),e.jsx(dc,{onClick:Te,disabled:ue.isPending,children:ue.isPending?"Purchasing...":"Confirm Purchase"})]})]})}),e.jsx(Dr,{open:i,onOpenChange:Le=>{!Le&&j?tt():d(Le)},children:e.jsx(Lr,{children:j?e.jsxs(e.Fragment,{children:[e.jsxs(Ur,{children:[e.jsxs(Br,{className:"flex items-center gap-2",children:[e.jsx(Li,{className:"h-5 w-5 text-green-500"}),"Thank You for Your Review!"]}),e.jsx(Gs,{children:"Would you also share your review on Google? It helps other agents discover LevelUp!"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-muted p-4 rounded-lg",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Your review:"}),e.jsxs("p",{className:"text-sm italic",children:['"',A,'"']})]}),e.jsxs(Q,{variant:"outline",className:"w-full",onClick:we,children:[e.jsx(fo,{className:"h-4 w-4 mr-2"}),"Copy Review to Clipboard"]})]}),e.jsxs(Dn,{className:"flex-col sm:flex-row gap-2",children:[e.jsx(Q,{variant:"outline",onClick:tt,children:"Maybe Later"}),e.jsxs(Q,{onClick:ve,className:"bg-blue-600 hover:bg-blue-700",children:[e.jsx(En,{className:"h-4 w-4 mr-2"}),"Leave Google Review"]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Leave a Review"}),e.jsx(Gs,{children:"Share your experience with LevelUp and earn 25 spendable points!"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Your Rating"}),e.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(Le=>e.jsx("button",{type:"button",onClick:()=>g(Le),className:"focus:outline-none",children:e.jsx(Ln,{className:`h-8 w-8 transition-colors ${m>=Le?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-400"}`})},Le))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Your Review"}),e.jsx(Ks,{placeholder:"What do you love about LevelUp? How has it helped your business?",value:y,onChange:Le=>v(Le.target.value),rows:4})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>d(!1),children:"Cancel"}),e.jsx(Q,{onClick:be,disabled:b,className:"bg-yellow-600 hover:bg-yellow-700",children:b?"Submitting...":"Submit & Earn 25 Points"})]})]})})}),e.jsx(Dr,{open:!!I,onOpenChange:()=>F(null),children:e.jsxs(Lr,{className:"max-w-lg",children:[e.jsxs(Ur,{children:[e.jsxs(Br,{className:"flex items-center gap-2",children:[I==null?void 0:I.name,e.jsxs(bt,{variant:"secondary",className:"font-bold",children:[e.jsx(Ln,{className:"h-3 w-3 mr-1"}),I==null?void 0:I.points_cost]})]}),(I==null?void 0:I.category)&&e.jsxs(bt,{variant:"outline",className:"w-fit",children:[I.category.icon&&`${I.category.icon} `,I.category.name]})]}),(I==null?void 0:I.preview_image_url)&&e.jsx("div",{className:"aspect-video relative overflow-hidden bg-muted rounded-lg",children:e.jsx("img",{src:I.preview_image_url,alt:I.name,className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-muted-foreground",children:(I==null?void 0:I.description)||"No description available"}),(I==null?void 0:I.max_quantity)!==null&&!xe.has((I==null?void 0:I.id)||"")&&e.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"]})]}),e.jsx(Dn,{children:I&&xe.has(I.id)?e.jsx(Q,{className:"w-full",onClick:()=>{I.file_url&&Nue(I.file_url,I.name)},disabled:!I.file_url,children:I.item_type==="file"?e.jsxs(e.Fragment,{children:[e.jsx(Oi,{className:"h-4 w-4 mr-2"}),"Download"]}):e.jsxs(e.Fragment,{children:[e.jsx(En,{className:"h-4 w-4 mr-2"}),"Access"]})}):I&&e.jsx(Q,{className:"w-full",onClick:()=>{F(null),l(I)},disabled:I.max_quantity!==null&&I.current_quantity===0||de{const{user:t}=Gr(),r=qr(),s=Ht({queryKey:["smart-presentations",t==null?void 0:t.id],queryFn:async()=>{const{data:m,error:g}=await Z.from("smart_presentations").select("*").eq("owner_user_id",t.id).neq("status","archived").order("created_at",{ascending:!1});if(g)throw g;return m||[]},enabled:!!t}),n=Ht({queryKey:["smart-presentation-templates",t==null?void 0:t.id],queryFn:async()=>{const{data:m,error:g}=await Z.from("smart_presentation_templates").select("*").eq("is_active",!0).order("created_at",{ascending:!0});if(g)throw g;return m||[]},enabled:!!t}),a=Jt({mutationFn:async m=>{const{data:g,error:y}=await Z.from("smart_presentations").insert({owner_user_id:t.id,...m}).select().single();if(y)throw y;return g},onSuccess:()=>{r.invalidateQueries({queryKey:["smart-presentations"]})}}),o=Jt({mutationFn:async({id:m,...g})=>{const{data:y,error:v}=await Z.from("smart_presentations").update(g).eq("id",m).select().single();if(v)throw v;return y},onSuccess:()=>{r.invalidateQueries({queryKey:["smart-presentations"]})}}),l=Jt({mutationFn:async m=>{const{data:g,error:y}=await Z.from("smart_presentations").update({status:"published",published_at:new Date().toISOString()}).eq("id",m).select().single();if(y)throw y;return g},onSuccess:()=>{r.invalidateQueries({queryKey:["smart-presentations"]}),Se.success("Presentation published!")}}),i=Jt({mutationFn:async m=>{const{error:g}=await Z.from("smart_presentations").update({status:"archived"}).eq("id",m);if(g)throw g},onSuccess:()=>{r.invalidateQueries({queryKey:["smart-presentations"]}),Se.success("Presentation archived")}}),d=Jt({mutationFn:async m=>{const{error:g}=await Z.from("smart_presentation_templates").insert({owner_user_id:t.id,name:m.title+" Template",description:"Created from "+m.title,template_type:"custom",icon:"📄",sections:m.sections,cta_config:{type:m.cta_type,label:m.cta_label},is_system:!1});if(g)throw g},onSuccess:()=>{r.invalidateQueries({queryKey:["smart-presentation-templates"]}),Se.success("Saved as template!")}});return{presentations:s.data||[],templates:n.data||[],isLoading:s.isLoading,templatesLoading:n.isLoading,createPresentation:a,updatePresentation:o,publishPresentation:l,archivePresentation:i,saveAsTemplate:d}},irr=[{value:"positive",label:"Love it",icon:_d,color:"bg-emerald-100 text-emerald-700 border-emerald-300"},{value:"suggestion",label:"Suggestion",icon:yy,color:"bg-amber-100 text-amber-700 border-amber-300"},{value:"issue",label:"Issue",icon:Qu,color:"bg-red-100 text-red-700 border-red-300"}],orr=({feature:t,children:r})=>{const{user:s}=Gr(),[n,a]=E.useState(!1),[o,l]=E.useState(null),[i,d]=E.useState(""),[m,g]=E.useState(!1),y=async()=>{var v;if(!o||!i.trim()){Se.error("Please select a type and add your feedback");return}g(!0);try{const{error:b}=await Z.functions.invoke("send-beta-feedback",{body:{feature:t,sentiment:o,message:i.trim(),userName:((v=s==null?void 0:s.user_metadata)==null?void 0:v.name)||(s==null?void 0:s.email)||"Unknown",userEmail:(s==null?void 0:s.email)||"unknown"}});if(b)throw b;Se.success("Thank you for your feedback!"),a(!1),l(null),d("")}catch(b){console.error("Feedback error:",b),Se.error("Failed to send feedback. Please try again.")}finally{g(!1)}};return e.jsxs(Dr,{open:n,onOpenChange:a,children:[e.jsx(xo,{asChild:!0,children:r||e.jsxs(Q,{variant:"outline",size:"sm",className:"gap-1.5 text-xs border-amber-200 bg-amber-50 text-amber-700 hover:bg-amber-100 hover:text-amber-800 dark:bg-amber-900/20 dark:border-amber-800 dark:text-amber-400 dark:hover:bg-amber-900/30 transition-colors",children:[e.jsx(SA,{className:"h-3.5 w-3.5"}),"Feedback"]})}),e.jsxs(Lr,{className:"sm:max-w-md",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Share Your Feedback"}),e.jsx(Gs,{children:"This feature is in beta — your thoughts help us make it better!"})]}),e.jsxs("div",{className:"space-y-4 pt-2",children:[e.jsx("div",{className:"flex gap-2",children:irr.map(v=>{const b=v.icon;return e.jsxs("button",{type:"button",onClick:()=>l(v.value),className:qt("flex-1 flex flex-col items-center gap-1.5 rounded-lg border-2 p-3 text-xs font-medium transition-all",o===v.value?v.color:"border-border bg-background text-muted-foreground hover:bg-accent"),children:[e.jsx(b,{className:"h-5 w-5"}),v.label]},v.value)})}),e.jsx(Ks,{placeholder:"Tell us what you think...",value:i,onChange:v=>d(v.target.value),rows:4,className:"resize-none"}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(Q,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsx(Q,{onClick:y,disabled:m||!o||!i.trim(),children:m?"Sending...":"Send Feedback"})]})]})]})]})},lrr=()=>{const t=Ws(),{presentations:r,isLoading:s,archivePresentation:n,saveAsTemplate:a}=jHe(),o=i=>i.status==="draft"?e.jsx(bt,{variant:"outline",className:"text-xs",children:"Draft"}):i.view_count>1?e.jsx(bt,{className:"text-xs bg-emerald-100 text-emerald-700 border-emerald-200",children:"Revisited"}):i.view_count===1?e.jsx(bt,{className:"text-xs bg-blue-100 text-blue-700 border-blue-200",children:"Opened"}):e.jsx(bt,{variant:"secondary",className:"text-xs",children:"Not Opened"}),l=i=>{const d=`https://presentations.relevelup.com/${i}`;navigator.clipboard.writeText(d),Se.success("Link copied!")};return e.jsx(Fr,{title:"Smart Presentations",children:e.jsxs("div",{className:"max-w-5xl mx-auto space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h1",{className:"text-2xl font-serif font-bold text-foreground",children:"Smart Presentations"}),e.jsx(eFe,{}),e.jsx(orr,{feature:"Smart Presentations"})]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Create personalized, video-first presentations for your clients"})]}),e.jsxs(Q,{onClick:()=>t("/mission-control/presentations/new"),className:"gap-2",children:[e.jsx(gs,{className:"h-4 w-4"}),"Create Presentation"]})]}),s?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(i=>e.jsx(fr,{className:"h-20 w-full rounded-lg"},i))}):r.length===0?e.jsx(ze,{children:e.jsxs(qe,{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-4",children:e.jsx($f,{className:"h-8 w-8 text-primary"})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No presentations yet"}),e.jsx("p",{className:"text-muted-foreground mb-6 max-w-md",children:"Create your first Smart Presentation to impress clients with personalized, video-first content."}),e.jsxs(Q,{onClick:()=>t("/mission-control/presentations/new"),className:"gap-2",children:[e.jsx(gs,{className:"h-4 w-4"}),"Create Your First Presentation"]})]})}):e.jsx("div",{className:"space-y-3",children:r.map(i=>e.jsx(ze,{className:"hover:shadow-sm transition-shadow",children:e.jsx(qe,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(fa,{className:"h-5 w-5 text-primary"})}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:"font-semibold truncate",children:i.title}),o(i)]}),e.jsxs("div",{className:"flex items-center gap-x-3 gap-y-0.5 flex-wrap text-sm text-muted-foreground mt-0.5",children:[i.client_name&&e.jsx("span",{children:i.client_name}),e.jsxs("span",{children:["Created ",Xr(new Date(i.created_at),"MMM d, yyyy")]}),i.view_count>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Gi,{className:"h-3 w-3"})," ",i.view_count," view",i.view_count!==1?"s":""]}),i.cta_clicked_count>0&&e.jsx("span",{className:"text-emerald-600 font-medium",children:"CTA clicked"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap sm:flex-nowrap sm:shrink-0",children:[i.status==="published"&&i.share_token&&e.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>l(i.share_token),children:[e.jsx(fo,{className:"h-3.5 w-3.5 mr-1"}),"Copy Link"]}),i.status==="published"&&e.jsx(Q,{variant:"outline",size:"sm",onClick:()=>t(`/mission-control/presentations/${i.id}?edit=true`),children:"Edit"}),e.jsx(Q,{variant:"outline",size:"sm",onClick:()=>t(`/mission-control/presentations/${i.id}`),children:i.status==="draft"?"Edit":"View"}),e.jsxs(mh,{children:[e.jsx(ph,{asChild:!0,children:e.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(Pg,{className:"h-4 w-4"})})}),e.jsxs(Au,{align:"end",children:[i.status==="published"&&i.share_token&&e.jsxs(Ba,{onClick:()=>window.open(`https://presentations.relevelup.com/${i.share_token}`,"_blank"),children:[e.jsx(En,{className:"h-4 w-4 mr-2"}),"Preview Link"]}),e.jsxs(Ba,{onClick:()=>a.mutate(i),children:[e.jsx(fa,{className:"h-4 w-4 mr-2"}),"Save as Template"]}),e.jsxs(Ba,{onClick:()=>n.mutate(i.id),className:"text-destructive",children:[e.jsx(mA,{className:"h-4 w-4 mr-2"}),"Archive"]})]})]})]})]})})]})})},i.id))})]})})},UTe={Welcome:[{label:"Warm & Personal",text:"Hey there! I'm so glad you're here. I put this presentation together just for you because I truly believe we'd make a great team. Over the next few minutes, I'll walk you through exactly how I can help you achieve your real estate goals. Let's dive in!"},{label:"Professional & Confident",text:"Welcome! Thank you for taking the time to check this out. I've prepared this presentation specifically with your needs in mind. I want to show you what sets me apart, the results I've delivered, and how I plan to make your experience smooth and successful. Let's get started!"}],"About Me":[{label:"Relatable Story",text:"Let me tell you a little about myself. I didn't just fall into real estate — I chose it because I love helping people with one of the biggest decisions of their lives. Every client I work with gets my full attention, my honest advice, and someone who truly has their back from start to finish."},{label:"Results-Focused",text:"Here's what I want you to know about me: I'm not just another agent. I've helped dozens of families find their perfect home and get top dollar for their properties. I stay on top of the market, I communicate constantly, and I don't stop until we hit your goals."}],"Market Update":[{label:"Engaging Overview",text:"Let's talk about what's happening in the market right now. I want you to feel confident and informed, so here's the honest picture. I'll break down the key numbers, what they mean for you, and how we can use current conditions to your advantage. Knowledge is power!"},{label:"Buyer-Focused",text:"The market is always moving, and I want to make sure you're in the best position possible. Here's what the latest data tells us, what opportunities are out there for you, and why timing matters. Let me walk you through it."}],"My Process":[{label:"Step-by-Step",text:"I want you to know exactly what to expect when we work together. My process is simple, clear, and designed to take the stress out of the equation. From our first conversation all the way to closing day, I'll be right there guiding you every step of the way. Here's how it works."},{label:"Client-Centered",text:"One thing my clients always tell me is how easy and stress-free the process was. That's not by accident — I've refined my approach over the years to make sure you always know what's happening, what's next, and that someone's got your back. Let me show you how."}],Testimonials:[{label:"Social Proof",text:"Don't just take my word for it — let me share what some of my past clients have said. These are real people, real experiences, and real results. I'm proud of the relationships I've built and the outcomes we've achieved together."}],Pricing:[{label:"Transparent & Value-Driven",text:"Let's talk about the investment. I believe in being completely transparent about pricing because trust is everything. Here's what you get when you work with me, and why my clients say it's the best decision they made. Let me walk you through it."}],"Call to Action":[{label:"Warm Close",text:"So here's my ask — let's connect! I'd love to hop on a quick call, answer any questions you have, and see how I can help. No pressure, no obligation — just a real conversation about your goals. Click the button below and let's make it happen!"},{label:"Urgency Close",text:"The market waits for no one, and neither should you. Let's get started today! Click the link below to schedule a quick chat. I promise — this could be the best 15 minutes you invest in your real estate journey."}]},crr=[{label:"Engaging Introduction",text:"In this section, I want to share something important with you. I've put real thought into this, and I think you'll find it valuable. Let me walk you through what I've prepared — I'm excited for you to see it!"},{label:"Keep It Simple",text:"Let me keep this short and sweet. Here's what you need to know, and why it matters for you. I'm always about giving you the real picture — no fluff, just the facts and my honest take."}];function drr(t){const r=UTe[t];if(r)return r;const s=t.toLowerCase();for(const[n,a]of Object.entries(UTe))if(s.includes(n.toLowerCase())||n.toLowerCase().includes(s))return a;return crr}function urr({sectionTitle:t,contactId:r,onVideoReady:s}){const[n,a]=E.useState(!1),[o,l]=E.useState("script"),[i,d]=E.useState(0),[m,g]=E.useState(0),{canRecord:y}=WBe(),v=Zae(),[b,N]=E.useState(""),[j,S]=E.useState(!1),[A,M]=E.useState(!0),[I,F]=E.useState(!1),[O,B]=E.useState(null),$=drr(t),H=()=>{l("script"),d(0),g(0),N(""),S(!1),M(!0),F(!1),B(null)},W=ne=>{!ne&&(o==="uploading"||o==="processing")||(a(ne),ne||H())},X=ne=>{B(ne),N($[ne].text),S(!1)},se=()=>{l("record"),M(b.trim().length>0)},ae=()=>{N(""),M(!1),l("record")},le=E.useCallback(async(ne,fe)=>{l("uploading");try{const oe=t||"Presentation Video",{videoId:de,uploadUrl:ue,libraryId:xe}=await GBe(oe),{apiKey:Te}=await KBe(de),be=new XMLHttpRequest;be.upload.onprogress=Le=>{Le.lengthComputable&&d(Le.loaded/Le.total*100)},await new Promise((Le,Ue)=>{be.onload=()=>be.status>=200&&be.status<300?Le():Ue(new Error("Upload failed")),be.onerror=()=>Ue(new Error("Upload failed")),be.open("PUT",ue),be.setRequestHeader("AccessKey",Te),be.send(ne)}),l("processing");let we=0;const ve=Date.now(),tt=9e4;let Ae=null;for(;we<4;){if(await new Promise(Ue=>setTimeout(Ue,3e3)),Date.now()-ve>tt){const Ue=ne.size/1048576,Ye=`https://iframe.mediadelivery.net/embed/${xe}/${de}?responsive=true`;await v.mutateAsync({bunny_video_id:de,playback_url:Ye,file_size_mb:Ue,title:oe,contact_id:r||void 0,status:"processing",touch_type:"presentation"}),s(Ye),Se.success("Video saved — still encoding. It will be ready shortly."),l("done"),setTimeout(()=>a(!1),1500);return}const Le=await ZBe(de);if(we=Le.status,g(Le.encodeProgress||0),we===4)Ae={playbackUrl:Le.directPlayUrl,thumbnailUrl:Le.thumbnailUrl,previewUrl:Le.previewUrl||null,duration:Le.length||fe,fileSizeMb:(Le.storageSize||ne.size)/(1024*1024)};else if(we===5||we===6)throw new Error("Video processing failed")}if(!Ae)throw new Error("No video data");await v.mutateAsync({bunny_video_id:de,contact_id:r||void 0,playback_url:Ae.playbackUrl,thumbnail_url:Ae.thumbnailUrl,preview_url:Ae.previewUrl,duration_seconds:Ae.duration,file_size_mb:Ae.fileSizeMb,title:oe,status:"ready",touch_type:"presentation"}),s(Ae.playbackUrl),Se.success("Video recorded, saved to library & attached!"),l("done"),setTimeout(()=>a(!1),1500)}catch(oe){console.error("Recording upload error:",oe),Se.error("Failed to process video. Please try again."),l("record")}},[t,r,s,v]);return e.jsxs(Dr,{open:n,onOpenChange:W,children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{variant:"outline",size:"sm",className:"gap-1.5 shrink-0",title:"Record a video",children:[e.jsx(ya,{className:"h-3.5 w-3.5"}),"Record"]})}),e.jsxs(Lr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto !top-[5%] !translate-y-0 sm:!top-[5%] sm:!translate-y-0",children:[e.jsx(Ur,{children:e.jsxs(Br,{children:[o==="script"&&`Prepare your script for "${t}"`,o==="record"&&`Record video for "${t}"`,o==="uploading"&&"Uploading...",o==="processing"&&"Processing...",o==="done"&&"Done!"]})}),o==="script"&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose a starter script below, edit it to make it yours, or skip and speak freely."}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Starter Scripts"}),e.jsx("div",{className:"grid gap-2",children:$.map((ne,fe)=>e.jsxs("button",{onClick:()=>X(fe),className:qt("text-left p-3 rounded-lg border transition-all hover:bg-accent/50",O===fe?"border-primary bg-primary/5 ring-1 ring-primary":"border-border"),children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(fa,{className:"h-3.5 w-3.5 text-primary shrink-0"}),e.jsx("span",{className:"text-sm font-medium",children:ne.label})]}),e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 ml-5.5",children:ne.text})]},fe))})]}),b&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Your Script"}),!j&&e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>S(!0),className:"h-7 text-xs gap-1",children:[e.jsx(ei,{className:"h-3 w-3"}),"Edit"]})]}),j?e.jsx(Ks,{value:b,onChange:ne=>N(ne.target.value),rows:5,placeholder:"Type your script here...",className:"text-sm"}):e.jsx("div",{className:"p-3 rounded-lg bg-muted/50 text-sm text-foreground leading-relaxed",children:b})]}),!b&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Or Write Your Own"}),e.jsx(Ks,{value:b,onChange:ne=>{N(ne.target.value),B(null)},rows:4,placeholder:"Type your own script here...",className:"text-sm"})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsx(Q,{variant:"ghost",size:"sm",onClick:ae,className:"text-muted-foreground",children:"Skip — no teleprompter"}),e.jsx(Q,{onClick:se,disabled:!1,children:b.trim()?"Continue with Script":"Continue Without Script"})]})]}),!y&&o==="record"?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8 text-center",children:[e.jsx(Qu,{className:"h-10 w-10 text-destructive"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"You've reached your video storage limit. Delete some videos to free up space."})]}):o==="record"?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Record up to 60 seconds. Saved to your library & auto-attached."}),b.trim()&&e.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>M(!A),className:"h-7 text-xs gap-1",children:[A?e.jsx(zf,{className:"h-3 w-3"}):e.jsx(Gi,{className:"h-3 w-3"}),A?"Hide Script":"Show Script"]})]}),e.jsx(YVe,{maxDurationSeconds:60,onRecordingComplete:le,onRecordingStateChange:F,onError:ne=>Se.error(ne),teleprompterContent:b.trim()?e.jsx(QVe,{text:b,isVisible:A,onToggleVisibility:()=>M(!A),isRecording:I,startCountdown:!1}):void 0}),e.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>l("script"),className:"text-xs text-muted-foreground",children:"← Back to script"})]}):o==="uploading"?e.jsxs("div",{className:"flex flex-col items-center gap-4 py-12",children:[e.jsx(Hr,{className:"h-10 w-10 animate-spin text-primary"}),e.jsxs("div",{className:"w-full max-w-xs space-y-2",children:[e.jsx(hc,{value:i,className:"h-2"}),e.jsxs("p",{className:"text-sm text-muted-foreground text-center",children:["Uploading... ",Math.round(i),"%"]})]})]}):o==="processing"?e.jsxs("div",{className:"flex flex-col items-center gap-4 py-12",children:[e.jsx(Hr,{className:"h-10 w-10 animate-spin text-primary"}),e.jsxs("div",{className:"w-full max-w-xs space-y-2",children:[e.jsx(hc,{value:m,className:"h-2"}),e.jsxs("p",{className:"text-sm text-muted-foreground text-center",children:["Processing... ",Math.round(m),"%"]}),e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"This usually takes less than a minute"})]})]}):o==="done"?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-12",children:[e.jsx(ui,{className:"h-12 w-12 text-emerald-500"}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Video attached!"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Saved to your video library"})]}):null]})]})}function hrr({sectionTitle:t,contactId:r,onVideoReady:s}){const[n,a]=E.useState(!1),[o,l]=E.useState(null),[i,d]=E.useState("idle"),[m,g]=E.useState(0),y=E.useRef(null),v=Zae(),{data:b}=Yae(),N=(b==null?void 0:b.total_storage_mb)||0,S=((b==null?void 0:b.max_storage_mb)||1024)-N,A=()=>{l(null),d("idle"),g(0)},M=$=>{!$&&i!=="idle"&&i!=="done"||(a($),$||A())},I=$=>{var X;const H=(X=$.target.files)==null?void 0:X[0];if(!H)return;if(!H.type.startsWith("video/")){Se.error("Please select a video file");return}const W=H.size/(1024*1024);if(W>500){Se.error("Video file must be less than 500MB");return}if(W>S){Se.error(`Not enough storage. You have ${S.toFixed(1)} MB remaining.`);return}l(H)},F=E.useCallback(async()=>{if(o){d("creating"),g(0);try{const $=t||o.name,{data:H,error:W}=await Z.functions.invoke("bunny-upload",{body:{action:"create",title:$,isAgentVideo:!0}});if(W)throw new Error(W.message);const{videoId:X,libraryId:se}=H;d("uploading");const{data:ae,error:le}=await Z.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:X,isAgentVideo:!0}});if(le)throw new Error(le.message);await new Promise((oe,de)=>{const ue=new XMLHttpRequest;ue.upload.addEventListener("progress",xe=>{xe.lengthComputable&&g(Math.round(xe.loaded/xe.total*100))}),ue.addEventListener("load",()=>ue.status>=200&&ue.status<300?oe():de(new Error(`Upload failed (${ue.status})`))),ue.addEventListener("error",()=>de(new Error("Upload failed"))),ue.open("PUT",ae.uploadUrl),ue.setRequestHeader("AccessKey",ae.apiKey),ue.send(o)}),d("processing");const ne=o.size/(1024*1024),fe=`https://iframe.mediadelivery.net/embed/${se}/${X}`;await v.mutateAsync({bunny_video_id:X,playback_url:fe,file_size_mb:ne,title:$,contact_id:r||void 0,status:"processing",touch_type:"presentation"}),s(fe),d("done"),Se.success("Video uploaded & attached to section!"),setTimeout(()=>a(!1),1200)}catch($){console.error("Upload error:",$),Se.error($ instanceof Error?$.message:"Failed to upload video"),d("idle")}}},[o,t,r,s,v]),O=()=>{switch(i){case"creating":return"Preparing upload...";case"uploading":return`Uploading... ${m}%`;case"processing":return"Saving video...";case"done":return"Done!";default:return""}},B=i!=="idle"&&i!=="done";return e.jsxs(Dr,{open:n,onOpenChange:M,children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{variant:"outline",size:"sm",className:"gap-1.5 shrink-0",title:"Upload a video file",children:[e.jsx(to,{className:"h-3.5 w-3.5"}),"Upload"]})}),e.jsxs(Lr,{className:"sm:max-w-md",children:[e.jsx(Ur,{children:e.jsxs(Br,{children:['Upload Video for "',t,'"']})}),e.jsxs("div",{className:"space-y-4 py-2",children:[o?e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted rounded-lg",children:[e.jsx(ya,{className:"h-8 w-8 text-primary flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:o.name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[(o.size/(1024*1024)).toFixed(1)," MB"]})]}),!B&&e.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>l(null),children:e.jsx(rn,{className:"h-4 w-4"})})]}):e.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 $;return($=y.current)==null?void 0:$.click()},children:[e.jsx(to,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to select a video file"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"MP4, MOV, WebM (max 500MB)"})]}),e.jsx("input",{ref:y,type:"file",accept:"video/*",className:"hidden",onChange:I,disabled:B}),B&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Hr,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{children:O()})]}),e.jsx(hc,{value:i==="uploading"?m:i==="processing"?100:10})]})]}),e.jsxs(Dn,{children:[e.jsx(Q,{variant:"outline",onClick:()=>M(!1),disabled:B,children:"Cancel"}),e.jsx(Q,{onClick:F,disabled:!o||B,children:B?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):e.jsxs(e.Fragment,{children:[e.jsx(to,{className:"h-4 w-4 mr-2"}),"Upload & Attach"]})})]})]})]})}const qTe=[{value:"schedule_call",label:"Schedule a Call"},{value:"ready_to_list",label:"Ready to List"},{value:"request_pricing",label:"Request Pricing Update"},{value:"sign_agreement",label:"Sign Buyer Agreement"},{value:"text_questions",label:"Text Me Questions"}],VTe=()=>{const t=Ws(),{id:r}=Xl(),{user:s}=Gr(),{templates:n,templatesLoading:a,createPresentation:o,updatePresentation:l,publishPresentation:i}=jHe(),{isGmailConnected:d,gmailEmail:m}=J3(),[g,y]=E.useState(!1),[v,b]=E.useState("client"),[N,j]=E.useState(!1),[S,A]=E.useState(""),[M,I]=E.useState([]),[F,O]=E.useState(!1),[B,$]=E.useState(null),[H,W]=E.useState(!1),[X,se]=E.useState(""),[ae,le]=E.useState(""),[ne,fe]=E.useState(""),[oe,de]=E.useState("buyer"),[ue,xe]=E.useState(""),[Te,be]=E.useState(null),[we,ve]=E.useState(""),[tt,Ae]=E.useState([]),[Le,Ue]=E.useState("schedule_call"),[Ye,Ie]=E.useState("Schedule a Call"),[et,It]=E.useState(""),[Pe,at]=E.useState(""),[ce,$e]=E.useState(null),[Ge,rt]=E.useState(r||null),[je,it]=E.useState(null),[Me,Je]=E.useState(!1),Xe=async(At,Rt)=>{if(!s)return;const Cr=5*1024*1024;if(At.size>Cr){Se.error("Image must be under 5MB");return}if(!At.type.startsWith("image/")){Se.error("Please upload an image file");return}$e(Rt);try{const fs=At.name.split(".").pop()||"jpg",Vs=`${s.id}/${Date.now()}.${fs}`,{error:Js}=await Z.storage.from("listing-photos").upload(Vs,At);if(Js)throw Js;const{data:{publicUrl:hi}}=Z.storage.from("listing-photos").getPublicUrl(Vs);Mt(Rt,{image_url:hi}),Se.success("Image uploaded")}catch{Se.error("Failed to upload image")}finally{$e(null)}};E.useEffect(()=>{r&&Ve(r)},[r]);const Ve=async At=>{const{data:Rt,error:Cr}=await Z.from("smart_presentations").select("*").eq("id",At).single();if(Cr||!Rt)return;const fs=Rt;if(j(!0),ve(fs.title),se(fs.client_name||""),xe(fs.property_address||""),Ae(fs.sections||[]),Ue(fs.cta_type||"schedule_call"),Ie(fs.cta_label||"Schedule a Call"),It(fs.cta_url||""),at(fs.heading||""),it(fs.share_token),Je(fs.status==="published"),rt(fs.id),b("builder"),fs.contact_id){const{data:Vs}=await Z.from("innercircle_contacts").select("id, first_name, last_name, email, phone").eq("id",fs.contact_id).maybeSingle();Vs&&($(Vs),le(Vs.email||""),fe(Vs.phone||""))}};E.useEffect(()=>{if(!s||S.length<1){I([]);return}const At=setTimeout(async()=>{O(!0);const{data:Rt}=await Z.from("innercircle_contacts").select("id, first_name, last_name, email, phone, lead_source").eq("owner_user_id",s.id).or(`first_name.ilike.%${S}%,last_name.ilike.%${S}%,email.ilike.%${S}%`).limit(10);I(Rt||[]),O(!1)},300);return()=>clearTimeout(At)},[S,s]);const ot=At=>{$(At),se(`${At.first_name} ${At.last_name||""}`.trim()),le(At.email||""),fe(At.phone||""),W(!1)},mt=async()=>{if(!X.trim()){Se.error("Client name is required");return}const At=X.trim().split(" "),Rt=At[0],Cr=At.slice(1).join(" ")||null,{data:fs,error:Vs}=await Z.from("innercircle_contacts").insert({owner_user_id:s.id,first_name:Rt,last_name:Cr,email:ae||null,phone:ne||null,lead_source:"Smart Presentation"}).select().single();if(Vs){Se.error("Failed to create client");return}$(fs),Se.success("Client created & saved to Agent OS"),b("template")},ft=At=>{be(At);const Rt=(At.sections||[]).map(Cr=>({...Cr,is_visible:!0,video_url:"",text:""}));if(Ae(Rt),ve(At.name+(X?` for ${X}`:"")),At.cta_config){const Cr=At.cta_config;Ue(Cr.type||"schedule_call"),Ie(Cr.label||"Schedule a Call")}b("builder")},ct=()=>{Ae([{title:"Welcome",description:"A personal welcome",type:"video",icon:"👋",is_visible:!0}]),ve(X?`Presentation for ${X}`:"New Presentation"),b("builder")},Mt=(At,Rt)=>{Ae(Cr=>Cr.map((fs,Vs)=>Vs===At?{...fs,...Rt}:fs))},Ot=At=>{Mt(At,{is_visible:!tt[At].is_visible})},rr=()=>{Ae(At=>[...At,{title:"New Section",description:"",type:"video",icon:"📝",is_visible:!0}])},Ir=At=>{Ae(Rt=>Rt.filter((Cr,fs)=>fs!==At))},cr=async()=>{if(!we.trim()){Se.error("Title is required");return}try{if(Ge){const At=await l.mutateAsync({id:Ge,title:we,sections:tt,client_name:X,property_address:ue||null,cta_type:Le,cta_label:Ye,cta_url:et||null,heading:Pe||null});Se.success("Saved")}else{const At=await o.mutateAsync({title:we,contact_id:(B==null?void 0:B.id)||void 0,client_name:X,property_address:ue||void 0,template_id:(Te==null?void 0:Te.id)||void 0,sections:tt,cta_type:Le,cta_label:Ye,cta_url:et||void 0,heading:Pe||void 0});rt(At.id),it(At.share_token),Se.success("Presentation created!")}}catch(At){console.error("Failed to save presentation:",At);const Rt=(At==null?void 0:At.message)||(At==null?void 0:At.toString())||"Unknown error";Se.error(`Failed to save: ${Rt}`)}},Mr=async()=>{try{await cr();const At=Ge;if(At){const Rt=await i.mutateAsync(At);it(Rt.share_token),Je(!0),b("share")}}catch(At){console.error("Failed to publish presentation:",At),Se.error(`Failed to publish: ${(At==null?void 0:At.message)||"Unknown error"}`)}},As=je?`https://presentations.relevelup.com/${je}`:"";return e.jsx(Fr,{title:"Smart Presentations",children:e.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>t("/mission-control/presentations"),children:e.jsx(_i,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-serif font-bold text-foreground",children:N?"Edit Presentation":"Create Smart Presentation"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[v==="client"&&"Who is this presentation for?",v==="template"&&"Choose a starting template",v==="builder"&&"Customize your presentation",v==="share"&&"Share with your client"]})]})]}),!N&&e.jsx("div",{className:"flex items-center gap-2",children:["client","template","builder","share"].map((At,Rt)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:qt("w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors",v===At?"bg-primary text-primary-foreground":Rt<["client","template","builder","share"].indexOf(v)?"bg-emerald-100 text-emerald-700":"bg-muted text-muted-foreground"),children:Rt<["client","template","builder","share"].indexOf(v)?e.jsx(li,{className:"h-4 w-4"}):Rt+1}),e.jsx("span",{className:"text-sm font-medium capitalize hidden sm:inline",children:At}),Rt<3&&e.jsx("div",{className:"w-8 h-px bg-border"})]},At))}),v==="client"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("button",{onClick:()=>{$(null),se(""),le(""),fe(""),W(!1),b("template")},className:"w-full group flex items-center justify-between gap-4 rounded-xl border border-dashed border-primary/30 bg-primary/5 hover:bg-primary/10 transition-all p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(Mi,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"font-semibold text-foreground text-sm",children:"Skip — Use as Lead Gen Tool"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"No specific client. Share broadly to capture new leads."})]})]}),e.jsx(Hi,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors shrink-0"})]}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-3",children:e.jsxs(Zt,{className:"text-base flex items-center gap-2",children:[e.jsx(Qn,{className:"h-4 w-4 text-muted-foreground"}),"Select Existing Client"]})}),e.jsxs(qe,{className:"space-y-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search by name or email...",value:S,onChange:At=>A(At.target.value),className:"pl-10"})]}),e.jsxs("div",{className:"space-y-2 max-h-56 overflow-y-auto",children:[F&&e.jsx(fr,{className:"h-12 w-full"}),M.map(At=>e.jsxs("button",{onClick:()=>ot(At),className:qt("w-full text-left p-3 rounded-lg border transition-colors",(B==null?void 0:B.id)===At.id?"border-primary bg-primary/5":"border-border hover:border-primary/50"),children:[e.jsxs("p",{className:"font-medium text-sm",children:[At.first_name," ",At.last_name]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:At.email||At.phone||"No contact info"})]},At.id)),!S&&e.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:"Start typing to search your contacts"}),S&&M.length===0&&!F&&e.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:"No clients found"})]}),B&&e.jsxs(Q,{onClick:()=>b("template"),className:"w-full gap-2",children:["Continue with ",B.first_name,e.jsx(Hi,{className:"h-4 w-4"})]})]})]}),e.jsxs(ze,{children:[e.jsx(Wt,{className:"pb-3",children:e.jsxs(Zt,{className:"text-base flex items-center gap-2",children:[e.jsx($d,{className:"h-4 w-4 text-muted-foreground"}),"Add New Client"]})}),e.jsxs(qe,{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"col-span-2",children:[e.jsx(Ee,{className:"text-xs",children:"Name *"}),e.jsx(Qe,{value:X,onChange:At=>{se(At.target.value),W(!0),$(null)},placeholder:"Sarah & Mike Johnson"})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-xs",children:"Email"}),e.jsx(Qe,{value:ae,onChange:At=>le(At.target.value),placeholder:"Optional",type:"email"})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-xs",children:"Phone"}),e.jsx(Qe,{value:ne,onChange:At=>fe(At.target.value),placeholder:"Optional"})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-xs",children:"Client Type"}),e.jsxs(ds,{value:oe,onValueChange:de,children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsxs(cs,{children:[e.jsx(Ut,{value:"buyer",children:"Buyer"}),e.jsx(Ut,{value:"seller",children:"Seller"}),e.jsx(Ut,{value:"recruit",children:"Recruit"}),e.jsx(Ut,{value:"other",children:"Other"})]})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-xs",children:"Property Address"}),e.jsx(Qe,{value:ue,onChange:At=>xe(At.target.value),placeholder:"Optional"})]})]}),H&&X&&e.jsxs(Q,{onClick:mt,className:"w-full gap-2",children:["Create Client & Continue",e.jsx(Hi,{className:"h-4 w-4"})]})]})]})]})]}),v==="template"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs(ci,{defaultValue:"system",children:[e.jsxs(ri,{children:[e.jsx(Kr,{value:"mine",children:"My Core Templates"}),e.jsx(Kr,{value:"system",children:"LevelUp Smart Templates"}),e.jsx(Kr,{value:"blank",children:"+ Start Blank"})]}),e.jsx(ms,{value:"mine",className:"mt-4",children:a?e.jsx("div",{className:"grid grid-cols-2 gap-4",children:[1,2].map(At=>e.jsx(fr,{className:"h-32"},At))}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:n.filter(At=>!At.is_system).length===0?e.jsx("p",{className:"text-muted-foreground col-span-2 text-center py-8",children:"You haven't saved any templates yet. Create a presentation and save it as a template!"}):n.filter(At=>!At.is_system).map(At=>e.jsx(HTe,{template:At,onSelect:ft},At.id))})}),e.jsx(ms,{value:"system",className:"mt-4",children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:n.filter(At=>At.is_system).map(At=>e.jsx(HTe,{template:At,onSelect:ft},At.id))})}),e.jsx(ms,{value:"blank",className:"mt-4",children:e.jsx(ze,{children:e.jsxs(qe,{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx("p",{className:"text-muted-foreground mb-4",children:"Start with a blank canvas and add your own sections."}),e.jsx(Q,{onClick:ct,children:"Start from Scratch"})]})})})]}),e.jsxs(Q,{variant:"outline",onClick:()=>b("client"),className:"gap-2",children:[e.jsx(_i,{className:"h-4 w-4"}),"Back"]})]}),v==="builder"&&e.jsxs("div",{className:"space-y-6",children:[e.jsx(ze,{children:e.jsxs(qe,{className:"pt-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{children:"Presentation Title"}),e.jsx(Qe,{value:we,onChange:At=>ve(At.target.value)})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"Page Heading"}),e.jsx(Qe,{value:Pe,onChange:At=>at(At.target.value),placeholder:X?`Welcome, ${X}!`:"e.g. Welcome! or Your Custom Listing Plan"}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:['The main heading visitors see. Leave blank for "Welcome, ',"",'!"']})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{children:"Client Name"}),e.jsx(Qe,{value:X,onChange:At=>se(At.target.value)})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"Property Address"}),e.jsx(Qe,{value:ue,onChange:At=>xe(At.target.value),placeholder:"Optional"})]})]})]})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Sections"}),e.jsx(Q,{variant:"outline",size:"sm",onClick:rr,children:"+ Add Section"})]}),e.jsx("div",{className:"space-y-3",children:tt.map((At,Rt)=>e.jsx(ze,{className:qt(!At.is_visible&&"opacity-50"),children:e.jsx(qe,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center gap-1 pt-1",children:[e.jsx(xp,{className:"h-4 w-4 text-muted-foreground cursor-grab"}),e.jsx("span",{className:"text-lg",children:At.icon})]}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(Qe,{value:At.title,onChange:Cr=>Mt(Rt,{title:Cr.target.value}),className:"font-semibold border-none p-0 h-auto text-base focus-visible:ring-0 bg-transparent"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>Ot(Rt),children:At.is_visible?e.jsx(Gi,{className:"h-4 w-4"}):e.jsx(zf,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>Ir(Rt),className:"text-destructive hover:text-destructive",children:e.jsx(Rs,{className:"h-4 w-4"})})]})]}),e.jsx(Qe,{value:At.description||"",onChange:Cr=>Mt(Rt,{description:Cr.target.value}),placeholder:"Section description...",className:"text-sm"}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx(Ee,{className:"text-xs",children:"Video URL"}),e.jsx(Qe,{value:At.video_url||"",onChange:Cr=>Mt(Rt,{video_url:Cr.target.value}),placeholder:"Paste a YouTube or video URL...",className:"text-sm"})]}),e.jsx(urr,{sectionTitle:At.title,contactId:B==null?void 0:B.id,onVideoReady:Cr=>Mt(Rt,{video_url:Cr})}),e.jsx(hrr,{sectionTitle:At.title,contactId:B==null?void 0:B.id,onVideoReady:Cr=>Mt(Rt,{video_url:Cr})}),e.jsx(mrr,{userId:s==null?void 0:s.id,onSelect:Cr=>Mt(Rt,{video_url:Cr})})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-xs",children:"Image (optional — shown if no video is set)"}),At.image_url?e.jsxs("div",{className:"relative mt-1 rounded-lg overflow-hidden border border-border bg-muted/30 group",children:[e.jsx("img",{src:At.image_url,alt:"",className:"w-full max-h-40 object-cover"}),e.jsx(Q,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>Mt(Rt,{image_url:""}),children:e.jsx(rn,{className:"h-3.5 w-3.5"})})]}):e.jsxs("label",{className:"mt-1 flex items-center gap-2 cursor-pointer rounded-lg border border-dashed border-border hover:border-primary/50 p-3 transition-colors",children:[ce===Rt?e.jsx(Hr,{className:"h-4 w-4 animate-spin text-muted-foreground"}):e.jsx(X1,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:ce===Rt?"Uploading...":"Click to upload an image"}),e.jsx("input",{type:"file",accept:"image/*",className:"hidden",disabled:ce===Rt,onChange:Cr=>{var Vs;const fs=(Vs=Cr.target.files)==null?void 0:Vs[0];fs&&Xe(fs,Rt),Cr.target.value=""}})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-xs",children:"Text (optional)"}),e.jsx(eg,{content:At.text||"",onChange:Cr=>Mt(Rt,{text:Cr}),placeholder:"Add supporting text...",minHeight:"80px",compact:!0})]})]})]})})},Rt))})]}),e.jsxs(ze,{children:[e.jsx(Wt,{children:e.jsx(Zt,{className:"text-base",children:"Call to Action"})}),e.jsxs(qe,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Ee,{children:"CTA Type"}),e.jsxs(ds,{value:Le,onValueChange:At=>{Ue(At);const Rt=qTe.find(Cr=>Cr.value===At);Rt&&Ie(Rt.label)},children:[e.jsx(ls,{children:e.jsx(us,{})}),e.jsx(cs,{children:qTe.map(At=>e.jsx(Ut,{value:At.value,children:At.label},At.value))})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"Button Label"}),e.jsx(Qe,{value:Ye,onChange:At=>Ie(At.target.value)})]}),e.jsxs("div",{children:[e.jsxs(Ee,{children:["Link URL ",e.jsx("span",{className:"text-muted-foreground",children:"(optional — leave blank to show a lead capture form instead)"})]}),e.jsx(Qe,{value:et,onChange:At=>It(At.target.value),placeholder:"https://calendly.com/..."}),!et&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Without a URL, clients will see a contact form — their info gets added to your contacts and you'll receive an email notification."})]})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[!N&&e.jsxs(Q,{variant:"outline",onClick:()=>b("template"),className:"gap-2",children:[e.jsx(_i,{className:"h-4 w-4"}),"Back"]}),e.jsxs("div",{className:"flex gap-3 ml-auto",children:[e.jsx(Q,{variant:"outline",onClick:cr,disabled:o.isPending||l.isPending,children:"Save Draft"}),e.jsxs(Q,{onClick:Mr,disabled:i.isPending,className:"gap-2",children:[e.jsx(Mi,{className:"h-4 w-4"}),Me?"Update & Reshare":"Publish & Share"]})]})]})]}),v==="share"&&je&&e.jsxs("div",{className:"space-y-6",children:[e.jsx(ze,{children:e.jsxs(qe,{className:"flex flex-col items-center py-12 text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-emerald-100 flex items-center justify-center mb-4",children:e.jsx(li,{className:"h-8 w-8 text-emerald-600"})}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Your Presentation is Live!"}),e.jsxs("p",{className:"text-muted-foreground mb-6 max-w-md",children:["Share this link with ",X||"your client",". You'll be notified when they view it."]}),e.jsxs("div",{className:"flex items-center gap-2 w-full max-w-lg",children:[e.jsx(Qe,{value:As,readOnly:!0,className:"text-center font-mono text-sm"}),e.jsx(Q,{onClick:()=>{navigator.clipboard.writeText(As),Se.success("Link copied!")},children:e.jsx(fo,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex gap-3 mt-6",children:[e.jsxs(Q,{variant:"outline",className:"gap-2",onClick:()=>{const At=`Hi ${X||""}! I put together something for you — check it out: ${As}`;navigator.clipboard.writeText(At),Se.success("Message copied!")},children:[e.jsx($o,{className:"h-4 w-4"}),"Copy Text Message"]}),e.jsxs(Q,{variant:"outline",className:"gap-2",onClick:()=>{d?y(!0):window.open(`mailto:${ae||""}?subject=${encodeURIComponent(we)}&body=${encodeURIComponent(`Hi ${(B==null?void 0:B.first_name)||(X==null?void 0:X.split(" ")[0])||""}, I put together a personalized presentation for you: ${As} Looking forward to connecting!`)}`)},children:[e.jsx(mn,{className:"h-4 w-4"}),"Send Email"]})]}),d&&e.jsx(Gae,{open:g,onOpenChange:y,contact:B?{id:B.id,first_name:B.first_name,last_name:B.last_name,email:ae||B.email||""}:ae?{id:"",first_name:(X==null?void 0:X.split(" ")[0])||"",last_name:(X==null?void 0:X.split(" ").slice(1).join(" "))||"",email:ae}:void 0,defaultSubject:we,defaultBody:`Hi ${(B==null?void 0:B.first_name)||(X==null?void 0:X.split(" ")[0])||""}, I put together a personalized presentation for you: ${As} Looking forward to connecting!`,gmailEmail:m})]})}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs(Q,{variant:"outline",onClick:()=>b("builder"),children:[e.jsx(_i,{className:"h-4 w-4 mr-2"}),"Edit Presentation"]}),e.jsx(Q,{onClick:()=>t("/mission-control/presentations"),children:"Done"})]})]})]})})},HTe=({template:t,onSelect:r})=>e.jsx(ze,{className:"hover:shadow-sm transition-shadow",children:e.jsxs(qe,{className:"p-5",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-2xl",children:t.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-semibold",children:t.name}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:t.description}),e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx(bt,{variant:"outline",className:"text-xs capitalize",children:t.template_type}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[(t.sections||[]).length," sections"]})]})]})]}),e.jsx(Q,{className:"w-full mt-4",size:"sm",onClick:()=>r(t),children:"Use Template"})]})}),mrr=({userId:t,onSelect:r})=>{const[s,n]=E.useState(!1),[a,o]=E.useState([]),[l,i]=E.useState(!1),[d,m]=E.useState("");E.useEffect(()=>{!s||!t||(i(!0),Z.from("agent_videos").select("id, title, recipient_name, playback_url, thumbnail_url, created_at, duration_seconds").eq("owner_user_id",t).eq("is_deleted",!1).eq("status","ready").order("created_at",{ascending:!1}).limit(50).then(({data:y})=>{o(y||[]),i(!1)}))},[s,t]);const g=a.filter(y=>!d||(y.title||y.recipient_name||"").toLowerCase().includes(d.toLowerCase()));return e.jsxs(Dr,{open:s,onOpenChange:n,children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{variant:"outline",size:"sm",className:"gap-1.5 shrink-0",children:[e.jsx(Od,{className:"h-3.5 w-3.5"}),"Library"]})}),e.jsxs(Lr,{className:"max-w-lg max-h-[70vh] flex flex-col",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Select from Video Library"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose a video from your Agent OS library"})]}),e.jsxs("div",{className:"relative mb-3",children:[e.jsx(Qn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Qe,{placeholder:"Search videos...",value:d,onChange:y=>m(y.target.value),className:"pl-10"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto space-y-2 min-h-0",children:l?e.jsxs(e.Fragment,{children:[e.jsx(fr,{className:"h-16 w-full"}),e.jsx(fr,{className:"h-16 w-full"})]}):g.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:a.length===0?"No videos in your library yet":"No videos match your search"}):g.map(y=>e.jsxs("button",{onClick:()=>{r(y.playback_url||""),n(!1)},className:"w-full flex items-center gap-3 p-3 rounded-lg border border-border hover:border-primary/50 hover:bg-accent/50 transition-colors text-left",children:[e.jsx("div",{className:"w-16 h-10 rounded bg-muted flex items-center justify-center shrink-0 overflow-hidden",children:y.thumbnail_url?e.jsx("img",{src:y.thumbnail_url,alt:"",className:"w-full h-full object-cover",referrerPolicy:"no-referrer",onError:v=>{const b=v.currentTarget.parentElement;if(b){v.currentTarget.remove();const N=document.createElement("span");N.innerHTML="🎬",N.className="text-lg",b.appendChild(N)}}}):e.jsx(ya,{className:"h-4 w-4 text-muted-foreground"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-medium text-sm truncate",children:y.title||y.recipient_name||"Untitled Video"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[y.duration_seconds?`${Math.round(y.duration_seconds)}s`:"",y.created_at?` · ${new Date(y.created_at).toLocaleDateString()}`:""]})]})]},y.id))})]})]})},prr=()=>{var j;const{shareToken:t}=Xl(),[r,s]=E.useState(null),[n,a]=E.useState(!0),[o,l]=E.useState(0),[i,d]=E.useState(!1);E.useEffect(()=>(document.body.classList.add("presentation-page"),()=>{document.body.classList.remove("presentation-page")}),[]),E.useEffect(()=>{t&&m()},[t]);const m=async()=>{const{data:S,error:A}=await Z.from("smart_presentations").select("*").eq("share_token",t).eq("status","published").single();if(A||!S){d(!0),a(!1);return}const{data:M}=await Z.from("profiles").select("name, email, phone, avatar_url, title, brokerage_id").eq("id",S.owner_user_id).single();let I;if(M!=null&&M.brokerage_id){const{data:O}=await Z.from("brokerages").select("name").eq("id",M.brokerage_id).single();I=(O==null?void 0:O.name)||void 0}let F=null;if(S.contact_id){const{data:O}=await Z.from("innercircle_contacts").select("first_name, last_name, email, phone").eq("id",S.contact_id).single();F=O}s({...S,owner_name:M==null?void 0:M.name,owner_email:M==null?void 0:M.email,owner_phone:M==null?void 0:M.phone,owner_avatar:M==null?void 0:M.avatar_url,owner_title:(M==null?void 0:M.title)||void 0,brokerage_name:I,contact_name:F?[F.first_name,F.last_name].filter(Boolean).join(" "):void 0,contact_email:(F==null?void 0:F.email)||void 0,contact_phone:(F==null?void 0:F.phone)||void 0}),a(!1);try{await Z.rpc("log_presentation_view",{p_presentation_id:S.id,p_section_index:0,p_cta_clicked:!1,p_ip_hash:null,p_user_agent:navigator.userAgent,p_referrer:document.referrer||null})}catch{}},g=async()=>{if(r){try{await Z.rpc("log_presentation_view",{p_presentation_id:r.id,p_section_index:null,p_cta_clicked:!0,p_ip_hash:null,p_user_agent:navigator.userAgent,p_referrer:null})}catch{}r.cta_url&&window.open(r.cta_url,"_blank")}};if(n)return e.jsx("div",{className:"min-h-screen bg-white flex items-center justify-center",children:e.jsxs("div",{className:"space-y-4 w-full max-w-2xl px-4",children:[e.jsx(fr,{className:"h-12 w-3/4 mx-auto"}),e.jsx(fr,{className:"h-64 w-full"}),e.jsx(fr,{className:"h-8 w-1/2 mx-auto"})]})});if(i||!r)return e.jsx("div",{className:"min-h-screen bg-white flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Presentation Not Found"}),e.jsx("p",{className:"text-gray-500",children:"This presentation may have been removed or is no longer available."})]})});const y=r.sections.filter(S=>S.is_visible!==!1),v=y[o],b=S=>{const A=S.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]+)/);if(A)return`https://www.youtube.com/embed/${A[1]}?rel=0`;if(S.includes("iframe.mediadelivery.net/play/")){const F=S.replace("/play/","/embed/"),O=F.includes("?")?"&":"?";return`${F}${O}responsive=true`}if(S.includes("iframe.mediadelivery.net")){if(S.match(/\/embed\/(\d+)\/([a-f0-9-]+)/)){const O=S.includes("?")?"&":"?";return`${S}${O}responsive=true`}return""}const M=S.match(/loom\.com\/share\/([a-zA-Z0-9]+)/);if(M)return`https://www.loom.com/embed/${M[1]}`;const I=S.match(/video\.bunnycdn\.com\/play\/(\d+)\/([a-f0-9-]+)/);return I?`https://iframe.mediadelivery.net/embed/${I[1]}/${I[2]}?responsive=true`:S},N=!!((j=r.cta_url)!=null&&j.trim());return e.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white",children:[e.jsx("header",{className:"bg-white border-b border-gray-100 sticky top-0 z-10",children:e.jsxs("div",{className:"max-w-5xl mx-auto px-4 py-3 flex items-center justify-between",children:[e.jsx("div",{}),e.jsxs("div",{className:"flex items-center gap-3",children:[r.owner_avatar&&e.jsx("img",{src:r.owner_avatar,alt:r.owner_name||"Agent",className:"h-10 w-10 rounded-full object-cover border border-gray-200"}),e.jsxs("div",{className:"text-right text-sm",children:[e.jsx("p",{className:"font-semibold text-gray-900",children:r.owner_name}),r.owner_title&&e.jsx("p",{className:"text-gray-500 text-xs",children:r.owner_title}),r.brokerage_name&&!r.owner_title&&e.jsx("p",{className:"text-gray-500 text-xs",children:r.brokerage_name})]})]})]})}),e.jsxs("main",{className:"max-w-5xl mx-auto px-4 py-8",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("h1",{className:"text-3xl md:text-4xl font-bold text-gray-900 mb-2",children:r.heading||(r.client_name?`Welcome, ${r.client_name}!`:r.title)}),r.property_address&&e.jsxs("p",{className:"text-lg text-gray-600",children:["Here's the plan for your home at ",e.jsx("strong",{children:r.property_address}),"."]})]}),e.jsxs("div",{className:"grid md:grid-cols-5 gap-8",children:[e.jsxs("div",{className:"md:col-span-3",children:[v!=null&&v.video_url&&b(v.video_url)?e.jsx("div",{className:"relative w-full rounded-xl overflow-hidden shadow-lg bg-gray-900",style:{paddingTop:"56.25%"},children:e.jsx("iframe",{src:b(v.video_url),className:"absolute inset-0 w-full h-full border-0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,loading:"lazy"})}):v!=null&&v.image_url?e.jsx("div",{className:"rounded-xl overflow-hidden shadow-lg",children:e.jsx("img",{src:v.image_url,alt:v.title,className:"w-full h-auto object-cover",loading:"lazy"})}):e.jsxs("div",{className:"aspect-video bg-gradient-to-br from-blue-50 to-slate-100 rounded-xl flex flex-col items-center justify-center shadow-lg",children:[e.jsx("span",{className:"text-5xl mb-3",children:v==null?void 0:v.icon}),e.jsx("h3",{className:"text-xl font-semibold text-gray-800",children:v==null?void 0:v.title}),e.jsx("p",{className:"text-gray-500 mt-1 text-sm",children:v==null?void 0:v.description})]}),(v==null?void 0:v.text)&&e.jsx("div",{className:"mt-4 p-4 bg-white rounded-lg border text-gray-700 text-sm leading-relaxed prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:v.text}})]}),e.jsx("div",{className:"md:col-span-2 space-y-3",children:y.map((S,A)=>e.jsx("button",{onClick:()=>l(A),className:qt("w-full text-left p-4 rounded-xl border transition-all",o===A?"border-blue-500 bg-blue-50 shadow-sm":"border-gray-200 bg-white hover:border-blue-200 hover:bg-blue-50/50"),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("span",{className:"text-blue-600 font-bold text-sm mt-0.5",children:[String(A+1).padStart(2,"0"),"."]}),e.jsxs("div",{children:[e.jsx("span",{className:"mr-2",children:S.icon}),e.jsx("span",{className:"font-semibold text-gray-900",children:S.title}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:S.description})]})]})},A))})]}),e.jsxs("div",{className:"mt-12 max-w-md mx-auto bg-white rounded-2xl border border-gray-200 shadow-sm p-6 text-center",children:[r.owner_avatar&&e.jsx("img",{src:r.owner_avatar,alt:r.owner_name||"Agent",className:"h-20 w-20 rounded-full object-cover mx-auto mb-3 border-2 border-gray-100"}),e.jsx("h3",{className:"text-lg font-bold text-gray-900",children:r.owner_name}),r.owner_title&&e.jsx("p",{className:"text-sm text-gray-500",children:r.owner_title}),r.brokerage_name&&e.jsx("p",{className:"text-sm text-gray-500",children:r.brokerage_name}),e.jsxs("div",{className:"mt-3 flex flex-col items-center gap-1 text-sm text-gray-600",children:[r.owner_phone&&e.jsx("a",{href:`tel:${r.owner_phone}`,className:"hover:text-blue-600 transition-colors",children:r.owner_phone}),r.owner_email&&e.jsx("a",{href:`mailto:${r.owner_email}`,className:"hover:text-blue-600 transition-colors",children:r.owner_email})]})]}),r.cta_label&&e.jsxs("div",{className:"text-center mt-8 py-8",children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Ready to Get Started?"}),N?e.jsxs(Q,{size:"lg",onClick:g,className:"text-lg px-8 py-6 rounded-xl bg-blue-600 hover:bg-blue-700 text-white shadow-lg",children:[r.cta_label,e.jsx(En,{className:"h-5 w-5 ml-2"})]}):e.jsx("div",{className:"max-w-md mx-auto bg-white rounded-2xl border border-gray-200 shadow-sm p-6",children:e.jsx(WOe,{presentationId:r.id,ctaLabel:r.cta_label,agentName:r.owner_name||void 0,prefillName:r.contact_name,prefillEmail:r.contact_email,prefillPhone:r.contact_phone})})]})]}),e.jsx("footer",{className:"border-t border-gray-100 bg-white mt-12 py-6 text-center text-xs text-gray-400",children:"Powered by LevelUp"})]})},uge="guestbook.relevelup.com";function frr(){const{data:t,isLoading:r}=zdt(),s=$dt(),n=Udt(),a=qdt(),[o,l]=E.useState(!1),[i,d]=E.useState(null),{user:m}=Gr(),[g,y]=E.useState(null),[v,b]=E.useState(null),[N,j]=E.useState(!1),S=E.useRef(null),[A,M]=E.useState({property_address:"",city:"",state:"",zip:"",event_date:Xr(new Date,"yyyy-MM-dd"),start_time:"10:00",end_time:"14:00",agent_greeting:"Welcome! Please sign in below."}),I=$=>{var W;const H=(W=$.target.files)==null?void 0:W[0];if(H){if(H.size>5*1024*1024){Jn({title:"Photo must be under 5MB",variant:"destructive"});return}y(H),b(URL.createObjectURL(H))}},F=()=>{y(null),b(null),S.current&&(S.current.value="")},O=async()=>{if(!A.property_address){Jn({title:"Address is required",variant:"destructive"});return}let $;if(g&&m){j(!0);const H=g.name.split(".").pop(),W=`${m.id}/${Date.now()}.${H}`,{error:X}=await Z.storage.from("open-house-photos").upload(W,g,{upsert:!0});if(X){Jn({title:"Photo upload failed",description:X.message,variant:"destructive"}),j(!1);return}const{data:se}=Z.storage.from("open-house-photos").getPublicUrl(W);$=se.publicUrl,j(!1)}await s.mutateAsync({...A,photo_url:$}),l(!1),M({property_address:"",city:"",state:"",zip:"",event_date:Xr(new Date,"yyyy-MM-dd"),start_time:"10:00",end_time:"14:00",agent_greeting:"Welcome! Please sign in below."}),F()},B=$=>{navigator.clipboard.writeText(`https://${uge}/${$}`),Jn({title:"Link copied!"})};return e.jsxs(Fr,{title:"Guest Book",children:[e.jsx(qh,{children:e.jsx("title",{children:"Guest Book | LevelUp"})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold font-serif text-foreground",children:"Guest Book"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"The modern open house sign-in experience"})]}),e.jsxs(Dr,{open:o,onOpenChange:l,children:[e.jsx(xo,{asChild:!0,children:e.jsxs(Q,{children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"New Open House"]})}),e.jsxs(Lr,{className:"sm:max-w-lg max-h-[90vh] flex flex-col",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"Create Open House"}),e.jsx(Gs,{children:"Set up a new open house sign-in page"})]}),e.jsxs("div",{className:"space-y-4 pt-2 overflow-y-auto flex-1 pr-1",children:[e.jsxs("div",{children:[e.jsx(Ee,{children:"Property Address *"}),e.jsx(Qe,{value:A.property_address,onChange:$=>M(H=>({...H,property_address:$.target.value})),placeholder:"123 Main Street"})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx(Ee,{children:"City"}),e.jsx(Qe,{value:A.city,onChange:$=>M(H=>({...H,city:$.target.value})),placeholder:"Austin"})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"State"}),e.jsx(Qe,{value:A.state,onChange:$=>M(H=>({...H,state:$.target.value})),placeholder:"TX",maxLength:2})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"ZIP"}),e.jsx(Qe,{value:A.zip,onChange:$=>M(H=>({...H,zip:$.target.value})),placeholder:"78701"})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx(Ee,{children:"Date"}),e.jsx(Qe,{type:"date",value:A.event_date,onChange:$=>M(H=>({...H,event_date:$.target.value}))})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"Start Time"}),e.jsx(Qe,{type:"time",value:A.start_time,onChange:$=>M(H=>({...H,start_time:$.target.value}))})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"End Time"}),e.jsx(Qe,{type:"time",value:A.end_time,onChange:$=>M(H=>({...H,end_time:$.target.value}))})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"Welcome Message"}),e.jsx(Ks,{value:A.agent_greeting,onChange:$=>M(H=>({...H,agent_greeting:$.target.value})),placeholder:"Welcome! Please sign in below."})]}),e.jsxs("div",{children:[e.jsx(Ee,{children:"Property Photo"}),e.jsx("input",{ref:S,type:"file",accept:"image/*",onChange:I,className:"hidden"}),v?e.jsxs("div",{className:"relative mt-1 rounded-xl overflow-hidden border border-border",children:[e.jsx("img",{src:v,alt:"Property preview",className:"w-full h-40 object-cover"}),e.jsx("button",{type:"button",onClick:F,className:"absolute top-2 right-2 bg-black/60 hover:bg-black/80 text-white rounded-full p-1 transition-colors",children:e.jsx(rn,{className:"h-4 w-4"})})]}):e.jsxs("button",{type:"button",onClick:()=>{var $;return($=S.current)==null?void 0:$.click()},className:"mt-1 w-full h-32 rounded-xl border-2 border-dashed border-muted-foreground/25 hover:border-muted-foreground/50 flex flex-col items-center justify-center gap-2 text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(X1,{className:"h-6 w-6"}),e.jsx("span",{className:"text-sm",children:"Add a property photo"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Max 5MB"})]})]}),e.jsx(Q,{onClick:O,disabled:s.isPending||N,className:"w-full",children:N?"Uploading photo...":s.isPending?"Creating...":"Create Open House"})]})]})]})]}),r?e.jsx("div",{className:"grid gap-4",children:[1,2].map($=>e.jsx(ze,{className:"animate-pulse",children:e.jsxs(Wt,{children:[e.jsx("div",{className:"h-5 bg-muted rounded w-48"}),e.jsx("div",{className:"h-4 bg-muted rounded w-32 mt-2"})]})},$))}):t!=null&&t.length?e.jsx("div",{className:"space-y-4",children:t.map($=>e.jsx(grr,{openHouse:$,isExpanded:i===$.id,onToggle:()=>d(i===$.id?null:$.id),onCopyLink:()=>B($.slug||""),onToggleActive:()=>n.mutate({id:$.id,is_active:!$.is_active}),onDelete:()=>a.mutate($.id)},$.id))}):e.jsx(ze,{className:"border-dashed",children:e.jsxs(qe,{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-primary/10 flex items-center justify-center mb-4",children:e.jsx(Zj,{className:"h-8 w-8 text-primary"})}),e.jsx("h3",{className:"text-lg font-semibold mb-1",children:"No Open Houses Yet"}),e.jsx("p",{className:"text-muted-foreground text-sm max-w-sm mb-6",children:"Create your first open house to get a beautiful, mobile-friendly sign-in page with a shareable link and QR code."}),e.jsxs(Q,{onClick:()=>l(!0),children:[e.jsx(gs,{className:"h-4 w-4 mr-2"}),"Create Your First Open House"]})]})})]})]})}function grr({openHouse:t,isExpanded:r,onToggle:s,onCopyLink:n,onToggleActive:a,onDelete:o}){const{data:l}=Bdt(r?t.id:void 0),[i,d]=E.useState(!1),[m,g]=E.useState(!1),y=E.useRef(null),v=`https://${uge}/${t.slug}`,b=M=>{if(!M)return"";const[I,F]=M.split(":"),O=parseInt(I),B=O>=12?"PM":"AM";return`${O>12?O-12:O||12}:${F} ${B}`},N=()=>{if(!(l!=null&&l.length))return;const M=["First Name","Last Name","Email","Phone","Intent","Wants Market Updates","Message","Signed In"],I=l.map(H=>[H.first_name,H.last_name||"",H.email||"",H.phone||"",H.visitor_intent||"",H.wants_market_updates?"Yes":"No",(H.message||"").replace(/"/g,'""'),Xr(new Date(H.created_at),"MM/dd/yyyy h:mm a")]),F=[M,...I].map(H=>H.map(W=>`"${W}"`).join(",")).join(` `),O=new Blob([F],{type:"text/csv"}),B=URL.createObjectURL(O),$=document.createElement("a");$.href=B,$.download=`${t.property_address.replace(/[^a-zA-Z0-9]/g,"-")}-visitors.csv`,$.click(),URL.revokeObjectURL(B)},j=E.useCallback(()=>{if(!y.current)return;const M=y.current.querySelector("svg");if(!M)return;const I=new XMLSerializer().serializeToString(M),F=document.createElement("canvas");F.width=1024,F.height=1024;const O=F.getContext("2d"),B=new Image;B.onload=()=>{O==null||O.drawImage(B,0,0,1024,1024);const $=document.createElement("a");$.download=`${t.property_address.replace(/[^a-zA-Z0-9]/g,"-")}-qr.png`,$.href=F.toDataURL("image/png"),$.click()},B.src="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(I)))},[t.property_address]),S=E.useCallback(()=>{if(!y.current)return;const M=y.current.querySelector("svg");if(!M)return;const I=new XMLSerializer().serializeToString(M),F="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(I))),O=Xr(new Date(t.event_date+"T00:00:00"),"EEEE, MMMM d, yyyy"),B=t.start_time?`${b(t.start_time)}${t.end_time?" – "+b(t.end_time):""}`:"",$=[t.city,t.state].filter(Boolean).join(", "),H=t.agent_greeting||"Welcome! Please sign in below.",W=window.open("","_blank");W&&(W.document.write(` Open House – ${t.property_address}
Open House
${t.property_address}
${$?`
${$}${t.zip?" "+t.zip:""}
`:""}
Date
${O}
${B?`
Time
${B}
`:""}
${H}
QR Code
Scan to Sign In
Point your phone camera at the QR code
`),W.document.close(),setTimeout(()=>{W.focus(),W.print()},500))},[t,v]),A=async()=>{g(!0);try{const{error:M}=await Z.functions.invoke("guestbook-email-link",{body:{openHouseId:t.id}});if(M)throw M;Jn({title:"Email sent!",description:"Check your inbox for the guest book link."})}catch(M){Jn({title:"Failed to send",description:M.message,variant:"destructive"})}finally{g(!1)}};return e.jsxs(ze,{className:`transition-all ${t.is_active?"border-primary/30":"opacity-75"}`,children:[e.jsx(Wt,{className:"pb-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Zt,{className:"text-base truncate",children:t.property_address}),e.jsx(bt,{variant:t.is_active?"default":"secondary",className:"shrink-0",children:t.is_active?"Active":"Inactive"})]}),e.jsxs(Ss,{className:"flex flex-wrap items-center gap-3 text-xs",children:[t.city&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(eo,{className:"h-3 w-3"}),t.city,t.state?`, ${t.state}`:""]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Mn,{className:"h-3 w-3"}),Xr(new Date(t.event_date+"T00:00:00"),"MMM d, yyyy")]}),t.start_time&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ea,{className:"h-3 w-3"}),b(t.start_time),t.end_time?` - ${b(t.end_time)}`:""]}),e.jsxs("span",{className:"flex items-center gap-1 font-medium",children:[e.jsx(ws,{className:"h-3 w-3"}),t.visitor_count," visitors"]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx(Q,{variant:"ghost",size:"icon",onClick:n,title:"Copy link",children:e.jsx(fo,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>d(!0),title:"QR Code",children:e.jsx(Zj,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>window.open(v,"_blank"),title:"Preview",children:e.jsx(En,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:a,title:t.is_active?"Deactivate":"Activate",children:t.is_active?e.jsx(zf,{className:"h-4 w-4"}):e.jsx(Gi,{className:"h-4 w-4"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:o,title:"Delete",children:e.jsx(Rs,{className:"h-4 w-4 text-destructive"})}),e.jsx(Q,{variant:"ghost",size:"icon",onClick:s,children:r?e.jsx(Hg,{className:"h-4 w-4"}):e.jsx(Jc,{className:"h-4 w-4"})})]})]})}),r&&e.jsxs(qe,{className:"pt-0",children:[e.jsx(gd,{className:"mb-4"}),e.jsxs("div",{className:"mb-3",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Share Link"}),e.jsxs("code",{className:"text-xs bg-muted/50 px-2 py-1 rounded block truncate",children:["https://",uge,"/",t.slug]})]}),l!=null&&l.length?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:[l.length," Visitor",l.length!==1?"s":""]}),e.jsxs(Q,{variant:"outline",size:"sm",onClick:N,className:"h-7 text-xs gap-1",children:[e.jsx(Oi,{className:"h-3 w-3"}),"Export CSV"]})]}),e.jsx("div",{className:"rounded-lg border overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-muted/30 text-xs text-muted-foreground",children:[e.jsx("th",{className:"text-left p-2 font-medium",children:"Name"}),e.jsx("th",{className:"text-left p-2 font-medium hidden sm:table-cell",children:"Contact"}),e.jsx("th",{className:"text-left p-2 font-medium hidden md:table-cell",children:"Intent"}),e.jsx("th",{className:"text-left p-2 font-medium",children:"Time"})]})}),e.jsx("tbody",{children:l.map(M=>e.jsxs("tr",{className:"border-t border-border/50",children:[e.jsxs("td",{className:"p-2 font-medium",children:[M.first_name,M.last_name?` ${M.last_name}`:""]}),e.jsxs("td",{className:"p-2 text-muted-foreground hidden sm:table-cell",children:[M.email&&e.jsx("div",{className:"truncate max-w-[180px]",children:M.email}),M.phone&&e.jsx("div",{className:"text-xs",children:M.phone})]}),e.jsx("td",{className:"p-2 hidden md:table-cell",children:M.visitor_intent&&e.jsx(bt,{variant:"outline",className:"text-xs capitalize",children:M.visitor_intent})}),e.jsx("td",{className:"p-2 text-xs text-muted-foreground",children:Xr(new Date(M.created_at),"h:mm a")})]},M.id))})]})})]}):e.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:"No visitors yet. Share the link to start collecting sign-ins!"})]}),e.jsx(Dr,{open:i,onOpenChange:d,children:e.jsxs(Lr,{className:"sm:max-w-sm",children:[e.jsxs(Ur,{children:[e.jsx(Br,{children:"QR Code"}),e.jsx(Gs,{className:"truncate",children:t.property_address})]}),e.jsxs("div",{className:"flex flex-col items-center gap-4 py-4",children:[e.jsx("div",{ref:y,className:"bg-white p-4 rounded-xl",children:e.jsx(yve,{value:v,size:240,level:"H"})}),e.jsx("p",{className:"text-xs text-muted-foreground text-center break-all",children:v}),e.jsxs("div",{className:"flex gap-2 w-full",children:[e.jsxs(Q,{variant:"outline",className:"flex-1",onClick:j,children:[e.jsx(Oi,{className:"h-4 w-4 mr-2"}),"Download"]}),e.jsxs(Q,{variant:"outline",className:"flex-1",onClick:S,children:[e.jsx(PA,{className:"h-4 w-4 mr-2"}),"Print Flyer"]})]}),e.jsxs(Q,{variant:"default",className:"w-full",onClick:A,disabled:m,children:[e.jsx(mn,{className:"h-4 w-4 mr-2"}),m?"Sending...":"Email Link to Me"]})]})]})})]})}const xrr=Pv({first_name:Do().trim().min(1,"First name is required").max(50),last_name:Do().trim().max(50).optional(),email:Do().trim().email("Please enter a valid email").max(255).optional().or(GC("")),phone:Do().trim().max(20).optional().or(GC(""))}),yrr=[{value:"buying",label:"Looking to Buy",emoji:"🏠"},{value:"selling",label:"Thinking of Selling",emoji:"📋"},{value:"browsing",label:"Just Browsing",emoji:"👀"},{value:"neighbor",label:"I'm a Neighbor",emoji:"👋"}];function vrr(){var F;const{slug:t}=Xl(),{data:r,isLoading:s,error:n}=GOe(t),a=KOe(),[o,l]=E.useState("welcome"),[i,d]=E.useState({first_name:"",last_name:"",email:"",phone:""}),[m,g]=E.useState(""),[y,v]=E.useState(!1),[b,N]=E.useState(""),j=O=>{if(!O)return"";const[B,$]=O.split(":"),H=parseInt(B),W=H>=12?"PM":"AM";return`${H>12?H-12:H||12}:${$} ${W}`},S=()=>{N("");const O=xrr.safeParse(i);if(!O.success){N(O.error.issues[0].message);return}if(!i.email&&!i.phone){N("Please provide either an email or phone number");return}l("intent")},A=async O=>{g(O);try{await a.mutateAsync({open_house_id:r.id,first_name:i.first_name.trim(),last_name:i.last_name.trim()||void 0,email:i.email.trim()||void 0,phone:i.phone.trim()||void 0,visitor_intent:O,wants_market_updates:y}),l("done")}catch{N("Something went wrong. Please try again.")}};if(s)return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center",children:e.jsx("div",{className:"w-10 h-10 border-4 border-white/20 border-t-white rounded-full animate-spin"})});if(n||!r)return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center p-6",children:e.jsxs("div",{className:"text-center text-white",children:[e.jsx(Wn,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Open House Not Found"}),e.jsx("p",{className:"text-white/60",children:"This sign-in page doesn't exist or is no longer active."})]})});const M=r.profiles,I=((F=M==null?void 0:M.name)==null?void 0:F.split(" ").map(O=>O[0]).join("").slice(0,2))||"?";return e.jsxs(e.Fragment,{children:[e.jsxs(qh,{children:[e.jsxs("title",{children:["Open House | ",r.property_address]}),e.jsx("meta",{name:"description",content:`Sign in to the open house at ${r.property_address}`}),e.jsx("meta",{name:"robots",content:"noindex, nofollow"})]}),e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-md",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsxs(ln,{className:"h-16 w-16 mx-auto mb-3 ring-2 ring-white/20",children:[e.jsx(pa,{src:(M==null?void 0:M.avatar_url)||"",alt:(M==null?void 0:M.name)||""}),e.jsx(cn,{className:"bg-white/10 text-white text-lg",children:I})]}),e.jsx("p",{className:"text-white/60 text-sm",children:M==null?void 0:M.name}),(M==null?void 0:M.title)&&e.jsx("p",{className:"text-white/40 text-xs",children:M.title})]}),e.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl overflow-hidden",children:[r.photo_url&&e.jsxs("div",{className:"relative h-44 sm:h-52 overflow-hidden",children:[e.jsx("img",{src:r.photo_url,alt:r.property_address,className:"w-full h-full object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-slate-900/80 via-slate-900/20 to-transparent"}),e.jsxs("div",{className:"absolute bottom-0 left-0 right-0 px-6 pb-4",children:[e.jsx("h1",{className:"text-white font-bold text-lg leading-tight drop-shadow-md",children:r.property_address}),e.jsxs("div",{className:"flex flex-wrap gap-3 mt-1.5 text-white/70 text-xs",children:[r.city&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(eo,{className:"h-3 w-3"}),r.city,r.state?`, ${r.state}`:""," ",r.zip]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Mn,{className:"h-3 w-3"}),Xr(new Date(r.event_date+"T00:00:00"),"MMM d, yyyy")]}),r.start_time&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ea,{className:"h-3 w-3"}),j(r.start_time),r.end_time?` – ${j(r.end_time)}`:""]})]})]})]}),!r.photo_url&&e.jsx("div",{className:"bg-gradient-to-r from-slate-800 to-slate-700 px-6 py-5",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-white/10 flex items-center justify-center shrink-0 mt-0.5",children:e.jsx(Wn,{className:"h-5 w-5 text-white"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-white font-bold text-lg leading-tight",children:r.property_address}),e.jsxs("div",{className:"flex flex-wrap gap-3 mt-2 text-white/60 text-xs",children:[r.city&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(eo,{className:"h-3 w-3"}),r.city,r.state?`, ${r.state}`:""," ",r.zip]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Mn,{className:"h-3 w-3"}),Xr(new Date(r.event_date+"T00:00:00"),"MMM d, yyyy")]}),r.start_time&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ea,{className:"h-3 w-3"}),j(r.start_time),r.end_time?` – ${j(r.end_time)}`:""]})]})]})]})}),e.jsxs("div",{className:"p-6",children:[o==="welcome"&&e.jsxs("div",{className:"text-center space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-slate-900 mb-2",children:"Welcome!"}),e.jsx("p",{className:"text-slate-500 text-sm",children:r.agent_greeting||"Please sign in below."})]}),e.jsxs(Q,{onClick:()=>l("info"),className:"w-full h-14 text-base bg-slate-900 hover:bg-slate-800 text-white rounded-xl",children:["Sign In ",e.jsx(Hi,{className:"h-5 w-5 ml-2"})]}),e.jsx("p",{className:"text-xs text-slate-400",children:"Quick & easy — takes 30 seconds"})]}),o==="info"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("button",{onClick:()=>l("welcome"),className:"text-slate-400 hover:text-slate-600",children:e.jsx(_i,{className:"h-4 w-4"})}),e.jsx("h2",{className:"text-lg font-bold text-slate-900",children:"Your Info"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(Ee,{className:"text-slate-600 text-xs",children:"First Name *"}),e.jsx(Qe,{value:i.first_name,onChange:O=>d(B=>({...B,first_name:O.target.value})),placeholder:"First",className:"mt-1 h-12 rounded-xl border-slate-200 text-base",autoFocus:!0})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-slate-600 text-xs",children:"Last Name"}),e.jsx(Qe,{value:i.last_name,onChange:O=>d(B=>({...B,last_name:O.target.value})),placeholder:"Last",className:"mt-1 h-12 rounded-xl border-slate-200 text-base"})]})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-slate-600 text-xs",children:"Email"}),e.jsx(Qe,{type:"email",value:i.email,onChange:O=>d(B=>({...B,email:O.target.value})),placeholder:"your@email.com",className:"mt-1 h-12 rounded-xl border-slate-200 text-base"})]}),e.jsxs("div",{children:[e.jsx(Ee,{className:"text-slate-600 text-xs",children:"Phone"}),e.jsx(Qe,{type:"tel",value:i.phone,onChange:O=>d(B=>({...B,phone:O.target.value})),placeholder:"(555) 123-4567",className:"mt-1 h-12 rounded-xl border-slate-200 text-base"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer pt-1",children:[e.jsx("input",{type:"checkbox",checked:y,onChange:O=>v(O.target.checked),className:"rounded border-slate-300 text-slate-900 focus:ring-slate-500"}),e.jsx("span",{className:"text-sm text-slate-600",children:"Send me market updates for this area"})]}),b&&e.jsx("p",{className:"text-destructive text-sm",children:b}),e.jsxs(Q,{onClick:S,className:"w-full h-14 text-base bg-slate-900 hover:bg-slate-800 text-white rounded-xl",children:["Continue ",e.jsx(Hi,{className:"h-5 w-5 ml-2"})]})]}),o==="intent"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("button",{onClick:()=>l("info"),className:"text-slate-400 hover:text-slate-600",children:e.jsx(_i,{className:"h-4 w-4"})}),e.jsx("h2",{className:"text-lg font-bold text-slate-900",children:"What brings you here?"})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:yrr.map(O=>e.jsxs("button",{onClick:()=>A(O.value),disabled:a.isPending,className:"flex flex-col items-center gap-2 p-5 rounded-xl border-2 border-slate-200 hover:border-slate-900 hover:bg-slate-50 transition-all text-center group",children:[e.jsx("span",{className:"text-2xl",children:O.emoji}),e.jsx("span",{className:"text-sm font-medium text-slate-700 group-hover:text-slate-900",children:O.label})]},O.value))}),b&&e.jsx("p",{className:"text-destructive text-sm text-center",children:b})]}),o==="done"&&e.jsxs("div",{className:"text-center space-y-4 py-4",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-green-100 flex items-center justify-center mx-auto",children:e.jsx(Li,{className:"h-8 w-8 text-green-600"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-slate-900",children:"You're all set!"}),e.jsxs("p",{className:"text-slate-500 text-sm mt-1",children:["Thanks for signing in, ",i.first_name,". Enjoy the open house!"]})]}),(M==null?void 0:M.name)&&e.jsxs("p",{className:"text-sm text-slate-400",children:["Your host today: ",e.jsx("strong",{className:"text-slate-600",children:M.name})]})]})]})]}),e.jsx("p",{className:"text-center text-white/30 text-xs mt-6",children:"Powered by LevelUp Guest Book"})]})})]})}function _rr(){const{slug:t}=Xl();return t?e.jsx(yDe,{slug:t}):e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center p-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-bold text-slate-800 mb-2",children:"Portal Not Found"}),e.jsx("p",{className:"text-slate-500",children:"No portal slug was provided."})]})})}const brr=({team:t,onSelect:r})=>{const{data:s}=Ht({queryKey:["team-card-info",t.id],queryFn:async()=>{const{data:n}=await Z.from("team_members").select("user_id, role").eq("team_id",t.id),a=(n==null?void 0:n.length)||0,o=n==null?void 0:n.find(i=>i.role==="team_leader");let l=null;if(o){const{data:i}=await Z.from("profiles").select("name, avatar_url").eq("id",o.user_id).single();l=i}return{count:a,leaderProfile:l}}});return e.jsxs(ze,{className:"cursor-pointer hover:shadow-md transition-shadow group",onClick:r,children:[e.jsx(Wt,{className:"pb-3",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(Zt,{className:"text-lg truncate",children:t.name}),t.description&&e.jsx(Ss,{className:"mt-1 line-clamp-2",children:t.description})]}),e.jsxs(bt,{variant:"secondary",className:"ml-2 shrink-0",children:[e.jsx(ws,{className:"h-3 w-3 mr-1"}),(s==null?void 0:s.count)??"…"]})]})}),e.jsxs(qe,{className:"space-y-3",children:[(s==null?void 0:s.leaderProfile)&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(ln,{className:"h-6 w-6",children:[e.jsx(pa,{src:s.leaderProfile.avatar_url||""}),e.jsx(cn,{className:"text-xs",children:(s.leaderProfile.name||"?").charAt(0).toUpperCase()})]}),e.jsxs("span",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(ih,{className:"h-3 w-3 text-[hsl(var(--chart-4))]"}),s.leaderProfile.name||"Team Leader"]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Nu,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"capitalize text-xs",children:t.contact_visibility.replace("_"," ")})]}),t.lead_pond_enabled&&e.jsx(bt,{variant:"outline",className:"text-xs py-0",children:"Lead Pond"}),t.shared_assets_enabled&&e.jsx(bt,{variant:"outline",className:"text-xs py-0",children:"Shared Assets"}),t.shared_videos_enabled&&e.jsx(bt,{variant:"outline",className:"text-xs py-0",children:"Shared Videos"})]})]})]})},wrr=()=>{const{user:t,isAdmin:r,isBrokerageManager:s,brokerageId:n,managedBrokerages:a,selectedBrokerageId:o}=Gr(),l=o||(a.length>0?a[0].id:n),i=r?void 0:l||void 0,{teams:d,isLoading:m,createTeam:g,updateTeam:y,deleteTeam:v,addMember:b,removeMember:N,updateMemberRole:j}=Vk(i),[S,A]=E.useState(!1),[M,I]=E.useState(null),{data:F}=Ht({queryKey:["all-brokerages-for-teams"],queryFn:async()=>{const{data:$,error:H}=await Z.from("brokerages").select("id, name").order("name");if(H)throw H;return $||[]},enabled:r}),{data:O}=Ht({queryKey:["brokerage-agents-for-teams",l],queryFn:async()=>{const{data:$,error:H}=await Z.from("profiles").select("id, name, email, avatar_url").eq("brokerage_id",l).order("name");if(H)throw H;return $||[]},enabled:!!l}),B=async $=>{const H=$.brokerage_id||l||null,W=await g.mutateAsync({name:$.name,brokerage_id:H,description:$.description});if($.leaderId&&$.leaderId!=="none"&&await b.mutateAsync({team_id:W.id,user_id:$.leaderId,role:"team_leader"}),$.memberIds)for(const X of $.memberIds)await b.mutateAsync({team_id:W.id,user_id:X,role:"team_member"});A(!1)};return!s&&!r?e.jsx(Fr,{title:"Teams",description:"Team Management",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(ws,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Access Denied"}),e.jsx("p",{className:"text-muted-foreground",children:"You need brokerage manager access to manage teams."})]})}):e.jsx(Fr,{title:"Teams",description:"Create and manage teams within your brokerage",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Teams"}),e.jsx("p",{className:"text-muted-foreground",children:"Organize your agents into teams with leaders and shared resources."})]}),e.jsxs(Q,{onClick:()=>A(!0),children:[e.jsx(gs,{className:"mr-2 h-4 w-4"}),"Create Team"]})]}),e.jsx(pBe,{open:S,onOpenChange:A,onCreateTeam:B,isCreating:g.isPending,brokerageAgents:O||[],isAdmin:r,allBrokerages:F,activeBrokerageId:l}),m&&e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map($=>e.jsx(ze,{children:e.jsxs(qe,{className:"p-6",children:[e.jsx(fr,{className:"h-5 w-32 mb-3"}),e.jsx(fr,{className:"h-4 w-48 mb-4"}),e.jsx(fr,{className:"h-8 w-full"})]})},$))}),!m&&d.length===0&&!M&&e.jsx(ze,{children:e.jsxs(qe,{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(ws,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No Teams Yet"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Create your first team to organize agents and share resources."}),e.jsxs(Q,{onClick:()=>A(!0),children:[e.jsx(gs,{className:"mr-2 h-4 w-4"}),"Create Your First Team"]})]})}),!m&&d.length>0&&!M&&e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:d.map($=>e.jsx(brr,{team:$,onSelect:()=>I($)},$.id))}),M&&e.jsx(mBe,{team:M,brokerageAgents:O||[],onBack:()=>I(null),onUpdate:$=>y.mutateAsync({id:M.id,...$}).then(H=>I(H)),onAddMember:($,H)=>b.mutateAsync({team_id:M.id,user_id:$,role:H}),onRemoveMember:$=>N.mutateAsync({team_id:M.id,member_id:$}),onUpdateRole:($,H)=>j.mutateAsync({team_id:M.id,member_id:$,role:H}),onDeleteTeam:()=>v.mutate(M.id),isUpdating:y.isPending,isAddingMember:b.isPending})]})})},jrr=()=>{const{data:t,isLoading:r}=Lv(),{useTeamMembers:s}=Vk(),{data:n=[],isLoading:a}=s((t==null?void 0:t.teamId)||"");if(r)return e.jsx(Fr,{title:"My Team",description:"Your team",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(fr,{className:"h-8 w-48"}),e.jsx(fr,{className:"h-40 w-full"})]})});if(!t)return e.jsx(Fr,{title:"My Team",description:"Your team",children:e.jsx(ze,{children:e.jsxs(qe,{className:"flex flex-col items-center justify-center py-12 text-center",children:[e.jsx(ws,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"No Team Yet"}),e.jsx("p",{className:"text-muted-foreground",children:"You haven't been assigned to a team. Ask your brokerage manager to add you."})]})})});const o=t.team;return e.jsx(Fr,{title:"My Team",description:o.name,children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:o.name}),e.jsx(bt,{variant:t.role==="team_leader"?"default":"secondary",className:"capitalize",children:t.role==="team_leader"?e.jsxs(e.Fragment,{children:[e.jsx(ih,{className:"mr-1 h-3 w-3"})," Leader"]}):"Member"})]}),o.description&&e.jsx("p",{className:"text-muted-foreground mt-1",children:o.description})]}),e.jsxs(ci,{defaultValue:"members",className:"space-y-4",children:[e.jsxs(ri,{className:"flex-wrap",children:[e.jsx(Kr,{value:"members",children:"Members"}),o.contact_visibility!=="private"&&e.jsxs(Kr,{value:"contacts",children:[e.jsx(zj,{className:"mr-1 h-3.5 w-3.5"}),"Team Contacts"]}),o.lead_pond_enabled&&e.jsxs(Kr,{value:"lead-pond",children:[e.jsx(Wg,{className:"mr-1 h-3.5 w-3.5"}),"Lead Pond"]}),o.shared_assets_enabled&&e.jsxs(Kr,{value:"shared-assets",children:[e.jsx(bm,{className:"mr-1 h-3.5 w-3.5"}),"Shared Assets"]})]}),e.jsx(ms,{value:"members",className:"space-y-2",children:a?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(l=>e.jsx(fr,{className:"h-16 w-full"},l))}):n.map(l=>{var i,d,m,g;return e.jsx(ze,{children:e.jsxs(qe,{className:"flex items-center gap-3 p-4",children:[e.jsxs(ln,{className:"h-10 w-10",children:[e.jsx(pa,{src:((i=l.profile)==null?void 0:i.avatar_url)||""}),e.jsx(cn,{children:(((d=l.profile)==null?void 0:d.name)||"?").charAt(0).toUpperCase()})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium",children:((m=l.profile)==null?void 0:m.name)||"Unknown"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:(g=l.profile)==null?void 0:g.email})]}),l.role==="team_leader"?e.jsxs(bt,{className:"ml-auto bg-amber-500/10 text-amber-600 border-amber-500",children:[e.jsx(ih,{className:"mr-1 h-3 w-3"})," Leader"]}):e.jsx(bt,{variant:"secondary",className:"ml-auto",children:"Member"})]})},l.id)})}),o.contact_visibility!=="private"&&e.jsx(ms,{value:"contacts",className:"space-y-4",children:e.jsx(Y0e,{})}),o.lead_pond_enabled&&e.jsx(ms,{value:"lead-pond",className:"space-y-4",children:e.jsx(X0e,{teamId:t.teamId})}),o.shared_assets_enabled&&e.jsx(ms,{value:"shared-assets",className:"space-y-4",children:e.jsx(hBe,{teamId:t.teamId})})]})]})})},krr=()=>{const t=Uh();return E.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",t.pathname)},[t.pathname]),e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-gray-100",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"mb-4 text-4xl font-bold",children:"404"}),e.jsx("p",{className:"mb-4 text-xl text-gray-600",children:"Oops! Page not found"}),e.jsx("a",{href:"/",className:"text-blue-500 underline hover:text-blue-700",children:"Return to Home"})]})})},Nrr=new Ztt,Srr=()=>{const t=window.location.hostname;return t==="listings.relevelup.com"||t.startsWith("listings.")},Crr=()=>{const t=window.location.hostname;return t==="cards.relevelup.com"||t.startsWith("cards.")},Mrr=()=>{const t=window.location.hostname;return t==="presentations.relevelup.com"||t.startsWith("presentations.")},Trr=()=>{const t=window.location.hostname;return t==="guestbook.relevelup.com"||t.startsWith("guestbook.")},Arr=()=>{const t=window.location.hostname;return t==="clients.relevelup.com"||t.startsWith("clients.")},Err=()=>e.jsx(ert,{client:Nrr,children:e.jsx(l6e,{children:e.jsxs(L3,{children:[e.jsx(mJe,{}),e.jsx(HJe,{}),e.jsx(mst,{children:e.jsx(yit,{children:e.jsx(vit,{children:e.jsxs(bit,{children:[e.jsx(_it,{}),e.jsx(Jlt,{}),e.jsx(fct,{}),Crr()?e.jsx(Ldt,{}):Srr()?e.jsx(rdt,{}):Mrr()?e.jsx(Rdt,{}):Trr()?e.jsx(Smt,{}):Arr()?e.jsx(qmt,{}):e.jsxs(ast,{children:[e.jsx(ts,{path:"/",element:e.jsx(Qmt,{})}),e.jsx(ts,{path:"/privacy-policy",element:e.jsx(Jmt,{})}),e.jsx(ts,{path:"/terms-of-service",element:e.jsx(ept,{})}),e.jsx(ts,{path:"/data-deletion",element:e.jsx(tpt,{})}),e.jsx(ts,{path:"/public/listings",element:e.jsx(zOe,{})}),e.jsx(ts,{path:"/public/listing/:slugOrId",element:e.jsx(sxt,{})}),e.jsx(ts,{path:"/card/:slug",element:e.jsx(nxt,{})}),e.jsx(ts,{path:"/auth",element:e.jsx(spt,{})}),e.jsx(ts,{path:"/subscription-success",element:e.jsx(npt,{})}),e.jsx(ts,{path:"/subscription",element:e.jsx(Ms,{children:e.jsx(ugt,{})})}),e.jsx(ts,{path:"/share/video",element:e.jsx(Jgt,{}),children:e.jsx(ts,{path:":shareToken",element:e.jsx(Qgt,{})})}),e.jsx(ts,{path:"/p/:shareToken",element:e.jsx(prr,{})}),e.jsx(ts,{path:"/portal/:slug",element:e.jsx(_rr,{})}),e.jsx(ts,{path:"/og/video/:token",element:e.jsx(ext,{})}),e.jsx(ts,{path:"/setup-brokerage",element:e.jsx(Ms,{children:e.jsx(hgt,{})})}),e.jsx(ts,{path:"/claim-account",element:e.jsx(t4e,{})}),e.jsx(ts,{path:"/claim",element:e.jsx(t4e,{})}),e.jsx(ts,{path:"/join",element:e.jsx(mgt,{})}),e.jsx(ts,{path:"/trial",element:e.jsx(kgt,{})}),e.jsx(ts,{path:"/trial/success",element:e.jsx(Ngt,{})}),e.jsx(ts,{path:"/dashboard",element:e.jsx(Ms,{children:e.jsx(lyt,{})})}),e.jsx(ts,{path:"/profile",element:e.jsx(Ms,{children:e.jsx(Xjt,{})})}),e.jsx(ts,{path:"/apps",element:e.jsx(Ms,{children:e.jsx(dkt,{})})}),e.jsx(ts,{path:"/admin",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(Z4t,{})})}),e.jsx(ts,{path:"/admin/apps",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(Q4t,{})})}),e.jsx(ts,{path:"/admin/members",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(iSt,{})})}),e.jsx(ts,{path:"/admin/invite-codes",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(oSt,{})})}),e.jsx(ts,{path:"/admin/events",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(mSt,{})})}),e.jsx(ts,{path:"/events",element:e.jsx(Ms,{children:e.jsx(okt,{})})}),e.jsx(ts,{path:"/events/:eventId",element:e.jsx(Ms,{children:e.jsx(ckt,{})})}),e.jsx(ts,{path:"/templates",element:e.jsx(Ms,{children:e.jsx(ukt,{})})}),e.jsx(ts,{path:"/templates/:templateId",element:e.jsx(Ms,{children:e.jsx(fkt,{})})}),e.jsx(ts,{path:"/admin/templates",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(pSt,{})})}),e.jsx(ts,{path:"/academy",element:e.jsx(Ms,{children:e.jsx(gkt,{})})}),e.jsx(ts,{path:"/academy/:videoId",element:e.jsx(Ms,{children:e.jsx(ykt,{})})}),e.jsx(ts,{path:"/admin/academy",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(gSt,{})})}),e.jsx(ts,{path:"/toolbox",element:e.jsx(Ms,{children:e.jsx(vkt,{})})}),e.jsx(ts,{path:"/toolbox/:kitId",element:e.jsx(Ms,{children:e.jsx(_kt,{})})}),e.jsx(ts,{path:"/admin/toolbox",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(xSt,{})})}),e.jsx(ts,{path:"/social-swag",element:e.jsx(Ms,{children:e.jsx(bkt,{})})}),e.jsx(ts,{path:"/social-swag-2",element:e.jsx(Ms,{children:e.jsx(v4t,{})})}),e.jsx(ts,{path:"/social-swag/:swagId",element:e.jsx(Ms,{children:e.jsx(_4t,{})})}),e.jsx(ts,{path:"/social-connections",element:e.jsx(Ms,{children:e.jsx(Ktr,{})})}),e.jsx(ts,{path:"/social-connections/callback",element:e.jsx(Ms,{children:e.jsx(Ztr,{})})}),e.jsx(ts,{path:"/social-connections/linkedin-callback",element:e.jsx(Ms,{children:e.jsx(Xtr,{})})}),e.jsx(ts,{path:"/social-connections/google-callback",element:e.jsx(Ms,{children:e.jsx(Ytr,{})})}),e.jsx(ts,{path:"/admin/social-swag",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(ySt,{})})}),e.jsx(ts,{path:"/admin/social-swag-2",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(a3t,{})})}),e.jsx(ts,{path:"/community",element:e.jsx(Ms,{children:e.jsx(z4t,{})})}),e.jsx(ts,{path:"/support",element:e.jsx(Ms,{children:e.jsx(B4t,{})})}),e.jsx(ts,{path:"/admin/community",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(i3t,{})})}),e.jsx(ts,{path:"/admin/support-tickets",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(p3t,{})})}),e.jsx(ts,{path:"/admin/email-templates",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(x3t,{})})}),e.jsx(ts,{path:"/admin/agent-email-templates",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(y3t,{})})}),e.jsx(ts,{path:"/admin/analytics",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(u3t,{})})}),e.jsx(ts,{path:"/admin/brokerage-resources",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(h3t,{})})}),e.jsx(ts,{path:"/admin/dashboard-management",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(m3t,{})})}),e.jsx(ts,{path:"/brokerage/dashboard",element:e.jsx(Ms,{requireBrokerageManager:!0,children:e.jsx(A3t,{})})}),e.jsx(ts,{path:"/brokerage/teams",element:e.jsx(Ms,{requireBrokerageManager:!0,children:e.jsx(wrr,{})})}),e.jsx(ts,{path:"/my-team",element:e.jsx(Ms,{children:e.jsx(jrr,{})})}),e.jsx(ts,{path:"/my-brokerage",element:e.jsx(Ms,{children:e.jsx(D3t,{})})}),e.jsx(ts,{path:"/brokerage-resources",element:e.jsx(Ms,{requireBrokerageManager:!0,children:e.jsx(W4t,{})})}),e.jsx(ts,{path:"/brokerage-resources/:resourceId",element:e.jsx(Ms,{requireBrokerageManager:!0,children:e.jsx(G4t,{})})}),e.jsx(ts,{path:"/newsletters",element:e.jsx(Ms,{children:e.jsx(R3t,{})})}),e.jsx(ts,{path:"/newsletters/:id",element:e.jsx(Ms,{children:e.jsx(z3t,{})})}),e.jsx(ts,{path:"/wishlist",element:e.jsx(Ms,{children:e.jsx(U3t,{})})}),e.jsx(ts,{path:"/wishlist/:itemId",element:e.jsx(Ms,{children:e.jsx(q3t,{})})}),e.jsx(ts,{path:"/admin/wishlist",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(V3t,{})})}),e.jsx(ts,{path:"/admin/levelup-brief",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(H3t,{})})}),e.jsx(ts,{path:"/admin/newsletters",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx($3t,{})})}),e.jsx(ts,{path:"/admin/additional-services",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(W3t,{})})}),e.jsx(ts,{path:"/admin/discounts",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(G3t,{})})}),e.jsx(ts,{path:"/admin/subscriptions",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(K3t,{})})}),e.jsx(ts,{path:"/admin/referrals",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(Z3t,{})})}),e.jsx(ts,{path:"/admin/prospector",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(Gtr,{})})}),e.jsx(ts,{path:"/admin/onboarding-checklist",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(X3t,{})})}),e.jsx(ts,{path:"/admin/marketplace",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(ktr,{})})}),e.jsx(ts,{path:"/admin/agent-points",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(Ker,{})})}),e.jsx(ts,{path:"/admin/reward-store",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(ztr,{})})}),e.jsx(ts,{path:"/admin/integrations",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx($tr,{})})}),e.jsx(ts,{path:"/admin/integrations/callback",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(Wtr,{})})}),e.jsx(ts,{path:"/reward-store",element:e.jsx(Ms,{children:e.jsx(arr,{})})}),e.jsx(ts,{path:"/additional-services",element:e.jsx(Ms,{children:e.jsx(l5t,{})})}),e.jsx(ts,{path:"/additional-services/:serviceId",element:e.jsx(Ms,{children:e.jsx(c5t,{})})}),e.jsx(ts,{path:"/ai-toolkit",element:e.jsx(Ms,{children:e.jsx(d5t,{})})}),e.jsx(ts,{path:"/mission-control",element:e.jsx(Ms,{children:e.jsx(k5t,{})})}),e.jsx(ts,{path:"/mission-control/contacts",element:e.jsx(Ms,{children:e.jsx(q5t,{})})}),e.jsx(ts,{path:"/mission-control/contacts/:contactId",element:e.jsx(Ms,{children:e.jsx(rMt,{})})}),e.jsx(ts,{path:"/mission-control/plans",element:e.jsx(Ms,{children:e.jsx(sMt,{})})}),e.jsx(ts,{path:"/mission-control/popbys",element:e.jsx(Ms,{children:e.jsx(iMt,{})})}),e.jsx(ts,{path:"/mission-control/popbys/map",element:e.jsx(Ms,{children:e.jsx(oMt,{})})}),e.jsx(ts,{path:"/admin/notification-settings",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(qtr,{})})}),e.jsx(ts,{path:"/admin/agent-os",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(J3t,{})})}),e.jsx(ts,{path:"/mission-control/listings",element:e.jsx(Ms,{children:e.jsx(WQt,{})})}),e.jsx(ts,{path:"/mission-control/listings/new",element:e.jsx(Ms,{children:e.jsx(PTe,{})})}),e.jsx(ts,{path:"/mission-control/listings/:listingId",element:e.jsx(Ms,{children:e.jsx(oJt,{})})}),e.jsx(ts,{path:"/mission-control/listings/:listingId/edit",element:e.jsx(Ms,{children:e.jsx(PTe,{})})}),e.jsx(ts,{path:"/admin/listing-exchange",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(Uer,{})})}),e.jsx(ts,{path:"/mission-control/pipeline",element:e.jsx(Ms,{children:e.jsx(ier,{})})}),e.jsx(ts,{path:"/mission-control/my-card",element:e.jsx(Ms,{children:e.jsx(Ser,{})})}),e.jsx(ts,{path:"/mission-control/integrations",element:e.jsx(Ms,{children:e.jsx(Ler,{})})}),e.jsx(ts,{path:"/mission-control/integrations/gmail/callback",element:e.jsx(Ms,{children:e.jsx(Oer,{})})}),e.jsx(ts,{path:"/mission-control/integrations/canva/callback",element:e.jsx(Der,{})}),e.jsx(ts,{path:"/mission-control/integrations/meta/callback",element:e.jsx(Ms,{children:e.jsx(Rer,{})})}),e.jsx(ts,{path:"/mission-control/scorecard",element:e.jsx(Ms,{children:e.jsx(DQt,{})})}),e.jsx(ts,{path:"/admin/scorecard",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(zer,{})})}),e.jsx(ts,{path:"/admin/scorecard/:userId",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx($er,{})})}),e.jsx(ts,{path:"/admin/membership-reviews",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(qer,{})})}),e.jsx(ts,{path:"/admin/weekly-digest",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(Wer,{})})}),e.jsx(ts,{path:"/mission-control/video/record",element:e.jsx(Ms,{children:e.jsx(fJt,{})})}),e.jsx(ts,{path:"/mission-control/video-library",element:e.jsx(Ms,{children:e.jsx(bJt,{})})}),e.jsx(ts,{path:"/marketplace",element:e.jsx(Ms,{children:e.jsx(Qtr,{})})}),e.jsx(ts,{path:"/marketplace/:productId",element:e.jsx(Ms,{children:e.jsx(Jtr,{})})}),e.jsx(ts,{path:"/marketplace/cart",element:e.jsx(Ms,{children:e.jsx(err,{})})}),e.jsx(ts,{path:"/marketplace/orders",element:e.jsx(Ms,{children:e.jsx(trr,{})})}),e.jsx(ts,{path:"/marketplace/orders/:orderId",element:e.jsx(Ms,{children:e.jsx(srr,{})})}),e.jsx(ts,{path:"/marketplace/success",element:e.jsx(Ms,{children:e.jsx(nrr,{})})}),e.jsx(ts,{path:"/admin/agent-cards",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(Zer,{})})}),e.jsx(ts,{path:"/admin/presentation-analytics",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(Vtr,{})})}),e.jsx(ts,{path:"/admin/guest-book-analytics",element:e.jsx(Ms,{requireAdmin:!0,children:e.jsx(Htr,{})})}),e.jsx(ts,{path:"/mission-control/presentations",element:e.jsx(Ms,{children:e.jsx(lrr,{})})}),e.jsx(ts,{path:"/mission-control/presentations/new",element:e.jsx(Ms,{children:e.jsx(VTe,{})})}),e.jsx(ts,{path:"/mission-control/presentations/:id",element:e.jsx(Ms,{children:e.jsx(VTe,{})})}),e.jsx(ts,{path:"/mission-control/guest-book",element:e.jsx(Ms,{children:e.jsx(frr,{})})}),e.jsx(ts,{path:"/guestbook/:slug",element:e.jsx(vrr,{})}),e.jsx(ts,{path:"*",element:e.jsx(krr,{})})]}),")"]})})})})]})})});fIe(document.getElementById("root")).render(e.jsx(Err,{}));